Remove excess.

This commit is contained in:
2025-01-30 13:23:30 -05:00
parent b78081d6b9
commit 1b94a2c2ce
3 changed files with 39 additions and 39 deletions

View File

@@ -107,7 +107,7 @@ namespace CaveGame::Client
unsigned int GetRenderTargetCount() const;
void RenderTile(const Core::TileID &tid, int wx, int wy, int tx, int ty);
protected:
float check_chunks_timer = 0.f;
@@ -139,6 +139,6 @@ namespace CaveGame::Client
void DrawSky();
void RenderTile(const Core::TileID &tid, int wx, int wy, int tx, int ty);
};
}

View File

@@ -83,22 +83,6 @@ void CaveGame::Client::GameSession::PassKeyInput(Key key, bool pressed) {
active_hotbar_slot = 9;
/*if (key == Keys::LeftArrow)
{
world->camera.MoveLeft();
}
if (key == Keys::RightArrow)
{
world->camera.MoveRight();
}
if (key == Keys::UpArrow)
{
world->camera.MoveUp();
}
if (key == Keys::DownArrow)
{
world->camera.MoveDown();
}*/
}
void CaveGame::Client::GameSession::ConstructHUD() {
@@ -149,7 +133,20 @@ void CaveGame::Client::GameSession::ConstructHUD() {
cell->BGColor(item->base_color);
// Add tile-sample rendertarget as item icon.
auto* img = new JUI::Image();
auto* img = new JUI::Image(cell);
img->FitImageToParent(true);
img->Padding({2_px});
int icon_size = 16;
auto* tile_icon_canvas = new RenderTarget({icon_size, icon_size});
JGL::J2D::Begin(tile_icon_canvas);
for (int x = 0; x < icon_size; x++)
for (int y = 0; y < icon_size; y++)
world->RenderTile(item->NumericID(), x, y, x, y);
JGL::J2D::End();
img->Content(tile_icon_canvas->GetJGLTexture());
auto* amount_label = new JUI::TextRect(cell);
amount_label->BGColor({0,0,0,0});

View File

@@ -43,7 +43,6 @@ namespace CaveGame::Client {
JGL::J2D::DrawLine(debug_grid_color, left, right, 1 / camera.Zoom());
}*/
// TODO: Draw coordinates for the chunk the mouse is in
}
@@ -62,18 +61,9 @@ namespace CaveGame::Client {
}
// rendertarget needs updating.
else if (chunk->touched) {
// TODO: Modify RenderTarget in place.
chunk->touched = false;
auto* target = cached_chunk_sprites[chunk_pos];
RenderChunkTexture(chunk_pos, target, chunk);
//cached_chunk_sprites.erase(chunk_pos);
//auto* target = new JGL::RenderTarget({Core::Chunk::ChunkSize, Core::Chunk::ChunkSize}, {0,0,0,0});
//RenderChunkTexture(chunk_pos, target, chunk);
//cached_chunk_sprites.insert({chunk_pos, target});
}
}
@@ -229,6 +219,9 @@ namespace CaveGame::Client {
void LocalWorld::RenderTile(const TileID& t_id, int wx, int wy, int tx, int ty)
{
// TODO: Migrate custom tile render code to an override Draw method in tile classes?
// TODO: See class Tile::Draw to see why this is halted.
if (t_id == TileID::AIR || t_id == TileID::VOID) // Air
return;
@@ -239,16 +232,28 @@ namespace CaveGame::Client {
Core::Tile* t_data = Core::GetByNumeric(t_id);
if (t_id == TileID::COBBLESTONE) {
float val = generator.Perlin(wx, wy, 12, 12, 12, 2);
float val = generator.Perlin(wx, wy, 4, 4, 0.25f, 1.5f);
if (val > 0.60f || val < -0.60f)
/*if (val > 0.60f || val < -0.60f)
t_color = Core::Tiles::Cobblestone.color_pallet[1];
else if (val > 0.40f || val < -0.40f)
t_color = Core::Tiles::Cobblestone.color_pallet[0];
else if (val > 0.2f || val < -0.2f)
t_color = Core::Tiles::Cobblestone.color_pallet[2];
else
t_color = Core::Tiles::Cobblestone.color_pallet[3];
else*/
uint rand = generator.ColorMap(Tiles::Stone.color_pallet.size(), wx, wy);
t_color = t_data->color_pallet[rand];
if (val > 0.40f || val < -0.40f) {
t_color.r += 32;
t_color.g += 32;
t_color.b += 32;
} else if (val > 0.15f || val < -0.10f)
{ } else {
t_color.r -= 64;
t_color.g -= 64;
t_color.b -= 64;
}
//Core::Tiles::Cobblestone.color_pallet
} else if (t_id == TileID::OAK_PLANK) {
@@ -276,8 +281,6 @@ namespace CaveGame::Client {
uint8_t base_g = 184 - shift;
uint8_t base_b = 135 - shift;
//if (wy % 5 == 0 || ((Math::RoundInt(wy/5)*5)+wx) % 9 == 0) { //&& (y_remainder == 0)) {
//if (wy % 5 == 0 || (wx+(plank_row*5)) % 19 == 0) { //&& (y_remainder == 0)) {
if (wy % 5 == 0 || (wx+(plank_row*5)) % plank_length_modulus == 0) {
base_r -= 50;
base_g -= 45;