Merged rg_gui improvements from dev branch
This includes lots of bug fixes to the dialog system, better file picker, as well as the virtual keyboard.
This commit is contained in:
parent
98ecbc507f
commit
207de1c5f8
@ -158,3 +158,11 @@
|
||||
#ifndef RG_SCREEN_VISIBLE_AREA
|
||||
#define RG_SCREEN_VISIBLE_AREA {0, 0, 0, 0}
|
||||
#endif
|
||||
|
||||
#ifndef RG_LANG_DEFAULT
|
||||
#define RG_LANG_DEFAULT RG_LANG_EN
|
||||
#endif
|
||||
|
||||
#ifndef RG_FONT_DEFAULT
|
||||
#define RG_FONT_DEFAULT RG_FONT_VERA_11
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -69,10 +69,11 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
intptr_t arg;
|
||||
size_t index;
|
||||
bool cancelled;
|
||||
} rg_dialog_ret_t;
|
||||
const char *layout;
|
||||
size_t columns;
|
||||
size_t rows;
|
||||
const char *label;
|
||||
} rg_keyboard_layout_t;
|
||||
|
||||
typedef struct rg_gui_option_s rg_gui_option_t;
|
||||
typedef rg_gui_event_t (*rg_gui_callback_t)(rg_gui_option_t *, rg_gui_event_t);
|
||||
@ -104,6 +105,7 @@ struct rg_gui_option_s
|
||||
#define TEXT_RECT(text, max) rg_gui_draw_text(-(max), 0, 0, (text), 0, 0, RG_TEXT_MULTILINE|RG_TEXT_DUMMY_DRAW)
|
||||
|
||||
void rg_gui_init(void);
|
||||
void rg_gui_update_geometry(void);
|
||||
bool rg_gui_set_language_id(int index);
|
||||
void rg_gui_set_surface(rg_surface_t *surface);
|
||||
bool rg_gui_set_font(int index);
|
||||
@ -111,25 +113,29 @@ bool rg_gui_set_theme(const char *name);
|
||||
const char *rg_gui_get_theme_name(void);
|
||||
rg_image_t *rg_gui_get_theme_image(const char *name);
|
||||
rg_color_t rg_gui_get_theme_color(const char *section, const char *key, rg_color_t default_value);
|
||||
void rg_gui_copy_buffer(int left, int top, int width, int height, int stride, const void *buffer);
|
||||
rg_margins_t rg_gui_get_safe_area(void);
|
||||
void rg_gui_copy_buffer(int left, int top, int width, int height, int stride, const uint16_t *buffer, bool transparency);
|
||||
|
||||
rg_rect_t rg_gui_draw_text(int x_pos, int y_pos, int width, const char *text, // const rg_font_t *font,
|
||||
rg_color_t color_fg, rg_color_t color_bg, uint32_t flags);
|
||||
rg_rect_t rg_gui_draw_dialog(const char *title, const rg_gui_option_t *options, size_t options_count, int sel);
|
||||
rg_rect_t rg_gui_draw_message(const char *format, ...);
|
||||
void rg_gui_draw_rect(int x_pos, int y_pos, int width, int height, int border_size,
|
||||
rg_color_t border_color, rg_color_t fill_color);
|
||||
void rg_gui_draw_icons(void);
|
||||
void rg_gui_draw_dialog(const char *header, const rg_gui_option_t *options, int sel);
|
||||
void rg_gui_draw_image(int x_pos, int y_pos, int width, int height, bool resample, const rg_image_t *img);
|
||||
void rg_gui_draw_icons(void);
|
||||
void rg_gui_draw_hourglass(void); // This should be moved to system or display...
|
||||
void rg_gui_draw_status_bars(void);
|
||||
void rg_gui_draw_keyboard(const rg_keyboard_map_t *map, size_t cursor);
|
||||
void rg_gui_draw_message(const char *format, ...);
|
||||
void rg_gui_draw_virtual_keyboard(int x_pos, int y_pos, const rg_keyboard_layout_t *map, int cursor_pos, bool partial_redraw);
|
||||
void rg_gui_draw_input_screen(const char *title, const char *message, const char *input_buffer,
|
||||
const rg_keyboard_layout_t *layout_ptr, int cursor_pos, bool partial_redraw);
|
||||
|
||||
intptr_t rg_gui_dialog(const char *title, const rg_gui_option_t *options, int selected_index);
|
||||
bool rg_gui_confirm(const char *title, const char *message, bool default_yes);
|
||||
void rg_gui_alert(const char *title, const char *message);
|
||||
char *rg_gui_file_picker(const char *title, const char *path, bool (*validator)(const char *path), bool none_option);
|
||||
char *rg_gui_file_picker(const char *title, const char *path, bool (*validator)(const char *path), bool browse_tree, bool none_option);
|
||||
char *rg_gui_input_str(const char *title, const char *message, const char *default_value);
|
||||
int rg_gui_input_char(const rg_keyboard_layout_t *map);
|
||||
|
||||
int rg_gui_savestate_menu(const char *title, const char *rom_path);
|
||||
void rg_gui_options_menu(void);
|
||||
|
||||
@ -170,7 +170,16 @@ static const _gpio_port gpio_ports[] = {
|
||||
};
|
||||
static const _gpio_sequence gpio_init_seq[] = {};
|
||||
static const _gpio_sequence gpio_deinit_seq[] = {};
|
||||
static rg_gpio_mode_t PCF8575_mode = -1;
|
||||
static rg_gpio_mode_t PCF857x_mode = -1;
|
||||
|
||||
#elif RG_I2C_GPIO_DRIVER == 5 // PCF8574
|
||||
|
||||
static const _gpio_port gpio_ports[] = {
|
||||
{-1, -1, -1, -1}, // PORT 0
|
||||
};
|
||||
static const _gpio_sequence gpio_init_seq[] = {};
|
||||
static const _gpio_sequence gpio_deinit_seq[] = {};
|
||||
static rg_gpio_mode_t PCF857x_mode = -1;
|
||||
|
||||
#else
|
||||
|
||||
@ -240,14 +249,15 @@ bool rg_i2c_gpio_configure_port(int port, uint8_t mask, rg_gpio_mode_t mode)
|
||||
{
|
||||
if (port < 0 || port >= gpio_ports_count)
|
||||
return false;
|
||||
#if RG_I2C_GPIO_DRIVER == 4 // PCF8575
|
||||
uint16_t temp = 0xFFFF;
|
||||
if (mask != 0xFF && mode != PCF8575_mode && (mode == RG_GPIO_OUTPUT || PCF8575_mode == RG_GPIO_OUTPUT))
|
||||
RG_LOGW("PCF8575 mode cannot be set by pin. (mask is 0x%02X, expected 0xFF)", mask);
|
||||
PCF8575_mode = mode;
|
||||
#if RG_I2C_GPIO_DRIVER == 4 || RG_I2C_GPIO_DRIVER == 5 // PCF8575/PCF8574
|
||||
uint32_t temp = 0xFFFFFFFF;
|
||||
if (mask != 0xFF && mode != PCF857x_mode && (mode == RG_GPIO_OUTPUT || PCF857x_mode == RG_GPIO_OUTPUT))
|
||||
RG_LOGW("PCF857x mode cannot be set by pin. (mask is 0x%02X, expected 0xFF)", mask);
|
||||
PCF857x_mode = mode;
|
||||
if (mode != RG_GPIO_OUTPUT)
|
||||
return rg_i2c_write(gpio_address, -1, &temp, 2) && rg_i2c_read(gpio_address, -1, &temp, 2);
|
||||
return rg_i2c_write(gpio_address, -1, &gpio_output_values, 2);
|
||||
return rg_i2c_write(gpio_address, -1, &temp, gpio_ports_count)
|
||||
&& rg_i2c_read(gpio_address, -1, &temp, gpio_ports_count);
|
||||
return rg_i2c_write(gpio_address, -1, &gpio_output_values, gpio_ports_count);
|
||||
#else
|
||||
int direction_reg = gpio_ports[port].direction_reg;
|
||||
int pullup_reg = gpio_ports[port].pullup_reg;
|
||||
@ -261,9 +271,9 @@ int rg_i2c_gpio_read_port(int port)
|
||||
{
|
||||
if (port < 0 || port >= gpio_ports_count)
|
||||
return -1;
|
||||
#if RG_I2C_GPIO_DRIVER == 4 // PCF8575
|
||||
uint8_t values[2];
|
||||
return rg_i2c_read(gpio_address, -1, &values, 2) ? values[port & 1] : -1;
|
||||
#if RG_I2C_GPIO_DRIVER == 4 || RG_I2C_GPIO_DRIVER == 5 // PCF8575/PCF8574
|
||||
uint8_t values[gpio_ports_count];
|
||||
return rg_i2c_read(gpio_address, -1, &values, gpio_ports_count) ? values[port] : -1;
|
||||
#else
|
||||
return rg_i2c_read_byte(gpio_address, gpio_ports[port].input_reg);
|
||||
#endif
|
||||
@ -274,10 +284,10 @@ bool rg_i2c_gpio_write_port(int port, uint8_t value)
|
||||
if (port < 0 || port >= gpio_ports_count)
|
||||
return false;
|
||||
gpio_output_values[port] = value;
|
||||
#if RG_I2C_GPIO_DRIVER == 4 // PCF8575
|
||||
if (PCF8575_mode != RG_GPIO_OUTPUT)
|
||||
#if RG_I2C_GPIO_DRIVER == 4 || RG_I2C_GPIO_DRIVER == 5 // PCF8575/PCF8574
|
||||
if (PCF857x_mode != RG_GPIO_OUTPUT)
|
||||
return true; // This is consistent with other extenders, where the output latch is updated even in input mode
|
||||
return rg_i2c_write(gpio_address, -1, &gpio_output_values, 2);
|
||||
return rg_i2c_write(gpio_address, -1, &gpio_output_values, gpio_ports_count);
|
||||
#else
|
||||
return rg_i2c_write_byte(gpio_address, gpio_ports[port].output_reg, value);
|
||||
#endif
|
||||
|
||||
@ -137,7 +137,7 @@ bool rg_input_read_gamepad_raw(uint32_t *out)
|
||||
uint32_t buttons = 0;
|
||||
#if defined(RG_I2C_GPIO_DRIVER)
|
||||
int data0 = rg_i2c_gpio_read_port(0), data1 = rg_i2c_gpio_read_port(1);
|
||||
if (data0 > -1 && data1 > -1)
|
||||
if (data0 > -1) // && data1 > -1)
|
||||
{
|
||||
buttons = (data1 << 8) | (data0);
|
||||
#elif defined(RG_TARGET_T_DECK_PLUS)
|
||||
@ -372,6 +372,11 @@ void rg_input_deinit(void)
|
||||
RG_LOGI("Input terminated.\n");
|
||||
}
|
||||
|
||||
bool rg_input_key_is_present(rg_key_t mask)
|
||||
{
|
||||
return (gamepad_mapped & mask) == mask;
|
||||
}
|
||||
|
||||
uint32_t rg_input_read_gamepad(void)
|
||||
{
|
||||
#ifdef RG_TARGET_SDL2
|
||||
@ -424,69 +429,3 @@ const char *rg_input_get_key_name(rg_key_t key)
|
||||
default: return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
const char *rg_input_get_key_mapping(rg_key_t key)
|
||||
{
|
||||
if ((gamepad_mapped & key) == key)
|
||||
return "PHYSICAL";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const rg_keyboard_map_t virtual_map1 = {
|
||||
.columns = 10,
|
||||
.rows = 4,
|
||||
.data = {
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
|
||||
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
|
||||
'U', 'V', 'W', 'X', 'Y', 'Z', ' ', ',', '.', ' ',
|
||||
}
|
||||
};
|
||||
|
||||
int rg_input_read_keyboard(const rg_keyboard_map_t *map)
|
||||
{
|
||||
int cursor = -1;
|
||||
int count = map->columns * map->rows;
|
||||
|
||||
if (!map)
|
||||
map = &virtual_map1;
|
||||
|
||||
rg_input_wait_for_key(RG_KEY_ALL, false, 1000);
|
||||
|
||||
while (1)
|
||||
{
|
||||
uint32_t joystick = rg_input_read_gamepad();
|
||||
int prev_cursor = cursor;
|
||||
|
||||
if (joystick & RG_KEY_A)
|
||||
return map->data[cursor];
|
||||
if (joystick & RG_KEY_B)
|
||||
break;
|
||||
|
||||
if (joystick & RG_KEY_LEFT)
|
||||
cursor--;
|
||||
if (joystick & RG_KEY_RIGHT)
|
||||
cursor++;
|
||||
if (joystick & RG_KEY_UP)
|
||||
cursor -= map->columns;
|
||||
if (joystick & RG_KEY_DOWN)
|
||||
cursor += map->columns;
|
||||
|
||||
if (cursor > count - 1)
|
||||
cursor = prev_cursor;
|
||||
else if (cursor < 0)
|
||||
cursor = prev_cursor;
|
||||
|
||||
cursor = RG_MIN(RG_MAX(cursor, 0), count - 1);
|
||||
|
||||
if (cursor != prev_cursor)
|
||||
rg_gui_draw_keyboard(map, cursor);
|
||||
|
||||
rg_input_wait_for_key(RG_KEY_ALL, false, 500);
|
||||
rg_input_wait_for_key(RG_KEY_ANY, true, 500);
|
||||
|
||||
rg_system_tick(0);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -88,21 +88,13 @@ typedef struct
|
||||
bool charging;
|
||||
} rg_battery_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
size_t columns, rows;
|
||||
char data[];
|
||||
} rg_keyboard_map_t;
|
||||
|
||||
void rg_input_init(void);
|
||||
void rg_input_deinit(void);
|
||||
bool rg_input_key_is_present(rg_key_t mask);
|
||||
bool rg_input_key_is_pressed(rg_key_t mask);
|
||||
bool rg_input_wait_for_key(rg_key_t mask, bool pressed, int timeout_ms);
|
||||
const char *rg_input_get_key_name(rg_key_t key);
|
||||
const char *rg_input_get_key_mapping(rg_key_t key);
|
||||
uint32_t rg_input_read_gamepad(void);
|
||||
int rg_input_read_keyboard(const rg_keyboard_map_t *map);
|
||||
rg_battery_t rg_input_read_battery(void);
|
||||
bool rg_input_read_gamepad_raw(uint32_t *out);
|
||||
bool rg_input_read_keyboard_raw(int *out);
|
||||
bool rg_input_read_battery_raw(rg_battery_t *out);
|
||||
const char *rg_input_get_key_name(rg_key_t key);
|
||||
|
||||
@ -92,31 +92,29 @@ static void network_event_handler(void *arg, esp_event_base_t event_base, int32_
|
||||
}
|
||||
#endif
|
||||
|
||||
#define CFG_KEY(key, slot) ({snprintf(key_buffer, sizeof(key_buffer), "%s%d", key, slot); key_buffer;})
|
||||
|
||||
bool rg_network_wifi_read_config(int slot, rg_wifi_config_t *out)
|
||||
{
|
||||
if (slot < 0 || slot > 99)
|
||||
return false;
|
||||
|
||||
char key_ssid[16], key_password[16], key_channel[16], key_mode[16];
|
||||
rg_wifi_config_t config = {0};
|
||||
char key_buffer[64] = {0};
|
||||
char *ptr;
|
||||
|
||||
snprintf(key_ssid, 16, "%s%d", SETTING_WIFI_SSID, slot);
|
||||
snprintf(key_password, 16, "%s%d", SETTING_WIFI_PASSWORD, slot);
|
||||
snprintf(key_channel, 16, "%s%d", SETTING_WIFI_CHANNEL, slot);
|
||||
snprintf(key_mode, 16, "%s%d", SETTING_WIFI_MODE, slot);
|
||||
RG_LOGD("Looking for '%s' (slot %d)", CFG_KEY(SETTING_WIFI_SSID, slot), slot);
|
||||
|
||||
RG_LOGD("Looking for '%s' (slot %d)\n", key_ssid, slot);
|
||||
|
||||
if ((ptr = rg_settings_get_string(NS_WIFI, key_ssid, NULL)))
|
||||
if ((ptr = rg_settings_get_string(NS_WIFI, CFG_KEY(SETTING_WIFI_SSID, slot), NULL)))
|
||||
memccpy(config.ssid, ptr, 0, 32), free(ptr);
|
||||
if ((ptr = rg_settings_get_string(NS_WIFI, key_password, NULL)))
|
||||
if ((ptr = rg_settings_get_string(NS_WIFI, CFG_KEY(SETTING_WIFI_PASSWORD, slot), NULL)))
|
||||
memccpy(config.password, ptr, 0, 64), free(ptr);
|
||||
config.channel = rg_settings_get_number(NS_WIFI, key_channel, 0);
|
||||
config.ap_mode = rg_settings_get_number(NS_WIFI, key_mode, 0);
|
||||
config.channel = rg_settings_get_number(NS_WIFI, CFG_KEY(SETTING_WIFI_CHANNEL, slot), 0);
|
||||
config.ap_mode = rg_settings_get_number(NS_WIFI, CFG_KEY(SETTING_WIFI_MODE, slot), 0);
|
||||
|
||||
if (!config.ssid[0] && slot == 0)
|
||||
{
|
||||
RG_LOGD("Looking for '%s' (slot %d)", SETTING_WIFI_SSID, slot);
|
||||
if ((ptr = rg_settings_get_string(NS_WIFI, SETTING_WIFI_SSID, NULL)))
|
||||
memccpy(config.ssid, ptr, 0, 32), free(ptr);
|
||||
if ((ptr = rg_settings_get_string(NS_WIFI, SETTING_WIFI_PASSWORD, NULL)))
|
||||
@ -132,6 +130,38 @@ bool rg_network_wifi_read_config(int slot, rg_wifi_config_t *out)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rg_network_wifi_write_config(int slot, const rg_wifi_config_t *config)
|
||||
{
|
||||
if (slot < 0 || slot > 99 || !config)
|
||||
return false;
|
||||
|
||||
RG_LOGD("Writing config to slot %d", slot);
|
||||
|
||||
char key_buffer[64] = {0};
|
||||
rg_settings_set_string(NS_WIFI, CFG_KEY(SETTING_WIFI_SSID, slot), config->ssid);
|
||||
rg_settings_set_string(NS_WIFI, CFG_KEY(SETTING_WIFI_PASSWORD, slot), config->password);
|
||||
rg_settings_set_number(NS_WIFI, CFG_KEY(SETTING_WIFI_CHANNEL, slot), config->channel);
|
||||
rg_settings_set_number(NS_WIFI, CFG_KEY(SETTING_WIFI_MODE, slot), config->ap_mode);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rg_network_wifi_delete_config(int slot)
|
||||
{
|
||||
if (slot < 0 || slot > 99)
|
||||
return false;
|
||||
|
||||
RG_LOGD("Deleting config in slot %d", slot);
|
||||
|
||||
char key_buffer[64] = {0};
|
||||
rg_settings_delete(NS_WIFI, CFG_KEY(SETTING_WIFI_SSID, slot));
|
||||
rg_settings_delete(NS_WIFI, CFG_KEY(SETTING_WIFI_PASSWORD, slot));
|
||||
rg_settings_delete(NS_WIFI, CFG_KEY(SETTING_WIFI_CHANNEL, slot));
|
||||
rg_settings_delete(NS_WIFI, CFG_KEY(SETTING_WIFI_MODE, slot));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rg_network_wifi_set_config(const rg_wifi_config_t *config)
|
||||
{
|
||||
#ifdef RG_ENABLE_NETWORKING
|
||||
|
||||
@ -33,11 +33,15 @@ typedef struct
|
||||
bool rg_network_init(void);
|
||||
void rg_network_deinit(void);
|
||||
bool rg_network_wifi_set_config(const rg_wifi_config_t *config);
|
||||
bool rg_network_wifi_read_config(int slot, rg_wifi_config_t *out);
|
||||
bool rg_network_wifi_start(void);
|
||||
void rg_network_wifi_stop(void);
|
||||
rg_network_t rg_network_get_info(void);
|
||||
|
||||
// Configuration slots management
|
||||
bool rg_network_wifi_read_config(int slot, rg_wifi_config_t *out);
|
||||
bool rg_network_wifi_write_config(int slot, const rg_wifi_config_t *config);
|
||||
bool rg_network_wifi_delete_config(int slot);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int max_redirections;
|
||||
|
||||
@ -30,6 +30,12 @@ typedef struct
|
||||
int width, height;
|
||||
} rg_rect_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int left, top;
|
||||
int right, bottom;
|
||||
} rg_margins_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int width, height;
|
||||
|
||||
@ -207,11 +207,12 @@ static void update_statistics(void)
|
||||
// Hard to fix this sync issue without a lock, which I don't want to use...
|
||||
ticks = RG_MAX(ticks, frames);
|
||||
|
||||
statistics.busyPercent = busyTime / totalTime * 100.f;
|
||||
statistics.totalFPS = ticks / totalTimeSecs;
|
||||
statistics.skippedFPS = (ticks - frames) / totalTimeSecs;
|
||||
statistics.fullFPS = fullFrames / totalTimeSecs;
|
||||
statistics.partialFPS = partFrames / totalTimeSecs;
|
||||
statistics.busyPercent = busyTime / totalTime * 100.f;
|
||||
statistics.speedPercent = app.tickRate > 0 ? (statistics.totalFPS / app.tickRate * 100.f) : 100.f;
|
||||
}
|
||||
statistics.uptime = rg_system_timer() / 1000000;
|
||||
|
||||
@ -263,7 +264,7 @@ static void system_monitor_task(void *arg)
|
||||
!rg_system_get_indicator(RG_INDICATOR_POWER_LOW)));
|
||||
|
||||
// Try to avoid complex conversions that could allocate, prefer rounding/ceiling if necessary.
|
||||
rg_system_log(RG_LOG_DEBUG, NULL, "STACK:%d, HEAP:%d+%d (%d+%d), BUSY:%d%%, FPS:%d (%d+%d+%d), BATT:%d\n",
|
||||
rg_system_log(RG_LOG_DEBUG, NULL, "STACK:%d, HEAP:%d+%d (%d+%d), BUSY:%d%%, FPS:%d (S:%d R:%d+%d), BATT:%d",
|
||||
statistics.freeStackMain,
|
||||
statistics.freeMemoryInt / 1024,
|
||||
statistics.freeMemoryExt / 1024,
|
||||
@ -810,7 +811,10 @@ rg_stats_t rg_system_get_counters(void)
|
||||
void rg_system_set_tick_rate(int tickRate)
|
||||
{
|
||||
app.tickRate = tickRate;
|
||||
app.frameTime = 1000000 / (app.tickRate * app.speed);
|
||||
if (tickRate > 0)
|
||||
app.frameTime = 1000000 / (app.tickRate * app.speed);
|
||||
else
|
||||
app.frameTime = 1000000;
|
||||
}
|
||||
|
||||
int rg_system_get_tick_rate(void)
|
||||
|
||||
@ -195,6 +195,7 @@ typedef struct
|
||||
float partialFPS;
|
||||
float fullFPS;
|
||||
float totalFPS;
|
||||
float speedPercent;
|
||||
float busyPercent;
|
||||
int64_t busyTime;
|
||||
int64_t lastTick;
|
||||
|
||||
@ -559,7 +559,7 @@ void app_main()
|
||||
|
||||
if (!iwad)
|
||||
{
|
||||
iwad = rg_gui_file_picker("Select IWAD file", I_DoomExeDir(), is_iwad, false) ?: "";
|
||||
iwad = rg_gui_file_picker("Select IWAD file", I_DoomExeDir(), is_iwad, false, false) ?: "";
|
||||
rg_gui_draw_hourglass(); // Redraw hourglass to indicate loading...
|
||||
}
|
||||
|
||||
|
||||
@ -175,7 +175,7 @@ static void nsf_draw_overlay(void)
|
||||
RG_DIALOG_END,
|
||||
};
|
||||
snprintf(song, sizeof(song), "%d / %d", nsf_current_song, header->total_songs);
|
||||
rg_gui_draw_dialog("NSF Player", options, -1);
|
||||
rg_gui_draw_dialog("NSF Player", options, 4, -1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,15 +6,10 @@ static rg_app_t *app;
|
||||
static rg_surface_t *updates[2];
|
||||
static rg_surface_t *currentUpdate;
|
||||
|
||||
const rg_keyboard_map_t coleco_keyboard = {
|
||||
const rg_keyboard_layout_t coleco_keyboard = {
|
||||
.layout = "123" "456" "789" "*0#",
|
||||
.columns = 3,
|
||||
.rows = 4,
|
||||
.data = {
|
||||
'1', '2', '3',
|
||||
'4', '5', '6',
|
||||
'7', '8', '9',
|
||||
'*', '0', '#',
|
||||
},
|
||||
};
|
||||
|
||||
static const char *SETTING_PALETTE = "palette";
|
||||
@ -171,7 +166,10 @@ void sms_main(void)
|
||||
|
||||
while (true)
|
||||
{
|
||||
const int64_t startTime = rg_system_timer();
|
||||
uint32_t joystick = rg_input_read_gamepad();
|
||||
bool drawFrame = !skipFrames;
|
||||
bool slowFrame = false;
|
||||
|
||||
if (joystick & (RG_KEY_MENU|RG_KEY_OPTION))
|
||||
{
|
||||
@ -179,12 +177,9 @@ void sms_main(void)
|
||||
rg_gui_game_menu();
|
||||
else
|
||||
rg_gui_options_menu();
|
||||
continue;
|
||||
}
|
||||
|
||||
int64_t startTime = rg_system_timer();
|
||||
bool drawFrame = !skipFrames;
|
||||
bool slowFrame = false;
|
||||
|
||||
input.pad[0] = 0x00;
|
||||
input.pad[1] = 0x00;
|
||||
input.system = 0x00;
|
||||
@ -221,7 +216,7 @@ void sms_main(void)
|
||||
{
|
||||
rg_gui_draw_text(RG_GUI_CENTER, RG_GUI_CENTER, 0, _("To start, try: 1 or * or #"), C_YELLOW, C_BLACK, RG_TEXT_BIGGER);
|
||||
rg_audio_set_mute(true);
|
||||
int key = rg_input_read_keyboard(&coleco_keyboard);
|
||||
int key = rg_gui_input_char(&coleco_keyboard);
|
||||
rg_audio_set_mute(false);
|
||||
|
||||
if (key >= '0' && key <= '9')
|
||||
@ -232,12 +227,14 @@ void sms_main(void)
|
||||
colecoKey = 11;
|
||||
else
|
||||
colecoKey = 255;
|
||||
colecoKeyDecay = 3;
|
||||
colecoKeyDecay = 4;
|
||||
continue;
|
||||
}
|
||||
else if (joystick & RG_KEY_SELECT)
|
||||
{
|
||||
rg_task_delay(100);
|
||||
system_reset();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user