/* SPDX-License-Identifier: GPL-3.0-or-later */ /* Copyright (C) 2021 KikooDX */ #include "filepaths.h" #include "input.h" #include "mainmenu.h" #include /* Return 1 if game state should change. */ int mainmenu_update(struct MainMenu *mainmenu, struct Input input) { /* decrease selected pack id */ if (input.keystates[K_UP] == KS_PRESS || input.keystates[K_LEFT] == KS_PRESS) { if (mainmenu->cursor > 0) mainmenu->cursor -= 1; else mainmenu->cursor = MENU_ENTRIES - 1; } /* increase selected pack id */ if (input.keystates[K_DOWN] == KS_PRESS || input.keystates[K_RIGHT] == KS_PRESS) { if (mainmenu->cursor < MENU_ENTRIES - 1) mainmenu->cursor += 1; else mainmenu->cursor = 0; } /* confirm */ if (input.keystates[K_A] == KS_PRESS) return 1; return 0; }