mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-26 13:34:22 +01:00
Cleanup round 1
This commit is contained in:
parent
5b48ef1baf
commit
c483dc63bb
@ -23,13 +23,13 @@ namespace globals
|
|||||||
gcn::Gui* gui;
|
gcn::Gui* gui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Include code to set up a Guichan GUI with all the widgets
|
||||||
|
// of Guichan. The code populates the global Gui object.
|
||||||
|
#include "widgets.hpp"
|
||||||
// Include code to set up an SDL application with Guichan.
|
// Include code to set up an SDL application with Guichan.
|
||||||
// The sdl.hpp file is responsible for creating and deleting
|
// The sdl.hpp file is responsible for creating and deleting
|
||||||
// the global Gui object.
|
// the global Gui object.
|
||||||
#include "sdl.hpp"
|
#include "sdl.hpp"
|
||||||
// Include code to set up a Guichan GUI with all the widgets
|
|
||||||
// of Guichan. The code populates the global Gui object.
|
|
||||||
#include "widgets.hpp"
|
|
||||||
|
|
||||||
void gui_menu_receive_input(SDL_Event ev)
|
void gui_menu_receive_input(SDL_Event ev)
|
||||||
{
|
{
|
||||||
|
@ -7,8 +7,6 @@ namespace widgets
|
|||||||
{
|
{
|
||||||
gcn::ImageFont* font;
|
gcn::ImageFont* font;
|
||||||
gcn::Container* top;
|
gcn::Container* top;
|
||||||
gcn::Label* label;
|
|
||||||
gcn::Icon* icon;
|
|
||||||
gcn::Button* button;
|
gcn::Button* button;
|
||||||
gcn::TextField* textField;
|
gcn::TextField* textField;
|
||||||
gcn::TextBox* textBox;
|
gcn::TextBox* textBox;
|
||||||
@ -17,11 +15,6 @@ namespace widgets
|
|||||||
gcn::DropDown* dropDown;
|
gcn::DropDown* dropDown;
|
||||||
gcn::CheckBox* checkBox1;
|
gcn::CheckBox* checkBox1;
|
||||||
gcn::CheckBox* checkBox2;
|
gcn::CheckBox* checkBox2;
|
||||||
gcn::RadioButton* radioButton1;
|
|
||||||
gcn::RadioButton* radioButton2;
|
|
||||||
gcn::RadioButton* radioButton3;
|
|
||||||
gcn::Slider* slider;
|
|
||||||
gcn::Image *image;
|
|
||||||
gcn::Window *window;
|
gcn::Window *window;
|
||||||
gcn::Image *darkbitsImage;
|
gcn::Image *darkbitsImage;
|
||||||
gcn::Icon* darkbitsIcon;
|
gcn::Icon* darkbitsIcon;
|
||||||
@ -29,6 +22,20 @@ namespace widgets
|
|||||||
gcn::Button* tabOneButton;
|
gcn::Button* tabOneButton;
|
||||||
gcn::CheckBox* tabTwoCheckBox;
|
gcn::CheckBox* tabTwoCheckBox;
|
||||||
|
|
||||||
|
|
||||||
|
class BackgroundContainer : public gcn::Container, gcn::Icon
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
BackgroundContainer(const char *fn) : gcn::Icon(fn), gcn::Container()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void draw(gcn::Graphics *graphics)
|
||||||
|
{
|
||||||
|
graphics->drawImage(mImage, 0, 0);
|
||||||
|
this->drawChildren(graphics);
|
||||||
|
}
|
||||||
|
};
|
||||||
/*
|
/*
|
||||||
* 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.
|
||||||
@ -73,7 +80,7 @@ namespace widgets
|
|||||||
// 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 BackgroundContainer("data/menu_background.png");
|
||||||
// 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.
|
||||||
@ -86,12 +93,6 @@ namespace widgets
|
|||||||
gcn::Widget::setGlobalFont(font);
|
gcn::Widget::setGlobalFont(font);
|
||||||
|
|
||||||
// Now we create the widgets
|
// Now we create the widgets
|
||||||
|
|
||||||
label = new gcn::Label("Label");
|
|
||||||
|
|
||||||
image = gcn::Image::load("data/menu_background.png");
|
|
||||||
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");
|
||||||
@ -109,13 +110,6 @@ namespace widgets
|
|||||||
checkBox1 = new gcn::CheckBox("Checkbox 1");
|
checkBox1 = new gcn::CheckBox("Checkbox 1");
|
||||||
checkBox2 = new gcn::CheckBox("Checkbox 2");
|
checkBox2 = new gcn::CheckBox("Checkbox 2");
|
||||||
|
|
||||||
radioButton1 = new gcn::RadioButton("RadioButton 1", "radiogroup", true);
|
|
||||||
radioButton2 = new gcn::RadioButton("RadioButton 2", "radiogroup");
|
|
||||||
radioButton3 = new gcn::RadioButton("RadioButton 3", "radiogroup");
|
|
||||||
|
|
||||||
slider = new gcn::Slider(0, 10);
|
|
||||||
slider->setSize(100, 10);
|
|
||||||
|
|
||||||
window = new gcn::Window("I am a window Drag me");
|
window = new gcn::Window("I am a window Drag me");
|
||||||
window->setBaseColor(gcn::Color(255, 150, 200, 190));
|
window->setBaseColor(gcn::Color(255, 150, 200, 190));
|
||||||
|
|
||||||
@ -134,8 +128,6 @@ namespace widgets
|
|||||||
// Now it's time to add the widgets to the top container
|
// Now it's time to add the widgets to the top container
|
||||||
// so they will be conected to the GUI.
|
// so they will be conected to the GUI.
|
||||||
|
|
||||||
top->add(label, 10, 10);
|
|
||||||
top->add(icon, 10, 30);
|
|
||||||
top->add(button, 200, 10);
|
top->add(button, 200, 10);
|
||||||
top->add(textField, 250, 10);
|
top->add(textField, 250, 10);
|
||||||
top->add(textBoxScrollArea, 200, 50);
|
top->add(textBoxScrollArea, 200, 50);
|
||||||
@ -143,10 +135,6 @@ namespace widgets
|
|||||||
top->add(dropDown, 500, 10);
|
top->add(dropDown, 500, 10);
|
||||||
top->add(checkBox1, 500, 130);
|
top->add(checkBox1, 500, 130);
|
||||||
top->add(checkBox2, 500, 150);
|
top->add(checkBox2, 500, 150);
|
||||||
top->add(radioButton1, 500, 200);
|
|
||||||
top->add(radioButton2, 500, 220);
|
|
||||||
top->add(radioButton3, 500, 240);
|
|
||||||
top->add(slider, 500, 300);
|
|
||||||
top->add(window, 50, 350);
|
top->add(window, 50, 350);
|
||||||
top->add(tabbedArea, 400, 350);
|
top->add(tabbedArea, 400, 350);
|
||||||
}
|
}
|
||||||
@ -158,8 +146,6 @@ namespace widgets
|
|||||||
{
|
{
|
||||||
delete font;
|
delete font;
|
||||||
delete top;
|
delete top;
|
||||||
delete label;
|
|
||||||
delete icon;
|
|
||||||
delete button;
|
delete button;
|
||||||
delete textField;
|
delete textField;
|
||||||
delete textBox;
|
delete textBox;
|
||||||
@ -168,10 +154,6 @@ namespace widgets
|
|||||||
delete dropDown;
|
delete dropDown;
|
||||||
delete checkBox1;
|
delete checkBox1;
|
||||||
delete checkBox2;
|
delete checkBox2;
|
||||||
delete radioButton1;
|
|
||||||
delete radioButton2;
|
|
||||||
delete radioButton3;
|
|
||||||
delete slider;
|
|
||||||
delete window;
|
delete window;
|
||||||
delete darkbitsIcon;
|
delete darkbitsIcon;
|
||||||
delete darkbitsImage;
|
delete darkbitsImage;
|
||||||
|
Loading…
Reference in New Issue
Block a user