mirror of
https://git.planet-casio.com/Lephenixnoir/JustUI.git
synced 2024-12-28 04:23:40 +01:00
jscene: add an option to control main menu manually
This commit is contained in:
parent
32ef1536d7
commit
6464074c12
3 changed files with 17 additions and 6 deletions
|
@ -17,8 +17,6 @@
|
||||||
only consists of a scrolling list of names showing a section of a folder's
|
only consists of a scrolling list of names showing a section of a folder's
|
||||||
entries.
|
entries.
|
||||||
|
|
||||||
TODO: jfileselect: Select a new file to write to
|
|
||||||
|
|
||||||
Events:
|
Events:
|
||||||
* JFILESELECT_LOADED when a folder is loaded into the view
|
* JFILESELECT_LOADED when a folder is loaded into the view
|
||||||
* JFILESELECT_VALIDATED when a file has been selected
|
* JFILESELECT_VALIDATED when a file has been selected
|
||||||
|
|
|
@ -31,6 +31,8 @@ typedef struct {
|
||||||
|
|
||||||
/* Number of events lots */
|
/* Number of events lots */
|
||||||
uint16_t lost_events;
|
uint16_t lost_events;
|
||||||
|
/* Whether jscene_run() returns to the main menu */
|
||||||
|
bool mainmenu;
|
||||||
|
|
||||||
} jscene;
|
} jscene;
|
||||||
|
|
||||||
|
@ -103,6 +105,10 @@ bool jscene_process_key_event(jscene *scene, key_event_t event);
|
||||||
Returns true if the event was accepted along the way, false if ignored. */
|
Returns true if the event was accepted along the way, false if ignored. */
|
||||||
bool jscene_process_event(jscene *scene, jevent event);
|
bool jscene_process_event(jscene *scene, jevent event);
|
||||||
|
|
||||||
|
/* jscene_set_mainmenu(): Set whether jscene_run() will return to main menu
|
||||||
|
Disabling this is useful if you want to catch the MENU key or clean up
|
||||||
|
resources before invoking the main menu. */
|
||||||
|
void jscene_set_mainmenu(jscene *scene, bool mainmenu);
|
||||||
|
|
||||||
/* jscene_run(): Run a scene's main loop
|
/* jscene_run(): Run a scene's main loop
|
||||||
|
|
||||||
|
|
15
src/jscene.c
15
src/jscene.c
|
@ -52,6 +52,7 @@ jscene *jscene_create(int x, int y, int w, int h, void *parent)
|
||||||
s->queue_first = 0;
|
s->queue_first = 0;
|
||||||
s->queue_next = 0;
|
s->queue_next = 0;
|
||||||
s->lost_events = 0;
|
s->lost_events = 0;
|
||||||
|
s->mainmenu = true;
|
||||||
|
|
||||||
/* Prepare first layout/paint operation */
|
/* Prepare first layout/paint operation */
|
||||||
s->widget.dirty = 1;
|
s->widget.dirty = 1;
|
||||||
|
@ -192,7 +193,11 @@ bool jscene_process_event(GUNUSED jscene *scene, jevent event)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* jscene_run(): Run a scene's main loop */
|
void jscene_set_mainmenu(jscene *scene, bool mainmenu)
|
||||||
|
{
|
||||||
|
scene->mainmenu = mainmenu;
|
||||||
|
}
|
||||||
|
|
||||||
jevent jscene_run(jscene *s)
|
jevent jscene_run(jscene *s)
|
||||||
{
|
{
|
||||||
keydev_t *d = keydev_std();
|
keydev_t *d = keydev_std();
|
||||||
|
@ -214,9 +219,11 @@ jevent jscene_run(jscene *s)
|
||||||
key_event_t k = keydev_read(d);
|
key_event_t k = keydev_read(d);
|
||||||
|
|
||||||
if(k.type == KEYEV_DOWN && k.key == KEY_MENU && !k.shift && !k.alpha) {
|
if(k.type == KEYEV_DOWN && k.key == KEY_MENU && !k.shift && !k.alpha) {
|
||||||
gint_osmenu();
|
if(s->mainmenu) {
|
||||||
jscene_queue_event(s, (jevent){ .type = JSCENE_PAINT });
|
gint_osmenu();
|
||||||
continue;
|
jscene_queue_event(s, (jevent){ .type = JSCENE_PAINT });
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#ifdef FX9860G
|
#ifdef FX9860G
|
||||||
if(k.type == KEYEV_DOWN && k.key == KEY_OPTN && k.shift && !k.alpha) {
|
if(k.type == KEYEV_DOWN && k.key == KEY_OPTN && k.shift && !k.alpha) {
|
||||||
|
|
Loading…
Reference in a new issue