-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
50 lines (44 loc) · 1.07 KB
/
main.cpp
File metadata and controls
50 lines (44 loc) · 1.07 KB
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 <iostream>
#include <raylib.h>
#include "physics.hpp"
using namespace std;
int main()
{
int width = 1920;
int height = 1080;
InitWindow(width, height, "engine");
frame f;
f.point1.x = 0;
f.point1.y = 0;
f.point2.x = 0;
f.point2.y = height;
f.point3.x = width;
f.point3.y = height;
f.point4.x = width;
f.point4.y = 0;
f.sideThick = 20;
f.baseThick = 20;
f.color = RAYWHITE;
particle c;
c.mass = 6;
c.centerX = 400;
c.centerY = 200;
c.radius = 20;
int time = 0;
SetTargetFPS(60);
bool toggleGravity = 0;
bool contact = 0;
while (!WindowShouldClose())
{
BeginDrawing();
ClearBackground(BLACK);
drawFrame(f,0,0,0,height,width,height,width,0);
control(c, f , width , height);
gravity(c, f , width , height, toggleGravity);
DrawCircle(c.centerX, c.centerY, c.radius, c.color);
time = GetTime();
DrawText(TextFormat("time: %i", time), 10, 10, 20, RAYWHITE);
EndDrawing();
}
CloseWindow();
}