From b3a5e36c738a3b153aef41c8a9fcfebdc32518d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 19 Aug 2012 12:53:36 +0200 Subject: [PATCH] Doc++, code cleanup. --- src/Contexts/AbstractXContext.h | 27 +++++++++++++++++++-------- src/Contexts/GlutContext.h | 32 +++++++++++++++++++++++--------- src/Contexts/Sdl2Context.h | 9 ++++++--- 3 files changed, 48 insertions(+), 20 deletions(-) diff --git a/src/Contexts/AbstractXContext.h b/src/Contexts/AbstractXContext.h index c8cca51fb..4e7d13fb6 100644 --- a/src/Contexts/AbstractXContext.h +++ b/src/Contexts/AbstractXContext.h @@ -32,7 +32,7 @@ namespace Magnum { namespace Contexts { -/** +/** @nosubgrouping @brief Base for X11-based contexts Supports keyboard and mouse handling. @@ -82,7 +82,11 @@ class AbstractXContext: public AbstractContext { /** @{ @name Keyboard handling */ public: - /** @brief Key */ + /** + * @brief Key + * + * @see keyPressEvent(), keyReleaseEvent() + */ enum class Key: KeySym { Up = XK_Up, /**< Up arrow */ Down = XK_Down, /**< Down arrow */ @@ -177,7 +181,11 @@ class AbstractXContext: public AbstractContext { /** @{ @name Mouse handling */ public: - /** @brief Mouse button */ + /** + * @brief Mouse button + * + * @see mousePressEvent(), mouseReleaseEvent() + */ enum class MouseButton: unsigned int { Left = Button1, /**< Left button */ Middle = Button2, /**< Middle button */ @@ -189,6 +197,8 @@ class AbstractXContext: public AbstractContext { protected: /** * @brief Mouse press event + * @param button Button pressed + * @param position Cursor position * * Called when mouse button is pressed. Default implementation does * nothing. @@ -197,6 +207,8 @@ class AbstractXContext: public AbstractContext { /** * @brief Mouse release event + * @param button Button released + * @param position Cursor position * * Called when mouse button is released. Default implementation does * nothing. @@ -218,11 +230,10 @@ class AbstractXContext: public AbstractContext { bool _redraw; }; -inline void AbstractXContext::keyPressEvent(AbstractXContext::Key, const Math::Vector2&) {} -inline void AbstractXContext::keyReleaseEvent(AbstractXContext::Key, const Math::Vector2&) {} -inline void AbstractXContext::mousePressEvent(AbstractXContext::MouseButton, const Math::Vector2&) {} -inline void AbstractXContext::mouseReleaseEvent(AbstractXContext::MouseButton, const Math::Vector2&) {} - +inline void AbstractXContext::keyPressEvent(Key, const Math::Vector2&) {} +inline void AbstractXContext::keyReleaseEvent(Key, const Math::Vector2&) {} +inline void AbstractXContext::mousePressEvent(MouseButton, const Math::Vector2&) {} +inline void AbstractXContext::mouseReleaseEvent(MouseButton, const Math::Vector2&) {} }} diff --git a/src/Contexts/GlutContext.h b/src/Contexts/GlutContext.h index 17a3c921c..73e32569f 100644 --- a/src/Contexts/GlutContext.h +++ b/src/Contexts/GlutContext.h @@ -60,7 +60,8 @@ class GlutContext: public AbstractContext { * @brief Viewport event * * 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& size) = 0; @@ -68,8 +69,9 @@ class GlutContext: public AbstractContext { * @brief Draw event * * Here implement your drawing functions, such as calling - * Camera::draw(). After drawing is finished, call swapBuffers(). If - * you want to draw immediately again, call also redraw(). + * SceneGraph::Camera::draw(). After drawing is finished, call + * swapBuffers(). If you want to draw immediately again, call also + * redraw(). */ virtual void drawEvent() = 0; @@ -97,7 +99,11 @@ class GlutContext: public AbstractContext { /** @{ @name Keyboard handling */ public: - /** @brief Key */ + /** + * @brief Key + * + * @see keyPressEvent() + */ enum class Key: int { Up = GLUT_KEY_UP, /**< Up arrow */ Down = GLUT_KEY_DOWN, /**< Down arrow */ @@ -136,7 +142,11 @@ class GlutContext: public AbstractContext { /** @{ @name Mouse handling */ public: - /** @brief Mouse button */ + /** + * @brief Mouse button + * + * @see mousePressEvent(), mouseReleaseEvent() + */ enum class MouseButton: int { Left = GLUT_LEFT_BUTTON, /**< Left button */ Middle = GLUT_MIDDLE_BUTTON, /**< Middle button */ @@ -145,7 +155,11 @@ class GlutContext: public AbstractContext { WheelDown = 4 /**< Wheel down */ }; - /** @brief Mouse cursor */ + /** + * @brief Mouse cursor + * + * @see setMouseCursor() + */ enum class MouseCursor: int { Default = GLUT_CURSOR_INHERIT, /**< Default cursor provided by parent window */ None = GLUT_CURSOR_NONE /**< No cursor */ @@ -231,9 +245,9 @@ class GlutContext: public AbstractContext { }; /* Implementations for inline functions with unused parameters */ -inline void GlutContext::keyPressEvent(GlutContext::Key, const Math::Vector2&) {} -inline void GlutContext::mousePressEvent(GlutContext::MouseButton, const Math::Vector2&) {} -inline void GlutContext::mouseReleaseEvent(GlutContext::MouseButton, const Math::Vector2&) {} +inline void GlutContext::keyPressEvent(Key, const Math::Vector2&) {} +inline void GlutContext::mousePressEvent(MouseButton, const Math::Vector2&) {} +inline void GlutContext::mouseReleaseEvent(MouseButton, const Math::Vector2&) {} inline void GlutContext::mouseMotionEvent(const Math::Vector2&) {} }} diff --git a/src/Contexts/Sdl2Context.h b/src/Contexts/Sdl2Context.h index fb4b00a22..da4024055 100644 --- a/src/Contexts/Sdl2Context.h +++ b/src/Contexts/Sdl2Context.h @@ -79,6 +79,7 @@ class Sdl2Context: public AbstractContext { public: /** * @brief Key + * * @see keyPressEvent(), keyReleaseEvent() */ enum class Key: SDL_Keycode { @@ -111,6 +112,7 @@ class Sdl2Context: public AbstractContext { public: /** * @brief Mouse button + * * @see mouseEvent() */ enum class MouseButton: Uint8 { @@ -121,6 +123,7 @@ class Sdl2Context: public AbstractContext { /** * @brief Mouse state + * * @see mouseEvent() */ enum class MouseState: Uint8 { @@ -169,9 +172,9 @@ class Sdl2Context: public AbstractContext { }; /* Implementations for inline functions with unused parameters */ -inline void Sdl2Context::keyPressEvent(Sdl2Context::Key, Uint8) {} -inline void Sdl2Context::keyReleaseEvent(Sdl2Context::Key) {} -inline void Sdl2Context::mouseEvent(Sdl2Context::MouseButton, Sdl2Context::MouseState, const Math::Vector2&) {} +inline void Sdl2Context::keyPressEvent(Key, Uint8) {} +inline void Sdl2Context::keyReleaseEvent(Key) {} +inline void Sdl2Context::mouseEvent(MouseButton, MouseState, const Math::Vector2&) {} inline void Sdl2Context::mouseWheelEvent(const Math::Vector2&) {} inline void Sdl2Context::mouseMotionEvent(const Math::Vector2&, const Math::Vector2&) {}