Hacky logger integration, other fixes.

This commit is contained in:
2025-02-12 14:02:38 -05:00
parent f20dec85ce
commit dd6a284b6f
7 changed files with 194 additions and 110 deletions

View File

@@ -113,5 +113,6 @@ namespace CaveGame::ClientApp {
float tool_radius = 8.f;
float tool_percent = 100.f;
bool wanna_die = false; // This field indicates the program is ready to close.
void DrawTileToolOverlayCursor();
};
}

View File

@@ -292,6 +292,34 @@ namespace CaveGame::ClientApp
}
void CaveGameWindow::DrawTileToolOverlayCursor() {
JGL::J2D::Begin();
auto camera = game_ctx->world->camera;
// TODO: The following Translation, Rotation, Scale transformation code is duplicated between here and LocalWorld.cpp:Draw.
// Shift the origin to the center of the screen.
glTranslatef(camera.HalfSizeOffset().x, camera.HalfSizeOffset().y, 0);
// Apply rotation, zoom, and translation.
glRotatef(camera.Rotation(), 0, 0, 1);
glScalef(camera.Zoom(), camera.Zoom(), 1);
glTranslatef(-camera.Position().x, -camera.Position().y, 0);
auto mpos = Vector2(currentMouse.Position.x, currentMouse.Position.y);
auto pos = camera.ScreenToWorld(mpos);
JGL::J2D::OutlineCircle(Colors::Red, pos, tool_radius);
JGL::J2D::DrawPoint({128, 128, 128, 128}, pos, 1.1f);
JGL::J2D::End();
}
void CaveGameWindow::Draw()
{
auto isize = GetSize();
@@ -336,33 +364,7 @@ namespace CaveGame::ClientApp
draw_debug_info(debug_lines);
if (current_scene == game_ctx) {
JGL::J2D::Begin();
auto camera = game_ctx->world->camera;
// TODO: The following Translation, Rotation, Scale transformation code is duplicated between here and LocalWorld.cpp:Draw.
// Shift the origin to the center of the screen.
glTranslatef(camera.HalfSizeOffset().x, camera.HalfSizeOffset().y, 0);
//DrawSky();
// Apply rotation, zoom, and translation.
glRotatef(camera.Rotation(), 0, 0, 1);
glScalef(camera.Zoom(), camera.Zoom(), 1);
glTranslatef(-camera.Position().x, -camera.Position().y, 0);
auto mpos = Vector2(currentMouse.Position.x, currentMouse.Position.y);
auto pos = camera.ScreenToWorld(mpos);
JGL::J2D::OutlineCircle(Colors::Red, pos, tool_radius);
JGL::J2D::DrawPoint({128, 128, 128, 128}, pos, 1.1f);
JGL::J2D::End();
DrawTileToolOverlayCursor();
}
}
@@ -394,7 +396,7 @@ namespace CaveGame::ClientApp
if (ev.key == Keys::Grave) {
// TODO: Key Input Hierarchy: Determine and handle priority of where certain keys go.
console_window->Visible(!console_window->IsVisible());
console_window->SetOpen(!console_window->IsOpen());
return;
}