aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorkotorifan <kotorifan05@gmail.com>2026-04-21 19:55:51 +0200
committerkotorifan <kotorifan05@gmail.com>2026-04-21 19:55:51 +0200
commit1efdb8ab18042d9efc7c2e6addf7f414fbee5590 (patch)
tree5ffd6553ab46e5465c0d056bc6658a23b27c5e64 /src/main.c
parent476c10961d6ddba806cd9f587fc461c848d27401 (diff)
downloadtrashbinphysics-1efdb8ab18042d9efc7c2e6addf7f414fbee5590.tar.gz
Added graphics functions
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/main.c b/src/main.c
index 1f943c8..12a3ac7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -9,18 +9,8 @@
#include "graphics.h"
#include "physics.h"
-void physics_init(void)
-{
- InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE);
- SetTargetFPS(60);
-}
-
-void physics_close(void)
-{
- CloseWindow();
-}
-void physics_draw_info()
+void draw_graphics_info()
{
char buffer[128];
snprintf(buffer, sizeof(buffer), "FPS: %d", GetFPS());
@@ -33,27 +23,38 @@ void physics_draw_info()
DrawText("C: Clear screen", 10, 135, 20, BLACK);
DrawText("RCLICK: Push object", 10, 160, 20, BLACK);
DrawText("LCLICK: Add object", 10, 185, 20, BLACK);
+ DrawText("1: Spawn Circle", 10, 210, 20, BLACK);
+ DrawText("2: Spawn Square", 10, 235, 20, BLACK);
+ DrawText("3: Spawn Rectangle", 10, 260, 20, BLACK);
}
+
int main(void)
{
bool should_run = true;
// physics related
- object_t objects[MAX_OBJECTS];
+ object_t world[MAX_OBJECTS];
float force_resitution = FORCE_RESITUTION_DEFAULT;
float force_gravity = FORCE_GRAVITY_DEFAULT;
float force_linear_damping = FORCE_LINEAR_DAMPING_DEFAULT;
- physics_init();
+ InitWindow(WINDOW_X, WINDOW_Y, SCREEN_TITLE);
+ SetTargetFPS(60);
while(!WindowShouldClose() && should_run)
- {
- BeginDrawing();
- ClearBackground(WHITE);
- physics_draw_info();
- EndDrawing();
+ {
+ /* handle_input(world) */
+ // physics_update
+
+ begin_graphics_drawing();
+
+ clear_graphics(RAYWHITE);
+ draw_graphics_objects(world, object_count, BLACK);
+ draw_graphics_info(GetFPS(), object_count, MAX_OBJECTS);
+
+ end_graphics_drawing();
}
- physics_close();
+ CloseWindow();
return EXIT_SUCCESS;
}