PandA-2024.02
main.c
Go to the documentation of this file.
1 
5 #include "plot.h"
6 #include "btn_ctrl.h"
7 #include "get_ticks.h"
8 #include "sevensegments_ctrl.h"
9 
10 // Window related defines
11 #define WINDOW_WIDTH 640
12 #define WINDOW_HEIGHT 480
13 
14 // Game related defines
15 #define FRAMES_PER_SECOND 60
16 #define FRAME_RATE 1000/FRAMES_PER_SECOND
17 
18 // RGB colors
19 #define YELLOW_COLOR 6
20 #define RED_COLOR 4
21 #define BLUE_COLOR 1
22 #define GREEN_COLOR 2
23 #define WHITE_COLOR 7
24 #define BLACK_COLOR 0
25 
26 // Minimum distance from the side of the screen to a BRICK
27 #define BRICK_SCREEN_BUFFER_X 41
28 #define BRICK_SCREEN_BUFFER_Y 30
29 
30 // Maximum number of bricks allowed
31 #define NUM_ROWS 6
32 #define NUM_COLS 9
33 #define MAX_BRICKS NUM_ROWS*NUM_COLS
34 
35 // Location of the player's paddle in the game
36 #define PLAYER_Y 430
37 
38 
39 // Dimensions of a BRICK
40 #define BRICK_WIDTH 62
41 #define BRICK_HEIGHT 16
42 
43 // Dimensions of a paddle
44 #define PADDLE_WIDTH 32
45 #define PADDLE_HEIGHT 8
46 
47 // Diameter of the ball
48 #define BALL_DIAMETER 8
49 
50 // Paddle speeds
51 #define PLAYER_SPEED 2
52 
53 // Ball speeds
54 #define BALL_SPEED_MODIFIER 4 // divide location on paddle by this
55 #define BALL_SPEED_Y 2 // max speed of ball along y axis
56 
57 // Maximum number of times the player can miss the ball
58 #define NUM_LIVES 5
59 
60 // Number of levels, increase this value to add new levels
61 #define NUM_LEVELS 3
62 
63 
64 #define LEFT 0
65 #define RIGHT 1
66 #define UP 2
67 #define DOWN 3
68 
69 #define sgn(x) ((x<0)?-1:((x>0)?1:0))
70 
71 typedef struct _obj_description
72 {
73  short int x;
74  short int y;
75  short int w;
76  short int h;
78 
79 // Struct that represents an entity in our game
80 typedef struct _entity
81 {
82  obj_description screen_location; // location on screen
83  int x_speed;
84  int y_speed;
85 } entity;
86 
87 typedef struct _brick
88 {
89  obj_description screen_location; // location on screen
90  int num_hits; // health
91  unsigned char color; //color of the brick
92 } brick;
93 
94 // Global data
95 entity player; // The player's paddle
96 entity ball; // The game ball
97 int lives; // Player's lives
98 int level; // Current level
99 int num_bricks; // Keep track of number of bricks
100 brick bricks[MAX_BRICKS]; // The bricks we're breaking
101 int timer; // Game timer
102 
103 unsigned char convert_char_digit_2_sseg(char c)
104 {
105  static unsigned char table[] = {63/*0*/, 6/*1*/, 91/*2*/, 79/*3*/, 102/*4*/, 109/*5*/, 125/*6*/, 7/*7*/, 127/*8*/, 111/*9*/};
106  return table[c-'0'];
107 }
108 
109 
110 void line(int x1, int y1, int x2, int y2, unsigned int color)
111 {
112  int i,dx,dy,sdx,sdy,dxabs,dyabs,x,y,px,py;
113  dx=x2-x1; /* the horizontal distance of the line */
114  dy=y2-y1; /* the vertical distance of the line */
115  dxabs=abs(dx);
116  dyabs=abs(dy);
117  sdx=sgn(dx);
118  sdy=sgn(dy);
119  x=dyabs>>1;
120  y=dxabs>>1;
121  px=x1;
122  py=y1;
123  plot(color,px,py);
124  if (dxabs>=dyabs) /* the line is more horizontal than vertical */
125  {
126  for(i=0; i<dxabs; i++)
127  {
128  y+=dyabs;
129  if (y>=dxabs)
130  {
131  y-=dxabs;
132  py+=sdy;
133  }
134  px+=sdx;
135  plot(color,px,py);
136  }
137  }
138  else /* the line is more vertical than horizontal */
139  {
140  for(i=0; i<dyabs; i++)
141  {
142  x+=dxabs;
143  if (x>=dyabs)
144  {
145  x-=dyabs;
146  px+=sdx;
147  }
148  py+=sdy;
149  plot(color,px,py);
150  }
151  }
152 }
153 
154 void rect(int left,int top, int right, int bottom, unsigned int color)
155 {
156  line(left,top,right,top,color);
157  line(left,top,left,bottom,color);
158  line(right,top,right,bottom,color);
159  line(left,bottom,right,bottom,color);
160 }
161 
162 void circle(int x0, int y0, int radius, unsigned int color)
163 {
164  int x = radius, y = 0;
165  int radiusError = 1-x;
166  while(x >= y)
167  {
168  plot(color,x + x0, y + y0);
169  plot(color,y + x0, x + y0);
170  plot(color,-x + x0, y + y0);
171  plot(color,-y + x0, x + y0);
172  plot(color,-x + x0, -y + y0);
173  plot(color,-y + x0, -x + y0);
174  plot(color,x + x0, -y + y0);
175  plot(color,y + x0, -x + y0);
176  y++;
177  if(radiusError<0)
178  radiusError+=2*y+1;
179  else
180  {
181  x--;
182  radiusError+=2*(y-x+1);
183  }
184  }
185 }
186 
187 void rect_fill(int left,int top, int right, int bottom, unsigned int color)
188 {
189  int currentline;
190  for (currentline=top; currentline<=bottom; currentline++)
191  line(left,currentline,right,currentline,color);
192 }
193 
194 
195 
197 {
198  char a, b, c, d;
199  short int low_byte = level;
200  short int high_byte = lives;
201  unsigned long long sseg_val = 0;
202  for ( b = '0' - 1; high_byte >= 0; high_byte -= 10 ) ++b;
203  a = '0' + high_byte + 10;
204  sseg_val |= ((unsigned long long)convert_char_digit_2_sseg(a))<<4*8;
205  sseg_val |= ((unsigned long long)convert_char_digit_2_sseg(b))<<5*8;
206  for ( d = '0' - 1; low_byte >= 0; low_byte -= 10 ) ++d;
207  c = '0' + low_byte + 10;
208  sseg_val |= ((unsigned long long)convert_char_digit_2_sseg(c))<<0*8;
209  sseg_val |= ((unsigned long long)convert_char_digit_2_sseg(d))<<1*8;
210  sevensegments_ctrl(sseg_val,~0ULL);
211 }
212 
213 
214 
215 // Check to see if a game object is going to hit the side of the screen
216 _Bool check_wall_collisions(entity *entity, unsigned char dir)
217 {
218  int temp_x=0; // stores the location of the entity after moving
219 
220  // Get the location of the entity after it moves
221  switch (dir)
222  {
223  case LEFT:
224  {
225  temp_x = entity->screen_location.x - entity->x_speed;
226  break;
227  }
228  case RIGHT:
229  {
230  // Notice that we have to add the entities width to get its right(->) coordinate
231  temp_x = entity->screen_location.x + entity->screen_location.w + entity->x_speed;
232  break;
233  }
234  }
235  if ( (temp_x <= 0) || (temp_x >= WINDOW_WIDTH) )
236  return 1;
237  else
238  return 0;
239 }
240 
241 // Check to see if the ball is going to hit a paddle
243 {
244  int ball_x = ball.screen_location.x;
245  int ball_y = ball.screen_location.y;
246  int ball_width = ball.screen_location.w;
247  int ball_height = ball.screen_location.h;
248  int ball_speed = ball.y_speed;
249  int paddle_x = player.screen_location.x;
250  int paddle_y = player.screen_location.y;
251  int paddle_width = player.screen_location.w;
252  int paddle_height = player.screen_location.h;
253  // Check to see if ball is in Y range of the player's paddle.
254  // We check its speed to see if it's even moving towards the player's paddle.
255  if ( (ball_speed > 0) && (ball_y + ball_height >= paddle_y) &&
256  (ball_y + ball_height <= paddle_y + paddle_height) ) // side hit
257  {
258  // If ball is in the X range of the paddle, return true.
259  if ( (ball_x <= paddle_x + paddle_width) && (ball_x + ball_width >= paddle_x) )
260  return 1;
261  }
262  return 0;
263 }
264 
265 
266 void move_ball()
267 {
268  ball.screen_location.x += ball.x_speed;
269  ball.screen_location.y += ball.y_speed;
270  // If the ball is moving left, we see if it hits the wall. If does,
271  // we change its direction. We do the same thing if it's moving right.
272  if ( ( (ball.x_speed < 0) && check_wall_collisions(&ball, LEFT) ) ||
273  ( (ball.x_speed > 0) && check_wall_collisions(&ball, RIGHT) ) )
274  ball.x_speed = -ball.x_speed;
275 }
276 
277 
278 static unsigned char level_hits[NUM_LEVELS][MAX_BRICKS] = {
279  {
280  0, 3, 3, 3, 3, 3, 3, 3, 0,
281  2, 0, 3, 3, 3, 3, 3, 0, 2,
282  2, 2, 0, 3, 3, 3, 0, 2, 2,
283  2, 2, 2, 0, 3, 0, 2, 2, 2,
284  2, 2, 2, 2, 0, 2, 2, 2, 2,
285  2, 2, 2, 0, 4, 0, 2, 2, 2
286  }, {
287  3, 3, 3, 3, 3, 3, 3, 3, 3,
288  0, 4, 0, 4, 0, 4, 0, 4, 0,
289  2, 2, 2, 2, 2, 2, 2, 2, 2,
290  0, 4, 0, 4, 0, 4, 0, 4, 0,
291  3, 3, 3, 3, 3, 3, 3, 3, 3,
292  0, 4, 0, 4, 0, 4, 0, 4, 0
293  }, {
294  1, 2, 1, 2, 1, 2, 1, 2, 1,
295  1, 2, 1, 2, 1, 2, 1, 2, 1,
296  1, 2, 1, 2, 1, 2, 1, 2, 1,
297  1, 2, 1, 1, 1, 2, 1, 2, 1,
298  1, 2, 1, 2, 1, 2, 1, 2, 1,
299  1, 2, 1, 2, 1, 2, 1, 2, 1
300  }
301 };
302 
303 
304 // This function determines which level to load and then iterates through the BRICK structure
305 // reading in values from the level file and setting up the BRICKs accordingly.
307 {
308  int index = 0; // used to index bricks in bricks array
309  // We'll first read in the number of hits a BRICK has and then determine whether we
310  // should create the BRICK (num_hits = 1-4) or if we should skip that BRICK (0)
311  int temp_hits;
312  int row, col;
314  // Iterate through each row and column of BRICKs
315  for (row=0; row<NUM_ROWS; row++)
316  {
317  for (col=0; col<NUM_COLS; col++)
318  {
319  // Read the next value into temp_hits //
320  temp_hits = level_hits[level][row*NUM_COLS+col];
321 
322  bricks[index].num_hits = temp_hits;
323 
324  // We set the location of the BRICK according to what row and column
325  // we're on in our loop. Notice that we use BRICK_SCREEN_BUFFER_[X,Y] to set
326  // the BRICKs away from the sides of the screen.
331  bricks[index].color = BLACK_COLOR;
332 
333  // Now we set the colors
334  switch (bricks[index].num_hits)
335  {
336  case 1:
337  {
338  bricks[index].color = YELLOW_COLOR;
339  break;
340  }
341  case 2:
342  {
343  bricks[index].color = RED_COLOR;
344  break;
345  }
346  case 3:
347  {
348  bricks[index].color = GREEN_COLOR;
349  break;
350  }
351  case 4:
352  {
353  bricks[index].color = BLUE_COLOR;
354  break;
355  }
356  }
357  // For future use, keep track of how many bricks we have.
358  index++; // move to next brick
359 
360  }
361  }
362 }
363 
364 
365 // This function initializes the game.
367 {
368  // Initialize the screen locations of paddle and the ball
369  player.screen_location.x = (WINDOW_WIDTH / 2) - (PADDLE_WIDTH / 2); // center screen
370  player.screen_location.y = PLAYER_Y;
371  player.screen_location.w = PADDLE_WIDTH;
373  ball.screen_location.x = (WINDOW_WIDTH / 2) - (BALL_DIAMETER / 2); // center screen
374  ball.screen_location.y = (WINDOW_HEIGHT / 2) - (BALL_DIAMETER / 2); // center screen
377  // Initialize speeds
378  player.x_speed = PLAYER_SPEED;
379  ball.x_speed = 0;
380  ball.y_speed = 0;
381  // init lives and levels
382  lives = NUM_LIVES;
383  level=0;
384  // We'll need to initialize our bricks for each level, so we have a separate function handle it
386  // clear the screen
388  // timer initialization
389  timer = get_ticks(1);
390 }
391 
392 // This function receives player input and
393 // handles it for the main game state.
395 {
396  _Bool left_pressed = 0;
397  _Bool right_pressed = 0;
398  unsigned char button_pressed = btn_ctrl();
399  if((button_pressed & BUTTON_UP) != 0)
400  return 1;
401  if((button_pressed & BUTTON_DOWN) != 0)
402  ball.y_speed = BALL_SPEED_Y;
403  if((button_pressed & BUTTON_LEFT) != 0)
404  left_pressed = 1;
405  if((button_pressed & BUTTON_RIGHT) != 0)
406  right_pressed = 1;
407  // This is where we actually move the paddle
408  if (left_pressed)
409  {
410  if ( !check_wall_collisions(&player, LEFT) )
411  player.screen_location.x -= PLAYER_SPEED;
412  }
413  if (right_pressed)
414  {
415  if ( !check_wall_collisions(&player, RIGHT) )
416  player.screen_location.x += PLAYER_SPEED;
417  }
418  return 0;
419 }
420 
421 // Check to see if a point is within a rectangle
423 {
424  if ( (x >= rect->x) && (x <= rect->x + rect->w) &&
425  (y >= rect->y) && (y <= rect->y + rect->h) )
426  return 1;
427  else
428  return 0;
429 }
430 
432 {
433  level++;
434 
435  // Check to see if the player has won
436  if (level >= NUM_LEVELS)
437  return 1;
438 
439  // Reset the ball
440  ball.x_speed = 0;
441  ball.y_speed = 0;
442 
443  ball.screen_location.x = WINDOW_WIDTH/2 - ball.screen_location.w/2;
444  ball.screen_location.y = WINDOW_HEIGHT/2 - ball.screen_location.h/2;
445 
446  num_bricks = 0; // Set this to zero before calling bricks_initialization()
447  bricks_initialization(); // it will load the proper level
448  return 0;
449 }
450 
451 
452 // This function changes the brick's hit count. We also need it to change
453 // the color of the brick and check to see if the hit count reached zero.
455 {
456  bricks[index].num_hits--;
457 
458  // If num_hits is 0, the brick needs to be erased
459  if (bricks[index].num_hits == 0)
460  {
461  // Since order isn't important in our brick array, we can quickly erase a brick
462  // simply by copying the last brick into the deleted brick's space. Note that we
463  // have to decrement the brick count so we don't keep trying to access the
464  // last brick (the one we just moved).
465  bricks[index].color = BLACK_COLOR;
466  num_bricks--;
467 
468  // Check to see if it's time to change the level
469  if (num_bricks == 0)
470  {
471  if (change_level())
472  return 1;
473  }
474  }
475  // If the hit count hasn't reached zero, we need to change the brick's color
476  else
477  {
478  switch (bricks[index].num_hits)
479  {
480  case 0:
481  {
482  bricks[index].color = BLACK_COLOR;
483  break;
484  }
485  case 1:
486  {
487  bricks[index].color = YELLOW_COLOR;
488  break;
489  }
490  case 2:
491  {
492  bricks[index].color = RED_COLOR;
493  break;
494  }
495  case 3:
496  {
497  bricks[index].color = GREEN_COLOR;
498  break;
499  }
500  }
501  }
502  return 0;
503 }
504 
505 
506 // This function checks to see if the ball has hit one of the bricks. It also checks
507 // what part of the ball hit the brick so we can adjust the ball's speed acoordingly.
509 {
510  // collision points
511  int left_x = ball.screen_location.x;
512  int left_y = ball.screen_location.y + ball.screen_location.h/2;
513  int right_x = ball.screen_location.x + ball.screen_location.w;
514  int right_y = ball.screen_location.y + ball.screen_location.h/2;
515  int top_x = ball.screen_location.x + ball.screen_location.w/2;
516  int top_y = ball.screen_location.y;
517  int bottom_x = ball.screen_location.x + ball.screen_location.w/2;
518  int bottom_y = ball.screen_location.y + ball.screen_location.h;
519 
520  _Bool top = 0;
521  _Bool bottom = 0;
522  _Bool left = 0;
523  _Bool right = 0;
524  int brick_index;
525  for (brick_index=0; brick_index<MAX_BRICKS; brick_index++)
526  {
527  if(bricks[brick_index].color == BLACK_COLOR) continue;
528  // top
529  if ( check_point_in_rect(top_x, top_y, &bricks[brick_index].screen_location) )
530  {
531  top = 1;
532  if(manage_brick_collision(brick_index)) return 1;
533  }
534  // bottom
535  if ( check_point_in_rect(bottom_x, bottom_y, &bricks[brick_index].screen_location) )
536  {
537  bottom = 1;
538  if(manage_brick_collision(brick_index)) return 1;
539  }
540  // left
541  if ( check_point_in_rect(left_x, left_y, &bricks[brick_index].screen_location) )
542  {
543  left = 1;
544  if(manage_brick_collision(brick_index)) return 1;
545  }
546  // right
547  if ( check_point_in_rect(right_x, right_y, &bricks[brick_index].screen_location) )
548  {
549  right = 1;
550  if(manage_brick_collision(brick_index)) return 1;
551  }
552  }
553 
554  if (top)
555  {
556  ball.y_speed = -ball.y_speed;
558  }
559  if (bottom)
560  {
561  ball.y_speed = -ball.y_speed;
563  }
564  if (left)
565  {
566  ball.x_speed = -ball.x_speed;
568  }
569  if (right)
570  {
571  ball.x_speed = -ball.x_speed;
573  }
574  return 0;
575 }
576 
578 {
579  ball.x_speed = 0;
580  ball.y_speed = 0;
581 
582  ball.screen_location.x = WINDOW_WIDTH/2 - ball.screen_location.w/2;
583  ball.screen_location.y = WINDOW_HEIGHT/2 - ball.screen_location.h/2;
584 
585  lives = NUM_LIVES;
586  level = 0;
587  num_bricks = 0;
589 }
590 
591 
592 _Bool manage_ball()
593 {
594  // Start by moving the ball
595  move_ball();
596 
597  if ( check_ball_collisions() )
598  {
599  // Get center location of paddle
600  int paddle_center = player.screen_location.x + player.screen_location.w / 2;
601  int ball_center = ball.screen_location.x + ball.screen_location.w / 2;
602  // Find the location on the paddle that the ball hit
603  int paddle_location = ball_center - paddle_center;
604  // Increase X speed according to distance from center of paddle.
605  ball.x_speed = paddle_location / BALL_SPEED_MODIFIER;
606  ball.y_speed = -ball.y_speed;
607  }
608  // If the ball is moving up, we should check to see if it hits the 'roof'
609  if ( (ball.y_speed < 0) && (ball.screen_location.y <= 0) )
610  {
611  ball.y_speed = -ball.y_speed;
612  }
613 
614  // Check to see if ball has passed the player
615  if ( ball.screen_location.y >= WINDOW_HEIGHT )
616  {
617  lives--;
618  ball.x_speed = 0;
619  ball.y_speed = 0;
620  ball.screen_location.x = WINDOW_WIDTH/2 - ball.screen_location.w/2;
621  ball.screen_location.y = WINDOW_HEIGHT/2 - ball.screen_location.h/2;
622  if (lives == 0)
623  {
624  manage_loss();
625  return 1;
626  }
627  }
628  // Check for collisions with bricks
629  return check_brick_collisions();
630 }
631 
632 
633 // This function handles the main game. We'll control the
634 // drawing of the game as well as any necessary game logic.
636 {
637  int i;
638  // Here we compare the difference between the current time and the last time we
639  // handled a frame. If FRAME_RATE amount of time has, it's time for a new frame.
640  if(get_ticks(0) - timer > FRAME_RATE)
641  {
642  entity player_saved=player;
643  entity ball_saved=ball;
644  if(get_game_input())
645  return 0;
646  if(manage_ball())
647  return 0;
648  // Draw the paddle and the ball
649  rect(player_saved.screen_location.x,player_saved.screen_location.y, player_saved.screen_location.x+player_saved.screen_location.w-1, player_saved.screen_location.y+player_saved.screen_location.h-1, BLACK_COLOR);
651  // Iterate through the bricks array, drawing each brick
652  for (i=0; i<MAX_BRICKS; i++)
653  {
654  rect_fill(bricks[i].screen_location.x+1, bricks[i].screen_location.y+1, bricks[i].screen_location.x+bricks[i].screen_location.w-2, bricks[i].screen_location.y+bricks[i].screen_location.h-2, bricks[i].color);
655  }
656  circle(ball_saved.screen_location.x+ball_saved.screen_location.w/2,ball_saved.screen_location.y+ball_saved.screen_location.h/2, ball_saved.screen_location.w/2, BLACK_COLOR);
658  // Draw the boundary
660  // Output the computer and player scores
661  output_score();
662  // We've processed a frame so we now need to record the time at which we did it.
663  // This way we can compare this time the next time our function gets called and
664  // see if enough time has passed between iterations.
665  timer = get_ticks(0);
666  }
667  return 1;
668 }
669 
670 void main()
671 {
673  while (game_main_loop()) {}
674 }
675 
676 
Definition: main.c:80
_Bool check_wall_collisions(entity *entity, unsigned char dir)
Definition: main.c:216
#define RED_COLOR
Definition: main.c:20
void * top(node_stack *head)
Definition: tree.c:75
#define BLACK_COLOR
Definition: main.c:24
unsigned int get_ticks(unsigned char restart_value)
return an unsigned int which represents the elapsed processor time in milliseconds since some constan...
Definition: get_ticks.c:19
int num_hits
Definition: main.c:90
short int w
Definition: main.c:75
#define PADDLE_WIDTH
Definition: main.c:44
unsigned char btn_ctrl()
Definition: btn_ctrl.c:3
#define RIGHT
Definition: main.c:65
#define BRICK_HEIGHT
Definition: main.c:41
#define sgn(x)
Definition: main.c:69
_Bool manage_ball()
Definition: main.c:592
#define BRICK_SCREEN_BUFFER_X
Definition: main.c:27
obj_description screen_location
Definition: main.c:89
#define MAX_BRICKS
Definition: main.c:33
void bricks_initialization()
Definition: main.c:306
void circle(int x0, int y0, int radius, unsigned int color)
Definition: main.c:162
entity ball
Definition: main.c:96
#define WINDOW_WIDTH
Breakout game ported to the PandA framework by Fabrizio Ferrandi on April 11th 2016.
Definition: main.c:11
_Bool change_level()
Definition: main.c:431
#define BRICK_SCREEN_BUFFER_Y
Definition: main.c:28
#define FRAME_RATE
Definition: main.c:16
short int y
Definition: main.c:74
#define BALL_DIAMETER
Definition: main.c:48
void line(int x1, int y1, int x2, int y2, unsigned int color)
Definition: main.c:110
_Bool get_game_input()
Definition: main.c:394
struct _brick brick
#define NUM_LIVES
Definition: main.c:58
short int h
Definition: main.c:76
#define PLAYER_Y
Definition: main.c:36
obj_description screen_location
Definition: main.c:82
void rect_fill(int left, int top, int right, int bottom, unsigned int color)
Definition: main.c:187
int lives
Definition: main.c:97
brick bricks[MAX_BRICKS]
Definition: main.c:100
#define BRICK_WIDTH
Definition: main.c:40
#define NUM_COLS
Definition: main.c:32
#define BLUE_COLOR
Definition: main.c:21
void output_score()
Definition: main.c:196
#define LEFT
Definition: main.c:64
#define index(x, y)
Definition: Keccak.c:74
#define BALL_SPEED_MODIFIER
Definition: main.c:54
static unsigned char level_hits[NUM_LEVELS][MAX_BRICKS]
Definition: main.c:278
#define NUM_ROWS
Definition: main.c:31
struct _entity entity
_Bool check_brick_collisions()
Definition: main.c:508
void game_initialization()
Definition: main.c:366
int x_speed
Definition: main.c:83
#define NUM_LEVELS
Definition: main.c:61
#define BUTTON_LEFT
Definition: btn_ctrl.h:6
struct _obj_description obj_description
#define YELLOW_COLOR
Definition: main.c:19
#define abs(x)
Definition: main.c:3
#define PADDLE_HEIGHT
Definition: main.c:45
#define WINDOW_HEIGHT
Definition: main.c:12
void manage_loss()
Definition: main.c:577
#define BUTTON_RIGHT
Definition: btn_ctrl.h:7
void move_ball()
Definition: main.c:266
#define BALL_SPEED_Y
Definition: main.c:55
#define BUTTON_DOWN
Definition: btn_ctrl.h:5
int num_bricks
Definition: main.c:99
void main()
Definition: main.c:670
unsigned char color
Definition: main.c:91
int level
Definition: main.c:98
_Bool game_main_loop()
Definition: main.c:635
#define BUTTON_UP
Definition: btn_ctrl.h:4
int timer
Definition: main.c:101
_Bool check_point_in_rect(int x, int y, obj_description *rect)
Definition: main.c:422
Definition: main.c:87
unsigned char convert_char_digit_2_sseg(char c)
Definition: main.c:103
void rect(int left, int top, int right, int bottom, unsigned int color)
Definition: main.c:154
#define PLAYER_SPEED
Definition: main.c:51
_Bool manage_brick_collision(int index)
Definition: main.c:454
void sevensegments_ctrl(unsigned long long val, unsigned long long mask)
int y_speed
Definition: main.c:84
short int x
Definition: main.c:73
entity player
Definition: main.c:95
#define WHITE_COLOR
Definition: main.c:23
void plot(int color, int x, int y)
Definition: plot.c:1
#define GREEN_COLOR
Definition: main.c:22
_Bool check_ball_collisions()
Definition: main.c:242

Generated on Mon Feb 12 2024 13:02:48 for PandA-2024.02 by doxygen 1.8.13