-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
59 lines (51 loc) · 1.37 KB
/
main.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
59
#include <stdlib.h>
#include <time.h>
#include "DeltaTime.h"
#include "SDL.h"
#include "Entity.h"
#include "Game.h"
#include "Random.h"
#include "Screen.h"
#include "TestScreen.h"
int main()
{
srand((unsigned)time(NULL));
InitializeGameState();
SetScreen(CreateTestScreen());
ScreenDimensions dimensions;
dimensions.x = SCREEN_WIDTH;
dimensions.y = SCREEN_HEIGHT;
Viewport* viewport = malloc(sizeof(Viewport));
if(viewport)
{
viewport->width = SCREEN_WIDTH;
viewport->height = SCREEN_HEIGHT;
viewport->x = 0;
viewport->y = 0;
}
InitializeSDL(dimensions);
InitializeDeltaTime();
InitializeEntityData();
//TEST
for(uint16_t i = 0; i < 100; ++i)
{
Sprite* testSprite = LoadSprite("still.png");
const EntityID entityId = RegisterEntity();
EntitySetSprite(entityId, testSprite);
EntitySetRotation(entityId, 0.f, RandomFloatBetween(5.f, 250.f));
EntitySetVelocity(entityId, RandomFloatBetween(25.f, 150.f), RandomFloatBetween(25.f, 150.f));
}
//TEST
game_state->viewport = viewport;
while(game_state->isRunning)
{
PrepareScreen();
Update();
DrawScreen();
}
DestroyDeltaTime();
DestroyScreen();
DestroyGame();
DestroyTextures();
return 0;
}