-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrts.c
50 lines (43 loc) · 1.39 KB
/
rts.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
#include "source/tools/raylib.h"
#include "source/tools/helper.h"
#include "source/game.h"
#include "source/map.h"
#include "source/unit.h"
#include "source/building.h"
#include "source/interface.h"
i32 main() {
SetTraceLogLevel(LOG_WARNING);
InitWindow(1024, 768, "RTS");
SetWindowState(FLAG_WINDOW_RESIZABLE);
SetTargetFPS(60);
initGame();
newBuilding((tBuilding){Type: &Farm, Finished: true}, 16, 16);
for(i32 i = 0; i < 10; i++) {
Vector2 pos = {16.0 + GetRandomValue(-100, 100)/100.0,16.0 + GetRandomValue(-100, 100)/100.0};
newUnit((tUnit){Type: &Peasent, Position: pos});
}
for(i32 i = 0; i < 30; i++) {
Vector2 pos = {MAP_SIZE-16.0 + GetRandomValue(-100, 100)/100.0,MAP_SIZE-16.0 + GetRandomValue(-100, 100)/100.0};
newUnit((tUnit){Type: &Peasent, Player: 7, Position: pos});
}
//tMoveOrder *move = newMoveOrder((tMoveOrder){AttackOnSight: true, Target: {16.0, 16.0}});
for(i32 i = 0; i < 10; i++) {
Vector2 pos = {MAP_SIZE-16.0 + GetRandomValue(-100, 100)/100.0,MAP_SIZE-16.0 + GetRandomValue(-100, 100)/100.0};
UnitHandle unit = newUnit((tUnit){Type: &Peasent, Player: 7, Position: pos});
//moveUnit(unit, move);
}
while(!WindowShouldClose()) {
updateGame();
updateInterface();
updateUnits();
BeginDrawing();
ClearBackground(BLACK);
beginDrawMap();
beginDrawInterface();
drawUnits();
endDrawMap();
endDrawInterface();
EndDrawing();
}
return 0;
}