InputService stub
This commit is contained in:
@@ -245,6 +245,9 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="Header Files"
|
Name="Header Files"
|
||||||
Filter="h;hpp;hxx;hm;inl">
|
Filter="h;hpp;hxx;hm;inl">
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\include\AbstractedInput.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\include\Application.h">
|
RelativePath=".\src\include\Application.h">
|
||||||
</File>
|
</File>
|
||||||
@@ -529,6 +532,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\src\source\DataModelV3\GroupInstance.cpp">
|
RelativePath=".\src\source\DataModelV3\GroupInstance.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\source\DataModelV3\InputService.cpp">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\src\source\DataModelV3\Instance.cpp">
|
RelativePath=".\src\source\DataModelV3\Instance.cpp">
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
8
src/include/AbstractedInput.h
Normal file
8
src/include/AbstractedInput.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
namespace B3D{
|
||||||
|
namespace AbstractedInput{
|
||||||
|
static const unsigned char MOUSE_LEFT = 0x01;
|
||||||
|
static const unsigned char MOUSE_RIGHT = 0x02;
|
||||||
|
static const unsigned char MOUSE_MIDDLE = 0x03;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,7 +16,6 @@ class CameraController;
|
|||||||
class Application { // : public GApp {
|
class Application { // : public GApp {
|
||||||
public:
|
public:
|
||||||
Application(HWND parentWindow);
|
Application(HWND parentWindow);
|
||||||
void Boop();
|
|
||||||
virtual ~Application() {}
|
virtual ~Application() {}
|
||||||
virtual void exitApplication();
|
virtual void exitApplication();
|
||||||
virtual void onInit();
|
virtual void onInit();
|
||||||
@@ -72,13 +71,15 @@ class Application { // : public GApp {
|
|||||||
HWND _hwndToolbox;
|
HWND _hwndToolbox;
|
||||||
HWND _buttonTest;
|
HWND _buttonTest;
|
||||||
HWND _hwndRenderer;
|
HWND _hwndRenderer;
|
||||||
|
//TODO make list
|
||||||
DataModelInstance* _dataModel;
|
DataModelInstance* _dataModel;
|
||||||
G3D::TextureRef shadowMap;
|
|
||||||
std::string _title;
|
std::string _title;
|
||||||
|
//TODO deprecated?
|
||||||
bool _dragging;
|
bool _dragging;
|
||||||
|
//TODO deprecated
|
||||||
int _mode;
|
int _mode;
|
||||||
|
//Can be moved?
|
||||||
GAppSettings _settings;
|
GAppSettings _settings;
|
||||||
double lightProjX, lightProjY, lightProjNear, lightProjFar;
|
|
||||||
IEBrowser* webBrowser;
|
IEBrowser* webBrowser;
|
||||||
protected:
|
protected:
|
||||||
Stopwatch m_graphicsWatch;
|
Stopwatch m_graphicsWatch;
|
||||||
|
|||||||
@@ -1,18 +1,46 @@
|
|||||||
//Should potentially make a "Service" class
|
//Should potentially make a "Service" class
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "Instance.h"
|
#include "Instance.h"
|
||||||
|
#include "PartInstance.h"
|
||||||
|
|
||||||
namespace B3D{
|
namespace B3D{
|
||||||
|
|
||||||
|
struct MousePoint{
|
||||||
|
Vector3 position;
|
||||||
|
B3D::PartInstance * target;
|
||||||
|
MousePoint(Vector3 pos, PartInstance * targ)
|
||||||
|
{
|
||||||
|
position = pos;
|
||||||
|
target = targ;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class InputService : public Instance{
|
class InputService : public Instance{
|
||||||
public:
|
public:
|
||||||
InputService(void);
|
InputService(void);
|
||||||
InputService~(void);
|
~InputService(void);
|
||||||
bool pollKeyState(char keyChar);
|
|
||||||
|
//Polling
|
||||||
|
int pollKeyState(unsigned char keyCode);
|
||||||
int pollMouseX();
|
int pollMouseX();
|
||||||
int pollMouseY();
|
int pollMouseY();
|
||||||
bool pollMouseButton(int button);
|
int pollMouseButton(unsigned char button);
|
||||||
|
bool pollFocus();
|
||||||
|
|
||||||
|
|
||||||
|
//Update Input
|
||||||
|
void updateMouse(int x, int y);
|
||||||
|
void updateFocus(bool focus);
|
||||||
|
|
||||||
|
//Signal
|
||||||
|
void signalKeyState(unsigned char keyCode, bool isDown);
|
||||||
|
void signalMouseButtonState(unsigned char button, bool isDown);
|
||||||
|
void signalMouseWheelState(int step);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int mouseX, mouseY;
|
int mouseX, mouseY;
|
||||||
|
Ray lastRay;
|
||||||
}
|
bool hasFocus;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
//TODO holy shit
|
||||||
#include <G3DAll.h>
|
#include <G3DAll.h>
|
||||||
#include <initguid.h>
|
#include <initguid.h>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
@@ -30,12 +31,6 @@
|
|||||||
#include "Faces.h"
|
#include "Faces.h"
|
||||||
#define LEGACY_LOAD_G3DFUN_LEVEL
|
#define LEGACY_LOAD_G3DFUN_LEVEL
|
||||||
|
|
||||||
static bool mouseMovedBeginMotion = false;
|
|
||||||
static POINT oldGlobalMouse;
|
|
||||||
Vector2 oldMouse = Vector2(0,0);
|
|
||||||
float moveRate = 0.5;
|
|
||||||
float wasPropShown = 0;
|
|
||||||
|
|
||||||
using namespace B3D;
|
using namespace B3D;
|
||||||
|
|
||||||
void Application::clearInstances()
|
void Application::clearInstances()
|
||||||
@@ -499,7 +494,6 @@ void Application::onMouseRightUp(int x,int y)
|
|||||||
}
|
}
|
||||||
void Application::onMouseMoved(int x,int y)
|
void Application::onMouseMoved(int x,int y)
|
||||||
{
|
{
|
||||||
oldMouse = Vector2(mouse.x, mouse.y);
|
|
||||||
mouse.oldx = mouse.x;
|
mouse.oldx = mouse.x;
|
||||||
mouse.oldy = mouse.y;
|
mouse.oldy = mouse.y;
|
||||||
mouse.x = x;
|
mouse.x = x;
|
||||||
|
|||||||
54
src/source/DataModelV3/InputService.cpp
Normal file
54
src/source/DataModelV3/InputService.cpp
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#include "DataModelV3/InputService.h"
|
||||||
|
#include "win32Defines.h"
|
||||||
|
|
||||||
|
using namespace B3D;
|
||||||
|
|
||||||
|
InputService::InputService(void) : Instance()
|
||||||
|
{
|
||||||
|
name = "Mouse";
|
||||||
|
}
|
||||||
|
|
||||||
|
InputService::~InputService(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//Poll state
|
||||||
|
int InputService::pollKeyState(unsigned char keyCode){
|
||||||
|
return GetHoldKeyState(keyCode);
|
||||||
|
}
|
||||||
|
int InputService::pollMouseX(){
|
||||||
|
return mouseX;
|
||||||
|
}
|
||||||
|
int InputService::pollMouseY(){
|
||||||
|
return mouseY;
|
||||||
|
}
|
||||||
|
int InputService::pollMouseButton(unsigned char button){
|
||||||
|
return GetHoldKeyState(button);
|
||||||
|
}
|
||||||
|
bool InputService::pollFocus(){
|
||||||
|
return hasFocus;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Update Input
|
||||||
|
void InputService::updateMouse(int x, int y){
|
||||||
|
mouseX = x;
|
||||||
|
mouseY = y;
|
||||||
|
}
|
||||||
|
void InputService::updateFocus(bool focus){
|
||||||
|
hasFocus = focus;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Signal
|
||||||
|
void InputService::signalKeyState(unsigned char keyCode, bool isDown){
|
||||||
|
//TODO Signal Service
|
||||||
|
}
|
||||||
|
void InputService::signalMouseButtonState(unsigned char button, bool isDown){
|
||||||
|
//TODO Signal service
|
||||||
|
}
|
||||||
|
void InputService::signalMouseWheelState(int step){
|
||||||
|
//TODO Signal service
|
||||||
|
}
|
||||||
|
|
||||||
|
//Targeting and mouse actions
|
||||||
|
//TODO camera instance
|
||||||
Reference in New Issue
Block a user