diff --git a/Blocks3D VS2003.vcproj b/Blocks3D VS2003.vcproj index 348b83c..1722483 100644 --- a/Blocks3D VS2003.vcproj +++ b/Blocks3D VS2003.vcproj @@ -245,6 +245,9 @@ + + @@ -529,6 +532,9 @@ + + diff --git a/src/include/AbstractedInput.h b/src/include/AbstractedInput.h new file mode 100644 index 0000000..d223eb3 --- /dev/null +++ b/src/include/AbstractedInput.h @@ -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; + } +} \ No newline at end of file diff --git a/src/include/Application.h b/src/include/Application.h index 7c1799c..91b4954 100644 --- a/src/include/Application.h +++ b/src/include/Application.h @@ -16,7 +16,6 @@ class CameraController; class Application { // : public GApp { public: Application(HWND parentWindow); - void Boop(); virtual ~Application() {} virtual void exitApplication(); virtual void onInit(); @@ -72,13 +71,15 @@ class Application { // : public GApp { HWND _hwndToolbox; HWND _buttonTest; HWND _hwndRenderer; + //TODO make list DataModelInstance* _dataModel; - G3D::TextureRef shadowMap; std::string _title; + //TODO deprecated? bool _dragging; + //TODO deprecated int _mode; + //Can be moved? GAppSettings _settings; - double lightProjX, lightProjY, lightProjNear, lightProjFar; IEBrowser* webBrowser; protected: Stopwatch m_graphicsWatch; diff --git a/src/include/DataModelV3/InputService.h b/src/include/DataModelV3/InputService.h index d5c6e1c..bc4ec42 100644 --- a/src/include/DataModelV3/InputService.h +++ b/src/include/DataModelV3/InputService.h @@ -1,18 +1,46 @@ //Should potentially make a "Service" class #pragma once #include "Instance.h" +#include "PartInstance.h" namespace B3D{ + + struct MousePoint{ + Vector3 position; + B3D::PartInstance * target; + MousePoint(Vector3 pos, PartInstance * targ) + { + position = pos; + target = targ; + } + }; + class InputService : public Instance{ public: InputService(void); - InputService~(void); - bool pollKeyState(char keyChar); + ~InputService(void); + + //Polling + int pollKeyState(unsigned char keyCode); int pollMouseX(); 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: int mouseX, mouseY; - - } + Ray lastRay; + bool hasFocus; + }; } \ No newline at end of file diff --git a/src/source/Application.cpp b/src/source/Application.cpp index e619ebc..4ddfd80 100644 --- a/src/source/Application.cpp +++ b/src/source/Application.cpp @@ -1,3 +1,4 @@ +//TODO holy shit #include #include #include @@ -30,12 +31,6 @@ #include "Faces.h" #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; void Application::clearInstances() @@ -499,7 +494,6 @@ void Application::onMouseRightUp(int x,int y) } void Application::onMouseMoved(int x,int y) { - oldMouse = Vector2(mouse.x, mouse.y); mouse.oldx = mouse.x; mouse.oldy = mouse.y; mouse.x = x; diff --git a/src/source/DataModelV3/InputService.cpp b/src/source/DataModelV3/InputService.cpp new file mode 100644 index 0000000..eb1ce90 --- /dev/null +++ b/src/source/DataModelV3/InputService.cpp @@ -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 \ No newline at end of file