#include "raylib.h" #include "menu.h" #include "resource_dir.h" // utility header for SearchAndSetResourceDir #include int main () { struct MenuItem item[] = { {.x = 200, .y = 500, .label = "Play"}, {.x = 200, .y = 550, .label = "Options"}, {.x = 200, .y = 600, .label = "Exit"}, }; size_t current_item = 0; size_t items_len = sizeof(item) / sizeof(struct MenuItem); // Tell the window to use vsync and work on high DPI displays SetConfigFlags(FLAG_VSYNC_HINT | FLAG_WINDOW_HIGHDPI); // Create the window and OpenGL context InitWindow(1280, 800, "Touhou Jikuusen ~ Apotheotic Heterochronicity"); // 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 SearchAndSetResourceDir("resources"); // Load a texture from the resources directory Texture wabbit = LoadTexture("wabbit_alpha.png"); // game loop while (!WindowShouldClose()) // run the loop untill the user presses ESCAPE or presses the Close button on the window { // drawing BeginDrawing(); // Setup the back buffer for drawing (clear color and depth buffers) ClearBackground(BLACK); for (int i = 0; i < items_len; i++) { DrawText(item[i].label, item[i].x, item[i].y, 20, i == current_item ? YELLOW : WHITE); } if (IsKeyPressed(KEY_DOWN)) { current_item = (current_item + 1) % items_len; } if (IsKeyPressed(KEY_UP)) { if (current_item == 0) { current_item = items_len - 1; } else { current_item--; } } // draw some text using the default font DrawText("TOUHOU!!!!", 200,200,20,WHITE); // draw our texture to the screen DrawTexture(wabbit, 400, 200, WHITE); // end the frame and get ready for the next one (display frame, poll input, etc...) EndDrawing(); } // cleanup // unload our texture so it can be cleaned up UnloadTexture(wabbit); // destroy the window and cleanup the OpenGL context CloseWindow(); return 0; }