From b1a04a73a325fd48831495ef7489cf3330f2859a Mon Sep 17 00:00:00 2001 From: David Phillips Date: Wed, 10 Apr 2019 22:00:56 +1200 Subject: Change colours to gruvbox theme --- plot.c | 2 +- tetris.c | 28 +++++++++++++++++++--------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/plot.c b/plot.c index 7a7a54e..c13b314 100644 --- a/plot.c +++ b/plot.c @@ -68,7 +68,7 @@ void plot_clear(void) { /* blank out the background with black */ - SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xFF); + SDL_SetRenderDrawColor(renderer, 0x28, 0x28, 0x28, 0xFF); SDL_RenderFillRect(renderer, NULL); } diff --git a/tetris.c b/tetris.c index e5e0a16..1d90846 100644 --- a/tetris.c +++ b/tetris.c @@ -25,14 +25,24 @@ static unsigned int speed_mode; static unsigned int pause_mode; struct colour palette[] = { - {.r=0x00,.g=0x00,.b=0x00}, - {.r=0x00,.g=0x00,.b=0xFF}, - {.r=0x00,.g=0xFF,.b=0x00}, - {.r=0x00,.g=0xFF,.b=0xFF}, - {.r=0xFF,.g=0x00,.b=0x00}, - {.r=0xFF,.g=0x00,.b=0xFF}, - {.r=0xFF,.g=0xFF,.b=0x00}, - {.r=0xFF,.g=0xFF,.b=0xFF} + {.r=0x28,.g=0x28,.b=0x28}, /* black */ + {.r=0xCC,.g=0x24,.b=0x1D}, /* red */ + {.r=0x98,.g=0x97,.b=0x1A}, /* green */ + {.r=0xD7,.g=0x99,.b=0x21}, /* yellow */ + {.r=0x45,.g=0x85,.b=0x88}, /* blue */ + {.r=0xB1,.g=0x62,.b=0x86}, /* purple */ + {.r=0x68,.g=0x9d,.b=0x6a}, /* aqua */ + {.r=0xA8,.g=0x99,.b=0x84}, /* grey */ + {.r=0x92,.g=0x83,.b=0x74}, /* grey2 */ + {.r=0xFB,.g=0x49,.b=0x23}, /* bright red */ + {.r=0xB8,.g=0xBB,.b=0x26}, /* bright green */ + {.r=0xFA,.g=0xBD,.b=0x2F}, /* bright yellow */ + {.r=0x83,.g=0xA5,.b=0x98}, /* bright blue */ + {.r=0xD3,.g=0x86,.b=0x9B}, /* bright purple */ + {.r=0x8E,.g=0xC0,.b=0x7C}, /* bright aqua */ + {.r=0xD6,.g=0x5D,.b=0x0E}, /* orange */ + {.r=0xFE,.g=0x80,.b=0x19}, /* bright orange */ + {.r=0xEB,.g=0xDB,.b=0xB2}, /* whitish */ }; void @@ -147,7 +157,7 @@ update_bitmap(struct piece *held) void new_piece(struct piece *held) { - held->colour = &palette[rand() % 7 + 1]; + held->colour = &palette[rand() % (sizeof(palette)/sizeof(*palette) - 1) + 1]; held->type = rand()%7; held->rotation= rand()%4; update_bitmap(held); -- cgit v1.1