Hacky logger integration, other fixes.
This commit is contained in:
@@ -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();
|
||||
};
|
||||
}
|
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user