Skip to content

Commit

Permalink
Add more options to ex_menu's popup menu.
Browse files Browse the repository at this point in the history
  • Loading branch information
SiegeLordEx authored and SiegeLord committed Sep 26, 2023
1 parent 99f99fb commit 658bad6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions examples/ex_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ enum {
FILE_OPEN_ID,
FILE_RESIZE_ID,
FILE_FULLSCREEN_ID,
FILE_MAXIMIZE_ID,
FILE_FRAMELESS_ID,
FILE_CLOSE_ID,
FILE_EXIT_ID,
DYNAMIC_ID,
Expand Down Expand Up @@ -122,6 +124,8 @@ int main(int argc, char **argv)
al_append_menu_item(pmenu, "&Open", FILE_OPEN_ID, 0, NULL, NULL);
al_append_menu_item(pmenu, "&Resize", FILE_RESIZE_ID, 0, NULL, NULL);
al_append_menu_item(pmenu, "&Fullscreen window", FILE_FULLSCREEN_ID, 0, NULL, NULL);
al_append_menu_item(pmenu, "Remove window fr&ame", FILE_FRAMELESS_ID, 0, NULL, NULL);
al_append_menu_item(pmenu, "&Maximize window", FILE_MAXIMIZE_ID, 0, NULL, NULL);
al_append_menu_item(pmenu, "E&xit", FILE_EXIT_ID, 0, NULL, NULL);
}
}
Expand Down Expand Up @@ -241,6 +245,16 @@ int main(int argc, char **argv)
bool value = (flags & ALLEGRO_FULLSCREEN_WINDOW) ? true : false;
al_set_display_flag(display, ALLEGRO_FULLSCREEN_WINDOW, !value);
}
else if (event.user.data1 == FILE_FRAMELESS_ID) {
int flags = al_get_display_flags(display);
bool value = (flags & ALLEGRO_FRAMELESS) ? true : false;
al_set_display_flag(display, ALLEGRO_FRAMELESS, !value);
}
else if (event.user.data1 == FILE_MAXIMIZE_ID) {
int flags = al_get_display_flags(display);
bool value = (flags & ALLEGRO_MAXIMIZED) ? true : false;
al_set_display_flag(display, ALLEGRO_MAXIMIZED, !value);
}
}
else {
/* The child window */
Expand Down

0 comments on commit 658bad6

Please sign in to comment.