X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fui%2Fui.cpp;h=ea9786b0382952c4aea69a5ac29b1cd0e7d8ed00;hb=955fbb45dedb570520fc45d2ce69f420bed2ad08;hp=410072da681ed292042949fb88247bd409160068;hpb=b7d09e1e35ef90282c97509e0020b20db3c7ea9f;p=blank.git diff --git a/src/ui/ui.cpp b/src/ui/ui.cpp index 410072d..ea9786b 100644 --- a/src/ui/ui.cpp +++ b/src/ui/ui.cpp @@ -128,6 +128,10 @@ void Interface::HandlePress(const SDL_KeyboardEvent &event) { TurnBlock(); break; + case SDLK_n: + ToggleCollision(); + break; + case SDLK_b: PrintBlockInfo(); break; @@ -178,6 +182,11 @@ void Interface::TurnBlock() { hud.Display(selection); } +void Interface::ToggleCollision() { + ctrl.Controlled().WorldCollidable(!ctrl.Controlled().WorldCollidable()); + std::cout << "collision " << (ctrl.Controlled().WorldCollidable() ? "on" : "off") << std::endl; +} + void Interface::PrintBlockInfo() { std::cout << std::endl; if (!aim_chunk) { @@ -356,7 +365,7 @@ void Interface::Update(int dt) { void Interface::CheckAim() { float dist; - if (world.Intersection(aim, glm::mat4(1.0f), &aim_chunk, &aim_block, &dist, &aim_normal)) { + if (world.Intersection(aim, glm::mat4(1.0f), aim_chunk, aim_block, dist, aim_normal)) { outline.Clear(); aim_chunk->Type(aim_chunk->BlockAt(aim_block)).FillOutlineModel(outline); outline_transform = glm::scale(glm::vec3(1.0002f));