diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/char_select.cpp | 9 | ||||
-rw-r--r-- | src/gui/char_server.cpp | 12 | ||||
-rw-r--r-- | src/gui/gui.cpp | 15 | ||||
-rw-r--r-- | src/gui/gui.h | 3 | ||||
-rw-r--r-- | src/gui/login.cpp | 5 | ||||
-rw-r--r-- | src/gui/progressbar.cpp | 6 |
6 files changed, 36 insertions, 14 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index 9cf20f94..24fa9c86 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -450,13 +450,12 @@ void charSelect() sel->setPlayerInfo(char_info); } - // Draw background - login_wallpaper->draw(screen, 0, 0); - gui->logic(); - gui->draw(); - // Draw to screen + guiGraphics->_beginDraw(); + login_wallpaper->draw(screen, 0, 0); + gui->draw(); + guiGraphics->_endDraw(); guiGraphics->updateScreen(); } diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp index a0988b5a..6cc45f3d 100644 --- a/src/gui/char_server.cpp +++ b/src/gui/char_server.cpp @@ -126,14 +126,24 @@ void char_server() { case SDL_QUIT: state = EXIT; break; + + case SDL_KEYDOWN: + if (event.key.keysym.sym == SDLK_ESCAPE) + { + showServerList = false; + } + break; } guiInput->pushInput(event); } - login_wallpaper->draw(screen, 0, 0); gui->logic(); + + guiGraphics->_beginDraw(); + login_wallpaper->draw(screen, 0, 0); gui->draw(); + guiGraphics->_endDraw(); guiGraphics->updateScreen(); } diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index b64f6a98..6cc05910 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -41,7 +41,12 @@ Gui::Gui(Graphics *graphics): guiInput = new gcn::SDLInput(); // Set image loader +#ifndef USE_OPENGL imageLoader = new gcn::SDLImageLoader(); +#else + hostImageLoader = new gcn::SDLImageLoader(); + imageLoader = new gcn::OpenGLImageLoader(hostImageLoader); +#endif gcn::Image::setImageLoader(imageLoader); // Initialize top GUI widget @@ -67,6 +72,9 @@ Gui::~Gui() delete guiFont; delete guiTop; delete imageLoader; +#ifdef USE_OPENGL + delete hostImageLoader; +#endif delete guiInput; delete focusHandler; } @@ -148,16 +156,13 @@ void Gui::logic() void Gui::draw() { - guiGraphics->_beginDraw(); + //guiGraphics->_beginDraw(); guiGraphics->pushClipArea(guiTop->getDimension()); guiTop->draw(guiGraphics); guiGraphics->popClipArea(); - // Draw the mouse - //draw_sprite(buffer, mouse_sprite, mouse_x, mouse_y); - - guiGraphics->_endDraw(); + //guiGraphics->_endDraw(); } void Gui::focusNone() diff --git a/src/gui/gui.h b/src/gui/gui.h index cd37ae63..597cdb5c 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -75,6 +75,9 @@ class Gui private: gcn::Gui *gui; /**< The GUI system */ +#ifdef USE_OPENGL + gcn::ImageLoader *hostImageLoader; /**< For loading images in GL */ +#endif gcn::ImageLoader *imageLoader; /**< For loading images */ gcn::ImageFont *guiFont; /**< The global GUI font */ diff --git a/src/gui/login.cpp b/src/gui/login.cpp index 3c58cde9..5621f5b2 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -152,9 +152,12 @@ void login() { guiInput->pushInput(event); } - login_wallpaper->draw(screen, 0, 0); gui->logic(); + + guiGraphics->_beginDraw(); + login_wallpaper->draw(screen, 0, 0); gui->draw(); + guiGraphics->_endDraw(); guiGraphics->updateScreen(); } diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp index 09e05932..cc12c247 100644 --- a/src/gui/progressbar.cpp +++ b/src/gui/progressbar.cpp @@ -42,6 +42,7 @@ ProgressBar::ProgressBar(float progress, int x, int y, int width, unsigned char void ProgressBar::draw(gcn::Graphics *graphics) { +#ifndef USE_OPENGL int absx, absy; getAbsolutePosition(absx, absy); @@ -73,9 +74,10 @@ void ProgressBar::draw(gcn::Graphics *graphics) Temp = absx+X+int(float(Width)*progress)-2; if ( Temp < (absx+X+PROGRESSBAR_HEIGHT+1) ) Temp = absx+X+PROGRESSBAR_HEIGHT; DrawLine(screen, absx+X+PROGRESSBAR_HEIGHT+1, absy+Y+1, Temp, absy+Y+1, abs(Red-40), abs(Green-40), abs(Blue-40)); - DrawLine(screen, absx+X+PROGRESSBAR_HEIGHT, absy+Y+1, absx+X+2, absy+Y+PROGRESSBAR_HEIGHT-1, abs(Red-40), abs(Green-40), abs(Blue-40)); - + DrawLine(screen, absx+X+PROGRESSBAR_HEIGHT, absy+Y+1, absx+X+2, absy+Y+PROGRESSBAR_HEIGHT-1, abs(Red-40), abs(Green-40), abs(Blue-40)); + SDL_UnlockSurface(screen); +#endif } void ProgressBar::setProgress(float progress) |