Fixed UTF8 text rendering in Guichan

This commit is contained in:
pelya
2014-11-06 21:26:10 +02:00
parent 088f43c8c8
commit d65b899ec6
6 changed files with 333 additions and 330 deletions

View File

@@ -23,7 +23,7 @@ InhibitSuspend=n
# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir - # If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir -
# these files are put inside .apk package by build system # these files are put inside .apk package by build system
# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS # Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS
AppDataDownloadUrl="data file|files.zip" AppDataDownloadUrl="!!data file|files.zip"
# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only # Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only
# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32) # with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32)
@@ -161,7 +161,7 @@ StartupMenuButtonTimeout=3000
# Menu items to hide from startup menu, available menu items: # Menu items to hide from startup menu, available menu items:
# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout # SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout
HiddenMenuOptions='' HiddenMenuOptions='SettingsMenuMisc.OptionalDownloadConfig'
# Menu items to show at startup - this is Java code snippet, leave empty for default # Menu items to show at startup - this is Java code snippet, leave empty for default
# new SettingsMenuMisc.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new SettingsMenuMouse.DisplaySizeConfig(true) : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(true), new SettingsMenuMisc.GyroscopeCalibration() # new SettingsMenuMisc.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new SettingsMenuMouse.DisplaySizeConfig(true) : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(true), new SettingsMenuMisc.GyroscopeCalibration()
@@ -171,7 +171,7 @@ FirstStartMenuOptions=''
# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices, # Enable multi-ABI binary, with hardware FPU support - it will also work on old devices,
# but .apk size is 2x bigger (y) / (n) / (x86) / (all) # but .apk size is 2x bigger (y) / (n) / (x86) / (all)
MultiABI=all MultiABI='armeabi-v7a'
# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower # Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower
AppMinimumRAM=256 AppMinimumRAM=256
@@ -191,7 +191,7 @@ DeleteFilesOnUpgrade="%"
# Optional shared libraries to compile - removing some of them will save space # Optional shared libraries to compile - removing some of them will save space
# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed # MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed
# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2 # Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2
CompiledLibraries="sdl_image guichan" CompiledLibraries="sdl_image sdl_ttf guichan"
# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n) # Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n)
CustomBuildScript=n CustomBuildScript=n

View File

@@ -1,23 +1,23 @@
<container name="top" width="640" height="480"> <container name="top" width="640" height="480">
<label name="logo_text" caption="Simple example of using XmlGui" /> <label name="logo_text" caption="Simple example of using XmlGui АбВгЁ" />
<button x="5" y="20" name="exit" caption="Please click to exit" /> <button x="5" y="20" name="exit" caption="Please click to exit АбВгЁ" />
<icon name="logo" x="250" y="160" image="darkbitslogo_by_haiko.bmp" /> <icon name="logo" x="250" y="160" image="darkbitslogo_by_haiko.bmp" />
<dropdown name="dp" x="100" y="100"> <dropdown name="dp" x="100" y="100">
<li>Item 1</li> <li>Item 1</li>
<li>Item 2</li> <li>Item 2</li>
<li>Item 3</li> <li>Item 3</li>
</dropdown> </dropdown>
<listbox name="lb" x="200" y="100"> <listbox name="lb" x="200" y="100">
<li>Item 1</li> <li>Item 1</li>
<li>Item 2</li> <li>Item 2</li>
<li>Item 3</li> <li>Item 3</li>
</listbox> </listbox>
<textfield name="tf" text="simple text" x="5" y="300" /> <textfield name="tf" text="simple text" x="5" y="300" />
<scrollarea name="sc" x="300" y="5" width="100" height="100"> <scrollarea name="sc" x="300" y="5" width="100" height="100">
<textbox name="tb" text="simple textbox <textbox name="tb" text="simple textbox
ddjdjd" /> ddjdjd" />
</scrollarea> </scrollarea>
<window name="wnd" caption="Drag me!" x="100" y="200"> <window name="wnd" caption="Drag me!" x="100" y="200">
<icon name="logo_in_wnd" x="0" y="0" image="darkbitslogo_by_haiko.bmp" /> <icon name="logo_in_wnd" x="0" y="0" image="darkbitslogo_by_haiko.bmp" />
</window> </window>
</container> </container>

View File

