[FEAT] Border
[FEAT] Color accepts a third optional parameter for border
This commit is contained in:
2021-12-10 19:32:05 +01:00
parent f21f199917
commit 376c15c272
3 changed files with 27 additions and 5 deletions

View File

@@ -19,6 +19,7 @@ uint8_t *color_screen = NULL;
uint8_t screen_width = 40;
uint8_t screen_height = 30;
uint8_t current_color = 0x1e;
uint8_t current_border = 0;
uint8_t current_mode = 1;
uint8_t cursor_x = 0;
uint8_t cursor_y = 0;
@@ -65,6 +66,7 @@ void reinit() {
screen_width = 80;
screen_height = 30;
current_color = 0x07;
current_border = 0;
cursor_x = 0;
cursor_y = 0;
char_screen = &mem[0];
@@ -76,6 +78,7 @@ void reinit() {
screen_width = 40;
screen_height = 30;
current_color = 0x07;
current_border = 0;
cursor_x = 0;
cursor_y = 0;
char_screen = &mem[0];
@@ -87,6 +90,7 @@ void reinit() {
screen_width = 20;
screen_height = 15;
current_color = 0x07;
current_border = 0;
cursor_x = 0;
cursor_y = 0;
char_screen = &mem[0];
@@ -268,7 +272,7 @@ int main(int argc,char*argv[]) {
//for (int i=0;i<screen_surface->size;++i) pixels[i] = palette[screen_surface->p[i]];
SDL_UnlockTexture(mini_bak);
SDL_SetRenderDrawColor(mini_ren, (palette[0] >> 16)&0xff, (palette[0] >> 8)&0xff, palette[0]&0xff, 0);
SDL_SetRenderDrawColor(mini_ren, (palette[current_border] >> 16)&0xff, (palette[current_border] >> 8)&0xff, palette[current_border]&0xff, 0);
//SDL_SetRenderDrawColor(mini_ren, 255, 0, 0, 0);
SDL_RenderClear(mini_ren);
SDL_Rect rect = {40, 40, 640, 480};
@@ -300,8 +304,13 @@ void paper(uint8_t value) {
current_color = (current_color & 0x0f) + (value << 4);
}
void color(uint8_t ink, uint8_t paper) {
void border(uint8_t value) {
current_border = value & 0xf;
}
void color(uint8_t ink, uint8_t paper, int8_t border) {
current_color = (ink & 0x0f) + (paper << 4);
if (border >= 0) current_border = border & 0xf;
}
void locate(uint8_t x, uint8_t y) {