Files
archer/src/main.c

55 lines
1.5 KiB
C
Raw Normal View History

2024-08-14 17:09:43 -07:00
/*
Raylib example file.
This is an example main file for a simple raylib project.
Use this as a starting point or replace it with your code.
2024-12-26 13:40:47 -08:00
by Jeffery Myers is marked with CC0 1.0. To view a copy of this license, visit https://creativecommons.org/publicdomain/zero/1.0/
2024-08-14 17:09:43 -07:00
*/
#include "raylib.h"
2024-08-17 08:53:09 -07:00
#include "resource_dir.h" // utility header for SearchAndSetResourceDir
2024-08-14 17:09:43 -07:00
int main ()
{
// Tell the window to use vsync and work on high DPI displays
2024-08-17 08:53:09 -07:00
SetConfigFlags(FLAG_VSYNC_HINT | FLAG_WINDOW_HIGHDPI);
// Create the window and OpenGL context
2024-08-14 17:09:43 -07:00
InitWindow(1280, 800, "Hello Raylib");
2024-08-17 08:53:09 -07:00
// Utility function from resource_dir.h to find the resources folder and set it as the current working directory so we can load from it
2024-08-14 17:09:43 -07:00
SearchAndSetResourceDir("resources");
2024-08-17 08:53:09 -07:00
// Load a texture from the resources directory
2024-08-14 17:09:43 -07:00
Texture wabbit = LoadTexture("wabbit_alpha.png");
// game loop
2024-08-17 08:53:09 -07:00
while (!WindowShouldClose()) // run the loop untill the user presses ESCAPE or presses the Close button on the window
2024-08-14 17:09:43 -07:00
{
// drawing
BeginDrawing();
2024-08-17 08:53:09 -07:00
// Setup the back buffer for drawing (clear color and depth buffers)
2024-08-14 17:09:43 -07:00
ClearBackground(BLACK);
2024-08-17 08:53:09 -07:00
// draw some text using the default font
2024-08-14 17:09:43 -07:00
DrawText("Hello Raylib", 200,200,20,WHITE);
2024-08-17 08:53:09 -07:00
// draw our texture to the screen
2024-08-14 17:09:43 -07:00
DrawTexture(wabbit, 400, 200, WHITE);
2024-08-17 08:53:09 -07:00
// end the frame and get ready for the next one (display frame, poll input, etc...)
2024-08-14 17:09:43 -07:00
EndDrawing();
}
// cleanup
2024-08-17 08:53:09 -07:00
// unload our texture so it can be cleaned up
UnloadTexture(wabbit);
// destroy the window and cleanup the OpenGL context
2024-08-14 17:09:43 -07:00
CloseWindow();
return 0;
}