#include #include #include #include "scenes.h" #include "liquid.h" #include "analog.h" #include "graphics/nokia.h" #include "graphics/drawing.h" /** * The struct is allocated bigger than 'Scene' to accommodate private fields. * Since the base struct is located at the beginning, it can be cast and passed around as Scene. */ struct RootScene { struct Scene base; }; static struct SceneEvent Root_init(struct RootScene *self) { return SceneEvent_OpenChild(NewScene_Boot(), 1); } struct SceneEvent Root_onChildReturn( struct RootScene *self, uint32_t tag, int32_t status, void *data) { if (tag == 1) { return SceneEvent_OpenChild(NewScene_Demo(), 0); } // this should be unreachable return SceneEvent_None(); } struct Scene *NewScene_Root(void) { struct RootScene *scene = calloc(1, sizeof(struct RootScene)); scene->base.init = (Scene_init_t) Root_init; scene->base.onChildReturn = (Scene_onChildReturn_t) Root_onChildReturn; return (struct Scene *) scene; }