aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <dbphillipsnz@gmail.com>2016-04-06 11:00:43 +1200
committerDavid Phillips <dbphillipsnz@gmail.com>2016-04-06 11:00:43 +1200
commit7fb0918148654b2e66047d4f4fe5dbaf3cf1c342 (patch)
tree0089b154f9b083ca47d70c08b741e673091b8d8b
parent503e6b23592e57d27fe843a4b0fef9b16f31c10c (diff)
downloadtetris-7fb0918148654b2e66047d4f4fe5dbaf3cf1c342.tar.xz
Reshuffle function order, remove prototypes
-rw-r--r--tetris.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/tetris.c b/tetris.c
index b768d0d..9942e6a 100644
--- a/tetris.c
+++ b/tetris.c
@@ -11,16 +11,8 @@
#define TETROMINO_WIDTH 4
#define TETROMINO_HEIGHT 4
#define TETROMINO_AREA (TETROMINO_HEIGHT*TETROMINO_WIDTH)
-
-
#define MIN(a,b) (a<b? a : b)
-
-void main_loop();
-
-
-
-
struct colour palette[] = {
{.r=0x00,.g=0x00,.b=0x00},
{.r=0x00,.g=0x00,.b=0xFF},
@@ -32,7 +24,6 @@ struct colour palette[] = {
{.r=0xFF,.g=0xFF,.b=0xFF}
};
-
void draw_board(struct colour* (*board)[WIDTH_CELLS][HEIGHT_CELLS])
{
unsigned int x,y;
@@ -90,14 +81,6 @@ Uint32 gravity_callback(Uint32 interval, void *param)
return interval;
}
-int main()
-{
- srand(time(NULL));
- plot_init();
- main_loop();
-}
-
-
int hit_floor(int x, int y, struct piece *held, struct colour* (*board)[WIDTH_CELLS][HEIGHT_CELLS])
{
int px,py;
@@ -154,9 +137,11 @@ void new_piece(struct piece *held)
update_bitmap(held);
}
+
void rotate(struct piece *held, int direction)
{
held->rotation += direction;
+ /* FIXME need to handle direction not in [-4, 4] */
if (held->rotation >= 4)
held->rotation -= 4;
@@ -272,3 +257,13 @@ void main_loop()
}
}
}
+
+int main()
+{
+ srand(time(NULL));
+ plot_init();
+ main_loop();
+}
+
+
+