Browse Source

Doc++, code cleanup.

vectorfields
Vladimír Vondruš 14 years ago
parent
commit
b3a5e36c73
  1. 27
      src/Contexts/AbstractXContext.h
  2. 32
      src/Contexts/GlutContext.h
  3. 9
      src/Contexts/Sdl2Context.h

27
src/Contexts/AbstractXContext.h

@ -32,7 +32,7 @@
namespace Magnum { namespace Contexts { namespace Magnum { namespace Contexts {
/** /** @nosubgrouping
@brief Base for X11-based contexts @brief Base for X11-based contexts
Supports keyboard and mouse handling. Supports keyboard and mouse handling.
@ -82,7 +82,11 @@ class AbstractXContext: public AbstractContext {
/** @{ @name Keyboard handling */ /** @{ @name Keyboard handling */
public: public:
/** @brief Key */ /**
* @brief Key
*
* @see keyPressEvent(), keyReleaseEvent()
*/
enum class Key: KeySym { enum class Key: KeySym {
Up = XK_Up, /**< Up arrow */ Up = XK_Up, /**< Up arrow */
Down = XK_Down, /**< Down arrow */ Down = XK_Down, /**< Down arrow */
@ -177,7 +181,11 @@ class AbstractXContext: public AbstractContext {
/** @{ @name Mouse handling */ /** @{ @name Mouse handling */
public: public:
/** @brief Mouse button */ /**
* @brief Mouse button
*
* @see mousePressEvent(), mouseReleaseEvent()
*/
enum class MouseButton: unsigned int { enum class MouseButton: unsigned int {
Left = Button1, /**< Left button */ Left = Button1, /**< Left button */
Middle = Button2, /**< Middle button */ Middle = Button2, /**< Middle button */
@ -189,6 +197,8 @@ class AbstractXContext: public AbstractContext {
protected: protected:
/** /**
* @brief Mouse press event * @brief Mouse press event
* @param button Button pressed
* @param position Cursor position
* *
* Called when mouse button is pressed. Default implementation does * Called when mouse button is pressed. Default implementation does
* nothing. * nothing.
@ -197,6 +207,8 @@ class AbstractXContext: public AbstractContext {
/** /**
* @brief Mouse release event * @brief Mouse release event
* @param button Button released
* @param position Cursor position
* *
* Called when mouse button is released. Default implementation does * Called when mouse button is released. Default implementation does
* nothing. * nothing.
@ -218,11 +230,10 @@ class AbstractXContext: public AbstractContext {
bool _redraw; bool _redraw;
}; };
inline void AbstractXContext::keyPressEvent(AbstractXContext::Key, const Math::Vector2<int>&) {} inline void AbstractXContext::keyPressEvent(Key, const Math::Vector2<int>&) {}
inline void AbstractXContext::keyReleaseEvent(AbstractXContext::Key, const Math::Vector2<int>&) {} inline void AbstractXContext::keyReleaseEvent(Key, const Math::Vector2<int>&) {}
inline void AbstractXContext::mousePressEvent(AbstractXContext::MouseButton, const Math::Vector2<int>&) {} inline void AbstractXContext::mousePressEvent(MouseButton, const Math::Vector2<int>&) {}
inline void AbstractXContext::mouseReleaseEvent(AbstractXContext::MouseButton, const Math::Vector2<int>&) {} inline void AbstractXContext::mouseReleaseEvent(MouseButton, const Math::Vector2<int>&) {}
}} }}

32
src/Contexts/GlutContext.h

@ -60,7 +60,8 @@ class GlutContext: public AbstractContext {
* @brief Viewport event * @brief Viewport event
* *
* Called when viewport size changes. You should pass the new size to * Called when viewport size changes. You should pass the new size to
* Camera::viewport() function of your camera. * Framebuffer::setViewport() or SceneGraph::Camera::setViewport(),
* if using scene graph.
*/ */
virtual void viewportEvent(const Math::Vector2<GLsizei>& size) = 0; virtual void viewportEvent(const Math::Vector2<GLsizei>& size) = 0;
@ -68,8 +69,9 @@ class GlutContext: public AbstractContext {
* @brief Draw event * @brief Draw event
* *
* Here implement your drawing functions, such as calling * Here implement your drawing functions, such as calling
* Camera::draw(). After drawing is finished, call swapBuffers(). If * SceneGraph::Camera::draw(). After drawing is finished, call
* you want to draw immediately again, call also redraw(). * swapBuffers(). If you want to draw immediately again, call also
* redraw().
*/ */
virtual void drawEvent() = 0; virtual void drawEvent() = 0;
@ -97,7 +99,11 @@ class GlutContext: public AbstractContext {
/** @{ @name Keyboard handling */ /** @{ @name Keyboard handling */
public: public:
/** @brief Key */ /**
* @brief Key
*
* @see keyPressEvent()
*/
enum class Key: int { enum class Key: int {
Up = GLUT_KEY_UP, /**< Up arrow */ Up = GLUT_KEY_UP, /**< Up arrow */
Down = GLUT_KEY_DOWN, /**< Down arrow */ Down = GLUT_KEY_DOWN, /**< Down arrow */
@ -136,7 +142,11 @@ class GlutContext: public AbstractContext {
/** @{ @name Mouse handling */ /** @{ @name Mouse handling */
public: public:
/** @brief Mouse button */ /**
* @brief Mouse button
*
* @see mousePressEvent(), mouseReleaseEvent()
*/
enum class MouseButton: int { enum class MouseButton: int {
Left = GLUT_LEFT_BUTTON, /**< Left button */ Left = GLUT_LEFT_BUTTON, /**< Left button */
Middle = GLUT_MIDDLE_BUTTON, /**< Middle button */ Middle = GLUT_MIDDLE_BUTTON, /**< Middle button */
@ -145,7 +155,11 @@ class GlutContext: public AbstractContext {
WheelDown = 4 /**< Wheel down */ WheelDown = 4 /**< Wheel down */
}; };
/** @brief Mouse cursor */ /**
* @brief Mouse cursor
*
* @see setMouseCursor()
*/
enum class MouseCursor: int { enum class MouseCursor: int {
Default = GLUT_CURSOR_INHERIT, /**< Default cursor provided by parent window */ Default = GLUT_CURSOR_INHERIT, /**< Default cursor provided by parent window */
None = GLUT_CURSOR_NONE /**< No cursor */ None = GLUT_CURSOR_NONE /**< No cursor */
@ -231,9 +245,9 @@ class GlutContext: public AbstractContext {
}; };
/* Implementations for inline functions with unused parameters */ /* Implementations for inline functions with unused parameters */
inline void GlutContext::keyPressEvent(GlutContext::Key, const Math::Vector2<int>&) {} inline void GlutContext::keyPressEvent(Key, const Math::Vector2<int>&) {}
inline void GlutContext::mousePressEvent(GlutContext::MouseButton, const Math::Vector2<int>&) {} inline void GlutContext::mousePressEvent(MouseButton, const Math::Vector2<int>&) {}
inline void GlutContext::mouseReleaseEvent(GlutContext::MouseButton, const Math::Vector2<int>&) {} inline void GlutContext::mouseReleaseEvent(MouseButton, const Math::Vector2<int>&) {}
inline void GlutContext::mouseMotionEvent(const Math::Vector2<int>&) {} inline void GlutContext::mouseMotionEvent(const Math::Vector2<int>&) {}
}} }}

9
src/Contexts/Sdl2Context.h

@ -79,6 +79,7 @@ class Sdl2Context: public AbstractContext {
public: public:
/** /**
* @brief Key * @brief Key
*
* @see keyPressEvent(), keyReleaseEvent() * @see keyPressEvent(), keyReleaseEvent()
*/ */
enum class Key: SDL_Keycode { enum class Key: SDL_Keycode {
@ -111,6 +112,7 @@ class Sdl2Context: public AbstractContext {
public: public:
/** /**
* @brief Mouse button * @brief Mouse button
*
* @see mouseEvent() * @see mouseEvent()
*/ */
enum class MouseButton: Uint8 { enum class MouseButton: Uint8 {
@ -121,6 +123,7 @@ class Sdl2Context: public AbstractContext {
/** /**
* @brief Mouse state * @brief Mouse state
*
* @see mouseEvent() * @see mouseEvent()
*/ */
enum class MouseState: Uint8 { enum class MouseState: Uint8 {
@ -169,9 +172,9 @@ class Sdl2Context: public AbstractContext {
}; };
/* Implementations for inline functions with unused parameters */ /* Implementations for inline functions with unused parameters */
inline void Sdl2Context::keyPressEvent(Sdl2Context::Key, Uint8) {} inline void Sdl2Context::keyPressEvent(Key, Uint8) {}
inline void Sdl2Context::keyReleaseEvent(Sdl2Context::Key) {} inline void Sdl2Context::keyReleaseEvent(Key) {}
inline void Sdl2Context::mouseEvent(Sdl2Context::MouseButton, Sdl2Context::MouseState, const Math::Vector2<int>&) {} inline void Sdl2Context::mouseEvent(MouseButton, MouseState, const Math::Vector2<int>&) {}
inline void Sdl2Context::mouseWheelEvent(const Math::Vector2<int>&) {} inline void Sdl2Context::mouseWheelEvent(const Math::Vector2<int>&) {}
inline void Sdl2Context::mouseMotionEvent(const Math::Vector2<int>&, const Math::Vector2<int>&) {} inline void Sdl2Context::mouseMotionEvent(const Math::Vector2<int>&, const Math::Vector2<int>&) {}

Loading…
Cancel
Save