mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-22 12:59:07 -06:00
More work on transitioning to windowwrapper for keyboard and mouse interaction
This commit is contained in:
@@ -25,9 +25,13 @@
|
||||
#ifndef __OPENSPACEENGINE_H__
|
||||
#define __OPENSPACEENGINE_H__
|
||||
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
|
||||
#include <openspace/util/keys.h>
|
||||
#include <openspace/util/mouse.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -100,9 +104,10 @@ public:
|
||||
void postSynchronizationPreDraw();
|
||||
void render(const glm::mat4 &projectionMatrix, const glm::mat4 &viewMatrix);
|
||||
void postDraw();
|
||||
void keyboardCallback(int key, int action);
|
||||
// void keyboardCallback(int key, int action);
|
||||
void keyboardCallback(Key key, KeyModifier mod, KeyAction action);
|
||||
void charCallback(unsigned int codepoint);
|
||||
void mouseButtonCallback(int key, int action);
|
||||
void mouseButtonCallback(MouseButton button, MouseAction action);
|
||||
void mousePositionCallback(double x, double y);
|
||||
void mouseScrollWheelCallback(double pos);
|
||||
void externalControlCallback(const char* receivedChars, int size, int clientId);
|
||||
|
||||
@@ -36,8 +36,11 @@ public:
|
||||
|
||||
double averageDeltaTime() override;
|
||||
glm::vec2 mousePosition() override;
|
||||
uint32_t mouseButtons(int maxNumber) override;
|
||||
glm::ivec2 currentWindowSize() override;
|
||||
glm::ivec2 currentWindowResolution() override;
|
||||
|
||||
bool isRegularRendering() override;
|
||||
|
||||
|
||||
// void forEachWindow(std::function<void (void)> function) override;
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
|
||||
namespace openspace {
|
||||
@@ -36,9 +37,11 @@ public:
|
||||
virtual void setBarrier(bool enabled) = 0;
|
||||
virtual void clearAllWindows() = 0;
|
||||
virtual double averageDeltaTime() = 0;
|
||||
virtual uint32_t mouseButtons(int maxNumber = 8) = 0;
|
||||
virtual glm::vec2 mousePosition() = 0;
|
||||
virtual glm::ivec2 currentWindowSize() = 0;
|
||||
virtual glm::ivec2 currentWindowResolution() = 0;
|
||||
virtual bool isRegularRendering() = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
#include <openspace/network/parallelconnection.h>
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/util/keys.h>
|
||||
|
||||
#include <mutex>
|
||||
|
||||
@@ -109,8 +110,8 @@ public:
|
||||
void setCamera(Camera* camera);
|
||||
const Camera* const camera() const;
|
||||
|
||||
void keyboardCallback(int key, int action);
|
||||
void mouseButtonCallback(int button, int action);
|
||||
void keyboardCallback(Key key, KeyAction action);
|
||||
void mouseButtonCallback(MouseButton button, MouseAction action);
|
||||
void mousePositionCallback(double x, double y);
|
||||
void mouseScrollWheelCallback(double pos);
|
||||
|
||||
@@ -131,7 +132,7 @@ public:
|
||||
void setRotation(const glm::quat& rotation);
|
||||
|
||||
void resetKeyBindings();
|
||||
void bindKey(int key, const std::string& lua);
|
||||
void bindKey(Key key, std::string lua);
|
||||
|
||||
void setInteractionSensitivity(float sensitivity);
|
||||
float interactionSensitivity() const;
|
||||
@@ -170,7 +171,7 @@ private:
|
||||
std::mutex _mutex;
|
||||
|
||||
bool _validKeyLua;
|
||||
std::multimap<int, std::string > _keyLua;
|
||||
std::multimap<Key, std::string > _keyLua;
|
||||
|
||||
float _controllerSensitivity;
|
||||
bool _invertRoll;
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
|
||||
#include <openspace/util/keys.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -40,12 +42,12 @@ public:
|
||||
void initialize();
|
||||
void deinitialize();
|
||||
|
||||
void keyboardCallback(int key, int action);
|
||||
void keyboardCallback(Key key, KeyAction action);
|
||||
void charCallback(unsigned int codepoint);
|
||||
|
||||
void render();
|
||||
|
||||
unsigned int commandInputButton();
|
||||
Key commandInputButton();
|
||||
|
||||
bool isVisible() const;
|
||||
void setVisible(bool visible);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <openspace/interaction/controller.h>
|
||||
|
||||
#include <openspace/interaction/mouse.h>
|
||||
#include <openspace/util/mouse.h>
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
MouseController();
|
||||
virtual ~MouseController() {}
|
||||
|
||||
virtual void button(MouseAction action, MouseButton button) = 0;
|
||||
virtual void button(MouseButton button, MouseAction action) = 0;
|
||||
virtual void move(float x, float y) = 0;
|
||||
virtual void scrollWheel(int pos) = 0;
|
||||
virtual void update(const double& dt) = 0;
|
||||
@@ -59,13 +59,13 @@ class TrackballMouseController : public MouseController {
|
||||
public:
|
||||
TrackballMouseController();
|
||||
|
||||
void button(MouseAction action, MouseButton button);
|
||||
void button(MouseButton button, MouseAction action) override;
|
||||
|
||||
void move(float x, float y);
|
||||
void move(float x, float y) override;
|
||||
|
||||
void scrollWheel(int pos);
|
||||
void scrollWheel(int pos) override;
|
||||
|
||||
void update(const double& dt);
|
||||
void update(const double& dt) override;
|
||||
|
||||
protected:
|
||||
bool _leftMouseButtonDown;
|
||||
@@ -76,13 +76,13 @@ class OrbitalMouseController : public MouseController {
|
||||
public:
|
||||
OrbitalMouseController();
|
||||
|
||||
void button(MouseAction action, MouseButton button);
|
||||
void button(MouseButton button, MouseAction action) override;
|
||||
|
||||
void move(float x, float y);
|
||||
void move(float x, float y) override;
|
||||
|
||||
void scrollWheel(int pos);
|
||||
void scrollWheel(int pos) override;
|
||||
|
||||
void update(const double& dt);
|
||||
void update(const double& dt) override;
|
||||
|
||||
protected:
|
||||
bool _leftMouseButtonDown;
|
||||
|
||||
@@ -22,150 +22,314 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
// This file is based on the definitions as presented in the GLFW library:
|
||||
/*************************************************************************
|
||||
* GLFW 3.1 - www.glfw.org
|
||||
* A library for OpenGL, window and input
|
||||
*------------------------------------------------------------------------
|
||||
* Copyright (c) 2002-2006 Marcus Geelnard
|
||||
* Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would
|
||||
* be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not
|
||||
* be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef __KEYS_H__
|
||||
#define __KEYS_H__
|
||||
|
||||
#include <sgct.h>
|
||||
// All values that are defined here are compatible with (and are based on) the
|
||||
// definitions GLFW v3.1
|
||||
|
||||
namespace openspace {
|
||||
|
||||
enum class KeyAction {
|
||||
Press = SGCT_PRESS,
|
||||
Release = SGCT_RELEASE,
|
||||
Repeat = SGCT_REPEAT
|
||||
Release = 0,
|
||||
Press = 1,
|
||||
Repeat = 2
|
||||
};
|
||||
|
||||
enum class KeyModifier {
|
||||
NoModifier = 0,
|
||||
Shift = GLFW_MOD_SHIFT,
|
||||
Control = GLFW_MOD_CONTROL,
|
||||
Alt = GLFW_MOD_ALT,
|
||||
Super = GLFW_MOD_SUPER
|
||||
Shift = 0x0001,
|
||||
Control = 0x0002,
|
||||
Alt = 0x0004,
|
||||
Super = 0x0008
|
||||
};
|
||||
|
||||
enum class Key {
|
||||
Unknown = SGCT_KEY_UNKNOWN,
|
||||
Space = SGCT_KEY_SPACE,
|
||||
Apostrophe = SGCT_KEY_APOSTROPHE,
|
||||
Comma = SGCT_KEY_COMMA,
|
||||
Minus = SGCT_KEY_MINUS,
|
||||
Period = SGCT_KEY_PERIOD,
|
||||
Slash = SGCT_KEY_SLASH,
|
||||
Num0 = SGCT_KEY_0,
|
||||
Num1 = SGCT_KEY_1,
|
||||
Num2 = SGCT_KEY_2,
|
||||
Num3 = SGCT_KEY_3,
|
||||
Num4 = SGCT_KEY_4,
|
||||
Num5 = SGCT_KEY_5,
|
||||
Num6 = SGCT_KEY_6,
|
||||
Num7 = SGCT_KEY_7,
|
||||
Num8 = SGCT_KEY_8,
|
||||
Num9 = SGCT_KEY_9,
|
||||
SemiColon = SGCT_KEY_SEMICOLON,
|
||||
Equal = SGCT_KEY_EQUAL,
|
||||
A = SGCT_KEY_A,
|
||||
B = SGCT_KEY_B,
|
||||
C = SGCT_KEY_C,
|
||||
D = SGCT_KEY_D,
|
||||
E = SGCT_KEY_E,
|
||||
F = SGCT_KEY_F,
|
||||
G = SGCT_KEY_G,
|
||||
H = SGCT_KEY_H,
|
||||
I = SGCT_KEY_I,
|
||||
J = SGCT_KEY_J,
|
||||
K = SGCT_KEY_K,
|
||||
L = SGCT_KEY_L,
|
||||
M = SGCT_KEY_M,
|
||||
N = SGCT_KEY_N,
|
||||
O = SGCT_KEY_O,
|
||||
P = SGCT_KEY_P,
|
||||
Q = SGCT_KEY_Q,
|
||||
R = SGCT_KEY_R,
|
||||
S = SGCT_KEY_S,
|
||||
T = SGCT_KEY_T,
|
||||
U = SGCT_KEY_U,
|
||||
V = SGCT_KEY_V,
|
||||
W = SGCT_KEY_W,
|
||||
X = SGCT_KEY_X,
|
||||
Y = SGCT_KEY_Y,
|
||||
Z = SGCT_KEY_Z,
|
||||
LeftBracket = SGCT_KEY_LEFT_BRACKET,
|
||||
BackSlash = SGCT_KEY_BACKSLASH,
|
||||
RightBracket = SGCT_KEY_RIGHT_BRACKET,
|
||||
GraveAccent = SGCT_KEY_GRAVE_ACCENT,
|
||||
World1 = SGCT_KEY_WORLD_1,
|
||||
World2 = SGCT_KEY_WORLD_2,
|
||||
Escape = SGCT_KEY_ESC,
|
||||
Enter = SGCT_KEY_ENTER,
|
||||
Tab = SGCT_KEY_TAB,
|
||||
BackSpace = SGCT_KEY_BACKSPACE,
|
||||
Insert = SGCT_KEY_INSERT,
|
||||
Delete = SGCT_KEY_DELETE,
|
||||
Right = SGCT_KEY_RIGHT,
|
||||
Left = SGCT_KEY_LEFT,
|
||||
Down = SGCT_KEY_DOWN,
|
||||
Up = SGCT_KEY_UP,
|
||||
PageUp = SGCT_KEY_PAGE_UP,
|
||||
PageDown = SGCT_KEY_PAGE_DOWN,
|
||||
Home = SGCT_KEY_HOME,
|
||||
End = SGCT_KEY_END,
|
||||
CapsLock = SGCT_KEY_CAPS_LOCK,
|
||||
ScrollLock = SGCT_KEY_SCROLL_LOCK,
|
||||
NumLock = SGCT_KEY_NUM_LOCK,
|
||||
PrintScreen = SGCT_KEY_PRINT_SCREEN,
|
||||
Pause = SGCT_KEY_PAUSE,
|
||||
F1 = SGCT_KEY_F1,
|
||||
F2 = SGCT_KEY_F2,
|
||||
F3 = SGCT_KEY_F3,
|
||||
F4 = SGCT_KEY_F4,
|
||||
F5 = SGCT_KEY_F5,
|
||||
F6 = SGCT_KEY_F6,
|
||||
F7 = SGCT_KEY_F7,
|
||||
F8 = SGCT_KEY_F8,
|
||||
F9 = SGCT_KEY_F9,
|
||||
F10 = SGCT_KEY_F10,
|
||||
F11 = SGCT_KEY_F11,
|
||||
F12 = SGCT_KEY_F12,
|
||||
F13 = SGCT_KEY_F13,
|
||||
F14 = SGCT_KEY_F14,
|
||||
F15 = SGCT_KEY_F15,
|
||||
F16 = SGCT_KEY_F16,
|
||||
F17 = SGCT_KEY_F17,
|
||||
F18 = SGCT_KEY_F18,
|
||||
F19 = SGCT_KEY_F19,
|
||||
F20 = SGCT_KEY_F20,
|
||||
F21 = SGCT_KEY_F21,
|
||||
F22 = SGCT_KEY_F22,
|
||||
F23 = SGCT_KEY_F23,
|
||||
F24 = SGCT_KEY_F24,
|
||||
F25 = SGCT_KEY_F25,
|
||||
Keypad0 = SGCT_KEY_KP_0,
|
||||
Keypad1 = SGCT_KEY_KP_1,
|
||||
Keypad2 = SGCT_KEY_KP_2,
|
||||
Keypad3 = SGCT_KEY_KP_3,
|
||||
Keypad4 = SGCT_KEY_KP_4,
|
||||
Keypad5 = SGCT_KEY_KP_5,
|
||||
Keypad6 = SGCT_KEY_KP_6,
|
||||
Keypad7 = SGCT_KEY_KP_7,
|
||||
Keypad8 = SGCT_KEY_KP_8,
|
||||
Keypad9 = SGCT_KEY_KP_9,
|
||||
KeypadDecimal = SGCT_KEY_KP_DECIMAL,
|
||||
KeypadDivide = SGCT_KEY_KP_DIVIDE,
|
||||
KeypadMultiply = SGCT_KEY_KP_MULTIPLY,
|
||||
KeypadSubtract = SGCT_KEY_KP_SUBTRACT,
|
||||
KeypadAdd = SGCT_KEY_KP_ADD,
|
||||
KeypadEnter = SGCT_KEY_KP_ENTER,
|
||||
LeftShift = SGCT_KEY_LEFT_SHIFT,
|
||||
LeftControl = SGCT_KEY_LEFT_CONTROL,
|
||||
LeftAlt = SGCT_KEY_LEFT_ALT,
|
||||
LeftSuper = SGCT_KEY_LEFT_SUPER,
|
||||
RightShift = SGCT_KEY_RIGHT_SHIFT,
|
||||
RightControl = SGCT_KEY_RIGHT_CONTROL,
|
||||
RightAlt = SGCT_KEY_RIGHT_ALT,
|
||||
RightSuper = SGCT_KEY_RIGHT_SUPER,
|
||||
Menu = SGCT_KEY_MENU,
|
||||
Last = SGCT_KEY_LAST
|
||||
Unknown = -1,
|
||||
Space = 32,
|
||||
Apostrophe = 39,
|
||||
Comma = 44,
|
||||
Minus = 45,
|
||||
Period = 46,
|
||||
Slash = 47,
|
||||
Num0 = 48,
|
||||
Num1 = 49,
|
||||
Num2 = 50,
|
||||
Num3 = 51,
|
||||
Num4 = 52,
|
||||
Num5 = 53,
|
||||
Num6 = 54,
|
||||
Num7 = 55,
|
||||
Num8 = 56,
|
||||
Num9 = 57,
|
||||
SemiColon = 59,
|
||||
Equal = 61,
|
||||
A = 65,
|
||||
B = 66,
|
||||
C = 67,
|
||||
D = 68,
|
||||
E = 69,
|
||||
F = 70,
|
||||
G = 71,
|
||||
H = 72,
|
||||
I = 73,
|
||||
J = 74,
|
||||
K = 75,
|
||||
L = 76,
|
||||
M = 77,
|
||||
N = 78,
|
||||
O = 79,
|
||||
P = 80,
|
||||
Q = 81,
|
||||
R = 82,
|
||||
S = 83,
|
||||
T = 84,
|
||||
U = 85,
|
||||
V = 86,
|
||||
W = 87,
|
||||
X = 88,
|
||||
Y = 89,
|
||||
Z = 90,
|
||||
LeftBracket = 91,
|
||||
BackSlash = 92,
|
||||
RightBracket = 93,
|
||||
GraveAccent = 96,
|
||||
World1 = 161,
|
||||
World2 = 162,
|
||||
Escape = 256,
|
||||
Enter = 257,
|
||||
Tab = 258,
|
||||
BackSpace = 259,
|
||||
Insert = 260,
|
||||
Delete = 261,
|
||||
Right = 262,
|
||||
Left = 263,
|
||||
Down = 264,
|
||||
Up = 265,
|
||||
PageUp = 266,
|
||||
PageDown = 267,
|
||||
Home = 268,
|
||||
End = 269,
|
||||
CapsLock = 280,
|
||||
ScrollLock = 281,
|
||||
NumLock = 282,
|
||||
PrintScreen = 283,
|
||||
Pause = 284,
|
||||
F1 = 290,
|
||||
F2 = 291,
|
||||
F3 = 292,
|
||||
F4 = 293,
|
||||
F5 = 294,
|
||||
F6 = 295,
|
||||
F7 = 296,
|
||||
F8 = 297,
|
||||
F9 = 298,
|
||||
F10 = 299,
|
||||
F11 = 300,
|
||||
F12 = 301,
|
||||
F13 = 302,
|
||||
F14 = 303,
|
||||
F15 = 304,
|
||||
F16 = 305,
|
||||
F17 = 306,
|
||||
F18 = 307,
|
||||
F19 = 308,
|
||||
F20 = 309,
|
||||
F21 = 310,
|
||||
F22 = 311,
|
||||
F23 = 312,
|
||||
F24 = 313,
|
||||
F25 = 314,
|
||||
Keypad0 = 320,
|
||||
Keypad1 = 321,
|
||||
Keypad2 = 322,
|
||||
Keypad3 = 323,
|
||||
Keypad4 = 324,
|
||||
Keypad5 = 325,
|
||||
Keypad6 = 326,
|
||||
Keypad7 = 327,
|
||||
Keypad8 = 328,
|
||||
Keypad9 = 329,
|
||||
KeypadDecimal = 330,
|
||||
KeypadDivide = 331,
|
||||
KeypadMultiply = 332,
|
||||
KeypadSubtract = 333,
|
||||
KeypadAdd = 334,
|
||||
KeypadEnter = 335,
|
||||
LeftShift = 340,
|
||||
LeftControl = 341,
|
||||
LeftAlt = 342,
|
||||
LeftSuper = 343,
|
||||
RightShift = 344,
|
||||
RightControl = 345,
|
||||
RightAlt = 346,
|
||||
RightSuper = 347,
|
||||
Menu = 348,
|
||||
Last = Menu
|
||||
};
|
||||
|
||||
static const std::map<std::string, Key> KeyMapping = {
|
||||
{ "SPACE", Key::Space },
|
||||
{ "APOSTROPHE", Key::Apostrophe },
|
||||
{ "COMMA", Key::Comma },
|
||||
{ "MINUS", Key::Minus },
|
||||
{ "PERIOD", Key::Period },
|
||||
{ "SLASH", Key::Slash },
|
||||
{ "0", Key::Num0 },
|
||||
{ "1", Key::Num1 },
|
||||
{ "2", Key::Num2 },
|
||||
{ "3", Key::Num3 },
|
||||
{ "4", Key::Num4 },
|
||||
{ "5", Key::Num5 },
|
||||
{ "6", Key::Num6 },
|
||||
{ "7", Key::Num7 },
|
||||
{ "8", Key::Num8 },
|
||||
{ "9", Key::Num9 },
|
||||
{ "SEMICOLON", Key::SemiColon },
|
||||
{ "EQUAL", Key::Equal },
|
||||
{ "A", Key::A },
|
||||
{ "B", Key::B },
|
||||
{ "C", Key::C },
|
||||
{ "D", Key::D },
|
||||
{ "E", Key::E },
|
||||
{ "F", Key::F },
|
||||
{ "G", Key::G },
|
||||
{ "H", Key::H },
|
||||
{ "I", Key::I },
|
||||
{ "J", Key::J },
|
||||
{ "K", Key::K },
|
||||
{ "L", Key::L },
|
||||
{ "M", Key::M },
|
||||
{ "N", Key::N },
|
||||
{ "O", Key::O },
|
||||
{ "P", Key::P },
|
||||
{ "Q", Key::Q },
|
||||
{ "R", Key::R },
|
||||
{ "S", Key::S },
|
||||
{ "T", Key::T },
|
||||
{ "U", Key::U },
|
||||
{ "V", Key::V },
|
||||
{ "W", Key::W },
|
||||
{ "X", Key::X },
|
||||
{ "Y", Key::Y },
|
||||
{ "Z", Key::Z },
|
||||
{ "LEFT_BRACKET", Key::LeftBracket },
|
||||
{ "BACKSLASH", Key::BackSlash },
|
||||
{ "RIGHT_BRACKET", Key::RightBracket },
|
||||
{ "GRAVE_ACCENT", Key::GraveAccent },
|
||||
{ "WORLD_1", Key::World1 },
|
||||
{ "WORLD_2", Key::World2 },
|
||||
{ "ESC", Key::Escape },
|
||||
{ "ESCAPE", Key::Escape},
|
||||
{ "ENTER", Key::Enter },
|
||||
{ "TAB", Key::Tab },
|
||||
{ "BACKSPACE", Key::BackSpace },
|
||||
{ "INSERT", Key::Insert },
|
||||
{ "DEL", Key::Delete },
|
||||
{ "DELETE", Key::Delete },
|
||||
{ "RIGHT", Key::Right },
|
||||
{ "LEFT", Key::Left },
|
||||
{ "DOWN", Key::Down },
|
||||
{ "UP", Key::Up },
|
||||
{ "PAGEUP", Key::PageUp },
|
||||
{ "PAGEDOWN", Key::PageDown },
|
||||
{ "PAGE_UP", Key::PageUp },
|
||||
{ "PAGE_DOWN", Key::PageDown },
|
||||
{ "HOME", Key::Home },
|
||||
{ "END", Key::End },
|
||||
{ "CAPS_LOCK", Key::CapsLock },
|
||||
{ "SCROLL_LOCK", Key::ScrollLock },
|
||||
{ "NUM_LOCK", Key::NumLock },
|
||||
{ "PRINT_SCREEN", Key::PrintScreen },
|
||||
{ "PAUSE", Key::Pause },
|
||||
{ "F1", Key::F1 },
|
||||
{ "F2", Key::F2 },
|
||||
{ "F3", Key::F3 },
|
||||
{ "F4", Key::F4 },
|
||||
{ "F5", Key::F5 },
|
||||
{ "F6", Key::F6 },
|
||||
{ "F7", Key::F7 },
|
||||
{ "F8", Key::F8 },
|
||||
{ "F9", Key::F9 },
|
||||
{ "F10", Key::F10 },
|
||||
{ "F11", Key::F11 },
|
||||
{ "F12", Key::F12 },
|
||||
{ "F13", Key::F13 },
|
||||
{ "F14", Key::F14 },
|
||||
{ "F15", Key::F15 },
|
||||
{ "F16", Key::F16 },
|
||||
{ "F17", Key::F17 },
|
||||
{ "F18", Key::F18 },
|
||||
{ "F19", Key::F19 },
|
||||
{ "F20", Key::F20 },
|
||||
{ "F21", Key::F21 },
|
||||
{ "F22", Key::F22 },
|
||||
{ "F23", Key::F23 },
|
||||
{ "F24", Key::F24 },
|
||||
{ "F25", Key::F25 },
|
||||
{ "KP_0", Key::Keypad0 },
|
||||
{ "KP_1", Key::Keypad1 },
|
||||
{ "KP_2", Key::Keypad2 },
|
||||
{ "KP_3", Key::Keypad3 },
|
||||
{ "KP_4", Key::Keypad4 },
|
||||
{ "KP_5", Key::Keypad5 },
|
||||
{ "KP_6", Key::Keypad6 },
|
||||
{ "KP_7", Key::Keypad7 },
|
||||
{ "KP_8", Key::Keypad8 },
|
||||
{ "KP_9", Key::Keypad9 },
|
||||
{ "KP_DECIMAL", Key::KeypadDecimal },
|
||||
{ "KP_DIVIDE", Key::KeypadDivide },
|
||||
{ "KP_MULTIPLY", Key::KeypadMultiply },
|
||||
{ "KP_SUBTRACT", Key::KeypadSubtract },
|
||||
{ "KP_ADD", Key::KeypadAdd },
|
||||
{ "KP_ENTER", Key::KeypadEnter },
|
||||
{ "KP_EQUAL", Key::KeypadEnter },
|
||||
{ "LSHIFT", Key::LeftShift },
|
||||
{ "LEFT_SHIFT", Key::LeftShift },
|
||||
{ "LCTRL", Key::LeftControl },
|
||||
{ "LEFT_CONTROL", Key::LeftControl },
|
||||
{ "LALT", Key::LeftAlt },
|
||||
{ "LEFT_ALT", Key::LeftAlt },
|
||||
{ "LEFT_SUPER", Key::LeftSuper },
|
||||
{ "RSHIFT", Key::RightShift },
|
||||
{ "RIGHT_SHIFT", Key::RightShift },
|
||||
{ "RCTRL", Key::RightControl },
|
||||
{ "RIGHT_CONTROL", Key::RightControl },
|
||||
{ "RALT", Key::RightAlt },
|
||||
{ "RIGHT_ALT", Key::RightAlt },
|
||||
{ "RIGHT_SUPER", Key::RightSuper },
|
||||
{ "MENU", Key::Menu }
|
||||
};
|
||||
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
@@ -22,36 +22,64 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
// This file is based on the definitions as presented in the GLFW library:
|
||||
/*************************************************************************
|
||||
* GLFW 3.1 - www.glfw.org
|
||||
* A library for OpenGL, window and input
|
||||
*------------------------------------------------------------------------
|
||||
* Copyright (c) 2002-2006 Marcus Geelnard
|
||||
* Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would
|
||||
* be appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not
|
||||
* be misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*
|
||||
*************************************************************************/
|
||||
|
||||
// All values that are defined here are compatible with (and are based on) the
|
||||
// definitions GLFW v3.1
|
||||
|
||||
#ifndef __MOUSE_H__
|
||||
#define __MOUSE_H__
|
||||
|
||||
#include <sgct.h>
|
||||
|
||||
namespace openspace {
|
||||
namespace interaction {
|
||||
|
||||
enum class MouseAction {
|
||||
Press = SGCT_PRESS,
|
||||
Release = SGCT_RELEASE,
|
||||
Repeat = SGCT_REPEAT
|
||||
Release = 0,
|
||||
Press = 1,
|
||||
Repeat = 2
|
||||
};
|
||||
|
||||
enum class MouseButton {
|
||||
Left = SGCT_MOUSE_BUTTON_LEFT,
|
||||
Right = SGCT_MOUSE_BUTTON_RIGHT,
|
||||
Middle = SGCT_MOUSE_BUTTON_MIDDLE,
|
||||
//Button1 = SGCT_MOUSE_BUTTON_1,
|
||||
//Button2 = SGCT_MOUSE_BUTTON_2,
|
||||
//Button3 = SGCT_MOUSE_BUTTON_3,
|
||||
//Button4 = SGCT_MOUSE_BUTTON_4,
|
||||
//Button5 = SGCT_MOUSE_BUTTON_5,
|
||||
//Button6 = SGCT_MOUSE_BUTTON_6,
|
||||
//Button7 = SGCT_MOUSE_BUTTON_7,
|
||||
//Button8 = SGCT_MOUSE_BUTTON_8,
|
||||
ButtonLast = SGCT_MOUSE_BUTTON_LAST,
|
||||
Button1 = 0,
|
||||
Button2 = 1,
|
||||
Button3 = 2,
|
||||
Button4 = 3,
|
||||
Button5 = 4,
|
||||
Button6 = 5,
|
||||
Button7 = 6,
|
||||
Button8 = 8,
|
||||
Last = Button8,
|
||||
Left = Button1,
|
||||
Right = Button2,
|
||||
Middle = Button3
|
||||
};
|
||||
|
||||
} // namespace interaction
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __MOUSE_H__
|
||||
Reference in New Issue
Block a user