@@ -1,120 +1,122 @@
/* /*
* Code that sets up an SDL application with Guichan using the * Code that sets up an SDL application with Guichan using the
* Guichan SDL back end. * Guichan SDL back end.
*/ */
#include <guichan.hpp> #include <guichan.hpp>
#include <guichan/sdl.hpp> #include <guichan/sdl.hpp>
#include <guichan/contrib/sdl/sdltruetypefont.hpp>
namespace sdl
{ namespace sdl
bool running = true; {
SDL_Surface* screen; bool running = true;
SDL_Surface* screen;
// All back ends contain objects to make Guichan work on a
// specific target - in this case SDL - and they are a Graphics // All back ends contain objects to make Guichan work on a
// object to make Guichan able to draw itself using SDL, an // specific target - in this case SDL - and they are a Graphics
// input objec to make Guichan able to get user input using SDL // object to make Guichan able to draw itself using SDL, an
// and an ImageLoader object to make Guichan able to load images // input objec to make Guichan able to get user input using SDL
// using SDL. // and an ImageLoader object to make Guichan able to load images
gcn::SDLGraphics* graphics; // using SDL.
gcn::SDLInput* input; gcn::SDLGraphics* graphics;
gcn::SDLImageLoader* imageLoader; gcn::SDLInput* input;
gcn::SDLImageLoader* imageLoader;
/**
* Initialises the SDL application. This function creates the global /**
* Gui object that can be populated by various examples. * Initialises the SDL application. This function creates the global
*/ * Gui object that can be populated by various examples.
void init() */
{ void init()
// We simply initialise SDL as we would do with any SDL application. {
SDL_Init(SDL_INIT_VIDEO); // We simply initialise SDL as we would do with any SDL application.
screen = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE); SDL_Init(SDL_INIT_VIDEO);
// We want unicode for the SDLInput object to function properly. screen = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE);
SDL_EnableUNICODE(1); // We want unicode for the SDLInput object to function properly.
// We also want to enable key repeat. SDL_EnableUNICODE(1);
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); // We also want to enable key repeat.
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
// Now it's time to initialise the Guichan SDL back end. TTF_Init();
imageLoader = new gcn::SDLImageLoader(); // Now it's time to initialise the Guichan SDL back end.
// The ImageLoader Guichan should use needs to be passed to the Image object
// using a static function. imageLoader = new gcn::SDLImageLoader();
gcn::Image::setImageLoader(imageLoader); // The ImageLoader Guichan should use needs to be passed to the Image object
graphics = new gcn::SDLGraphics(); // using a static function.
// The Graphics object needs a target to draw to, in this case it's the gcn::Image::setImageLoader(imageLoader);
// screen surface, but any surface will do, it doesn't have to be the screen. graphics = new gcn::SDLGraphics();
graphics->setTarget(screen); // The Graphics object needs a target to draw to, in this case it's the
input = new gcn::SDLInput(); // screen surface, but any surface will do, it doesn't have to be the screen.
graphics->setTarget(screen);
// Now we create the Gui object to be used with this SDL application. input = new gcn::SDLInput();
globals::gui = new gcn::Gui();
// The Gui object needs a Graphics to be able to draw itself and an Input // Now we create the Gui object to be used with this SDL application.
// object to be able to check for user input. In this case we provide the globals::gui = new gcn::Gui();
// Gui object with SDL implementations of these objects hence making Guichan // The Gui object needs a Graphics to be able to draw itself and an Input
// able to utilise SDL. // object to be able to check for user input. In this case we provide the
globals::gui->setGraphics(graphics); // Gui object with SDL implementations of these objects hence making Guichan
globals::gui->setInput(input); // able to utilise SDL.
} globals::gui->setGraphics(graphics);
globals::gui->setInput(input);
/** }
* Halts the SDL application.
*/ /**
void halt() * Halts the SDL application.
{ */
delete globals::gui; void halt()
{
delete imageLoader; delete globals::gui;
delete input;
delete graphics; delete imageLoader;
delete input;
SDL_Quit(); delete graphics;
}
SDL_Quit();
/** }
* Runs the SDL application.
*/ /**
void run() * Runs the SDL application.
{ */
// The main loop void run()
while(running) {
{ // The main loop
// Check user input while(running)
SDL_Event event; {
while(SDL_PollEvent(&event)) // Check user input
{ SDL_Event event;
if (event.type == SDL_KEYDOWN) while(SDL_PollEvent(&event))
{ {
if (event.key.keysym.sym == SDLK_ESCAPE) if (event.type == SDL_KEYDOWN)
{ {
running = false; if (event.key.keysym.sym == SDLK_ESCAPE)
} {
if (event.key.keysym.sym == SDLK_f) running = false;
{ }
if (event.key.keysym.mod & KMOD_CTRL) if (event.key.keysym.sym == SDLK_f)
{ {
// Works with X11 only if (event.key.keysym.mod & KMOD_CTRL)
SDL_WM_ToggleFullScreen(screen); {
} // Works with X11 only
} SDL_WM_ToggleFullScreen(screen);
} }
else if(event.type == SDL_QUIT) }
{ }
running = false; else if(event.type == SDL_QUIT)
} {
running = false;
// After we have manually checked user input with SDL for }
// any attempt by the user to halt the application we feed
// the input to Guichan by pushing the input to the Input // After we have manually checked user input with SDL for
// object. // any attempt by the user to halt the application we feed
input->pushInput(event); // the input to Guichan by pushing the input to the Input
} // object.
// Now we let the Gui object perform its logic. input->pushInput(event);
globals::gui->logic(); }
// Now we let the Gui object draw itself. // Now we let the Gui object perform its logic.
globals::gui->draw(); globals::gui->logic();
// Finally we update the screen. // Now we let the Gui object draw itself.
SDL_Flip(screen); globals::gui->draw();
} // Finally we update the screen.
} SDL_Flip(screen);
} }
}
}

