#include #include #include #include #include #include "./world/Chunk.h" #include "./WindowManager/WindowManager.h" int main() { // Initialize the window and raylib WindowManager windowManager("My Title", 320, 240); std::string userInput; SetTargetFPS(60); Texture2D texture = LoadTextureFromImage(ImageFromImage(LoadImage("tiles.png"), { 0, 0, 8, 8 })); std::map myMap; myMap["grass"] = &texture; Chunk chunk(100, 100, 50, BLUE); chunk.LoadTextures(myMap); // Enable window resizing SetWindowState(FLAG_WINDOW_RESIZABLE); while (!WindowShouldClose()) { windowManager.UpdateScale(); BeginTextureMode(windowManager.Screen); ClearBackground(BLACK); DrawText("Drawing on Render Texture", 10, 10, 20, RED); DrawRectangle(160, 120, 160, 120, RED); ClearBackground(GRAY); double xStart = (GetScreenWidth() - windowManager.ScaledScreen.texture.width) / 2; double yStart = (GetScreenHeight() - windowManager.ScaledScreen.texture.height) / 2; // Display the user input on the screen DrawText(userInput.c_str(), 10, 10, 20, BLACK); DrawRectangle(200, 200 / 2 - 50, 100, 100, RED); chunk.Draw(); EndTextureMode(); // Scaled Texture float deltaTime = GetFrameTime(); // Update // Check for mouse input if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) { int mouseX = GetMouseX(); int mouseY = GetMouseY(); // Print the mouse coordinates printf("Mouse clicked at (%d, %d)\n", mouseX, mouseY); } // Check for user input if (IsKeyPressed(KEY_BACKSPACE) && userInput.length() > 0) { // Remove the last character from the input string userInput.pop_back(); } else { // Check if any key is being pressed int key = GetKeyPressed(); if ( IsKeyPressed(KEY_A) ) { } if (key > 0) { // Append the pressed key to the input string userInput += static_cast(key); } } // Display windowManager.Display(); } // Close the window and raylib CloseWindow(); return 0; }