Enchanced menus yet again...

This commit is contained in:
Ognjen Milan Robovic 2023-12-21 23:22:17 -05:00
parent 2a303e9804
commit 1851eb9239
3 changed files with 13 additions and 34 deletions

View File

@ -73,41 +73,19 @@ void view_hud (int alpha, int width, int height, int x, int y) {
} }
void view_neon_menu (int menu, int align, int x, int y) { void view_neon_menu (int menu, int align, int x, int y) {
int item, width, height, aligned_x, aligned_y, offset_x, offset_y, i, j; int item, aligned_x, aligned_y, i, j;
if (menu_show [menu] == 0) { if (menu_show [menu] == 0) {
return; return;
} }
width = (int) strlen (menu_text [menu] [0]) + 4; i = (int) strlen (menu_text [menu] [0]) + 4;
height = menu_items [menu] + 4; j = menu_items [menu] + 4;
aligned_x = (align == 0) ? x : ((render_width () - ICON_SIZE * width) / 2); aligned_x = (align == 0) ? x : ((render_width () - ICON_SIZE * i) / 2);
aligned_y = (align == 0) ? y : ((render_height () - ICON_SIZE * height) / 2); aligned_y = (align == 0) ? y : ((render_height () - ICON_SIZE * j) / 2);
offset_x = ICON_SIZE * (width - 3); view_hud (menu_alpha [menu], i * ICON_SIZE, j * ICON_SIZE, aligned_x, aligned_y);
offset_y = ICON_SIZE * (height - 3);
for (i = 0; i < width - 1; ++i) {
for (j = 0; j < height - 1; ++j) {
render_sprite (neonui, aligned_x + i * ICON_SIZE + ICON_SIZE / 2, aligned_y + j * ICON_SIZE + ICON_SIZE / 2, 0, 0, ICON_SIZE, ICON_SIZE);
}
}
for (i = 1; i < width - 1; ++i) {
render_sprite (neonui, aligned_x + i * ICON_SIZE, aligned_y, 560, 0, ICON_SIZE, ICON_SIZE);
render_sprite (neonui, aligned_x + i * ICON_SIZE, aligned_y + ICON_SIZE * (height - 1), 560, 0, ICON_SIZE, ICON_SIZE);
}
for (i = 1; i < height - 1; ++i) {
render_sprite (neonui, aligned_x, aligned_y + i * ICON_SIZE, 256, 128, ICON_SIZE, ICON_SIZE);
render_sprite (neonui, aligned_x + ICON_SIZE * (width - 1), aligned_y + i * ICON_SIZE, 256, 128, ICON_SIZE, ICON_SIZE);
}
render_sprite (neonui, aligned_x, aligned_y, 288, 0, 3 * ICON_SIZE, 3 * ICON_SIZE);
render_sprite (neonui, aligned_x + offset_x, aligned_y, 384, 0, 3 * ICON_SIZE, 3 * ICON_SIZE);
render_sprite (neonui, aligned_x, aligned_y + offset_y, 288, 96, 3 * ICON_SIZE, 3 * ICON_SIZE);
render_sprite (neonui, aligned_x + offset_x, aligned_y + offset_y, 384, 96, 3 * ICON_SIZE, 3 * ICON_SIZE);
aligned_x += 2 * ICON_SIZE; aligned_x += 2 * ICON_SIZE;
aligned_y += 2 * ICON_SIZE; aligned_y += 2 * ICON_SIZE;

View File

@ -31,9 +31,10 @@ int main (void) {
view_unit (elf, i, 900 + 32 * i, 96); view_unit (elf, i, 900 + 32 * i, 96);
} }
*/ */
if (IsKeyPressed (KEY_RIGHT)) { menu_show [menu_traits] = menu_show [menu_traits] ? 0 : 1; } if (IsKeyPressed (KEY_RIGHT)) { menu_show [menu_traits] = menu_show [menu_traits] ? 0 : 1; }
if (IsKeyPressed (KEY_LEFT)) { menu_show [menu_skills] = menu_show [menu_skills] ? 0 : 1; } if (IsKeyPressed (KEY_LEFT)) { menu_show [menu_skills] = menu_show [menu_skills] ? 0 : 1; }
if (IsKeyPressed (KEY_DOWN)) { menu_show [menu_values] = menu_show [menu_values] ? 0 : 1; } if (IsKeyPressed (KEY_DOWN)) { menu_show [menu_values] = menu_show [menu_values] ? 0 : 1; }
if (IsKeyPressed (KEY_UP)) { menu_show [menu_resources] = menu_show [menu_resources] ? 0 : 1; }
view_hud (0, SIDE_SIZE, render_height (), render_width () - SIDE_SIZE, 0); view_hud (0, SIDE_SIZE, render_height (), render_width () - SIDE_SIZE, 0);
view_hud (1, render_width () - SIDE_SIZE, render_height (), 0, 0); view_hud (1, render_width () - SIDE_SIZE, render_height (), 0, 0);

View File

@ -29,9 +29,9 @@ static void define_menu (int alpha) {
void menu_configure (void) { void menu_configure (void) {
int index; int index;
define_menu (1); define_menu (0);
define_menu (1); define_menu (0);
define_menu (1); define_menu (0);
define_menu (0); define_menu (0);
for (index = 0; index < chad_trait_count; ++index) { for (index = 0; index < chad_trait_count; ++index) {