Added grid and tileactivity commands, Grid render doesn't appear to work though.
This commit is contained in:
@@ -80,7 +80,6 @@ namespace CaveGame::Client
|
||||
|
||||
protected:
|
||||
bool enabled = false;
|
||||
bool draw_grid = false;
|
||||
Color4 grid_color = {128, 128, 128, 128};
|
||||
|
||||
private:
|
||||
@@ -113,6 +112,13 @@ namespace CaveGame::Client
|
||||
|
||||
}
|
||||
|
||||
void SetShowTileActivity(bool enabled)
|
||||
{
|
||||
show_tile_activity = enabled;
|
||||
}
|
||||
|
||||
bool IsShowTileActivityEnabled() const { return show_tile_activity;}
|
||||
|
||||
void RenderTile(const Core::TileID &tid, int wx, int wy, int tx, int ty);
|
||||
protected:
|
||||
|
||||
@@ -144,7 +150,7 @@ namespace CaveGame::Client
|
||||
static Color4 GetSkyColorBaseForTimeOfDay(float time);
|
||||
|
||||
void DrawSky();
|
||||
|
||||
bool show_tile_activity = false;
|
||||
|
||||
};
|
||||
}
|
@@ -162,7 +162,6 @@ namespace CaveGame::Client {
|
||||
|
||||
glTranslatef(-camera.Position().x, -camera.Position().y, 0);
|
||||
|
||||
|
||||
// Draw the cached RenderTargets for our chunks.
|
||||
for (const auto& [chunk_pos, chunk] : loaded_chunks)
|
||||
{
|
||||
@@ -173,8 +172,8 @@ namespace CaveGame::Client {
|
||||
// Debug Grid
|
||||
if (chunk_debug.IsEnabled())
|
||||
{
|
||||
//chunk_debug.DrawStats(chunk, 0.99f / camera.Zoom());
|
||||
//chunk_debug.DrawCellCoords(chunk_pos, 0.99f / camera.Zoom());
|
||||
chunk_debug.DrawStats(chunk, 0.99f / camera.Zoom());
|
||||
chunk_debug.DrawCellCoords(chunk_pos, 0.99f / camera.Zoom());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -184,16 +183,6 @@ namespace CaveGame::Client {
|
||||
if (chunk_debug.IsEnabled())
|
||||
chunk_debug.DrawGrid(camera.ScaledViewport());
|
||||
|
||||
|
||||
|
||||
|
||||
// Banana for scale.
|
||||
JGL::J2D::FillRect(Colors::Blue, {0,0}, {64, 64});
|
||||
JGL::J2D::FillRect(Colors::Green, {0,0}, {32, 32});
|
||||
JGL::J2D::FillRect(Colors::Yellow, {0,0}, {16, 16});
|
||||
JGL::J2D::FillRect(Colors::Red, {0,0}, {8, 8});
|
||||
JGL::J2D::FillRect(Colors::White, {0,0}, {1, 1});
|
||||
|
||||
for (auto* entity : entities) {
|
||||
entity->Draw();
|
||||
}
|
||||
@@ -369,19 +358,24 @@ namespace CaveGame::Client {
|
||||
int wy = (coords.y*Core::Chunk::ChunkSize) + y;
|
||||
|
||||
|
||||
#ifdef DEBUG_TILE_UPDATES
|
||||
if (chunk->GetTileUpdateFlag(x, y))
|
||||
JGL::J2D::DrawPoint(Color4(255, 0, 0, 128), tile_coords);
|
||||
|
||||
if (chunk->GetTileUpdateBufferFlag(x, y))
|
||||
JGL::J2D::DrawPoint(Color4(255, 0, 0, 128), tile_coords);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
if (t_id == TileID::AIR || t_id == TileID::VOID) // Air
|
||||
continue;
|
||||
|
||||
RenderTile(t_id, wx, wy, x, y);
|
||||
|
||||
if (show_tile_activity)
|
||||
{
|
||||
if (chunk->GetTileUpdateFlag(x, y))
|
||||
JGL::J2D::DrawPoint(Color4(255, 0, 0, 64), tile_coords);
|
||||
|
||||
if (chunk->GetTileUpdateBufferFlag(x, y))
|
||||
JGL::J2D::DrawPoint(Color4(255, 0, 0, 64), tile_coords);
|
||||
}
|
||||
|
||||
|
||||
/*t_data = Core::GetByNumeric(t_id);
|
||||
|
||||
|
@@ -128,14 +128,28 @@ namespace CaveGame::ClientApp {
|
||||
{"sandbox", {"q"}, [this](const auto& args) {}},
|
||||
{"crash", {"q"}, [this](const auto& args) {}},
|
||||
{"time", {"q"}, [this](const auto& args) {}},
|
||||
{"jui_debug", {"q"}, [this](const auto& args) {}},
|
||||
{"fps-limit", {"fps"}, [this](const auto& args) {
|
||||
{"juidebug", {"q"}, [this](const auto& args) {}},
|
||||
{"fpslimit", {"fps"}, [this](const auto& args) {
|
||||
if (args.size() < 2)
|
||||
return Log(std::format("Current FPS Limit: {}fps", max_fps));
|
||||
|
||||
int val = stoi(args[1]);
|
||||
std::cout << val << std::endl;
|
||||
max_fps = val;
|
||||
}},
|
||||
{"grid", {}, [this](const auto& args) {
|
||||
if (current_scene == game_ctx)
|
||||
{
|
||||
game_ctx->world->chunk_debug.Enable(!game_ctx->world->chunk_debug.IsEnabled());
|
||||
} else
|
||||
Log("Must be in-game to use this command!");
|
||||
}},
|
||||
{"tileactivity", {}, [this](const auto& args) {
|
||||
if (current_scene == game_ctx)
|
||||
{
|
||||
game_ctx->world->SetShowTileActivity(!game_ctx->world->IsShowTileActivityEnabled());
|
||||
} else
|
||||
Log("Must be in-game to use this command!");
|
||||
}}
|
||||
};
|
||||
|
||||
|
@@ -364,8 +364,7 @@ namespace CaveGame::ClientApp
|
||||
// Draw floating windows.
|
||||
wm->Draw();
|
||||
|
||||
std::vector<std::string> debug_lines =
|
||||
{
|
||||
std::vector<std::string> debug_lines = {
|
||||
"Re-CaveGame - Redacted Software",
|
||||
std::format("frame: {}", refresh_count),
|
||||
std::format("delta: {}ms", J3ML::Math::Round(delta_time*1000)),
|
||||
@@ -375,9 +374,7 @@ namespace CaveGame::ClientApp
|
||||
|
||||
|
||||
if (current_scene == game_ctx) {
|
||||
|
||||
Core::TileID id = game_ctx->GetTileUnderMouse();
|
||||
|
||||
Core::Tile* data = Core::GetByNumeric(id);
|
||||
|
||||
debug_lines.push_back(std::format("tile: {} id: {}", data->MnemonicID(), (unsigned int)data->NumericID()));
|
||||
|
Reference in New Issue
Block a user