Fixed a crash bug related to sounds.

unloadFonts() is no longer called during re-initialization.
This commit is contained in:
Aloshi 2012-10-25 18:23:26 -05:00
parent 5b0166d294
commit bd41892cfd
6 changed files with 9 additions and 15 deletions

View file

@ -1,6 +1,7 @@
October 25
-Added gameImageNotFound tag for an image to display if a game image is not found/defined.
-Fixed keyboard not skipping joystick input configuration.
-Fixed a nasty crash bug with sounds. Always initialize your variables, kids!
October 17
-Added GuiAnimation class which animates its children.

View file

@ -8,7 +8,9 @@
#include <ft2build.h>
#include FT_FREETYPE_H
//A TrueType Font renderer that uses FreeType and OpenGL. initLibrary() MUST be called before using it.
//A TrueType Font renderer that uses FreeType and OpenGL.
//Subclass of GuiComponent to catch ::onInit and ::onDeinit.
//The library is automatically initialized when it's needed.
class Font : GuiComponent
{
public:

View file

@ -59,8 +59,7 @@ namespace Renderer {
Font* fonts[3] = {NULL, NULL, NULL};
//this is never really used, but is here "just in case"
void unloadFonts()
/*void unloadFonts()
{
std::cout << "unloading fonts...";
@ -73,12 +72,13 @@ namespace Renderer {
loadedFonts = false;
std::cout << "done.\n";
}
}*/
//creates the default fonts (which shouldn't ever be deleted)
void loadFonts()
{
if(loadedFonts)
unloadFonts();
return;
std::cout << "loading fonts...";

View file

@ -199,8 +199,6 @@ namespace Renderer
if(!createdSurface)
return false;
Font::initLibrary();
glViewport(0, 0, display_width, display_height);
glOrthof(0, display_width, display_height, 0, -1.0, 1.0);
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
@ -210,12 +208,9 @@ namespace Renderer
return true;
}
void unloadFonts(); //defined in Renderer_draw_gl.cpp
void deinit()
{
onDeinit();
//unloadFonts();
destroySurface();
}
};

View file

@ -79,8 +79,6 @@ namespace Renderer
if(!createdSurface)
return false;
//Font::initLibrary();
glViewport(0, 0, display_width, display_height);
glOrtho(0, display_width, display_height, 0, -1.0, 1.0);
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
@ -90,12 +88,9 @@ namespace Renderer
return true;
}
void unloadFonts(); //defined in Renderer_draw_gl.cpp
void deinit()
{
onDeinit();
//unloadFonts();
destroySurface();
}
};

View file

@ -5,6 +5,7 @@
Sound::Sound(std::string path)
{
mSound = NULL;
mChannel = -1;
AudioManager::registerSound(this);