Browse Source

Implemented AbstractXContext::redraw().

pull/279/head
Vladimír Vondruš 14 years ago
parent
commit
0ca0f03f1c
  1. 8
      src/Contexts/AbstractXContext.cpp
  2. 6
      src/Contexts/AbstractXContext.h

8
src/Contexts/AbstractXContext.cpp

@ -26,7 +26,7 @@ using namespace std;
namespace Magnum { namespace Contexts { namespace Magnum { namespace Contexts {
AbstractXContext::AbstractXContext(AbstractGlInterface<Display*, VisualID, Window>* glInterface, int&, char**, const string& title, const Math::Vector2<GLsizei>& size): glInterface(glInterface), viewportSize(size) { AbstractXContext::AbstractXContext(AbstractGlInterface<Display*, VisualID, Window>* glInterface, int&, char**, const string& title, const Math::Vector2<GLsizei>& size): glInterface(glInterface), viewportSize(size), _redraw(true) {
/* Get default X display */ /* Get default X display */
display = XOpenDisplay(0); display = XOpenDisplay(0);
@ -105,6 +105,7 @@ int AbstractXContext::exec() {
if(size != viewportSize) { if(size != viewportSize) {
viewportSize = size; viewportSize = size;
viewportEvent(size); viewportEvent(size);
_redraw = true;
} }
} break; } break;
@ -124,7 +125,10 @@ int AbstractXContext::exec() {
} }
} }
drawEvent(); if(_redraw) {
_redraw = false;
drawEvent();
} else Corrade::Utility::sleep(5);
} }
return 0; return 0;

6
src/Contexts/AbstractXContext.h

@ -74,8 +74,8 @@ class AbstractXContext: public AbstractContext {
/** @copydoc GlutContext::swapBuffers() */ /** @copydoc GlutContext::swapBuffers() */
inline void swapBuffers() { glInterface->swapBuffers(); } inline void swapBuffers() { glInterface->swapBuffers(); }
/** @todo implement */ /** @copydoc GlutContext::redraw() */
inline void redraw() {} inline void redraw() { _redraw = true; }
/*@}*/ /*@}*/
@ -214,6 +214,8 @@ class AbstractXContext: public AbstractContext {
/** @todo Get this from the created window */ /** @todo Get this from the created window */
Math::Vector2<GLsizei> viewportSize; Math::Vector2<GLsizei> viewportSize;
bool _redraw;
}; };
inline void AbstractXContext::keyPressEvent(AbstractXContext::Key, const Math::Vector2<int>&) {} inline void AbstractXContext::keyPressEvent(AbstractXContext::Key, const Math::Vector2<int>&) {}

Loading…
Cancel
Save