-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
64 lines (51 loc) · 1.99 KB
/
main.cpp
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
59
60
61
62
63
/*****************************************************************************
* Name: Emet Behrendt and Gerlad Liu *
* Date: xxxx due date... *
* *
* Purpose: Example 6 - Use a timer, set a frame rate *
* *
* Usage: Use arrows keys to change direction of sprite *
* *
* Revision History: Started on 16/04/18 *
* *
* Known Issues: N/A *
* *
*****************************************************************************/
#include <stdio.h>
#include <sstream>
#include <allegro5/allegro.h>
#include <allegro5/allegro_image.h>
#include <allegro5/allegro_native_dialog.h>
#include "functions.h"
#include <allegro5/allegro_ttf.h>
#include <allegro5/allegro_font.h>
#include <allegro5/allegro_audio.h>
#include <allegro5/allegro_acodec.h>
ALLEGRO_DISPLAY *display = nullptr;
ALLEGRO_EVENT_QUEUE *event_queue = nullptr;
ALLEGRO_TIMER *timer = nullptr;
ALLEGRO_SAMPLE *sample = NULL;
ALLEGRO_SAMPLE *walks = NULL;
Image background1[7], background2[6];
Image character;
Image sprite;
Image block[350];
Image run[8];
Image jump_bitmap;
int posx = 0;
int posy = 300;
int spriteDirection = 0;
int main(int argc, char *argv[]){
// Initializes allegro
initialize_allegro();
// Loads all images
if (!imageIndex()){
return 1;
}
ALLEGRO_FONT *font = al_load_ttf_font("SF_Cartoonist_Hand.ttf", 36, 0);
mainmenu(font);
play(font);
al_rest(10);
al_destroy_display(display);
return 0;
}