Set initial cursor position
This commit is contained in:
@@ -24,8 +24,9 @@ namespace Inferno {
|
||||
ASSERT(!s_instance, "Application already exists!");
|
||||
s_instance = this;
|
||||
|
||||
// Initialize Settings
|
||||
// Initialize
|
||||
Settings::initialize();
|
||||
Input::initialize();
|
||||
|
||||
m_window = std::make_unique<Window>();
|
||||
m_window->setEventCallback(NF_BIND_EVENT(Application::onEvent));
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "inferno/application.h"
|
||||
#include "inferno/event/mouseevent.h"
|
||||
#include "inferno/input.h"
|
||||
#include "inferno/log.h"
|
||||
#include "inferno/window.h"
|
||||
|
||||
namespace Inferno {
|
||||
@@ -13,8 +14,18 @@ namespace Inferno {
|
||||
float Input::m_xOffset = 0.0f;
|
||||
float Input::m_yOffset = 0.0f;
|
||||
|
||||
void Input::initialize()
|
||||
{
|
||||
// Set cursor in the middle of the screen
|
||||
m_xPosLast = Application::get().getWindow().getWidth() / 2.0f;
|
||||
m_yPosLast = Application::get().getWindow().getHeight() / 2.0f;
|
||||
|
||||
dbg(Log::Info) << "Input initialized";
|
||||
}
|
||||
|
||||
void Input::update()
|
||||
{
|
||||
// Stop infinite mouse movement
|
||||
m_xOffset = 0.0f;
|
||||
m_yOffset = 0.0f;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace Inferno {
|
||||
|
||||
class Input {
|
||||
public:
|
||||
static void initialize();
|
||||
static void update();
|
||||
|
||||
static bool onMousePosition(MousePositionEvent& e);
|
||||
|
||||
Reference in New Issue
Block a user