first version of IM ready for PR
This commit is contained in:
parent
ef36ae462e
commit
8ab5afd3c4
|
@ -23,6 +23,7 @@
|
|||
#include "Graphics/MiddleEnd/Interface/SHRenderable.h"
|
||||
#include "Scene/SHSceneManager.h"
|
||||
#include "Math/Transform/SHTransformSystem.h"
|
||||
#include "Input/SHInputManagerSystem.h"
|
||||
|
||||
#include "Scenes/SBTestScene.h"
|
||||
#include "Math/Transform/SHTransformComponent.h"
|
||||
|
@ -52,6 +53,7 @@ namespace Sandbox
|
|||
SHADE::SHSystemManager::CreateSystem<SHADE::SHTransformSystem>();
|
||||
SHADE::SHSystemManager::CreateSystem<SHADE::SHGraphicsSystem>();
|
||||
SHADE::SHGraphicsSystem* graphicsSystem = static_cast<SHADE::SHGraphicsSystem*>(SHADE::SHSystemManager::GetSystem<SHADE::SHGraphicsSystem>());
|
||||
SHADE::SHSystemManager::CreateSystem<SHADE::SHInputManagerSystem>();
|
||||
|
||||
// Create Routines
|
||||
SHADE::SHSystemManager::RegisterRoutine<SHADE::SHScriptEngine, SHADE::SHScriptEngine::FrameSetUpRoutine>();
|
||||
|
@ -72,6 +74,8 @@ namespace Sandbox
|
|||
SHADE::SHComponentManager::CreateComponentSparseSet<SHADE::SHRenderable>();
|
||||
SHADE::SHComponentManager::CreateComponentSparseSet<SHADE::SHTransformComponent>();
|
||||
|
||||
SHADE::SHSystemManager::RegisterRoutine<SHADE::SHInputManagerSystem, SHADE::SHInputManagerSystem::InputManagerRoutine>();
|
||||
|
||||
// Set up graphics system and windows
|
||||
graphicsSystem->SetWindow(&window);
|
||||
sdlWindow = SDL_CreateWindowFrom(window.GetHWND());
|
||||
|
|
|
@ -35,6 +35,8 @@ namespace SHADE
|
|||
int SHInputManagerSystem::mouseScreenY = 0;
|
||||
int SHInputManagerSystem::mouseScreenXLast = 0;
|
||||
int SHInputManagerSystem::mouseScreenYLast = 0;
|
||||
double SHInputManagerSystem::mouseVelocityX = 0;
|
||||
double SHInputManagerSystem::mouseVelocityY = 0;
|
||||
int SHInputManagerSystem::mouseWheelVerticalDelta = 0;
|
||||
int SHInputManagerSystem::mouseWheelVerticalDeltaPoll = 0;
|
||||
|
||||
|
@ -126,6 +128,10 @@ namespace SHADE
|
|||
//Mouse Positioning/////////////////////////////////////
|
||||
//https://stackoverflow.com/a/6423739
|
||||
|
||||
//Set last positioning
|
||||
mouseScreenXLast = mouseScreenX;
|
||||
mouseScreenYLast = mouseScreenY;
|
||||
|
||||
//Get cursor position, even when it is outside window
|
||||
POINT p;
|
||||
GetCursorPos(&p);
|
||||
|
|
|
@ -420,6 +420,16 @@ namespace SHADE
|
|||
if (y) *y = mouseScreenY;
|
||||
}
|
||||
|
||||
//Get the mouse velocity
|
||||
//Two output parameters for x and y velocitites
|
||||
//In pixels per second for both
|
||||
static inline void GetMouseVelocity(double* x = nullptr,
|
||||
double* y = nullptr) noexcept
|
||||
{
|
||||
if (x) *x = mouseVelocityX;
|
||||
if (y) *y = mouseVelocityY;
|
||||
}
|
||||
|
||||
//Get the mouse wheel vertical delta
|
||||
static inline int GetMouseWheelVerticalDelta() noexcept
|
||||
{
|
||||
|
@ -529,15 +539,26 @@ namespace SHADE
|
|||
//MOUSE VARIABLES///////////////////////////////////////////////////////////
|
||||
|
||||
//Present horizontal positioning of the mouse WRT the screen
|
||||
//Increasing rightwards
|
||||
static int mouseScreenX;
|
||||
//Present vertical positioning of the mouse WRT the screen
|
||||
//Increasing downwards
|
||||
static int mouseScreenY;
|
||||
|
||||
//Horizontal positioning of the mouse WRT screen in last frame
|
||||
//Increasing rightwards
|
||||
static int mouseScreenXLast;
|
||||
//Vertical positioning of the mouse WRT screen in the last frame
|
||||
//Increasing downwards
|
||||
static int mouseScreenYLast;
|
||||
|
||||
//The velocity at which the mouse is being moved horizontally (px/s)
|
||||
//Rightwards is positive
|
||||
static double mouseVelocityX;
|
||||
//The velocity at which the mouse is being moved vertically (px/s)
|
||||
//Downwards is positive
|
||||
static double mouseVelocityY;
|
||||
|
||||
//For polling mouse wheel events, not to be read
|
||||
static int mouseWheelVerticalDeltaPoll;
|
||||
//Mouse wheel vertical rotation speed. Positive is rotation AWAY from user
|
||||
|
|
Loading…
Reference in New Issue