summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/graphics/gui/rpgfont_wider.pngbin3161 -> 3166 bytes
-rw-r--r--src/graphics.cpp12
-rw-r--r--src/graphics.h2
-rw-r--r--src/gui/chargedialog.cpp7
-rw-r--r--src/gui/chargedialog.h2
-rw-r--r--src/gui/chat.cpp8
-rw-r--r--src/gui/chat.h5
-rw-r--r--src/gui/gui.cpp2
-rw-r--r--src/gui/popupmenu.cpp20
-rw-r--r--src/gui/popupmenu.h5
-rw-r--r--src/gui/updatewindow.cpp25
-rw-r--r--src/gui/window.cpp17
-rw-r--r--src/gui/window.h1
13 files changed, 40 insertions, 66 deletions
diff --git a/data/graphics/gui/rpgfont_wider.png b/data/graphics/gui/rpgfont_wider.png
index e068ec1c..081cf5e1 100644
--- a/data/graphics/gui/rpgfont_wider.png
+++ b/data/graphics/gui/rpgfont_wider.png
Binary files differ
diff --git a/src/graphics.cpp b/src/graphics.cpp
index dc6d0e75..16b8f67b 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -35,7 +35,7 @@ Graphics::Graphics():
mouseCursor(NULL)
{
if (useOpenGL) {
- #ifdef USE_OPENGL
+#ifdef USE_OPENGL
// Setup OpenGL
glViewport(0, 0, 800, 600);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
@@ -43,17 +43,17 @@ Graphics::Graphics():
SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &gotDoubleBuffer);
logger->log("Using OpenGL %s double buffering.",
(gotDoubleBuffer ? "with" : "without"));
-
+
setTargetPlane(800, 600);
- #endif
+#endif
}
else {
- #ifndef USE_OPENGL
+#ifndef USE_OPENGL
setTarget(SDL_GetVideoSurface());
- #endif
+#endif
}
- if (config.getValue("cursor", 1)==1)
+ if (config.getValue("cursor", 1) == 1)
{
// Hide the system mouse cursor
SDL_ShowCursor(SDL_DISABLE);
diff --git a/src/graphics.h b/src/graphics.h
index 279a611a..78d4a3e6 100644
--- a/src/graphics.h
+++ b/src/graphics.h
@@ -26,8 +26,10 @@
#include <guichan/sdl.hpp>
#include <SDL.h>
+#ifdef USE_OPENGL
#include <guichan/opengl.hpp>
#include <SDL_opengl.h>
+#endif
#include "resources/image.h"
extern SDL_Surface *screen;
diff --git a/src/gui/chargedialog.cpp b/src/gui/chargedialog.cpp
index 726e73ff..25f4297e 100644
--- a/src/gui/chargedialog.cpp
+++ b/src/gui/chargedialog.cpp
@@ -46,7 +46,7 @@ void ChargeDialog::action(const std::string& eventId)
}
// update the dialog
-void ChargeDialog::draw(gcn::Graphics *graphics)
+void ChargeDialog::logic()
{
// calculate time since the last attack was made
char_info->lastAttackTime += .01; // this a hack until someone explains
@@ -54,6 +54,7 @@ void ChargeDialog::draw(gcn::Graphics *graphics)
if(char_info->lastAttackTime > 1){char_info->lastAttackTime=1;}
// reset the progress bar to display accurate time since attack
- progBar->setProgress(char_info->lastAttackTime);
- Window::draw(graphics);
+ progBar->setProgress(char_info->lastAttackTime);
+
+ Window::logic();
}
diff --git a/src/gui/chargedialog.h b/src/gui/chargedialog.h
index e544a602..92eb1dd4 100644
--- a/src/gui/chargedialog.h
+++ b/src/gui/chargedialog.h
@@ -51,7 +51,7 @@ class ChargeDialog : public Window, public gcn::ActionListener
// action listener
void action(const std::string&);
- void draw(gcn::Graphics *graphics);
+ void logic();
};
extern ChargeDialog* chargeDialog;
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index ce5593f9..1a7eca65 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -53,7 +53,7 @@ ChatWindow::ChatWindow(const std::string &logfile):
scrollArea->getBorderSize(), scrollArea->getBorderSize());
scrollArea->setScrollPolicy(
gcn::ScrollArea::SHOW_NEVER, gcn::ScrollArea::SHOW_ALWAYS);
- //scrollArea->setOpaque(false);
+ scrollArea->setOpaque(false);
add(scrollArea);
add(chatInput);
@@ -151,12 +151,6 @@ void ChatWindow::chat_log(CHATSKILL action)
chat_log(const_msg(action), BY_SERVER);
}
-void ChatWindow::draw(gcn::Graphics *graphics)
-{
- // Draw the window border/background and children
- Window::draw(graphics);
-}
-
void ChatWindow::action(const std::string& eventId)
{
if (eventId == "chatinput")
diff --git a/src/gui/chat.h b/src/gui/chat.h
index 28c3ab0c..34e9c027 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -133,11 +133,6 @@ class ChatWindow : public Window, public gcn::ActionListener,
*/
void chat_log(CHATSKILL);
- /*
- * Draws the chat box.
- */
- void draw(gcn::Graphics *graphics);
-
/**
* Performs action.
*/
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 81e6c5df..37e5daff 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -118,7 +118,7 @@ Gui::Gui(Graphics *graphics)
catch (gcn::Exception e)
{
try {
- guiFont = new gcn::ImageFont(
+ speechFont = new gcn::ImageFont(
"data/graphics/gui/rpgfont_wider.png",
" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789.,!?-+/():;%&`'*#=[]\"<>{}^~|_@&\\"
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 36c246a6..5e8294a1 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -34,6 +34,7 @@ PopupMenu::PopupMenu():
{
setResizable(false);
setTitleBarHeight(0);
+ title = false;
browserBox = new BrowserBox();
browserBox->setPosition(4, 4);
@@ -120,25 +121,6 @@ void PopupMenu::showPopup(int mx, int my)
setVisible(true);
}
-void PopupMenu::draw(gcn::Graphics* graphics)
-{
- int x, y;
- getAbsolutePosition(x, y);
-
- ((Graphics*) graphics)->drawImageRect(x, y, getWidth(), getHeight(),
- border);
-
- if (mContent != NULL)
- {
- graphics->pushClipArea(getContentDimension());
- graphics->pushClipArea(gcn::Rectangle(
- 0, 0, mContent->getWidth(), mContent->getHeight()));
- mContent->draw(graphics);
- graphics->popClipArea();
- graphics->popClipArea();
- }
-}
-
void PopupMenu::handleLink(const std::string& link)
{
// Talk To action
diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h
index c21d4758..bb68852b 100644
--- a/src/gui/popupmenu.h
+++ b/src/gui/popupmenu.h
@@ -58,11 +58,6 @@ class PopupMenu : public Window, public LinkHandler
void showPopup(int mx, int my);
/**
- * Draws updated popup menu
- */
- void draw(gcn::Graphics* graphics);
-
- /**
* Handles link action.
*/
void handleLink(const std::string& link);
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index 7ad9b175..15c7afb3 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -117,14 +117,17 @@ int updateProgress(void *ptr,
labelString << (char *)ptr << " (" << (int)(progress*100) << "%)";
updaterWindow->setLabel(labelString.str());
updaterWindow->setProgress(progress);
- if(state!=UPDATE) {
+
+ if (state != UPDATE) {
// If the action was canceled return an error code to stop the thread
return -1;
}
+
return 0;
}
-int downloadThread(void *ptr) {
+int downloadThread(void *ptr)
+{
CURL *curl;
CURLcode res;
FILE *outfile;
@@ -134,7 +137,7 @@ int downloadThread(void *ptr) {
logger->log("Downloading: %s", url.c_str());
curl = curl_easy_init();
- if(curl)
+ if (curl)
{
downloadComplete = false;
progress = 0.0f;
@@ -142,7 +145,7 @@ int downloadThread(void *ptr) {
outfile = fopen(fileName.c_str(), "wb");
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile);
- curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE);
+ curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, updateProgress);
curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, ptr);
@@ -152,17 +155,23 @@ int downloadThread(void *ptr) {
curl_easy_cleanup(curl);
downloadComplete = true;
}
+
+ return 0;
}
-int download(std::string url) {
+int download(std::string url)
+{
thread = SDL_CreateThread(downloadThread, (void *)url.c_str());
- if ( thread == NULL ) {
+
+ if (thread == NULL) {
logger->log("Unable to create thread");
- return 0;
}
+
+ return 0;
}
-void updateData() {
+void updateData()
+{
updaterWindow = new UpdaterWindow();
state = UPDATE;
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index aa8569f2..fdbeb699 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -34,6 +34,7 @@ Window::Window(const std::string& caption, bool modal, Window *parent):
gcn::Window(caption),
parent(parent),
snapSize(8),
+ title(true),
modal(modal),
resizable(false),
mMouseResize(false),
@@ -128,18 +129,12 @@ void Window::draw(gcn::Graphics* graphics)
border);
// Draw title
- graphics->setFont(getFont());
- graphics->drawText(getCaption(), 7, 5, gcn::Graphics::LEFT);
-
- if (mContent != NULL)
- {
- graphics->pushClipArea(getContentDimension());
- graphics->pushClipArea(gcn::Rectangle(
- 0, 0, mContent->getWidth(), mContent->getHeight()));
- mContent->draw(graphics);
- graphics->popClipArea();
- graphics->popClipArea();
+ if (title) {
+ graphics->setFont(getFont());
+ graphics->drawText(getCaption(), 7, 5, gcn::Graphics::LEFT);
}
+
+ drawContent(graphics);
}
void Window::setContentWidth(int width)
diff --git a/src/gui/window.h b/src/gui/window.h
index 0a089b49..7441c804 100644
--- a/src/gui/window.h
+++ b/src/gui/window.h
@@ -155,6 +155,7 @@ class Window : public gcn::Window, public ConfigListener
gcn::Container *chrome; /**< Contained container */
Window *parent; /**< The parent window */
int snapSize; /**< Snap distance to window edge */
+ bool title; /**< Window has a title bar */
bool modal; /**< Window is modal */
bool resizable; /**< Window can be resized */