diff --git a/firmware-doom/lib/doomgeneric/src/d_alloc.c b/firmware-doom/lib/doomgeneric/src/d_alloc.c index 5a8a6f27..feb352c9 100644 --- a/firmware-doom/lib/doomgeneric/src/d_alloc.c +++ b/firmware-doom/lib/doomgeneric/src/d_alloc.c @@ -11,13 +11,15 @@ #include "r_bsp.h" void D_AllocBuffers() { - R_AllocMain(); - R_AllocPlanes(); - R_AllocThings(); - R_AllocBSP(); + printf("D_AllocBuffers: Allocating buffers\n"); + printf("R_AllocMain: allocated %d bytes\n", R_AllocMain()); + printf("R_AllocPlanes: allocated %d bytes\n", R_AllocPlanes()); + printf("R_AllocThings: allocated %d bytes\n", R_AllocThings()); + printf("R_AllocBSP: allocated %d bytes\n", R_AllocBSP()); } void D_FreeBuffers() { + printf("D_FreeBuffers: Freeing buffers\n"); R_FreeMain(); R_FreePlanes(); R_FreeThings(); diff --git a/firmware-doom/lib/doomgeneric/src/d_main.c b/firmware-doom/lib/doomgeneric/src/d_main.c index 9012e5f5..e6e164da 100644 --- a/firmware-doom/lib/doomgeneric/src/d_main.c +++ b/firmware-doom/lib/doomgeneric/src/d_main.c @@ -139,11 +139,11 @@ void D_CheckNetGame(void); void D_ProcessEvents (void) { event_t* ev; - + // IF STORE DEMO, DO NOT ACCEPT INPUT if (storedemo) return; - + while ((ev = D_PopEvent()) != NULL) { if (M_Responder (ev)) @@ -184,9 +184,9 @@ void D_Display (void) if (nodrawers) return; // for comparative timing / profiling - + redrawsbar = false; - + // change the view size if needed if (setsizeneeded) { @@ -206,7 +206,7 @@ void D_Display (void) if (gamestate == GS_LEVEL && gametic) HU_Erase(); - + // do buffered drawing switch (gamestate) { @@ -235,17 +235,17 @@ void D_Display (void) D_PageDrawer (); break; } - + // draw buffered stuff to screen I_UpdateNoBlit (); - + // draw the view directly if (gamestate == GS_LEVEL && !automapactive && gametic) R_RenderPlayerView (&players[displayplayer]); if (gamestate == GS_LEVEL && gametic) HU_Drawer (); - + // clean up border stuff if (gamestate != oldgamestate && gamestate != GS_LEVEL) I_SetPalette (W_CacheLumpName (DEH_String("PLAYPAL"),PU_CACHE)); @@ -280,7 +280,7 @@ void D_Display (void) viewactivestate = viewactive; inhelpscreensstate = inhelpscreens; oldgamestate = wipegamestate = gamestate; - + // draw pause pic if (paused) { @@ -304,7 +304,7 @@ void D_Display (void) I_FinishUpdate (); // page flip or blit buffer return; } - + // wipe update wipe_EndScreen(0, 0, SCREENWIDTH, SCREENHEIGHT); @@ -318,7 +318,7 @@ void D_Display (void) tics = nowtime - wipestart; I_Sleep(1); } while (tics <= 0); - + wipestart = nowtime; done = wipe_ScreenWipe(wipe_Melt , 0, 0, SCREENWIDTH, SCREENHEIGHT, tics); @@ -392,8 +392,8 @@ boolean D_GrabMouseCallback(void) if (drone) return false; - // when menu is active or game is paused, release the mouse - + // when menu is active or game is paused, release the mouse + if (menuactive || paused) return false; @@ -524,7 +524,7 @@ void D_DoAdvanceDemo (void) demosequence = (demosequence+1)%7; else demosequence = (demosequence+1)%6; - + switch (demosequence) { case 0: @@ -638,19 +638,19 @@ static char *banners[] = // // Get game name: if the startup banner has been replaced, use that. // Otherwise, use the name given -// +// static char *GetGameName(char *gamename) { size_t i; char *deh_sub; - + for (i=0; i 0) { gamemode = registered; @@ -853,7 +853,7 @@ void D_SetGameDescription(void) } else if (logical_gamemission == pack_plut) { - gamedescription = GetGameName("DOOM 2: Plutonia Experiment"); + gamedescription = GetGameName("DOOM 2: Plutonia Experiment"); } else if (logical_gamemission == pack_tnt) { @@ -876,7 +876,7 @@ static boolean D_AddFile(char *filename) } // Copyright message banners -// Some dehacked mods replace these. These are only displayed if they are +// Some dehacked mods replace these. These are only displayed if they are // replaced by dehacked. static char *copyright_banners[] = @@ -925,7 +925,7 @@ void PrintDehackedBanners(void) } } -static struct +static struct { char *description; char *cmdline; @@ -950,7 +950,7 @@ static void InitGameVersion(void) int p; int i; - //! + //! // @arg // @category compat // @@ -970,8 +970,8 @@ static void InitGameVersion(void) break; } } - - if (gameversions[i].description == NULL) + + if (gameversions[i].description == NULL) { printf("Supported game versions:\n"); @@ -980,7 +980,7 @@ static void InitGameVersion(void) printf("\t%s (%s)\n", gameversions[i].cmdline, gameversions[i].description); } - + I_Error("Unknown game version '%s'", myargv[p+1]); } } @@ -1030,7 +1030,7 @@ static void InitGameVersion(void) } } } - + // The original exe does not support retail - 4th episode not supported if (gameversion < exe_ultimate && gamemode == retail) @@ -1168,6 +1168,8 @@ void D_DoomMain (void) #if ORIGCODE int numiwadlumps; #endif + // Disable stdout buffering + setbuf(stdout, NULL); I_AtExit(D_Endoom, false); @@ -1242,7 +1244,7 @@ void D_DoomMain (void) // // Disable monsters. // - + nomonsters = M_CheckParm ("-nomonsters"); //! @@ -1261,7 +1263,7 @@ void D_DoomMain (void) fastparm = M_CheckParm ("-fast"); - //! + //! // @vanilla // // Developer mode. F1 saves a screenshot in the current working @@ -1295,7 +1297,7 @@ void D_DoomMain (void) if (devparm) DEH_printf(D_DEVSTR); - + // find which dir to use for config files #ifdef _WIN32 @@ -1335,7 +1337,7 @@ void D_DoomMain (void) int scale = 200; extern int forwardmove[2]; extern int sidemove[2]; - + if (p // @category net // @vanilla @@ -1746,7 +1748,7 @@ void D_DoomMain (void) // p = M_CheckParmWithArgs("-loadgame", 1); - + if (p) { startloadgame = atoi(myargv[p+1]); diff --git a/firmware-doom/lib/doomgeneric/src/doomgeneric.c b/firmware-doom/lib/doomgeneric/src/doomgeneric.c index 77ec4971..3a0fe4d4 100644 --- a/firmware-doom/lib/doomgeneric/src/doomgeneric.c +++ b/firmware-doom/lib/doomgeneric/src/doomgeneric.c @@ -21,12 +21,8 @@ void doomgeneric_Create(int argc, char **argv) DG_ScreenBuffer = malloc(DOOMGENERIC_RESX * DOOMGENERIC_RESY * 4); - D_AllocBuffers(); - DG_Init(); D_DoomMain (); - - D_FreeBuffers(); } diff --git a/firmware-doom/lib/doomgeneric/src/doomgeneric.h b/firmware-doom/lib/doomgeneric/src/doomgeneric.h index 3f83a070..3906f1b0 100644 --- a/firmware-doom/lib/doomgeneric/src/doomgeneric.h +++ b/firmware-doom/lib/doomgeneric/src/doomgeneric.h @@ -4,8 +4,8 @@ #include #include -#define DOOMGENERIC_RESX 240 -#define DOOMGENERIC_RESY 150 +#define DOOMGENERIC_RESX 320 +#define DOOMGENERIC_RESY 200 extern uint32_t* DG_ScreenBuffer; diff --git a/firmware-doom/lib/doomgeneric/src/i_video.h b/firmware-doom/lib/doomgeneric/src/i_video.h index 10949f8c..a29ed7c6 100644 --- a/firmware-doom/lib/doomgeneric/src/i_video.h +++ b/firmware-doom/lib/doomgeneric/src/i_video.h @@ -24,8 +24,8 @@ // Screen width and height. -#define SCREENWIDTH 240 -#define SCREENHEIGHT 150 +#define SCREENWIDTH 320 +#define SCREENHEIGHT 200 // Screen width used for "squash" scale functions diff --git a/firmware-doom/lib/doomgeneric/src/r_bsp.c b/firmware-doom/lib/doomgeneric/src/r_bsp.c index d16fb3db..f23f7949 100644 --- a/firmware-doom/lib/doomgeneric/src/r_bsp.c +++ b/firmware-doom/lib/doomgeneric/src/r_bsp.c @@ -47,9 +47,15 @@ drawseg_t* drawsegs; drawseg_t* ds_p; -void R_AllocBSP (void) +int R_AllocBSP (void) { - drawsegs = malloc (sizeof(*drawsegs) * MAXDRAWSEGS); + int size = sizeof(drawseg_t) * MAXDRAWSEGS; + drawsegs = malloc (size); + if (drawsegs == NULL) + { + return -1; + } + return size; } void R_FreeBSP (void) diff --git a/firmware-doom/lib/doomgeneric/src/r_bsp.h b/firmware-doom/lib/doomgeneric/src/r_bsp.h index 8836cab1..6e193f37 100644 --- a/firmware-doom/lib/doomgeneric/src/r_bsp.h +++ b/firmware-doom/lib/doomgeneric/src/r_bsp.h @@ -49,7 +49,7 @@ extern lighttable_t** dscalelight; typedef void (*drawfunc_t) (int start, int stop); -void R_AllocBSP (void); +int R_AllocBSP (void); void R_FreeBSP (void); diff --git a/firmware-doom/lib/doomgeneric/src/r_data.c b/firmware-doom/lib/doomgeneric/src/r_data.c index 2d4b65bb..5e0880ff 100644 --- a/firmware-doom/lib/doomgeneric/src/r_data.c +++ b/firmware-doom/lib/doomgeneric/src/r_data.c @@ -44,7 +44,7 @@ // is stored in vertical runs of opaque pixels (posts). // A column is composed of zero or more posts, // a patch or sprite is composed of zero or more columns. -// +// @@ -74,7 +74,7 @@ typedef struct typedef struct { char name[8]; - int masked; + int masked; short width; short height; int obsolete; @@ -91,7 +91,7 @@ typedef struct // Block origin (allways UL), // which has allready accounted // for the internal origin of the patch. - short originx; + short originx; short originy; int patch; } texpatch_t; @@ -106,7 +106,7 @@ typedef struct texture_s texture_t; struct texture_s { // Keep name for switch changing, etc. - char name[8]; + char name[8]; short width; short height; @@ -117,11 +117,11 @@ struct texture_s // Next in hash table chain texture_t *next; - + // All the patches[patchcount] // are drawn back to front into the cached texture. short patchcount; - texpatch_t patches[1]; + texpatch_t patches[1]; }; @@ -145,7 +145,7 @@ texture_t** textures_hashtable; int* texturewidthmask; // needed for texture pegging -fixed_t* textureheight; +fixed_t* textureheight; int* texturecompositesize; short** texturecolumnlump; unsigned short** texturecolumnofs; @@ -156,7 +156,7 @@ int* flattranslation; int* texturetranslation; // needed for pre rendering -fixed_t* spritewidth; +fixed_t* spritewidth; fixed_t* spriteoffset; fixed_t* spritetopoffset; @@ -210,8 +210,8 @@ R_DrawColumnInCache if (count > 0) memcpy (cache + position, source, count); - - patch = (column_t *)( (byte *)patch + patch->length + 4); + + patch = (column_t *)( (byte *)patch + patch->length + 4); } } @@ -227,7 +227,7 @@ void R_GenerateComposite (int texnum) { byte* block; texture_t* texture; - texpatch_t* patch; + texpatch_t* patch; patch_t* realpatch; int x; int x1; @@ -236,19 +236,19 @@ void R_GenerateComposite (int texnum) column_t* patchcol; short* collump; unsigned short* colofs; - + texture = textures[texnum]; block = Z_Malloc (texturecompositesize[texnum], - PU_STATIC, - &texturecomposite[texnum]); + PU_STATIC, + &texturecomposite[texnum]); collump = texturecolumnlump[texnum]; colofs = texturecolumnofs[texnum]; - + // Composite the columns together. patch = texture->patches; - + for (i=0 , patch = texture->patches; ipatchcount; i++, patch++) @@ -261,7 +261,7 @@ void R_GenerateComposite (int texnum) x = 0; else x = x1; - + if (x2 > texture->width) x2 = texture->width; @@ -270,7 +270,7 @@ void R_GenerateComposite (int texnum) // Column does not have multiple patches? if (collump[x] >= 0) continue; - + patchcol = (column_t *)((byte *)realpatch + LONG(realpatch->columnofs[x-x1])); R_DrawColumnInCache (patchcol, @@ -278,7 +278,7 @@ void R_GenerateComposite (int texnum) patch->originy, texture->height); } - + } // Now that the texture has been built in column cache, @@ -295,7 +295,7 @@ void R_GenerateLookup (int texnum) { texture_t* texture; byte* patchcount; // patchcount[texture->width] - texpatch_t* patch; + texpatch_t* patch; patch_t* realpatch; int x; int x1; @@ -303,16 +303,16 @@ void R_GenerateLookup (int texnum) int i; short* collump; unsigned short* colofs; - + texture = textures[texnum]; // Composited texture not created yet. texturecomposite[texnum] = 0; - + texturecompositesize[texnum] = 0; collump = texturecolumnlump[texnum]; colofs = texturecolumnofs[texnum]; - + // Now count the number of columns // that are covered by more than one patch. // Fill in the lump / offset, so columns @@ -328,7 +328,7 @@ void R_GenerateLookup (int texnum) realpatch = W_CacheLumpNum (patch->patch, PU_CACHE); x1 = patch->originx; x2 = x1 + SHORT(realpatch->width); - + if (x1 < 0) x = 0; else @@ -343,7 +343,7 @@ void R_GenerateLookup (int texnum) colofs[x] = LONG(realpatch->columnofs[x-x1])+3; } } - + for (x=0 ; xwidth ; x++) { if (!patchcount[x]) @@ -353,19 +353,19 @@ void R_GenerateLookup (int texnum) return; } // I_Error ("R_GenerateLookup: column without a patch"); - + if (patchcount[x] > 1) { // Use the cached block. - collump[x] = -1; + collump[x] = -1; colofs[x] = texturecompositesize[texnum]; - + if (texturecompositesize[texnum] > 0x10000-texture->height) { I_Error ("R_GenerateLookup: texture %i is >64k", texnum); } - + texturecompositesize[texnum] += texture->height; } } @@ -386,11 +386,11 @@ R_GetColumn { int lump; int ofs; - + col &= texturewidthmask[tex]; lump = texturecolumnlump[tex][col]; ofs = texturecolumnofs[tex][col]; - + if (lump > 0) return (byte *)W_CacheLumpNum(lump,PU_CACHE)+ofs; @@ -407,7 +407,7 @@ static void GenerateTextureHashTable(void) int i; int key; - textures_hashtable + textures_hashtable = Z_Malloc(sizeof(texture_t *) * numtextures, PU_STATIC, 0); memset(textures_hashtable, 0, sizeof(texture_t *) * numtextures); @@ -461,13 +461,13 @@ void R_InitTextures (void) int* maptex; int* maptex2; int* maptex1; - + char name[9]; char* names; char* name_p; - + int* patchlookup; - + int totalwidth; int nummappatches; int offset; @@ -477,12 +477,12 @@ void R_InitTextures (void) int numtextures2; int* directory; - + int temp1; int temp2; int temp3; - + // Load the patch names from pnames.lmp. name[8] = 0; names = W_CacheLumpName (DEH_String("PNAMES"), PU_STATIC); @@ -504,7 +504,7 @@ void R_InitTextures (void) numtextures1 = LONG(*maptex); maxoff = W_LumpLength (W_GetNumForName (DEH_String("TEXTURE1"))); directory = maptex+1; - + if (W_CheckNumForName (DEH_String("TEXTURE2")) != -1) { maptex2 = W_CacheLumpName (DEH_String("TEXTURE2"), PU_STATIC); @@ -518,7 +518,7 @@ void R_InitTextures (void) maxoff2 = 0; } numtextures = numtextures1 + numtextures2; - + textures = Z_Malloc (numtextures * sizeof(*textures), PU_STATIC, 0); texturecolumnlump = Z_Malloc (numtextures * sizeof(*texturecolumnlump), PU_STATIC, 0); texturecolumnofs = Z_Malloc (numtextures * sizeof(*texturecolumnofs), PU_STATIC, 0); @@ -528,7 +528,7 @@ void R_InitTextures (void) textureheight = Z_Malloc (numtextures * sizeof(*textureheight), PU_STATIC, 0); totalwidth = 0; - + // Really complex printing shit... temp1 = W_GetNumForName (DEH_String("S_START")); // P_??????? temp2 = W_GetNumForName (DEH_String("S_END")) - 1; @@ -547,11 +547,12 @@ void R_InitTextures (void) for (i = 0; i < temp3 + 10; i++) printf("\b"); } - + for (i=0 ; i maxoff) I_Error ("R_InitTextures: bad texture directory"); - + mtexture = (maptexture_t *) ( (byte *)maptex + offset); texture = textures[i] = Z_Malloc (sizeof(texture_t) + sizeof(texpatch_t)*(SHORT(mtexture->patchcount)-1), PU_STATIC, 0); - + texture->width = SHORT(mtexture->width); texture->height = SHORT(mtexture->height); texture->patchcount = SHORT(mtexture->patchcount); - + memcpy (texture->name, mtexture->name, sizeof(texture->name)); mpatch = &mtexture->patches[0]; patch = &texture->patches[0]; @@ -591,7 +592,7 @@ void R_InitTextures (void) I_Error ("R_InitTextures: Missing patch in texture %s", texture->name); } - } + } texturecolumnlump[i] = Z_Malloc (texture->width*sizeof(**texturecolumnlump), PU_STATIC,0); texturecolumnofs[i] = Z_Malloc (texture->width*sizeof(**texturecolumnofs), PU_STATIC,0); @@ -601,7 +602,7 @@ void R_InitTextures (void) texturewidthmask[i] = j-1; textureheight[i] = texture->height<width; } @@ -610,15 +611,15 @@ void R_InitTextures (void) W_ReleaseLumpName(DEH_String("TEXTURE1")); if (maptex2) W_ReleaseLumpName(DEH_String("TEXTURE2")); - - // Precalculate whatever possible. + + // Precalculate whatever possible. for (i=0 ; iname, name, 8) ) @@ -761,7 +766,7 @@ int R_CheckTextureNumForName (char *name) texture = texture->next; } - + return -1; } @@ -775,7 +780,7 @@ int R_CheckTextureNumForName (char *name) int R_TextureNumForName (char* name) { int i; - + i = R_CheckTextureNumForName (name); if (i==-1) @@ -807,24 +812,24 @@ void R_PrecacheLevel (void) int j; int k; int lump; - + texture_t* texture; thinker_t* th; spriteframe_t* sf; if (demoplayback) return; - + // Precache flats. flatpresent = Z_Malloc(numflats, PU_STATIC, NULL); - memset (flatpresent,0,numflats); + memset (flatpresent,0,numflats); for (i=0 ; ipatchcount ; j++) { lump = texture->patches[j].patch; @@ -875,17 +880,17 @@ void R_PrecacheLevel (void) } Z_Free(texturepresent); - + // Precache sprites. spritepresent = Z_Malloc(numsprites, PU_STATIC, NULL); memset (spritepresent,0, numsprites); - + for (th = thinkercap.next ; th != &thinkercap ; th=th->next) { if (th->function.acp1 == (actionf_p1)P_MobjThinker) spritepresent[((mobj_t *)th)->sprite] = 1; } - + spritememory = 0; for (i=0 ; ikey = KEY_UPARROW; + break; + case lilka::Button::DOWN: + key->key = KEY_DOWNARROW; + break; + case lilka::Button::LEFT: + key->key = KEY_LEFTARROW; + break; + case lilka::Button::RIGHT: + key->key = KEY_RIGHTARROW; + break; + case lilka::Button::A: + key->key = KEY_FIRE; + break; + case lilka::Button::B: + key->key = KEY_ESCAPE; + break; + case lilka::Button::SELECT: + key->key = KEY_TAB; + break; + case lilka::Button::START: + key->key = KEY_ENTER; + break; + default: + // TODO: Log warning? + return; + } + + key->pressed = pressed; + keyqueueWrite = (keyqueueWrite + 1) % 16; +} void setup() { lilka::begin(); @@ -23,17 +67,17 @@ void setup() { Serial.begin(115200); Serial.println("Doomgeneric starting..."); - delay(2000); - - for (int i = 0; i < 1024; i++) { - foo[i] = 0; - } + delay(1000); + D_AllocBuffers(); doomgeneric_Create(argc, argv); - for (int i = 0;; i++) { + lilka::controller.setGlobalHandler(buttonHandler); + + while (1) { doomgeneric_Tick(); } + D_FreeBuffers(); } extern "C" void DG_Init() {} @@ -58,9 +102,23 @@ extern "C" void DG_DrawFrame() { // lilka::display.writePixels(row, 240); // } // Нова версія: + // for (int y = 0; y < 150; y++) { + // for (int x = 0; x < 240; x++) { + // uint32_t pixel = DG_ScreenBuffer[y * 240 + x]; + // uint8_t r = (pixel >> 16) & 0xff; + // uint8_t g = (pixel >> 8) & 0xff; + // uint8_t b = pixel & 0xff; + // row[x] = lilka::display.color565(r, g, b); + // } + // lilka::display.writePixels(row, 240); + // } + // Convert 320x200 to 240x150 for (int y = 0; y < 150; y++) { for (int x = 0; x < 240; x++) { - uint32_t pixel = DG_ScreenBuffer[y * 240 + x]; + // Map 240x150 to 320x200 + int yy = y * 4 / 3; + int xx = x * 4 / 3; + uint32_t pixel = DG_ScreenBuffer[yy * 320 + xx]; uint8_t r = (pixel >> 16) & 0xff; uint8_t g = (pixel >> 8) & 0xff; uint8_t b = pixel & 0xff; @@ -85,6 +143,14 @@ extern "C" uint32_t DG_GetTicksMs() { } extern "C" int DG_GetKey(int *pressed, unsigned char *doomKey) { + if (keyqueueRead != keyqueueWrite) { + doomkey_t *key = &keyqueue[keyqueueRead]; + printf("Got key: %d, pressed: %d\n", key->key, key->pressed); + *pressed = key->pressed; + *doomKey = key->key; + keyqueueRead = (keyqueueRead + 1) % 16; + return 1; + } return 0; } diff --git a/lib/lilka/src/lilka/controller.cpp b/lib/lilka/src/lilka/controller.cpp index 55f90ea9..0ca7947f 100644 --- a/lib/lilka/src/lilka/controller.cpp +++ b/lib/lilka/src/lilka/controller.cpp @@ -17,8 +17,8 @@ Controller::Controller() { .justReleased = false, .time = 0, }; - handlers[i] = NULL; } + clearHandlers(); Controller::_instance = this; } @@ -33,6 +33,9 @@ void IRAM_ATTR Controller::handle_interrupt(int stateIndex) { if (handlers[stateIndex] != NULL) { handlers[stateIndex](state->pressed); } + if (globalHandler != NULL) { + globalHandler((Button)stateIndex, state->pressed); + } if (state->pressed) { if (_seq[_seqIndex++] == stateIndex) { if (_seqIndex == 10) { @@ -124,6 +127,10 @@ State Controller::getState() { return _current; } +void Controller::setGlobalHandler(void (*handler)(Button, bool)) { + globalHandler = handler; +} + void Controller::setHandler(Button button, void (*handler)(bool)) { handlers[button] = handler; } @@ -132,6 +139,7 @@ void Controller::clearHandlers() { for (int i = 0; i < Button::COUNT; i++) { handlers[i] = NULL; } + globalHandler = NULL; } Controller controller; diff --git a/lib/lilka/src/lilka/controller.h b/lib/lilka/src/lilka/controller.h index c99ccbd8..c17c2a67 100644 --- a/lib/lilka/src/lilka/controller.h +++ b/lib/lilka/src/lilka/controller.h @@ -48,6 +48,7 @@ class Controller { void begin(); void resetState(); State getState(); + void setGlobalHandler(void (*handler)(Button, bool)); void setHandler(Button button, void (*handler)(bool)); void clearHandlers(); @@ -68,6 +69,7 @@ class Controller { LILKA_GPIO_UP, LILKA_GPIO_DOWN, LILKA_GPIO_LEFT, LILKA_GPIO_RIGHT, LILKA_GPIO_A, LILKA_GPIO_B, LILKA_GPIO_SELECT, LILKA_GPIO_START, }; void (*handlers[Button::COUNT])(bool); + void (*globalHandler)(Button, bool); int8_t _seq[10] = {0, 0, 1, 1, 2, 3, 2, 5, 4}; int8_t _seqIndex = 0; }; diff --git a/lib/lilka/src/lilka/ui.h b/lib/lilka/src/lilka/ui.h index 521cbced..a5007b48 100644 --- a/lib/lilka/src/lilka/ui.h +++ b/lib/lilka/src/lilka/ui.h @@ -7,7 +7,7 @@ namespace lilka { -int ui_menu(String title, String menu[], int menu_size, int cursor, const menu_icon_t *icons[] = 0); +int ui_menu(String title, String menu[], int menu_size, int cursor = 0, const menu_icon_t *icons[] = 0); void ui_alert(String title, String message); } // namespace lilka