Browse Source

Fix colors, add colors, and tweak rom failure message

master
Nathaniel Walizer 11 months ago
parent
commit
067e1e3156
4 changed files with 26 additions and 9 deletions
  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 View File

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


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


static int get_input(nes_Input_Reader* reader,
nes_input* input, int *last) {
int status = nes_input_update(reader, input);
@@ -121,6 +116,11 @@ static inline int n_visible(void) {
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,
nes_Renderer* rend,
const file_list* files) {
@@ -145,11 +145,11 @@ static void show_menu(const menu_state* menu, int dim, int x,
"..." : filename,
x, y,
(menu->cursor == n) ?
color_highlight : color_menu
color_white : menu_colors[n % 6]
);
if (menu->cursor == n) {
nes_draw_text(rend, ">", x - 10, y,
color_highlight);
color_white);
}
}



+ 16
- 0
src/menu.h View File

@@ -6,6 +6,22 @@
#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 {
int cursor;
int top;


+ 1
- 1
src/nese.c View File

@@ -128,7 +128,7 @@ static int select_rom(menu_state* menu, nes_Renderer* rend,
if (NULL != cart.filename) {
char message[1024];
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);
if (input_Result_Quit == (button >> 8)) {
// Program closed inside modal


+ 2
- 1
src/sdl_render.c View File

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


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



Loading…
Cancel
Save