summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/char_select.cpp2
-rw-r--r--src/gui/char_server.cpp2
-rw-r--r--src/gui/checkbox.cpp2
-rw-r--r--src/gui/equipment.cpp18
-rw-r--r--src/gui/gui.cpp5
-rw-r--r--src/gui/itemcontainer.cpp10
-rw-r--r--src/gui/login.cpp2
-rw-r--r--src/gui/minimap.cpp3
-rw-r--r--src/gui/playerbox.cpp6
-rw-r--r--src/gui/popupmenu.cpp3
-rw-r--r--src/gui/radiobutton.cpp2
-rw-r--r--src/gui/scrollarea.cpp3
-rw-r--r--src/gui/setup.cpp2
-rw-r--r--src/gui/slider.cpp9
-rw-r--r--src/gui/updatewindow.cpp2
-rw-r--r--src/gui/window.cpp3
16 files changed, 47 insertions, 27 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index e4db6fab..c2bba9bc 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -464,7 +464,7 @@ void charSelect()
gui->logic();
- login_wallpaper->draw(screen, 0, 0);
+ guiGraphics->drawImage(login_wallpaper, 0, 0);
gui->draw();
guiGraphics->updateScreen();
}
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index bc53b3d3..01b39135 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -146,7 +146,7 @@ void char_server() {
gui->logic();
- login_wallpaper->draw(screen, 0, 0);
+ guiGraphics->drawImage(login_wallpaper, 0, 0);
gui->draw();
guiGraphics->updateScreen();
}
diff --git a/src/gui/checkbox.cpp b/src/gui/checkbox.cpp
index 2df7a82b..052957ec 100644
--- a/src/gui/checkbox.cpp
+++ b/src/gui/checkbox.cpp
@@ -85,6 +85,6 @@ void CheckBox::drawBox(gcn::Graphics* graphics)
x += 2;
y += 2;
if (box != NULL) {
- box->draw(screen, x, y);
+ dynamic_cast<Graphics*>(graphics)->drawImage(box, x, y);
}
}
diff --git a/src/gui/equipment.cpp b/src/gui/equipment.cpp
index 33786c36..37623637 100644
--- a/src/gui/equipment.cpp
+++ b/src/gui/equipment.cpp
@@ -55,15 +55,16 @@ void EquipmentWindow::draw(gcn::Graphics *graphics)
{
int x, y;
getAbsolutePosition(x, y);
-
+
// Draw window graphics
Window::draw(graphics);
-
+
for (int i = 0; i < 8; i++) {
if (equipments[i].id > 0) {
- itemset->spriteset[itemDb->getItemInfo(
- equipments[i].id)->getImage() - 1]->draw(
- screen, x + 36 * (i % 4) + 10, y + 36 * (i / 4) + 25);
+ Image *image = itemset->spriteset[itemDb->getItemInfo(
+ equipments[i].id)->getImage() - 1];
+ dynamic_cast<Graphics*>(graphics)->drawImage(
+ image, x + 36 * (i % 4) + 10, y + 36 * (i / 4) + 25);
}
graphics->setColor(gcn::Color(0, 0, 0));
graphics->drawRectangle(gcn::Rectangle(10 + 36 * (i % 4),
@@ -72,8 +73,11 @@ void EquipmentWindow::draw(gcn::Graphics *graphics)
graphics->setColor(gcn::Color(0, 0, 0));
graphics->drawRectangle(gcn::Rectangle(160, 25, 32, 32));
if (arrows) {
- itemset->spriteset[itemDb->getItemInfo(arrows)->getImage() - 1]->draw(
- screen, x + 160, y + 25);
+ Image *image = itemset->spriteset[
+ itemDb->getItemInfo(arrows)->getImage() - 1];
+
+ dynamic_cast<Graphics*>(graphics)->drawImage(
+ image, x + 160, y + 25);
std::stringstream n;
n << arrowsNumber;
graphics->drawText(n.str(), 170, 62,
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index ce8f428b..cf98dde9 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -81,7 +81,8 @@ Gui::Gui(Graphics *graphics):
// Initialize top GUI widget
guiTop = new WindowContainer();
- guiTop->setDimension(gcn::Rectangle(0, 0, screen->w, screen->h));
+ guiTop->setDimension(gcn::Rectangle(0, 0,
+ graphics->getWidth(), graphics->getHeight()));
guiTop->setOpaque(false);
guiTop->addMouseListener(this);
Window::setWindowContainer(guiTop);
@@ -214,7 +215,7 @@ void Gui::draw()
if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS || button & SDL_BUTTON(1))
&& mCustomCursor)
{
- mMouseCursor->draw(screen, mouseX - 5, mouseY - 2);
+ guiGraphics->drawImage(mMouseCursor, mouseX - 5, mouseY - 2);
}
guiGraphics->popClipArea();
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp
index 0ccfc3db..534364dc 100644
--- a/src/gui/itemcontainer.cpp
+++ b/src/gui/itemcontainer.cpp
@@ -95,15 +95,17 @@ void ItemContainer::draw(gcn::Graphics* graphics)
// Draw selection image below selected item
if (selectedItem == i)
{
- selImg->draw(screen, x + itemX, y + itemY);
+ dynamic_cast<Graphics*>(graphics)->drawImage(
+ selImg, x + itemX, y + itemY);
}
// Draw item icon
if (itemDb->getItemInfo(items[i].id)->getImage() > 0)
{
- itemset->spriteset[itemDb->getItemInfo(
- items[i].id)->getImage() - 1]->draw(
- screen, x + itemX, y + itemY);
+ Image *image = itemset->spriteset[itemDb->getItemInfo(
+ items[i].id)->getImage() - 1];
+ dynamic_cast<Graphics*>(graphics)->drawImage(
+ image, x + itemX, y + itemY);
}
// Draw item caption
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index 9f3b230e..38bcf6b3 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -205,7 +205,7 @@ void login()
gui->logic();
- login_wallpaper->draw(screen, 0, 0);
+ guiGraphics->drawImage(login_wallpaper, 0, 0);
gui->draw();
guiGraphics->updateScreen();
}
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index 8ce7ffd7..98392adf 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -73,7 +73,8 @@ void Minimap::draw(gcn::Graphics *graphics)
if (mMapImage != NULL)
{
- mMapImage->draw(screen, x + getPadding(), y + getTitleBarHeight());
+ dynamic_cast<Graphics*>(graphics)->drawImage(
+ mMapImage, x + getPadding(), y + getTitleBarHeight());
}
std::list<Being*>::iterator bi;
diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp
index c62596fc..a94e7c4b 100644
--- a/src/gui/playerbox.cpp
+++ b/src/gui/playerbox.cpp
@@ -81,7 +81,8 @@ void PlayerBox::draw(gcn::Graphics *graphics)
getAbsolutePosition(x, y);
// Draw character
- playerset->spriteset[0]->draw(screen, x + 23, y + 23);
+ dynamic_cast<Graphics*>(graphics)->drawImage(
+ playerset->spriteset[0], x + 23, y + 23);
// Draw his hair
if (hairColor >= 0 && hairStyle >= 0 &&
@@ -89,7 +90,8 @@ void PlayerBox::draw(gcn::Graphics *graphics)
{
int hf = hairColor + 40 * (hairStyle);
if (hf >= 0 && hf < (int)hairset->spriteset.size()) {
- hairset->spriteset[hf]->draw(screen, x + 37, y + 5);
+ dynamic_cast<Graphics*>(graphics)->drawImage(
+ hairset->spriteset[hf], x + 37, y + 5);
}
}
}
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 5e8294a1..ea8034d8 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -29,6 +29,9 @@
#include "../resources/itemmanager.h"
#include <iostream>
+// TODO Remove this once setVisible doesn't need it anymore
+extern SDL_Surface *screen;
+
PopupMenu::PopupMenu():
Window()
{
diff --git a/src/gui/radiobutton.cpp b/src/gui/radiobutton.cpp
index 4b3a439e..7eae469f 100644
--- a/src/gui/radiobutton.cpp
+++ b/src/gui/radiobutton.cpp
@@ -82,6 +82,6 @@ void RadioButton::drawBox(gcn::Graphics* graphics)
x += 2;
y += 2;
if (box != NULL) {
- box->draw(screen, x, y);
+ dynamic_cast<Graphics*>(graphics)->drawImage(box, x, y);
}
}
diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp
index cfefe898..863f8a85 100644
--- a/src/gui/scrollarea.cpp
+++ b/src/gui/scrollarea.cpp
@@ -266,7 +266,8 @@ void ScrollArea::drawButton(gcn::Graphics *graphics, BUTTON_DIR dir)
break;
}
- buttons[dir][state]->draw(screen, x + dim.x, y + dim.y);
+ dynamic_cast<Graphics*>(graphics)->drawImage(
+ buttons[dir][state], x + dim.x, y + dim.y);
}
void ScrollArea::drawUpButton(gcn::Graphics *graphics)
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index a9421874..eb9121bc 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -34,6 +34,8 @@
#define SETUP_WIDTH 240
+extern SDL_Surface *screen;
+
ModeListModel::ModeListModel()
{
SDL_Rect **modes;
diff --git a/src/gui/slider.cpp b/src/gui/slider.cpp
index 6bbe1bed..2d4e6c78 100644
--- a/src/gui/slider.cpp
+++ b/src/gui/slider.cpp
@@ -108,15 +108,16 @@ void Slider::draw(gcn::Graphics *graphics)
y += (h - hStart->getHeight()) / 2;
- hStart->draw(screen, x, y);
+ dynamic_cast<Graphics*>(graphics)->drawImage(hStart, x, y);
w -= hStart->getWidth() + hEnd->getWidth();
x += hStart->getWidth();
- hMid->drawPattern(screen, x, y, w, hMid->getHeight());
+ dynamic_cast<Graphics*>(graphics)->drawImagePattern(
+ hMid, x, y, w, hMid->getHeight());
x += w;
- hEnd->draw(screen, x, y);
+ dynamic_cast<Graphics*>(graphics)->drawImage(hEnd, x, y);
drawMarker(graphics);
}
@@ -130,5 +131,5 @@ void Slider::drawMarker(gcn::Graphics *graphics)
x += getMarkerPosition();
y += (h - hGrip->getHeight()) / 2;
- hGrip->draw(screen, x, y);
+ dynamic_cast<Graphics*>(graphics)->drawImage(hGrip, x, y);
}
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index 044a1a5c..0dd34854 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -346,7 +346,7 @@ void updateData()
gui->logic();
- login_wallpaper->draw(screen, 0, 0);
+ guiGraphics->drawImage(login_wallpaper, 0, 0);
gui->draw();
guiGraphics->updateScreen();
}
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index fdbeb699..e6a55ea0 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -26,6 +26,9 @@
#include "../log.h"
#include "../main.h"
+// TODO Check if we can get rid of this
+extern SDL_Surface *screen;
+
WindowContainer *Window::windowContainer = NULL;
int Window::instances = 0;
ImageRect Window::border;