Skip to content

Instantly share code, notes, and snippets.

@stoffera
Created October 2, 2019 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stoffera/622a931cdf7ab11b0355e0ff4a2917b3 to your computer and use it in GitHub Desktop.
Save stoffera/622a931cdf7ab11b0355e0ff4a2917b3 to your computer and use it in GitHub Desktop.
Display BMP on OpenMono
#include "app_controller.h"
AppController::AppController() :
fs("sd"),
img("/sd/mono/mockups/ToDo.bmp"),
bmpView(&img)
{
}
void AppController::monoWakeFromReset()
{
bmpView.show();
}
void AppController::monoWillGotoSleep()
{
}
void AppController::monoWakeFromSleep()
{
// this will not work - since FS has lost its state
bmpView.scheduleRepaint();
}
#ifndef app_controller_h
#define app_controller_h
#include <mono.h>
// import the SD card and FS definitions
#include <io/file_system.h>
#include <stdio.h>
class AppController : public mono::IApplication {
mono::io::FileSystem fs; // create an instance of the FS I/O
mono::media::BMPImage img; // create a bmp image representation
mono::ui::ImageView bmpView; // create a UI view to display the image
public:
AppController();
void monoWakeFromReset();
void monoWillGotoSleep();
void monoWakeFromSleep();
};
#endif /* app_controller_h */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment