summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-04-18 15:53:56 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-04-18 15:53:56 +0000
commit708384a6b1fca22c6352deb79e52422266dc307e (patch)
tree99fc89b50c1cae19d053e8bd30723ba964792820
parent1f03c67e2c81c75d83053dbabb1afca646a35ad6 (diff)
downloadmana-client-708384a6b1fca22c6352deb79e52422266dc307e.tar.gz
mana-client-708384a6b1fca22c6352deb79e52422266dc307e.tar.bz2
mana-client-708384a6b1fca22c6352deb79e52422266dc307e.tar.xz
mana-client-708384a6b1fca22c6352deb79e52422266dc307e.zip
Ok, of course the biggest problem to solve with OpenGL integration is loading
and rendering of images.
-rw-r--r--ChangeLog2
-rw-r--r--INSTALL2
-rwxr-xr-xconfigure.ac2
-rw-r--r--src/being.cpp8
-rw-r--r--src/graphics.cpp27
-rw-r--r--src/gui/gui.cpp13
-rw-r--r--src/gui/gui.h2
-rw-r--r--src/gui/setup.cpp4
-rw-r--r--src/main.cpp51
-rw-r--r--src/main.h1
10 files changed, 62 insertions, 50 deletions
diff --git a/ChangeLog b/ChangeLog
index 7eb02df1..7475bfdc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,7 +16,7 @@
- Scrollbars are now fully skinned
- Sound samples are now loaded through resource manager
- Added "Register" button in login screen
-- Added warning message to use at leas 4 characters as user name
+- Added warning message to use at least 4 characters as user name
0.0.11.2 (8 April 2005)
- Damage text now floats upwards
diff --git a/INSTALL b/INSTALL
index 55ce7ca4..d8ea880a 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,7 +1,7 @@
How to compile and run TMW on your GNU/Linux Box
================================================
-Homepage: http://themanaworld.sourceforge.net/
+Homepage: http://themanaworld.org/
IRC: irc.freenode.net / #manaworld
1) Requirements
diff --git a/configure.ac b/configure.ac
index e9e609fa..41be8258 100755
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_PREREQ(2.59)
-AC_INIT([The Mana World], [0.0.11.2], [umperio@users.sourceforge.net], [tmw])
+AC_INIT([The Mana World], [0.0.12], [umperio@users.sourceforge.net], [tmw])
AC_CONFIG_HEADERS([config.h:config.h.in])
AC_LANG_CPLUSPLUS
diff --git a/src/being.cpp b/src/being.cpp
index d3e51a4d..70259cf3 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -137,8 +137,7 @@ void sort() {
}
Being::Being():
- speech_time(0), aspd(350),
- damage(""), damage_time(0),
+ damage(""),
id(0), job(0),
x(0), y(0), destX(0), destY(0), direction(0),
type(0), action(0), frame(0),
@@ -149,7 +148,10 @@ Being::Being():
text_x(0), text_y(0),
hair_style(1), hair_color(1),
weapon(0),
- showSpeech(false), showDamage(false)
+ speech_time(0),
+ damage_time(0),
+ showSpeech(false), showDamage(false),
+ aspd(350)
{
strcpy(name, "");
}
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 88ba744a..e0763c29 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -32,6 +32,16 @@ SDL_Surface *screen;
Graphics::Graphics():
mouseCursor(NULL)
{
+ if (useOpenGL) {
+ // Setup OpenGL
+ glViewport(0, 0, 800, 600);
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ int gotDoubleBuffer;
+ SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &gotDoubleBuffer);
+ logger.log("Using OpenGL %s double buffering.",
+ (gotDoubleBuffer ? "with" : "without"));
+ }
+
#ifdef USE_OPENGL
setTargetPlane(800, 600);
#else
@@ -125,12 +135,13 @@ void Graphics::updateScreen()
SDL_GetMouseState(&mouseX, &mouseY);
mouseCursor->draw(screen, mouseX - 5, mouseY - 2);
-#ifdef USE_OPENGL
- glFlush();
- glFinish();
- SDL_GL_SwapBuffers();
- glClear(GL_COLOR_BUFFER_BIT);
-#else
- SDL_Flip(screen);
-#endif
+ if (useOpenGL) {
+ glFlush();
+ glFinish();
+ SDL_GL_SwapBuffers();
+ glClear(GL_COLOR_BUFFER_BIT);
+ }
+ else {
+ SDL_Flip(screen);
+ }
}
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 436a5a1a..6a57f214 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -45,12 +45,13 @@ Gui::Gui(Graphics *graphics)
setInput(guiInput);
// Set image loader
-#ifndef USE_OPENGL
- imageLoader = new gcn::SDLImageLoader();
-#else
- hostImageLoader = new gcn::SDLImageLoader();
- imageLoader = new gcn::OpenGLImageLoader(hostImageLoader);
-#endif
+ if (useOpenGL) {
+ hostImageLoader = new gcn::SDLImageLoader();
+ imageLoader = new gcn::OpenGLImageLoader(hostImageLoader);
+ }
+ else {
+ imageLoader = new gcn::SDLImageLoader();
+ }
gcn::Image::setImageLoader(imageLoader);
// Initialize top GUI widget
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 66f7cb0f..f2d48c77 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -69,9 +69,7 @@ class Gui : public gcn::Gui, public gcn::MouseListener
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/setup.cpp b/src/gui/setup.cpp
index 87d4ef42..42b770f9 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -188,12 +188,12 @@ void Setup::action(const std::string &eventId)
if (eventId == "sfx")
{
config.setValue("sfxVolume", (int)sfxSlider->getValue());
- sound.setSfxVolume(sfxSlider->getValue());
+ sound.setSfxVolume((int)sfxSlider->getValue());
}
else if (eventId == "music")
{
config.setValue("musicVolume", (int)musicSlider->getValue());
- sound.setMusicVolume(musicSlider->getValue());
+ sound.setMusicVolume((int)musicSlider->getValue());
}
else if (eventId == "guialpha")
{
diff --git a/src/main.cpp b/src/main.cpp
index da90e701..9cbc2871 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -67,6 +67,7 @@ unsigned char state;
unsigned char screen_mode;
char *dir = NULL;
int displayFlags, screenW, screenH, bitDepth;
+bool useOpenGL = false;
Sound sound;
Music *bgm;
@@ -170,6 +171,7 @@ void init_engine()
config.setValue("host", "www.lindeijer.nl");
config.setValue("port", 6901);
config.setValue("hwaccel", 0);
+ config.setValue("opengl", 0);
config.setValue("screen", 0);
config.setValue("sound", 1);
config.setValue("guialpha", 0.8f);
@@ -193,29 +195,36 @@ void init_engine()
SDL_WM_SetCaption("The Mana World", NULL);
+#ifdef USE_OPENGL
+ useOpenGL = true;
+#else
+ useOpenGL = false;
+#endif
displayFlags = SDL_ANYFORMAT;
if ((int)config.getValue("screen", 0) == 1) {
displayFlags |= SDL_FULLSCREEN;
}
-#ifndef USE_OPENGL
- if ((int)config.getValue("hwaccel", 0)) {
- logger.log("Attempting to use hardware acceleration.");
- displayFlags |= SDL_HWSURFACE | SDL_DOUBLEBUF;
+
+ if (useOpenGL) {
+ displayFlags |= SDL_OPENGL;
+ SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
}
else {
- displayFlags |= SDL_SWSURFACE;
+ if ((int)config.getValue("hwaccel", 0)) {
+ logger.log("Attempting to use hardware acceleration.");
+ displayFlags |= SDL_HWSURFACE | SDL_DOUBLEBUF;
+ }
+ else {
+ displayFlags |= SDL_SWSURFACE;
+ }
}
-#else
- displayFlags |= SDL_OPENGL;
- SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
-#endif
// TODO: the following variables should be loaded from config file
- screenW = 800;
- screenH = 600;
- bitDepth = 16;
+ screenW = (int)config.getValue("screenwidth", 800);
+ screenH = (int)config.getValue("screenheight", 600);
+ bitDepth = (int)config.getValue("bitdepth", 16);
SDL_WM_SetIcon(IMG_Load("data/icons/tmw-icon.png"), NULL);
@@ -235,16 +244,6 @@ void init_engine()
logger.log("Using video driver: unkown");
}
-#ifdef USE_OPENGL
- // Setup OpenGL
- glViewport(0, 0, 800, 600);
- glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
- int gotDoubleBuffer;
- SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &gotDoubleBuffer);
- logger.log("OpenGL is %s double buffering.",
- (gotDoubleBuffer ? "using" : "not using"));
-#endif
-
const SDL_VideoInfo *vi = SDL_GetVideoInfo();
logger.log("Possible to create hardware surfaces: %s",
@@ -291,13 +290,13 @@ void init_engine()
gui = new Gui(graphics);
state = LOGIN;
- // initialize sound-engine and start playing intro-theme /-kth5
+ // Initialize sound engine
try {
if (config.getValue("sound", 0) == 1) {
sound.init();
- }
- sound.setSfxVolume(config.getValue("sfxVolume", 100));
- sound.setMusicVolume(config.getValue("musicVolume", 60));
+ }
+ sound.setSfxVolume(config.getValue("sfxVolume", 100));
+ sound.setMusicVolume(config.getValue("musicVolume", 60));
}
catch (const char *err) {
state = ERROR;
diff --git a/src/main.h b/src/main.h
index 8b77db97..d60e400a 100644
--- a/src/main.h
+++ b/src/main.h
@@ -103,5 +103,6 @@ extern Sound sound;
extern Map *tiledMap;
extern Logger logger;
extern int screenW, screenH, bitDepth, displayFlags;
+extern bool useOpenGL;
#endif