diff options
author | David Phillips <david@sighup.nz> | 2019-04-10 22:00:56 +1200 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2019-04-10 22:00:56 +1200 |
commit | b1a04a73a325fd48831495ef7489cf3330f2859a (patch) | |
tree | fb197cc1c60abe406521d0ebc82d653913ca818d /tetris.c | |
parent | 8d98f9bf13085c3a36170c2a2e541ee9a58b520a (diff) | |
download | tetris-master.tar.xz |
Diffstat (limited to 'tetris.c')
-rw-r--r-- | tetris.c | 28 |
1 files changed, 19 insertions, 9 deletions
@@ -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); |