mirror of
https://github.com/phoboslab/wipeout-rewrite
synced 2025-01-13 20:01:54 +01:00
Blink current menu item 30x per second; see #31
This commit is contained in:
parent
dae45b786a
commit
59ebb89ed2
1 changed files with 9 additions and 4 deletions
|
@ -7,6 +7,11 @@
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
#include "sfx.h"
|
#include "sfx.h"
|
||||||
|
|
||||||
|
bool blink() {
|
||||||
|
// blink 30 times per second
|
||||||
|
return fmod(system_cycle_time(), 1.0/15.0) < 1.0/30.0;
|
||||||
|
}
|
||||||
|
|
||||||
void menu_reset(menu_t *menu) {
|
void menu_reset(menu_t *menu) {
|
||||||
menu->index = -1;
|
menu->index = -1;
|
||||||
}
|
}
|
||||||
|
@ -119,10 +124,10 @@ void menu_update(menu_t *menu) {
|
||||||
// Draw Horizontal (confirm)
|
// Draw Horizontal (confirm)
|
||||||
if (flags_is(page->layout_flags, MENU_HORIZONTAL)) {
|
if (flags_is(page->layout_flags, MENU_HORIZONTAL)) {
|
||||||
vec2i_t pos = vec2i(0, -20);
|
vec2i_t pos = vec2i(0, -20);
|
||||||
ui_draw_text_centered(page->title, ui_scaled_pos(page->title_anchor, pos), UI_SIZE_8, UI_COLOR_ACCENT);
|
ui_draw_text_centered(page->title, ui_scaled_pos(page->title_anchor, pos), UI_SIZE_8, UI_COLOR_DEFAULT);
|
||||||
if (page->subtitle) {
|
if (page->subtitle) {
|
||||||
pos.y += 12;
|
pos.y += 12;
|
||||||
ui_draw_text_centered(page->subtitle, ui_scaled_pos(page->title_anchor, pos), UI_SIZE_8, UI_COLOR_ACCENT);
|
ui_draw_text_centered(page->subtitle, ui_scaled_pos(page->title_anchor, pos), UI_SIZE_8, UI_COLOR_DEFAULT);
|
||||||
}
|
}
|
||||||
pos.y += 16;
|
pos.y += 16;
|
||||||
|
|
||||||
|
@ -131,7 +136,7 @@ void menu_update(menu_t *menu) {
|
||||||
for (int i = 0; i < page->entries_len; i++) {
|
for (int i = 0; i < page->entries_len; i++) {
|
||||||
menu_entry_t *entry = &page->entries[i];
|
menu_entry_t *entry = &page->entries[i];
|
||||||
rgba_t text_color;
|
rgba_t text_color;
|
||||||
if (i == page->index) {
|
if (i == page->index && blink()) {
|
||||||
text_color = UI_COLOR_ACCENT;
|
text_color = UI_COLOR_ACCENT;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -165,7 +170,7 @@ void menu_update(menu_t *menu) {
|
||||||
for (int i = 0; i < page->entries_len; i++) {
|
for (int i = 0; i < page->entries_len; i++) {
|
||||||
menu_entry_t *entry = &page->entries[i];
|
menu_entry_t *entry = &page->entries[i];
|
||||||
rgba_t text_color;
|
rgba_t text_color;
|
||||||
if (i == page->index) {
|
if (i == page->index && blink()) {
|
||||||
text_color = UI_COLOR_ACCENT;
|
text_color = UI_COLOR_ACCENT;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue