Simplify app registration with TactilityCpp (#7)
- Simplified app registration with a C++ wrapper for the TactilityC. - Rename the various app classes from `Application` to more specific names like `Calculator` etc.
This commit is contained in:
committed by
GitHub
parent
e1579d3cbd
commit
b39bd6b6f5
@@ -1,31 +1,10 @@
|
||||
#include <tt_app.h>
|
||||
#include "Application.h"
|
||||
|
||||
static void onShowApp(AppHandle appHandle, void* data, lv_obj_t* parent) {
|
||||
static_cast<Application*>(data)->onShow(appHandle, parent);
|
||||
}
|
||||
|
||||
static void onHideApp(AppHandle appHandle, void* data) {
|
||||
static_cast<Application*>(data)->onHide(appHandle);
|
||||
}
|
||||
|
||||
static void* createAppData() {
|
||||
return new Application();
|
||||
}
|
||||
|
||||
static void destroyAppData(void* app) {
|
||||
delete static_cast<Application*>(app);
|
||||
}
|
||||
#include "Diceware.h"
|
||||
#include <TactilityCpp/App.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
tt_app_register((AppRegistration) {
|
||||
.createData = createAppData,
|
||||
.destroyData = destroyAppData,
|
||||
.onShow = onShowApp,
|
||||
.onHide = onHideApp,
|
||||
});
|
||||
registerApp<Diceware>();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user