Add front drawing layer for UI

This commit is contained in:
Henrik Rydgard 2012-04-12 22:16:30 +02:00
parent 8656ec051c
commit 35ed4e02d1
2 changed files with 9 additions and 2 deletions

View File

@ -8,6 +8,7 @@
#include "gfx_es2/draw_buffer.h"
DrawBuffer ui_draw2d;
DrawBuffer ui_draw2d_front;
UIState uistate;
// Theme.
@ -18,7 +19,8 @@ static int themeCheckOnImage;
static int themeCheckOffImage;
void UIInit(const Atlas *atlas, int uiFont, int buttonImage, int checkOn, int checkOff) {
ui_draw2d.SetAtlas(atlas);
ui_draw2d.SetAtlas(atlas);
ui_draw2d_front.SetAtlas(atlas);
themeAtlas = atlas;
themeUIFont = uiFont;
themeButtonImage = buttonImage;
@ -53,6 +55,7 @@ bool UIRegionHit(int x, int y, int w, int h, int margin) {
void UIBegin() {
uistate.hotitem = 0;
ui_draw2d.Begin();
ui_draw2d_front.Begin();
}
void UIEnd() {
@ -63,7 +66,8 @@ void UIEnd() {
uistate.activeitem = -1;
}
}
ui_draw2d.End();
ui_draw2d.End();
ui_draw2d_front.End();
uistate.lastx = uistate.mousex;
uistate.lasty = uistate.mousey;

View File

@ -108,6 +108,7 @@ struct Atlas;
// This is the drawbuffer used for UI. Remember to flush it at the end of the frame.
// TODO: One should probably pass it in through UIInit.
extern DrawBuffer ui_draw2d;
extern DrawBuffer ui_draw2d_front; // for things that need to be on top of the rest
void UIInit(const Atlas *atlas, int uiFont, int buttonImage, int checkOn, int checkOff);
@ -189,4 +190,6 @@ int UIList(int id, int x, int y, int w, int h, UIListAdapter *adapter, UIListSta
// Do this afterwards (or similar):
// ShaderManager::SetUIProgram();
// ui_draw2d.Flush(ShaderManager::Program());
// ui_draw2d_front.Flush(ShaderManager::Program());
void UIEnd();