-
Notifications
You must be signed in to change notification settings - Fork 0
/
SpaceShooter.h
65 lines (51 loc) · 877 Bytes
/
SpaceShooter.h
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
64
#pragma once
#undef main
#pragma once
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <stdio.h>
#include <algorithm>
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 320
struct MousePos
{
int x;
int y;
};
typedef struct
{
int x;
int y;
int dx;
int dy;
int health;
SDL_Texture* texture;
} Entity;
typedef struct
{
int up;
int down;
int left;
int right;
} ControlScheme;
class SpaceShooter
{
public:
SDL_Renderer *renderer;
SDL_Window *window;
bool initSDL();
void processInputs();
void processKeyDown(SDL_KeyboardEvent *event);
void processKeyUp(SDL_KeyboardEvent *event);
void prepareScene();
void presentScene();
SDL_Texture* loadTexture(const char* filename);
void blit(SDL_Texture* texture, int x, int y);
int up;
int down;
int left;
int right;
int fire;
int speed = 4; // hee hee defining in .h, so cheeky
void run();
};