View File

@@ -1,182 +1,183 @@
/** /**
* Code to populate a global Gui object with all the widgets * Code to populate a global Gui object with all the widgets
* of Guichan. * of Guichan.
*/ */
namespace widgets namespace widgets
{ {
gcn::ImageFont* font; gcn::Font* font;
gcn::Container* top; gcn::Container* top;
gcn::Label* label; gcn::Label* label;
gcn::Icon* icon; gcn::Icon* icon;
gcn::Button* button; gcn::Button* button;
gcn::TextField* textField; gcn::TextField* textField;
gcn::TextBox* textBox; gcn::TextBox* textBox;
gcn::ScrollArea* textBoxScrollArea; gcn::ScrollArea* textBoxScrollArea;
gcn::ListBox* listBox; gcn::ListBox* listBox;
gcn::DropDown* dropDown; gcn::DropDown* dropDown;
gcn::CheckBox* checkBox1; gcn::CheckBox* checkBox1;
gcn::CheckBox* checkBox2; gcn::CheckBox* checkBox2;
gcn::RadioButton* radioButton1; gcn::RadioButton* radioButton1;
gcn::RadioButton* radioButton2; gcn::RadioButton* radioButton2;
gcn::RadioButton* radioButton3; gcn::RadioButton* radioButton3;
gcn::Slider* slider; gcn::Slider* slider;
gcn::Image *image; gcn::Image *image;
gcn::Window *window; gcn::Window *window;
gcn::Image *darkbitsImage; gcn::Image *darkbitsImage;
gcn::Icon* darkbitsIcon; gcn::Icon* darkbitsIcon;
gcn::TabbedArea* tabbedArea; gcn::TabbedArea* tabbedArea;
gcn::Button* tabOneButton; gcn::Button* tabOneButton;
gcn::CheckBox* tabTwoCheckBox; gcn::CheckBox* tabTwoCheckBox;
/* /*
* List boxes and drop downs need an instance of a list model * List boxes and drop downs need an instance of a list model
* in order to display a list. * in order to display a list.
*/ */
class DemoListModel : public gcn::ListModel class DemoListModel : public gcn::ListModel
{ {
public: public:
int getNumberOfElements() int getNumberOfElements()
{ {
return 5; return 5;
} }
std::string getElementAt(int i) std::string getElementAt(int i)
{ {
switch(i) switch(i)
{ {
case 0: case 0:
return std::string("zero"); return std::string("zero");
case 1: case 1:
return std::string("one"); return std::string("one");
case 2: case 2:
return std::string("two"); return std::string("two");
case 3: case 3:
return std::string("three"); return std::string("three");
case 4: case 4:
return std::string("four"); return std::string("four");
default: // Just to keep warnings away default: // Just to keep warnings away
return std::string(""); return std::string("");
} }
} }
}; };
DemoListModel demoListModel; DemoListModel demoListModel;
/** /**
* Initialises the widgets example by populating the global Gui * Initialises the widgets example by populating the global Gui
* object. * object.
*/ */
void init() void init()
{ {
// We first create a container to be used as the top widget. // We first create a container to be used as the top widget.
// The top widget in Guichan can be any kind of widget, but // The top widget in Guichan can be any kind of widget, but
// in order to make the Gui contain more than one widget we // in order to make the Gui contain more than one widget we
// make the top widget a container. // make the top widget a container.
top = new gcn::Container(); top = new gcn::Container();
// We set the dimension of the top container to match the screen. // We set the dimension of the top container to match the screen.
top->setDimension(gcn::Rectangle(0, 0, 640, 480)); top->setDimension(gcn::Rectangle(0, 0, 640, 480));
// Finally we pass the top widget to the Gui object. // Finally we pass the top widget to the Gui object.
globals::gui->setTop(top); globals::gui->setTop(top);
// Now we load the font used in this example. // Now we load the font used in this example.
font = new gcn::ImageFont("fixedfont.bmp", " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); //font = new gcn::ImageFont("fixedfont.bmp", " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
// Widgets may have a global font so we don't need to pass the font = new gcn::contrib::SDLTrueTypeFont("Roboto-Bold.ttf", 10);
// font object to every created widget. The global font is static. // Widgets may have a global font so we don't need to pass the
gcn::Widget::setGlobalFont(font); // font object to every created widget. The global font is static.
gcn::Widget::setGlobalFont(font);
// Now we create the widgets
// Now we create the widgets
label = new gcn::Label("Label");
label = new gcn::Label("Label");
image = gcn::Image::load("gui-chan.bmp");
icon = new gcn::Icon(image); image = gcn::Image::load("gui-chan.bmp");
icon = new gcn::Icon(image);
button = new gcn::Button("Button");
button = new gcn::Button("Button");
textField = new gcn::TextField("Text field");
textField = new gcn::TextField("Text field АбВгЁ");
textBox = new gcn::TextBox("Multiline\nText box");
textBoxScrollArea = new gcn::ScrollArea(textBox); textBox = new gcn::TextBox("Multiline\nText box\nАбВгЁ");
textBoxScrollArea->setWidth(200); textBoxScrollArea = new gcn::ScrollArea(textBox);
textBoxScrollArea->setHeight(100); textBoxScrollArea->setWidth(200);
textBoxScrollArea->setFrameSize(1); textBoxScrollArea->setHeight(100);
textBoxScrollArea->setFrameSize(1);
listBox = new gcn::ListBox(&demoListModel);
listBox->setFrameSize(1); listBox = new gcn::ListBox(&demoListModel);
dropDown = new gcn::DropDown(&demoListModel); listBox->setFrameSize(1);
dropDown = new gcn::DropDown(&demoListModel);
checkBox1 = new gcn::CheckBox("Checkbox 1");
checkBox2 = new gcn::CheckBox("Checkbox 2"); checkBox1 = new gcn::CheckBox("Checkbox 1");
checkBox2 = new gcn::CheckBox("Checkbox 2");
radioButton1 = new gcn::RadioButton("RadioButton 1", "radiogroup", true);
radioButton2 = new gcn::RadioButton("RadioButton 2", "radiogroup"); radioButton1 = new gcn::RadioButton("RadioButton 1 АбВгЁ", "radiogroup", true);
radioButton3 = new gcn::RadioButton("RadioButton 3", "radiogroup"); radioButton2 = new gcn::RadioButton("RadioButton 2 АбВгЁ", "radiogroup");
radioButton3 = new gcn::RadioButton("RadioButton 3 АбВгЁ", "radiogroup");
slider = new gcn::Slider(0, 10);
slider->setSize(100, 10); slider = new gcn::Slider(0, 10);
slider->setSize(100, 10);
window = new gcn::Window("I am a window Drag me");
window->setBaseColor(gcn::Color(255, 150, 200, 190)); window = new gcn::Window("I am a window Drag me АбВгЁ");
window->setBaseColor(gcn::Color(255, 150, 200, 190));
darkbitsImage = gcn::Image::load("darkbitslogo_by_haiko.bmp");
darkbitsIcon = new gcn::Icon(darkbitsImage); darkbitsImage = gcn::Image::load("darkbitslogo_by_haiko.bmp");
window->add(darkbitsIcon); darkbitsIcon = new gcn::Icon(darkbitsImage);
window->resizeToContent(); window->add(darkbitsIcon);
window->resizeToContent();
tabbedArea = new gcn::TabbedArea();
tabbedArea->setSize(200, 100); tabbedArea = new gcn::TabbedArea();
tabOneButton = new gcn::Button("A button in tab 1"); tabbedArea->setSize(200, 100);
tabbedArea->addTab("Tab 1", tabOneButton); tabOneButton = new gcn::Button("A button in tab 1 АбВгЁ");
tabTwoCheckBox = new gcn::CheckBox("A check box in tab 2"); tabbedArea->addTab("Tab 1 АбВгЁ", tabOneButton);
tabbedArea->addTab("Tab 2", tabTwoCheckBox); tabTwoCheckBox = new gcn::CheckBox("A check box in tab 2 АбВгЁ");
tabbedArea->addTab("Tab 2 АбВгЁ", tabTwoCheckBox);
// Now it's time to add the widgets to the top container
// so they will be conected to the GUI. // Now it's time to add the widgets to the top container
// so they will be conected to the GUI.
top->add(label, 10, 10);
top->add(icon, 10, 30); top->add(label, 10, 10);
top->add(button, 200, 10); top->add(icon, 10, 30);
top->add(textField, 250, 10); top->add(button, 200, 10);
top->add(textBoxScrollArea, 200, 50); top->add(textField, 250, 10);
top->add(listBox, 200, 200); top->add(textBoxScrollArea, 200, 50);
top->add(dropDown, 500, 10); top->add(listBox, 200, 200);
top->add(checkBox1, 500, 130); top->add(dropDown, 500, 10);
top->add(checkBox2, 500, 150); top->add(checkBox1, 500, 130);
top->add(radioButton1, 500, 200); top->add(checkBox2, 500, 150);
top->add(radioButton2, 500, 220); top->add(radioButton1, 500, 200);
top->add(radioButton3, 500, 240); top->add(radioButton2, 500, 220);
top->add(slider, 500, 300); top->add(radioButton3, 500, 240);
top->add(window, 50, 350); top->add(slider, 500, 300);
top->add(tabbedArea, 400, 350); top->add(window, 50, 350);
} top->add(tabbedArea, 400, 350);
}
/**
* Halts the widgets example. /**
*/ * Halts the widgets example.
void halt() */
{ void halt()
delete font; {
delete top; delete font;
delete label; delete top;
delete icon; delete label;
delete button; delete icon;
delete textField; delete button;
delete textBox; delete textField;
delete textBoxScrollArea; delete textBox;
delete listBox; delete textBoxScrollArea;
delete dropDown; delete listBox;
delete checkBox1; delete dropDown;
delete checkBox2; delete checkBox1;
delete radioButton1; delete checkBox2;
delete radioButton2; delete radioButton1;
delete radioButton3; delete radioButton2;
delete slider; delete radioButton3;
delete window; delete slider;
delete darkbitsIcon; delete window;
delete darkbitsImage; delete darkbitsIcon;
delete tabbedArea; delete darkbitsImage;
delete tabOneButton; delete tabbedArea;
delete tabTwoCheckBox; delete tabOneButton;
} delete tabTwoCheckBox;
} }
}

View File

@@ -121,11 +121,11 @@ namespace gcn
SDL_Surface *textSurface; SDL_Surface *textSurface;
if (mAntiAlias) if (mAntiAlias)
{ {
textSurface = TTF_RenderText_Blended(mFont, text.c_str(), sdlCol); textSurface = TTF_RenderUTF8_Blended(mFont, text.c_str(), sdlCol);
} }
else else
{ {
textSurface = TTF_RenderText_Solid(mFont, text.c_str(), sdlCol); textSurface = TTF_RenderUTF8_Solid(mFont, text.c_str(), sdlCol);
} }
SDL_Rect dst, src; SDL_Rect dst, src;