diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-07-13 09:50:11 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-07-13 09:50:11 +0000 |
commit | 360408fc4c04a72750ecfece7539260129b765ab (patch) | |
tree | d01bdddafa4dd0aa2cab4f3995dda1d0748cccee | |
parent | 6eb84fcfaf55c7e4baf13bfdff8f0a16a5b97d76 (diff) | |
download | mana-360408fc4c04a72750ecfece7539260129b765ab.tar.gz mana-360408fc4c04a72750ecfece7539260129b765ab.tar.bz2 mana-360408fc4c04a72750ecfece7539260129b765ab.tar.xz mana-360408fc4c04a72750ecfece7539260129b765ab.zip |
- Adding the wonderful new font by Bjorn to speech and player names
- Way to system cursor (now you can choose the original sdl cursor in config)
-rw-r--r-- | The Mana World.dev | 2 | ||||
-rw-r--r-- | data/graphics/gui/rpgfont_wider.png | bin | 0 -> 3161 bytes | |||
-rw-r--r-- | src/being.cpp | 1 | ||||
-rw-r--r-- | src/engine.cpp | 4 | ||||
-rw-r--r-- | src/graphics.cpp | 45 | ||||
-rw-r--r-- | src/graphics.h | 2 | ||||
-rw-r--r-- | src/gui/gui.cpp | 25 | ||||
-rw-r--r-- | src/gui/gui.h | 4 | ||||
-rw-r--r-- | src/main.cpp | 54 | ||||
-rw-r--r-- | src/main.h | 6 |
10 files changed, 87 insertions, 56 deletions
diff --git a/The Mana World.dev b/The Mana World.dev index 6deb34ac..653456ad 100644 --- a/The Mana World.dev +++ b/The Mana World.dev @@ -12,7 +12,7 @@ ResourceIncludes= MakeIncludes= Compiler=-Dmain=SDL_main_@@_ CppCompiler=-funroll-loops_@@_-ffast-math_@@_-fomit-frame-pointer_@@_-pipe_@@_-DUSE_OPENGL_@@_ -Linker=-lguichan_@@_-lguichan_sdl_@@_-lguichan_opengl_@@_-lwsock32_@@_-lSDL_image_@@_-lSDL_mixer_@@_-lmingw32_@@_-lSDLmain_@@_-lSDL_@@_-llibxml2_@@_-lopengl32_@@_-lz_@@_-lphysfs_@@_-lcurldll_@@_ +Linker=-lguichan_@@_-lguichan_sdl_@@_-lguichan_opengl_@@_-lwsock32_@@_-lSDL_image_@@_-lSDL_mixer_@@_-lmingw32_@@_-lSDLmain_@@_-lSDL_@@_-llibxml2_@@_-lopengl32_@@_-lz_@@_-lphysfs_@@_-lcurl_@@_ IsCpp=1 Icon=The Mana World.ico ExeOutput= diff --git a/data/graphics/gui/rpgfont_wider.png b/data/graphics/gui/rpgfont_wider.png Binary files differnew file mode 100644 index 00000000..e068ec1c --- /dev/null +++ b/data/graphics/gui/rpgfont_wider.png diff --git a/src/being.cpp b/src/being.cpp index d6d16b21..a6d700ea 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -346,6 +346,7 @@ void Being::drawSpeech(Graphics *graphics) { // Draw speech above this being if (showSpeech) { + graphics->setFont(speechFont); graphics->drawText(speech, text_x + 20, text_y - 60, gcn::Graphics::CENTER); diff --git a/src/engine.cpp b/src/engine.cpp index 85837235..11e653b7 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -431,10 +431,12 @@ void Engine::draw() sx * 32 + 5 + get_x_offset(being) - offset_x, sy * 32 - 65 + get_y_offset(being) - offset_y); } - + + graphics->setFont(speechFont); graphics->drawText(being->name, being->text_x + 15, being->text_y + 30, gcn::Graphics::CENTER); + graphics->setFont(gui->getFont()); } // Draw a warp diff --git a/src/graphics.cpp b/src/graphics.cpp index 42c9bddc..5fbea504 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -34,7 +34,6 @@ SDL_Surface *screen; Graphics::Graphics(): mouseCursor(NULL) { -#ifdef USE_OPENGL if (useOpenGL) { // Setup OpenGL glViewport(0, 0, 800, 600); @@ -43,23 +42,27 @@ Graphics::Graphics(): SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &gotDoubleBuffer); logger->log("Using OpenGL %s double buffering.", (gotDoubleBuffer ? "with" : "without")); + #ifdef USE_OPENGL + setTargetPlane(800, 600); + #endif } -#endif - -#ifdef USE_OPENGL - setTargetPlane(800, 600); -#else - setTarget(SDL_GetVideoSurface()); -#endif - - // Hide the system mouse cursor - SDL_ShowCursor(SDL_DISABLE); - - // Load the mouse cursor - ResourceManager *resman = ResourceManager::getInstance(); - mouseCursor = resman->getImage("graphics/gui/mouse.png"); - if (!mouseCursor) { - logger->error("Unable to load mouse cursor."); + else { + #ifndef USE_OPENGL + setTarget(SDL_GetVideoSurface()); + #endif + } + + if (config.getValue("cursor", 1)==1) + { + // Hide the system mouse cursor + SDL_ShowCursor(SDL_DISABLE); + + // Load the mouse cursor + ResourceManager *resman = ResourceManager::getInstance(); + mouseCursor = resman->getImage("graphics/gui/mouse.png"); + if (!mouseCursor) { + logger->error("Unable to load mouse cursor."); + } } // Initialize for drawing @@ -142,10 +145,11 @@ void Graphics::updateScreen() if (SDL_GetAppState() & SDL_APPMOUSEFOCUS || button & SDL_BUTTON(1)) { // Draw mouse before flipping - mouseCursor->draw(screen, mouseX - 5, mouseY - 2); + if (mouseCursor != NULL) { + mouseCursor->draw(screen, mouseX - 5, mouseY - 2); + } } -#ifdef USE_OPENGL if (useOpenGL) { glFlush(); glFinish(); @@ -154,9 +158,6 @@ void Graphics::updateScreen() else { SDL_Flip(screen); } -#else - SDL_Flip(screen); -#endif // Decrement frame counter when using framerate limiting if (framesToDraw > 1) framesToDraw--; diff --git a/src/graphics.h b/src/graphics.h index 78d4a3e6..279a611a 100644 --- a/src/graphics.h +++ b/src/graphics.h @@ -26,10 +26,8 @@ #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/gui.cpp b/src/gui/gui.cpp index 7643c01f..81e6c5df 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -43,6 +43,8 @@ WindowContainer *guiTop; // The top container gcn::ImageFont *hitRedFont; gcn::ImageFont *hitBlueFont; gcn::ImageFont *hitYellowFont; +// Font used to display speech and player names +gcn::ImageFont *speechFont; Gui::Gui(Graphics *graphics) { @@ -104,6 +106,29 @@ Gui::Gui(Graphics *graphics) logger->error("Unable to load sansserif8.png!"); } } + + // Set speech font + try { + speechFont = new gcn::ImageFont( + TMW_DATADIR "data/graphics/gui/rpgfont_wider.png", + " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789.,!?-+/():;%&`'*#=[]\"<>{}^~|_@&\\" + ); + } + catch (gcn::Exception e) + { + try { + guiFont = new gcn::ImageFont( + "data/graphics/gui/rpgfont_wider.png", + " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789.,!?-+/():;%&`'*#=[]\"<>{}^~|_@&\\" + ); + } + catch (gcn::Exception e) + { + logger->error("Unable to load rpgfont_wider.png!"); + } + } gcn::Widget::setGlobalFont(guiFont); diff --git a/src/gui/gui.h b/src/gui/gui.h index 42334ca1..dfd72ec7 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -95,5 +95,9 @@ extern gcn::SDLInput *guiInput; /**< GUI input */ extern gcn::ImageFont *hitRedFont; extern gcn::ImageFont *hitBlueFont; extern gcn::ImageFont *hitYellowFont; +/** + * Font used to display speech and player names + */ +extern gcn::ImageFont *speechFont; #endif diff --git a/src/main.cpp b/src/main.cpp index 2009be96..5fb543fc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -393,33 +393,37 @@ int download(const char *location) std::cout << "Downloading '" << location << "'" << std::endl; // init curl - curl_global_init(CURL_GLOBAL_ALL); + curl_global_init(CURL_GLOBAL_WIN32); // download file CURL *curl = curl_easy_init(); - - curl_easy_setopt(curl, CURLOPT_URL, location); - //curl_easy_setopt(curl, CURLOPT_NOPROGRESS, false); - //curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progressCallback); - //curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, NULL); - - //curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); + int ret = 0; + if (curl) + { + curl_easy_setopt(curl, CURLOPT_URL, "curl.haxx.se"); + std::cout << "Debug: setopt" << std::endl; + /*curl_easy_setopt(curl, CURLOPT_NOPROGRESS, false); + curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progressCallback); + curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, NULL); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);*/ - //int ret = curl_easy_perform(curl); - - curl_easy_cleanup(curl); - - + //ret = curl_easy_perform(curl); + std::cout << "Debug: perform" << std::endl; + curl_easy_cleanup(curl); + std::cout << "Debug: cleanup" << std::endl; + } + else { + ret = 1; + } + // cleanup curl curl_global_cleanup(); - fclose(fp); - - //if (ret != 0) + + if (ret != 0) std::cout << "Failed!" << std::endl; - //std::cout << " (" << ret << ")" << std::endl; + std::cout << " (" << ret << ")" << std::endl; - //return (ret == CURLE_OK) ? true : false; - return true; + return (ret == CURLE_OK) ? true : false; } /** Check to see if a file exists */ @@ -470,10 +474,8 @@ void update() std::cout << "Opening " << fullName << std::endl; - std::ifstream *in; - - in = new std::ifstream(fullName.c_str()); - if (in!=NULL && !in->is_open()) + std::ifstream in(fullName.c_str()); + if (!in.is_open()) { std::cout << "Error opening" << std::endl; delete updaterWindow; @@ -482,9 +484,9 @@ void update() std::string line; - while (!in->eof()) + while (!in.eof()) { - getline(*in, line); + getline(in, line); // check for XML tag (if it is XML tag it is error) if (line[0] == '<') { @@ -510,7 +512,7 @@ void update() PHYSFS_addToSearchPath(fullName.c_str(), 1); } } - in->close(); + in.close(); guiTop->remove(updaterWindow); delete updaterWindow; } @@ -26,6 +26,7 @@ #include "graphic/spriteset.h" #include "resources/image.h" +#include "configuration.h" #include "sound.h" #include <stdio.h> #include <memory> @@ -57,10 +58,6 @@ enum { #define LEN_USERNAME 25 #define LEN_PASSWORD 25 -#define N_SKILLS 100 // skill count constant value -#define XP_CONSTANT 1.2 // the exponent which determines skill exp curve - - extern Image *login_wallpaper; extern Spriteset *hairset, *playerset; extern char username[25]; @@ -75,5 +72,6 @@ extern Sound sound; extern int screenW, screenH, bitDepth, displayFlags; extern bool useOpenGL; extern char *homeDir; +extern Configuration config; #endif |