X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Finterface.cpp;h=f4b13b015d6d69fcbf6adbfc6e0a92d6c3d6454e;hb=bd6bd2c875f4b6baef913e5315aa9f7e7cd7da7a;hp=00c291df605e7b799c820947ed09d5ca58ff439b;hpb=d242294d15e7465f915d4c79ce563a557afc74d8;p=blank.git diff --git a/src/interface.cpp b/src/interface.cpp index 00c291d..f4b13b0 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -72,10 +72,17 @@ void Interface::Handle(const SDL_KeyboardEvent &event) { if (event.state == SDL_PRESSED) { PrintBlockInfo(); } + break; + case SDLK_l: + if (event.state == SDL_PRESSED) { + PrintLightInfo(); + } + break; case SDLK_p: if (event.state == SDL_PRESSED) { PrintSelectionInfo(); } + break; } } @@ -102,6 +109,13 @@ void Interface::PrintBlockInfo() { Print(aim_chunk->BlockAt(aim_block)); } +void Interface::PrintLightInfo() { + std::cout + << "light level " << world.PlayerChunk().GetLight(world.Player().Position()) + << " at position " << world.Player().Position() + << std::endl; +} + void Interface::PrintSelectionInfo() { std::cout << std::endl; Print(selection); @@ -146,13 +160,13 @@ void Interface::PlaceBlock() { mod_chunk = &world.Next(*aim_chunk, aim_normal); next_pos -= aim_normal * glm::vec3(Chunk::Extent()); } - mod_chunk->BlockAt(next_pos) = selection; + mod_chunk->SetBlock(next_pos, selection); mod_chunk->Invalidate(); } void Interface::RemoveBlock() { if (!aim_chunk) return; - aim_chunk->BlockAt(aim_block) = remove; + aim_chunk->SetBlock(aim_block, remove); aim_chunk->Invalidate(); }