aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorkotorifan <kotorifan05@gmail.com>2026-04-15 19:56:32 +0200
committerkotorifan <kotorifan05@gmail.com>2026-04-15 19:56:32 +0200
commit476c10961d6ddba806cd9f587fc461c848d27401 (patch)
treef0023add0c4d85668dd33fb05e5e7d128d892572 /src/main.c
parentb38ff486555a16840fd04caaa3cbe38e37b2b9ae (diff)
downloadtrashbinphysics-476c10961d6ddba806cd9f587fc461c848d27401.tar.gz
Displays various texts now
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index cdd077c..1f943c8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,13 +1,59 @@
// main.c
#include <stdio.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <raylib.h>
+#include <math.h>
#include "common.h"
#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()
+{
+ char buffer[128];
+ snprintf(buffer, sizeof(buffer), "FPS: %d", GetFPS());
+ DrawText(buffer, 10, 10, 20, BLACK);
+ /* snprintf(buffer, sizeof(buffer), "OBJ: %d/%d", objects, MAX_OBJECTS); */
+ /* DrawText(buffer, 10, 35, 20, BLACK); */
+ DrawText("ESC: Exit", 10, 60, 20, BLACK);
+ DrawText("R: Random velocity", 10, 85, 20, BLACK);
+ DrawText("G: Random gravity", 10, 110, 20, BLACK);
+ DrawText("C: Clear screen", 10, 135, 20, BLACK);
+ DrawText("RCLICK: Push object", 10, 160, 20, BLACK);
+ DrawText("LCLICK: Add object", 10, 185, 20, BLACK);
+}
int main(void)
{
+ bool should_run = true;
+
+ // physics related
+ object_t objects[MAX_OBJECTS];
+ float force_resitution = FORCE_RESITUTION_DEFAULT;
+ float force_gravity = FORCE_GRAVITY_DEFAULT;
+ float force_linear_damping = FORCE_LINEAR_DAMPING_DEFAULT;
+
+ physics_init();
+
+ while(!WindowShouldClose() && should_run)
+ {
+ BeginDrawing();
+ ClearBackground(WHITE);
+ physics_draw_info();
+ EndDrawing();
+ }
+
+ physics_close();
return EXIT_SUCCESS;
}