Skip to content

Commit

Permalink
implement page up / down
Browse files Browse the repository at this point in the history
also finish clear color menu
  • Loading branch information
Jaklyy committed Jan 25, 2024
1 parent 84c9ef5 commit 2e29a82
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
22 changes: 11 additions & 11 deletions source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,17 +495,17 @@ void menuMain(FILE** file)
struct MenuEntry entries[] =
{
{
.String = str_opt_changefile,
.String = str_opt_edit,
.Type = Entry_Button,
},
{
.String = str_opt_edit,
.String = str_opt_screenshot,
.Type = Entry_Button,
},
{
.String = str_opt_screenshot,
.String = str_opt_changefile,
.Type = Entry_Button,
}
},
};

s32 cursor = 0;
Expand All @@ -515,7 +515,13 @@ void menuMain(FILE** file)

switch(sel)
{
case 0: // change file
case 0: // edit menu
menuEditVars();
break;
case 1: // screenshot
menuScreenshot();
break;
case 2: // change file
{
bool unloaded = false;
while(true)
Expand Down Expand Up @@ -549,12 +555,6 @@ void menuMain(FILE** file)
}
break;
}
case 1: // edit menu
menuEditVars();
break;
case 2: // screenshot
menuScreenshot();
break;
}
abort:
}
Expand Down
10 changes: 7 additions & 3 deletions source/menu/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,16 +296,20 @@ u32 menuInputs(struct MenuDat m)
if (MENU_DOWN & keysrep)
{
(*m.Cursor)++;
if (*m.Cursor > m.NumEntries-1) *m.Cursor = 0;
if (*m.Cursor > m.NumEntries-1 || *m.Cursor < 0) *m.Cursor = 0;
menudirty = true;
}
if (MENU_PAGEUP & keysrep)
{
// todo
*m.Cursor -= 10;
if (*m.Cursor < 0) *m.Cursor = 0;
menudirty = true;
}
if (MENU_PAGEDOWN & keysrep)
{
// todo
*m.Cursor += 10;
if (*m.Cursor > m.NumEntries-1 || *m.Cursor < 0) *m.Cursor = m.NumEntries-1;
menudirty = true;
}
}
if ((ENTRY.Type == Entry_Button))
Expand Down
6 changes: 3 additions & 3 deletions source/menuedit.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ void menuClearColor()
.Mask = 0x3F,
},
};

//menuInputs(Str)
s32 cursor = 0;
menuInputs((struct MenuDat){&cursor, headers, entries, ARRSIZE(entries), InputsCommon});
}

void menuEdgeColor()
Expand Down Expand Up @@ -352,7 +352,7 @@ void menuEditGlobals()
menuEdgeColor();
break;
case 3: // clear color
//menuClearColor();
menuClearColor();
break;
case 4: // clear depth
break;
Expand Down

0 comments on commit 2e29a82

Please sign in to comment.