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 {
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 */
display = XOpenDisplay(0);
@ -105,6 +105,7 @@ int AbstractXContext::exec() {
if(size != viewportSize) {
viewportSize = size;
viewportEvent(size);
_redraw = true;
}
} break;
@ -124,7 +125,10 @@ int AbstractXContext::exec() {
}
}
drawEvent();
if(_redraw) {
_redraw = false;
drawEvent();
} else Corrade::Utility::sleep(5);
}
return 0;

6
src/Contexts/AbstractXContext.h

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

Loading…
Cancel
Save