feat: players interpolation & add hud.set_allow_pause(...)
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "window/Camera.hpp"
|
||||
#include "objects/Player.hpp"
|
||||
#include "objects/Players.hpp"
|
||||
#include "objects/Entities.hpp"
|
||||
#include "logic/LevelController.hpp"
|
||||
#include "util/stringutil.hpp"
|
||||
#include "engine/Engine.hpp"
|
||||
@@ -159,7 +160,11 @@ void Decorator::update(float delta, const Camera& camera) {
|
||||
renderer.texts->remove(textsIter->second);
|
||||
textsIter = playerTexts.erase(textsIter);
|
||||
} else {
|
||||
note->setPosition(player->getPosition() + glm::vec3(0, 1, 0));
|
||||
glm::vec3 position = player->getPosition();
|
||||
if (auto entity = level.entities->get(player->getEntity())) {
|
||||
position = entity->getInterpolatedPosition();
|
||||
}
|
||||
note->setPosition(position + glm::vec3(0, 1, 0));
|
||||
++textsIter;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,8 +274,9 @@ void WorldRenderer::renderHands(
|
||||
glm::mat4(1.0f), -glm::pi<float>() * 0.5f, glm::vec3(0, 1, 0)
|
||||
);
|
||||
prevRotation = rotation;
|
||||
glm::vec3 cameraRotation = player.getRotation();
|
||||
auto offset = -(camera.position - player.getPosition());
|
||||
float angle = glm::radians(player.rotation.x - 90);
|
||||
float angle = glm::radians(cameraRotation.x - 90);
|
||||
float cos = glm::cos(angle);
|
||||
float sin = glm::sin(angle);
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ void GUI::actFocused() {
|
||||
focus->keyPressed(key);
|
||||
}
|
||||
|
||||
if (!Events::_cursor_locked) {
|
||||
if (!Events::isCursorLocked()) {
|
||||
if (Events::clicked(mousecode::BUTTON_1) &&
|
||||
(Events::jclicked(mousecode::BUTTON_1) || Events::delta.x || Events::delta.y))
|
||||
{
|
||||
@@ -189,7 +189,7 @@ void GUI::act(float delta, const Viewport& vp) {
|
||||
auto prevfocus = focus;
|
||||
|
||||
updateTooltip(delta);
|
||||
if (!Events::_cursor_locked) {
|
||||
if (!Events::isCursorLocked()) {
|
||||
actMouse(delta);
|
||||
} else {
|
||||
if (hover) {
|
||||
|
||||
@@ -91,6 +91,10 @@ Page& Menu::getCurrent() {
|
||||
return current;
|
||||
}
|
||||
|
||||
bool Menu::hasOpenPage() const {
|
||||
return current.panel != nullptr;
|
||||
}
|
||||
|
||||
void Menu::clearHistory() {
|
||||
pageStack = std::stack<Page>();
|
||||
}
|
||||
|
||||
@@ -64,5 +64,7 @@ namespace gui {
|
||||
|
||||
/// @brief Get current page
|
||||
Page& getCurrent();
|
||||
|
||||
bool hasOpenPage() const;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user