浏览代码

Fix colors, add colors, and tweak rom failure message

master
Nathaniel Walizer 11 个月前
父节点
当前提交
067e1e3156
共有 4 个文件被更改,包括 26 次插入9 次删除
  1. +7
    -7
      src/menu.c
  2. +16
    -0
      src/menu.h
  3. +1
    -1
      src/nese.c
  4. +2
    -1
      src/sdl_render.c

+ 7
- 7
src/menu.c 查看文件

@@ -8,11 +8,6 @@
#include "timer.h" #include "timer.h"




#define color_menu (0xFFFFFFFFU)
#define color_highlight (0xFFeeee00U)
#define color_error (0xFFff4444U)


static int get_input(nes_Input_Reader* reader, static int get_input(nes_Input_Reader* reader,
nes_input* input, int *last) { nes_input* input, int *last) {
int status = nes_input_update(reader, input); int status = nes_input_update(reader, input);
@@ -121,6 +116,11 @@ static inline int n_visible(void) {
return ((nes_ppu_render_h - 20) / 11); return ((nes_ppu_render_h - 20) / 11);
} }


static const uint32_t menu_colors[6] = {
color_red, color_orange, color_yellow,
color_green, color_blue, color_purple,
};

static void show_menu(const menu_state* menu, int dim, int x, static void show_menu(const menu_state* menu, int dim, int x,
nes_Renderer* rend, nes_Renderer* rend,
const file_list* files) { const file_list* files) {
@@ -145,11 +145,11 @@ static void show_menu(const menu_state* menu, int dim, int x,
"..." : filename, "..." : filename,
x, y, x, y,
(menu->cursor == n) ? (menu->cursor == n) ?
color_highlight : color_menu
color_white : menu_colors[n % 6]
); );
if (menu->cursor == n) { if (menu->cursor == n) {
nes_draw_text(rend, ">", x - 10, y, nes_draw_text(rend, ">", x - 10, y,
color_highlight);
color_white);
} }
} }




+ 16
- 0
src/menu.h 查看文件

@@ -6,6 +6,22 @@
#include "input.h" #include "input.h"




#define color_white (0xFFffffffU)
#define color_black (0xFF000000U)
#define color_red (0xFFff371aU)
#define color_orange (0xFFff7b59U)
#define color_yellow (0xFFffa233U)
#define color_green (0xFF51d96aU)
#define color_blue (0xFF6f84ffU)
#define color_purple (0xFFd56fffU)


#define color_background color_blue
#define color_menu color_white
#define color_highlight color_yellow
#define color_error color_red


typedef struct { typedef struct {
int cursor; int cursor;
int top; int top;


+ 1
- 1
src/nese.c 查看文件

@@ -128,7 +128,7 @@ static int select_rom(menu_state* menu, nes_Renderer* rend,
if (NULL != cart.filename) { if (NULL != cart.filename) {
char message[1024]; char message[1024];
snprintf(message, sizeof(message) - 1, snprintf(message, sizeof(message) - 1,
"Could not load\n%s", cart.filename);
"Could not load\n%s", cart.filename + 4);
int button = modal_popup(message, rend, input, sys); int button = modal_popup(message, rend, input, sys);
if (input_Result_Quit == (button >> 8)) { if (input_Result_Quit == (button >> 8)) {
// Program closed inside modal // Program closed inside modal


+ 2
- 1
src/sdl_render.c 查看文件

@@ -5,6 +5,7 @@
#include "render.h" #include "render.h"
#include "ppu.h" #include "ppu.h"
#include "mapper.h" #include "mapper.h"
#include "menu.h"
#include "sdl_overlay.h" #include "sdl_overlay.h"




@@ -148,7 +149,7 @@ static int sdl_render_init(nes_Renderer* rend) {
} else { } else {
SDL_LockTextureToSurface(data->texture, NULL, SDL_LockTextureToSurface(data->texture, NULL,
&data->target); &data->target);
SDL_FillRect(data->target, NULL, 0x006677FF);
SDL_FillRect(data->target, NULL, color_background);
} }
} }




正在加载...
取消
保存