diff --git a/src/main.cpp b/src/main.cpp index 0384b79..29774e5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -44,6 +44,9 @@ int main() { camera.offset = { screenWidth/2.0f, screenHeight/2.0f }; camera.rotation = 0.0f; camera.zoom = 1.0f; + + Vector2 storedPosition = { 0, 0 }; + bool shouldDrawPlaceholder = false; while (!window.ShouldClose()) @@ -81,9 +84,17 @@ int main() { // ); // } //} + + if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) { + storedPosition = GetMousePosition(); + shouldDrawPlaceholder = true; + } - //if (IsMouseButtonDown(MOUSE_BUTTON_LEFT)) placeholder.Draw(GetMousePosition().x, GetMousePosition().y, WHITE); - + if (shouldDrawPlaceholder) { + gamemap.layers[0].chunks[Vector2{(storedPosition.x / 512),(storedPosition.y / 512)}].tiles[(int)((((int)storedPosition.y % 512) / 64) * 8 + ((int)storedPosition.x % 512) / 64)].spriteid = 1; + placeholder.Draw(storedPosition.x, storedPosition.y, WHITE); + } + raylib::Rectangle fov{ camera.target.x - screenWidth / 2 * camera.zoom, camera.target.y - screenHeight / 2 * camera.zoom,