-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGAME.c
58 lines (47 loc) · 1.08 KB
/
GAME.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <avr/io.h>
#include "io.c"
#include <avr/interrupt.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "mine/timer.h"
#include "mine/TitleScreen.h"
#include "mine/GameLogic.h"
int main(void) {
DDRA = 0x03; PORTA = 0xFC;
DDRB = 0xFF; PORTB = 0x00;
DDRC = 0xFF; PORTC = 0x00;
DDRD = 0xFF; PORTD = 0x00;
LCD_init();
LCD_ClearScreen();
TimerSet(100);
TimerOn();
unsigned char Timer_counter_Title = 0; //title screen iterator
const unsigned char Title_screen_period = 3; //So title screen ticks at a slower rate
while(1) {
return_value = 1;
unsigned char button_P1_start= ~PINA&0x04;
if(button_P1_start) //START GAME
{
LCD_ClearScreen(); //clear stuff left over from title screen
while(return_value)
{
TickFct_GAME();
while (!TimerFlag); // Wait 100ms
TimerFlag = 0;
}
}
else
{
if(!(Timer_counter_Title < Title_screen_period))
{
LCD_ClearScreen();
TickFct_TitleScreen();
Timer_counter_Title = 0;
}
else{Timer_counter_Title++;}
}
while (!TimerFlag); // Wait 100ms
TimerFlag = 0;
}
}