remove Player.hitbox (WIP)

This commit is contained in:
MihailRis
2024-07-08 03:51:46 +03:00
parent 2c7b5de50a
commit 7dfda981a8
11 changed files with 108 additions and 94 deletions
+3 -5
View File
@@ -129,20 +129,18 @@ std::shared_ptr<UINode> create_debug_panel(
auto box = std::make_shared<TextBox>(L"");
auto boxRef = box.get();
box->setTextSupplier([=]() {
Hitbox* hitbox = player->hitbox.get();
return util::to_wstring(hitbox->position[ax], 2);
return util::to_wstring(player->getPosition()[ax], 2);
});
box->setTextConsumer([=](const std::wstring& text) {
try {
glm::vec3 position = player->hitbox->position;
glm::vec3 position = player->getPosition();
position[ax] = std::stoi(text);
player->teleport(position);
} catch (std::exception& _){
}
});
box->setOnEditStart([=](){
Hitbox* hitbox = player->hitbox.get();
boxRef->setText(std::to_wstring(int(hitbox->position[ax])));
boxRef->setText(std::to_wstring(static_cast<int>(player->getPosition()[ax])));
});
box->setSize(glm::vec2(230, 27));
+5 -1
View File
@@ -136,9 +136,13 @@ void LevelScreen::update(float delta) {
bool paused = hud->isPause();
audio::get_channel("regular")->setPaused(paused);
audio::get_channel("ambient")->setPaused(paused);
glm::vec3 velocity {};
if (auto hitbox = player->getHitbox()) {
velocity = hitbox->velocity;
}
audio::set_listener(
camera->position-camera->dir,
player->hitbox->velocity,
velocity,
camera->dir,
glm::vec3(0, 1, 0)
);