From d96b4ebce5ee6245fa80d27d41b67aa56555c912 Mon Sep 17 00:00:00 2001 From: LucaSas Date: Thu, 4 Nov 2021 16:14:58 +0200 Subject: Changed the template to now download raylib instead of having it in the repo. --- sources/main.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 sources/main.c (limited to 'sources/main.c') diff --git a/sources/main.c b/sources/main.c new file mode 100644 index 0000000..2bed9bc --- /dev/null +++ b/sources/main.c @@ -0,0 +1,35 @@ +#include "raylib.h" + +#define SCREEN_WIDTH (800) +#define SCREEN_HEIGHT (450) + +#define WINDOW_TITLE "Window title" + +int main(void) +{ + InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, WINDOW_TITLE); + SetTargetFPS(60); + + Texture2D texture = LoadTexture(ASSETS_PATH"test.png"); // Check README.md for how this works + + while (!WindowShouldClose()) + { + 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(); + } + + CloseWindow(); + + return 0; +} -- cgit v1.2.3