ui and graphics changes

* implement draw clipping using opengl stencil buffers
* allow to create Widgets by style name with g_ui.createWidgetByStyle
* styles can now have children widgets
* make proper use of the isNotPathable in pathfinding
* add scrollbar skin
This commit is contained in:
Eduardo Bart
2012-03-24 12:22:40 -03:00
parent efa9811342
commit de0008caf1
34 changed files with 210 additions and 86 deletions

View File

@@ -49,6 +49,7 @@ void Graphics::init()
#endif
glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
m_emptyTexture = TexturePtr(new Texture);
@@ -113,6 +114,29 @@ void Graphics::endRender()
{
}
void Graphics::beginClipping(const Rect& clipRect)
{
// setup stencil buffer for writing
glClear(GL_STENCIL_BUFFER_BIT);
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_ALWAYS, 1, 1);
glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
// draw the clipping area into the stencil buffer
glColorMask(0, 0, 0, 0);
g_painter.drawFilledRect(clipRect);
// set stencil buffer for clippig
glColorMask(1, 1, 1, 1);
glStencilFunc(GL_EQUAL, 1, 1);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
}
void Graphics::endClipping()
{
glDisable(GL_STENCIL_TEST);
}
void Graphics::setViewportSize(const Size& size)
{
glViewport(0, 0, size.width(), size.height());

View File

@@ -44,6 +44,9 @@ public:
void beginRender();
void endRender();
void beginClipping(const Rect& clipRect);
void endClipping();
void setViewportSize(const Size& size);
int getMaxTextureSize();