Fixes #81 With --color specified, text should be white

This commit is contained in:
Stefan Arentz 2016-12-18 22:13:27 -05:00
parent a36f95676c
commit ab1a317b75
5 changed files with 13 additions and 6 deletions

View File

@ -91,7 +91,7 @@ static SDL_Texture *_generate_texture(SDL_Renderer *renderer, uint8_t rom_data[2
for (int y = 0; y < 8; y++) {
for (int x = 0; x < 7; x++) {
if (character_data[y] & (1 << x)) {
_set_pixel(surface, (6-x), y, 0xff00ff00);
_set_pixel(surface, (6-x), y, 0xffffffff);
}
}
}

View File

@ -47,6 +47,11 @@ static inline void scr_render_character(struct scr_t *scr, int row, int column)
dst.y = row * 24;
dst.w = 21;
dst.h = 24;
if (scr->color_scheme == EWM_SCR_COLOR_SCHEME_MONOCHROME) {
SDL_SetTextureColorMod(scr->chr->characters[c], 0, 255, 0);
}
SDL_RenderCopy(scr->renderer, scr->chr->characters[c], NULL, &dst);
}
}
@ -314,6 +319,6 @@ void ewm_scr_update(struct scr_t *scr) {
}
}
void ewm_scr_color_scheme(struct scr_t *scr, int color_scheme) {
void ewm_scr_set_color_scheme(struct scr_t *scr, int color_scheme) {
scr->color_scheme = color_scheme;
}

View File

@ -25,8 +25,9 @@
#include <SDL2/SDL.h>
#define EWM_SCR_COLOR_SCHEME_GREEN 0
#define EWM_SCR_COLOR_SCHEME_COLOR 1
#define EWM_SCR_COLOR_SCHEME_MONOCHROME (0)
#define EWM_SCR_COLOR_SCHEME_COLOR (1)
#define EWM_SCR_COLOR_SCHEME_DEFAULT (EWM_SCR_COLOR_SCHEME_MONOCHROME)
struct ewm_two_t;
struct ewm_chr_t;
@ -45,6 +46,6 @@ struct scr_t *ewm_scr_create(struct ewm_two_t *two, SDL_Renderer *renderer);
int ewm_scr_init(struct scr_t *scr, struct ewm_two_t *two, SDL_Renderer *renderer);
void ewm_scr_destroy(struct scr_t *scr);
void ewm_scr_update(struct scr_t *scr);
void ewm_scr_color_scheme(struct scr_t *scr, int color_scheme);
void ewm_scr_set_color_scheme(struct scr_t *scr, int color_scheme);
#endif

View File

@ -45,6 +45,7 @@ static inline void ewm_tty_render_character(struct ewm_tty_t *tty, int row, int
dst.y = row * 24;
dst.w = 21;
dst.h = 24;
SDL_SetTextureColorMod(tty->chr->characters[c], 0, 255, 0);
SDL_RenderCopy(tty->renderer, tty->chr->characters[c], NULL, &dst);
}
}

View File

@ -517,7 +517,7 @@ int ewm_two_main(int argc, char **argv) {
struct ewm_two_t *two = ewm_two_create(EWM_TWO_TYPE_APPLE2PLUS, renderer);
if (color) {
ewm_scr_color_scheme(two->scr, EWM_SCR_COLOR_SCHEME_COLOR);
ewm_scr_set_color_scheme(two->scr, EWM_SCR_COLOR_SCHEME_COLOR);
}
if (drive1 != NULL) {