|
|
|
@ -49,14 +49,14 @@ namespace Magnum { namespace Platform { |
|
|
|
Application using GLFW toolkit. Supports keyboard and mouse handling with |
|
|
|
Application using GLFW toolkit. Supports keyboard and mouse handling with |
|
|
|
support for changing cursor and mouse tracking and warping. |
|
|
|
support for changing cursor and mouse tracking and warping. |
|
|
|
|
|
|
|
|
|
|
|
This application library is available only on desktop OpenGL (Linux, Windows, |
|
|
|
This application library is available on all platforms where GLFW is ported. It |
|
|
|
OS X). It depends on **GLFW** library and is built if `WITH_GLFWAPPLICATION` is |
|
|
|
depends on **GLFW** library and is built if `WITH_GLFWAPPLICATION` is enabled |
|
|
|
enabled in CMake. |
|
|
|
in CMake. |
|
|
|
|
|
|
|
|
|
|
|
## Bootstrap application |
|
|
|
## Bootstrap application |
|
|
|
|
|
|
|
|
|
|
|
Fully contained base application using @ref GlfwApplication along with |
|
|
|
Fully contained base application using @ref GlfwApplication along with CMake |
|
|
|
CMake setup is available in `base-glfw` branch of |
|
|
|
setup is available in `base-glfw` branch of |
|
|
|
[Magnum Bootstrap](https://github.com/mosra/magnum-bootstrap) repository,
|
|
|
|
[Magnum Bootstrap](https://github.com/mosra/magnum-bootstrap) repository,
|
|
|
|
download it as [tar.gz](https://github.com/mosra/magnum-bootstrap/archive/base-glfw.tar.gz)
|
|
|
|
download it as [tar.gz](https://github.com/mosra/magnum-bootstrap/archive/base-glfw.tar.gz)
|
|
|
|
or [zip](https://github.com/mosra/magnum-bootstrap/archive/base-glfw.zip) file.
|
|
|
|
or [zip](https://github.com/mosra/magnum-bootstrap/archive/base-glfw.zip) file.
|
|
|
|
@ -266,9 +266,7 @@ class GlfwApplication { |
|
|
|
static GlfwApplication* _instance; |
|
|
|
static GlfwApplication* _instance; |
|
|
|
|
|
|
|
|
|
|
|
GLFWwindow* _window; |
|
|
|
GLFWwindow* _window; |
|
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<Platform::Context> _context; |
|
|
|
std::unique_ptr<Platform::Context> _context; |
|
|
|
|
|
|
|
|
|
|
|
bool _needsRedraw; |
|
|
|
bool _needsRedraw; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
@ -329,8 +327,14 @@ class GlfwApplication::Configuration { |
|
|
|
|
|
|
|
|
|
|
|
Minimized = 1 << 4, /**< Minimized window */ |
|
|
|
Minimized = 1 << 4, /**< Minimized window */ |
|
|
|
Floating = 1 << 5, /**< Window floating above others, top-most */ |
|
|
|
Floating = 1 << 5, /**< Window floating above others, top-most */ |
|
|
|
AutoIconify = 1 << 6, /**< Automatically iconify (minimize) if fullscreen window loses input focus */ |
|
|
|
|
|
|
|
Focused = 1 << 7, /**< Window has input focus */ |
|
|
|
/**
|
|
|
|
|
|
|
|
* Automatically iconify (minimize) if fullscreen window loses |
|
|
|
|
|
|
|
* input focus |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
AutoIconify = 1 << 6, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Focused = 1 << 7 /**< Window has input focus */ |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
@ -343,7 +347,7 @@ class GlfwApplication::Configuration { |
|
|
|
enum class CursorMode: Int { |
|
|
|
enum class CursorMode: Int { |
|
|
|
Normal = GLFW_CURSOR_NORMAL, /**< Visible unconstrained cursor */ |
|
|
|
Normal = GLFW_CURSOR_NORMAL, /**< Visible unconstrained cursor */ |
|
|
|
Hidden = GLFW_CURSOR_HIDDEN, /**< Hidden cursor */ |
|
|
|
Hidden = GLFW_CURSOR_HIDDEN, /**< Hidden cursor */ |
|
|
|
Diabled = GLFW_CURSOR_DISABLED, /**< Cursor hidden and locked window */ |
|
|
|
Diabled = GLFW_CURSOR_DISABLED /**< Cursor hidden and locked window */ |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/*implicit*/ Configuration(); |
|
|
|
/*implicit*/ Configuration(); |
|
|
|
@ -501,7 +505,7 @@ class GlfwApplication::InputEvent { |
|
|
|
Shift = GLFW_MOD_SHIFT, /**< Shift */ |
|
|
|
Shift = GLFW_MOD_SHIFT, /**< Shift */ |
|
|
|
Ctrl = GLFW_MOD_CONTROL, /**< Ctrl */ |
|
|
|
Ctrl = GLFW_MOD_CONTROL, /**< Ctrl */ |
|
|
|
Alt = GLFW_MOD_ALT, /**< Alt */ |
|
|
|
Alt = GLFW_MOD_ALT, /**< Alt */ |
|
|
|
AltGr = GLFW_MOD_SUPER, /**< AltGr */ |
|
|
|
AltGr = GLFW_MOD_SUPER /**< AltGr */ |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
@ -664,7 +668,7 @@ class GlfwApplication::KeyEvent: public GlfwApplication::InputEvent { |
|
|
|
RightCtrl = GLFW_KEY_RIGHT_CONTROL, /**< Right control */ |
|
|
|
RightCtrl = GLFW_KEY_RIGHT_CONTROL, /**< Right control */ |
|
|
|
RightAlt = GLFW_KEY_RIGHT_ALT, /**< Right alt */ |
|
|
|
RightAlt = GLFW_KEY_RIGHT_ALT, /**< Right alt */ |
|
|
|
RightSuper = GLFW_KEY_RIGHT_SUPER, /**< Right super */ |
|
|
|
RightSuper = GLFW_KEY_RIGHT_SUPER, /**< Right super */ |
|
|
|
Menu = GLFW_KEY_MENU, /**< Menu */ |
|
|
|
Menu = GLFW_KEY_MENU /**< Menu */ |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/** @brief Key */ |
|
|
|
/** @brief Key */ |
|
|
|
@ -710,7 +714,7 @@ class GlfwApplication::MouseEvent: public GlfwApplication::InputEvent { |
|
|
|
Button8 = GLFW_MOUSE_BUTTON_8, /**< Mouse button 8 */ |
|
|
|
Button8 = GLFW_MOUSE_BUTTON_8, /**< Mouse button 8 */ |
|
|
|
|
|
|
|
|
|
|
|
WheelUp = GLFW_MOUSE_BUTTON_LAST + 1, /**< Mouse wheel up */ |
|
|
|
WheelUp = GLFW_MOUSE_BUTTON_LAST + 1, /**< Mouse wheel up */ |
|
|
|
WheelDown = GLFW_MOUSE_BUTTON_LAST + 2, /**< Mouse wheel down */ |
|
|
|
WheelDown = GLFW_MOUSE_BUTTON_LAST + 2 /**< Mouse wheel down */ |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/** @brief Button */ |
|
|
|
/** @brief Button */ |
|
|
|
@ -735,7 +739,6 @@ class GlfwApplication::MouseMoveEvent: public GlfwApplication::InputEvent { |
|
|
|
friend GlfwApplication; |
|
|
|
friend GlfwApplication; |
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
|
|
|
|
|
|
|
|
/** @brief Position */ |
|
|
|
/** @brief Position */ |
|
|
|
constexpr Vector2i position() const { return _position; } |
|
|
|
constexpr Vector2i position() const { return _position; } |
|
|
|
|
|
|
|
|
|
|
|
@ -758,7 +761,6 @@ class GlfwApplication::MouseScrollEvent: public GlfwApplication::InputEvent { |
|
|
|
friend GlfwApplication; |
|
|
|
friend GlfwApplication; |
|
|
|
|
|
|
|
|
|
|
|
public: |
|
|
|
public: |
|
|
|
|
|
|
|
|
|
|
|
/** @brief Scroll offset */ |
|
|
|
/** @brief Scroll offset */ |
|
|
|
constexpr Vector2d offset() const { return _offset; } |
|
|
|
constexpr Vector2d offset() const { return _offset; } |
|
|
|
|
|
|
|
|
|
|
|
|