summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuca Sas <sas.luca.alex@gmail.com>2020-03-06 17:48:44 +0000
committerLuca Sas <sas.luca.alex@gmail.com>2020-03-06 17:48:44 +0000
commit581538a8b371c0a9003dc0f1bf081222b8c4fdd9 (patch)
treef5759a699424211d4a66e24365a596072818ab33 /src
downloadgamejam-slgj-2024-581538a8b371c0a9003dc0f1bf081222b8c4fdd9.tar.gz
gamejam-slgj-2024-581538a8b371c0a9003dc0f1bf081222b8c4fdd9.tar.bz2
gamejam-slgj-2024-581538a8b371c0a9003dc0f1bf081222b8c4fdd9.zip
Setup the project
Diffstat (limited to 'src')
-rw-r--r--src/main.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..4b5071d
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,47 @@
+#include "raylib.h"
+
+#define SCREEN_WIDTH (800)
+#define SCREEN_HEIGHT (450)
+
+int main(void)
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "Window title");
+
+ Texture2D texture = LoadTexture("../assets/test.png");
+
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ // Update
+ //----------------------------------------------------------------------------------
+ // TODO: Update your variables here
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ const int texture_x = SCREEN_WIDTH / 2 - texture.width / 2;
+ const int texture_y = SCREEN_HEIGHT / 2 - texture.height / 2;
+ DrawTexture(texture, texture_x, texture_y, WHITE);
+
+ const char* text = "OMG! IT WORKS!";
+ const Vector2 text_size = MeasureTextEx(GetFontDefault(), text, 20, 1);
+ DrawText(text, SCREEN_WIDTH / 2 - text_size.x / 2, texture_y + texture.height + text_size.y + 10, 20, BLACK);
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ CloseWindow(); // Close window and OpenGL context
+
+ return 0;
+} \ No newline at end of file