More mammoth cleanup in GUI code. Modal dialogs are now each is a separate file, and are in the now STK-specific paackage, not in the generic engine
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3765 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
85266dfe10
commit
9016d02b7e
@ -225,6 +225,14 @@ supertuxkart_SOURCES = \
|
||||
replay/replay_recorder.hpp \
|
||||
robots/default_robot.cpp \
|
||||
robots/default_robot.hpp \
|
||||
states_screens/dialogs/enter_player_name_dialog.cpp \
|
||||
states_screens/dialogs/enter_player_name_dialog.hpp \
|
||||
states_screens/dialogs/player_info_dialog.hpp \
|
||||
states_screens/dialogs/press_a_key_dialog.hpp \
|
||||
states_screens/dialogs/track_info_dialog.cpp \
|
||||
states_screens/dialogs/track_info_dialog.hpp \
|
||||
states_screens/dialogs/player_info_dialog.cpp \
|
||||
states_screens/dialogs/press_a_key_dialog.cpp \
|
||||
states_screens/credits.cpp \
|
||||
states_screens/credits.hpp \
|
||||
states_screens/kart_selection.cpp \
|
||||
|
@ -15,18 +15,8 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "config/player.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/modaldialog.hpp"
|
||||
#include "guiengine/widget.hpp"
|
||||
#include "input/input_manager.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
// FIXME : gui engine should not depend on the STK-specific implementation
|
||||
#include "states_screens/options_screen.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
|
||||
using namespace irr;
|
||||
|
||||
@ -106,469 +96,5 @@ ModalDialog* ModalDialog::getCurrent()
|
||||
void ModalDialog::onEnterPressedInternal()
|
||||
{
|
||||
}
|
||||
|
||||
#if 0
|
||||
#pragma mark -
|
||||
#pragma mark PressAKeyDialog
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
|
||||
PressAKeyDialog::PressAKeyDialog(const float w, const float h) :
|
||||
ModalDialog(w, h)
|
||||
{
|
||||
LabelWidget* widget = new LabelWidget();
|
||||
widget->m_properties[PROP_TEXT] = _("Press a key");
|
||||
widget->m_properties[PROP_TEXT_ALIGN] = "center";
|
||||
widget->x = 0;
|
||||
widget->y = 0;
|
||||
widget->w = m_area.getWidth();
|
||||
widget->h = m_area.getHeight()/2;
|
||||
widget->setParent(m_irrlicht_window);
|
||||
|
||||
m_children.push_back(widget);
|
||||
widget->add();
|
||||
|
||||
|
||||
IGUIFont* font = GUIEngine::getFont();
|
||||
const int textHeight = font->getDimension(L"X").Height;
|
||||
|
||||
ButtonWidget* widget2 = new ButtonWidget();
|
||||
widget2->m_properties[PROP_ID] = "cancel";
|
||||
widget2->m_properties[PROP_TEXT] = _("Press ESC to cancel");
|
||||
widget2->x = 15;
|
||||
widget2->y = m_area.getHeight() - textHeight - 12;
|
||||
widget2->w = m_area.getWidth() - 30;
|
||||
widget2->h = textHeight + 6;
|
||||
widget2->setParent(m_irrlicht_window);
|
||||
|
||||
m_children.push_back(widget2);
|
||||
widget2->add();
|
||||
}
|
||||
void PressAKeyDialog::processEvent(std::string& eventSource)
|
||||
{
|
||||
if(eventSource == "cancel")
|
||||
{
|
||||
input_manager->setMode(InputManager::MENU);
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
#pragma mark -
|
||||
#pragma mark EnterPlayerNameDialog
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
EnterPlayerNameDialog::EnterPlayerNameDialog(const float w, const float h) :
|
||||
ModalDialog(w, h)
|
||||
{
|
||||
//core::rect< s32 > area_top(0, 0, m_area.getWidth(), m_area.getHeight()/2);
|
||||
//IGUIStaticText* label = GUIEngine::getGUIEnv()->addStaticText( stringw(_("Enter the new player's name")).c_str(),
|
||||
// area_top, false /* border */, true /* word wrap */,
|
||||
// m_irrlicht_window);
|
||||
// label->setTextAlignment(EGUIA_CENTER, EGUIA_CENTER);
|
||||
|
||||
LabelWidget* widget = new LabelWidget();
|
||||
widget->m_properties[PROP_TEXT] = _("Enter the new player's name");
|
||||
widget->m_properties[PROP_TEXT_ALIGN] = "center";
|
||||
widget->x = 0;
|
||||
widget->y = 0;
|
||||
widget->w = m_area.getWidth();
|
||||
widget->h = m_area.getHeight()/3;
|
||||
widget->setParent(m_irrlicht_window);
|
||||
|
||||
m_children.push_back(widget);
|
||||
widget->add();
|
||||
|
||||
// ----
|
||||
|
||||
IGUIFont* font = GUIEngine::getFont();
|
||||
const int textHeight = font->getDimension(L"X").Height;
|
||||
|
||||
const int textAreaYFrom = m_area.getHeight()/2 - textHeight/2;
|
||||
|
||||
textCtrl = new TextBoxWidget();
|
||||
textCtrl->m_properties[PROP_TEXT] = "";
|
||||
textCtrl->x = 50;
|
||||
textCtrl->y = textAreaYFrom - 10;
|
||||
textCtrl->w = m_area.getWidth()-100;
|
||||
textCtrl->h = textHeight + 5;
|
||||
textCtrl->setParent(m_irrlicht_window);
|
||||
m_children.push_back(textCtrl);
|
||||
textCtrl->add();
|
||||
GUIEngine::getGUIEnv()->setFocus( textCtrl->getIrrlichtElement() );
|
||||
|
||||
// TODO : add Ok button
|
||||
|
||||
cancelButton = new ButtonWidget();
|
||||
cancelButton->m_properties[PROP_ID] = "cancel";
|
||||
cancelButton->m_properties[PROP_TEXT] = _("Cancel");
|
||||
cancelButton->x = 15;
|
||||
cancelButton->y = m_area.getHeight() - textHeight - 12;
|
||||
cancelButton->w = m_area.getWidth() - 30;
|
||||
cancelButton->h = textHeight + 6;
|
||||
cancelButton->setParent(m_irrlicht_window);
|
||||
|
||||
m_children.push_back(cancelButton);
|
||||
cancelButton->add();
|
||||
|
||||
}
|
||||
EnterPlayerNameDialog::~EnterPlayerNameDialog()
|
||||
{
|
||||
textCtrl->getIrrlichtElement()->remove();
|
||||
}
|
||||
void EnterPlayerNameDialog::processEvent(std::string& eventSource)
|
||||
{
|
||||
if(eventSource == "cancel")
|
||||
{
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
}
|
||||
void EnterPlayerNameDialog::onEnterPressedInternal()
|
||||
{
|
||||
// ---- Cancel button pressed
|
||||
if( GUIEngine::getGUIEnv()->hasFocus(cancelButton->getIrrlichtElement()) )
|
||||
{
|
||||
std::string fakeEvent = "cancel";
|
||||
processEvent(fakeEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
// ---- Otherwise, accept entered name
|
||||
stringw playerName = textCtrl->getText();
|
||||
if(playerName.size() > 0)
|
||||
OptionsScreen::gotNewPlayerName( playerName );
|
||||
|
||||
// irrLicht is too stupid to remove focus from deleted widgets
|
||||
// so do it by hand
|
||||
GUIEngine::getGUIEnv()->removeFocus( textCtrl->getIrrlichtElement() );
|
||||
GUIEngine::getGUIEnv()->removeFocus( m_irrlicht_window );
|
||||
|
||||
ModalDialog::dismiss();
|
||||
}
|
||||
|
||||
#if 0
|
||||
#pragma mark -
|
||||
#pragma mark TrackInfoDialog
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
TrackInfoDialog::TrackInfoDialog(const char* trackName, ITexture* screenshot, const float w, const float h) : ModalDialog(w, h)
|
||||
{
|
||||
const int y1 = m_area.getHeight()/7;
|
||||
const int y2 = m_area.getHeight()*5/7;
|
||||
const int y3 = m_area.getHeight()*6/7;
|
||||
|
||||
SpinnerWidget* spinner = new SpinnerWidget();
|
||||
spinner->x = m_area.getWidth()/2 - 200;
|
||||
spinner->y = y2;
|
||||
spinner->w = 400;
|
||||
spinner->h = y3 - y2 - 15;
|
||||
spinner->setParent(m_irrlicht_window);
|
||||
|
||||
spinner->m_properties[PROP_MIN_VALUE] = "1";
|
||||
spinner->m_properties[PROP_MAX_VALUE] = "99";
|
||||
spinner->m_properties[PROP_TEXT] = "%i laps";
|
||||
|
||||
m_children.push_back(spinner);
|
||||
spinner->add();
|
||||
spinner->setValue(3);
|
||||
spinner->getIrrlichtElement()->setTabStop(true);
|
||||
spinner->getIrrlichtElement()->setTabGroup(false);
|
||||
|
||||
ButtonWidget* okBtn = new ButtonWidget();
|
||||
okBtn->m_properties[PROP_ID] = "start";
|
||||
okBtn->m_properties[PROP_TEXT] = _("Start Race");
|
||||
okBtn->x = m_area.getWidth()/2 - 200;
|
||||
okBtn->y = y3;
|
||||
okBtn->w = 400;
|
||||
okBtn->h = m_area.getHeight() - y3 - 15;
|
||||
okBtn->setParent(m_irrlicht_window);
|
||||
m_children.push_back(okBtn);
|
||||
okBtn->add();
|
||||
okBtn->getIrrlichtElement()->setTabStop(true);
|
||||
okBtn->getIrrlichtElement()->setTabGroup(false);
|
||||
|
||||
GUIEngine::getGUIEnv()->setFocus( okBtn->getIrrlichtElement() );
|
||||
|
||||
|
||||
core::rect< s32 > area_top(0, 0, m_area.getWidth(), y1);
|
||||
IGUIStaticText* a = GUIEngine::getGUIEnv()->addStaticText( stringw(trackName).c_str(),
|
||||
area_top, false, true, // border, word warp
|
||||
m_irrlicht_window);
|
||||
a->setTabStop(false);
|
||||
|
||||
|
||||
core::rect< s32 > area_left(0, y1, m_area.getWidth()/2, y2);
|
||||
IGUIStaticText* b = GUIEngine::getGUIEnv()->addStaticText( stringw(_("High Scores & Track Info")).c_str(),
|
||||
area_left, false , true , // border, word warp
|
||||
m_irrlicht_window);
|
||||
b->setTabStop(false);
|
||||
|
||||
|
||||
// TODO : preserve aspect ratio
|
||||
core::rect< s32 > area_right(m_area.getWidth()/2, y1, m_area.getWidth(), y2-10);
|
||||
IGUIImage* screenshotWidget = GUIEngine::getGUIEnv()->addImage( area_right, m_irrlicht_window );
|
||||
screenshotWidget->setImage(screenshot);
|
||||
screenshotWidget->setScaleImage(true);
|
||||
screenshotWidget->setTabStop(false);
|
||||
|
||||
|
||||
|
||||
a->setTextAlignment(EGUIA_CENTER, EGUIA_CENTER);
|
||||
b->setTextAlignment(EGUIA_CENTER, EGUIA_CENTER);
|
||||
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
|
||||
// FIXME : this probably doesn't belong here
|
||||
void startGame()
|
||||
{
|
||||
ModalDialog::dismiss();
|
||||
|
||||
IVideoDriver* driver = GUIEngine::getDriver();
|
||||
|
||||
// TODO : draw a loading screen
|
||||
driver->endScene();
|
||||
driver->beginScene(true, false);
|
||||
driver->endScene();
|
||||
|
||||
|
||||
StateManager::get()->enterGameState();
|
||||
//race_manager->setDifficulty(RaceManager::RD_HARD);
|
||||
race_manager->setTrack("lighthouse");
|
||||
race_manager->setNumLaps( 3 );
|
||||
race_manager->setCoinTarget( 0 ); // Might still be set from a previous challenge
|
||||
//race_manager->setNumKarts( 1 );
|
||||
network_manager->setupPlayerKartInfo();
|
||||
//race_manager->getKartType(1) = KT_PLAYER;
|
||||
|
||||
race_manager->startNew();
|
||||
}
|
||||
|
||||
void TrackInfoDialog::onEnterPressedInternal()
|
||||
{
|
||||
startGame();
|
||||
}
|
||||
|
||||
void TrackInfoDialog::processEvent(std::string& eventSource)
|
||||
{
|
||||
if (eventSource == "start" ) startGame();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#if 0
|
||||
#pragma mark -
|
||||
#pragma mark PlayerInfoDialog
|
||||
#endif
|
||||
|
||||
PlayerInfoDialog::PlayerInfoDialog(PlayerProfile* player, const float w, const float h) : ModalDialog(w, h)
|
||||
{
|
||||
m_player = player;
|
||||
|
||||
showRegularDialog();
|
||||
}
|
||||
void PlayerInfoDialog::showRegularDialog()
|
||||
{
|
||||
clearWindow();
|
||||
|
||||
const int y1 = m_area.getHeight()/6;
|
||||
const int y2 = m_area.getHeight()*2/6;
|
||||
const int y3 = m_area.getHeight()*3/6;
|
||||
const int y4 = m_area.getHeight()*5/6;
|
||||
|
||||
IGUIFont* font = GUIEngine::getFont();
|
||||
const int textHeight = font->getDimension(L"X").Height;
|
||||
const int buttonHeight = textHeight + 10;
|
||||
|
||||
{
|
||||
textCtrl = new TextBoxWidget();
|
||||
textCtrl->m_properties[PROP_ID] = "renameplayer";
|
||||
textCtrl->m_properties[PROP_TEXT] = m_player->getName();
|
||||
textCtrl->x = 50;
|
||||
textCtrl->y = y1 - textHeight/2;
|
||||
textCtrl->w = m_area.getWidth()-100;
|
||||
textCtrl->h = textHeight + 5;
|
||||
textCtrl->setParent(m_irrlicht_window);
|
||||
m_children.push_back(textCtrl);
|
||||
textCtrl->add();
|
||||
GUIEngine::getGUIEnv()->setFocus( textCtrl->getIrrlichtElement() );
|
||||
}
|
||||
|
||||
{
|
||||
ButtonWidget* widget = new ButtonWidget();
|
||||
widget->m_properties[PROP_ID] = "renameplayer";
|
||||
widget->m_properties[PROP_TEXT] = _("Rename");
|
||||
|
||||
const int textWidth = font->getDimension( stringw(widget->m_properties[PROP_TEXT].c_str()).c_str() ).Width + 40;
|
||||
|
||||
widget->x = m_area.getWidth()/2 - textWidth/2;
|
||||
widget->y = y2;
|
||||
widget->w = textWidth;
|
||||
widget->h = buttonHeight;
|
||||
widget->setParent(m_irrlicht_window);
|
||||
m_children.push_back(widget);
|
||||
widget->add();
|
||||
}
|
||||
{
|
||||
ButtonWidget* widget = new ButtonWidget();
|
||||
widget->m_properties[PROP_ID] = "cancel";
|
||||
widget->m_properties[PROP_TEXT] = _("Cancel");
|
||||
|
||||
const int textWidth = font->getDimension( stringw(widget->m_properties[PROP_TEXT].c_str()).c_str() ).Width + 40;
|
||||
|
||||
widget->x = m_area.getWidth()/2 - textWidth/2;
|
||||
widget->y = y3;
|
||||
widget->w = textWidth;
|
||||
widget->h = buttonHeight;
|
||||
widget->setParent(m_irrlicht_window);
|
||||
m_children.push_back(widget);
|
||||
widget->add();
|
||||
}
|
||||
|
||||
{
|
||||
ButtonWidget* widget = new ButtonWidget();
|
||||
widget->m_properties[PROP_ID] = "removeplayer";
|
||||
widget->m_properties[PROP_TEXT] = _("Remove");
|
||||
|
||||
const int textWidth = font->getDimension( stringw(widget->m_properties[PROP_TEXT].c_str()).c_str() ).Width + 40;
|
||||
|
||||
widget->x = m_area.getWidth()/2 - textWidth/2;
|
||||
widget->y = y4;
|
||||
widget->w = textWidth;
|
||||
widget->h = buttonHeight;
|
||||
widget->setParent(m_irrlicht_window);
|
||||
m_children.push_back(widget);
|
||||
widget->add();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PlayerInfoDialog::showConfirmDialog()
|
||||
{
|
||||
clearWindow();
|
||||
|
||||
|
||||
IGUIFont* font = GUIEngine::getFont();
|
||||
const int textHeight = font->getDimension(L"X").Height;
|
||||
const int buttonHeight = textHeight + 10;
|
||||
|
||||
|
||||
char message[256];
|
||||
sprintf(message, _("Do you really want to delete player '%s' ?"), m_player->getName());
|
||||
|
||||
core::rect< s32 > area_left(5, 0, m_area.getWidth()-5, m_area.getHeight()/2);
|
||||
IGUIStaticText* a = GUIEngine::getGUIEnv()->addStaticText( stringw(message).c_str(),
|
||||
area_left, false /* border */, true /* word wrap */,
|
||||
m_irrlicht_window);
|
||||
a->setTextAlignment(EGUIA_CENTER, EGUIA_CENTER);
|
||||
|
||||
{
|
||||
ButtonWidget* widget = new ButtonWidget();
|
||||
widget->m_properties[PROP_ID] = "confirmremove";
|
||||
widget->m_properties[PROP_TEXT] = _("Confirm Remove");
|
||||
|
||||
const int textWidth = font->getDimension( stringw(widget->m_properties[PROP_TEXT].c_str()).c_str() ).Width + 40;
|
||||
|
||||
widget->x = m_area.getWidth()/2 - textWidth/2;
|
||||
widget->y = m_area.getHeight()/2;
|
||||
widget->w = textWidth;
|
||||
widget->h = buttonHeight;
|
||||
widget->setParent(m_irrlicht_window);
|
||||
m_children.push_back(widget);
|
||||
widget->add();
|
||||
}
|
||||
|
||||
{
|
||||
ButtonWidget* widget = new ButtonWidget();
|
||||
widget->m_properties[PROP_ID] = "cancelremove";
|
||||
widget->m_properties[PROP_TEXT] = _("Cancel Remove");
|
||||
|
||||
const int textWidth = font->getDimension( stringw(widget->m_properties[PROP_TEXT].c_str()).c_str() ).Width + 40;
|
||||
|
||||
widget->x = m_area.getWidth()/2 - textWidth/2;
|
||||
widget->y = m_area.getHeight()*3/4;
|
||||
widget->w = textWidth;
|
||||
widget->h = buttonHeight;
|
||||
widget->setParent(m_irrlicht_window);
|
||||
m_children.push_back(widget);
|
||||
widget->add();
|
||||
GUIEngine::getGUIEnv()->setFocus( widget->getIrrlichtElement() );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PlayerInfoDialog::onEnterPressedInternal()
|
||||
{
|
||||
}
|
||||
void PlayerInfoDialog::processEvent(std::string& eventSource)
|
||||
{
|
||||
if(eventSource == "renameplayer")
|
||||
{
|
||||
// accept entered name
|
||||
stringw playerName = textCtrl->getText();
|
||||
if(playerName.size() > 0)
|
||||
{
|
||||
OptionsScreen::gotNewPlayerName( playerName, m_player );
|
||||
}
|
||||
|
||||
// irrLicht is too stupid to remove focus from deleted widgets
|
||||
// so do it by hand
|
||||
GUIEngine::getGUIEnv()->removeFocus( textCtrl->getIrrlichtElement() );
|
||||
GUIEngine::getGUIEnv()->removeFocus( m_irrlicht_window );
|
||||
|
||||
ModalDialog::dismiss();
|
||||
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
else if(eventSource == "removeplayer")
|
||||
{
|
||||
showConfirmDialog();
|
||||
}
|
||||
else if(eventSource == "confirmremove")
|
||||
{
|
||||
OptionsScreen::deletePlayer( m_player );
|
||||
|
||||
// irrLicht is too stupid to remove focus from deleted widgets
|
||||
// so do it by hand
|
||||
GUIEngine::getGUIEnv()->removeFocus( textCtrl->getIrrlichtElement() );
|
||||
GUIEngine::getGUIEnv()->removeFocus( m_irrlicht_window );
|
||||
|
||||
ModalDialog::dismiss();
|
||||
|
||||
return;
|
||||
}
|
||||
else if(eventSource == "cancelremove")
|
||||
{
|
||||
showRegularDialog();
|
||||
}
|
||||
else if(eventSource == "cancel")
|
||||
{
|
||||
// irrLicht is too stupid to remove focus from deleted widgets
|
||||
// so do it by hand
|
||||
GUIEngine::getGUIEnv()->removeFocus( textCtrl->getIrrlichtElement() );
|
||||
GUIEngine::getGUIEnv()->removeFocus( m_irrlicht_window );
|
||||
|
||||
ModalDialog::dismiss();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,9 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#ifndef HEADER_MODAL_DIALOG_HPP
|
||||
#define HEADER_MODAL_DIALOG_HPP
|
||||
|
||||
#include "irrlicht.h"
|
||||
#include "utils/ptr_vector.hpp"
|
||||
#include "guiengine/skin.hpp"
|
||||
@ -57,60 +60,7 @@ public:
|
||||
static void onEnterPressed();
|
||||
static ModalDialog* getCurrent();
|
||||
static bool isADialogActive();
|
||||
};
|
||||
|
||||
class PressAKeyDialog : public ModalDialog
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Creates a modal dialog with given percentage of screen width and height
|
||||
*/
|
||||
PressAKeyDialog(const float percentWidth, const float percentHeight);
|
||||
void processEvent(std::string& eventSource);
|
||||
};
|
||||
|
||||
class EnterPlayerNameDialog : public ModalDialog
|
||||
{
|
||||
TextBoxWidget* textCtrl;
|
||||
ButtonWidget* cancelButton;
|
||||
public:
|
||||
/**
|
||||
* Creates a modal dialog with given percentage of screen width and height
|
||||
*/
|
||||
EnterPlayerNameDialog(const float percentWidth, const float percentHeight);
|
||||
~EnterPlayerNameDialog();
|
||||
|
||||
void onEnterPressedInternal();
|
||||
void processEvent(std::string& eventSource);
|
||||
};
|
||||
|
||||
class TrackInfoDialog : public ModalDialog
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Creates a modal dialog with given percentage of screen width and height
|
||||
*/
|
||||
TrackInfoDialog(const char* trackName, irr::video::ITexture* screenshot, const float percentWidth, const float percentHeight);
|
||||
void onEnterPressedInternal();
|
||||
void processEvent(std::string& eventSource);
|
||||
};
|
||||
|
||||
class PlayerInfoDialog : public ModalDialog
|
||||
{
|
||||
TextBoxWidget* textCtrl;
|
||||
PlayerProfile* m_player;
|
||||
|
||||
void showRegularDialog();
|
||||
void showConfirmDialog();
|
||||
public:
|
||||
/**
|
||||
* Creates a modal dialog with given percentage of screen width and height
|
||||
*/
|
||||
PlayerInfoDialog(PlayerProfile* PlayerInfoDialog,
|
||||
const float percentWidth, const float percentHeight);
|
||||
void onEnterPressedInternal();
|
||||
void processEvent(std::string& eventSource);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
@ -27,6 +27,12 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace GUIEngine;
|
||||
using namespace irr;
|
||||
using namespace core;
|
||||
using namespace scene;
|
||||
using namespace video;
|
||||
using namespace io;
|
||||
using namespace gui;
|
||||
|
||||
/**
|
||||
* Small utility to read config file info from a XML file.
|
||||
|
@ -247,6 +247,10 @@
|
||||
958330D710122B4A00C5137E /* race_gui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 958330C810122B4A00C5137E /* race_gui.cpp */; };
|
||||
958330D810122B4A00C5137E /* state_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 958330CA10122B4A00C5137E /* state_manager.cpp */; };
|
||||
9583319910123B0200C5137E /* abstract_state_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9583319810123B0200C5137E /* abstract_state_manager.cpp */; };
|
||||
9583323F101243ED00C5137E /* enter_player_name_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95833237101243ED00C5137E /* enter_player_name_dialog.cpp */; };
|
||||
95833240101243ED00C5137E /* player_info_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95833239101243ED00C5137E /* player_info_dialog.cpp */; };
|
||||
95833241101243ED00C5137E /* press_a_key_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9583323B101243ED00C5137E /* press_a_key_dialog.cpp */; };
|
||||
95833242101243ED00C5137E /* track_info_dialog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9583323D101243ED00C5137E /* track_info_dialog.cpp */; };
|
||||
95CB476C0FF30EF400413BAE /* bezier_curve.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95CB476B0FF30EF400413BAE /* bezier_curve.cpp */; };
|
||||
95D1F5F70FC8C3E300FF6968 /* input.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95D1F5F60FC8C3E300FF6968 /* input.cpp */; };
|
||||
95D950D20FE473CA002E10AD /* stk_config.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95D950CE0FE473CA002E10AD /* stk_config.cpp */; };
|
||||
@ -386,6 +390,14 @@
|
||||
958330CB10122B4A00C5137E /* state_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = state_manager.hpp; path = ../../states_screens/state_manager.hpp; sourceTree = SOURCE_ROOT; };
|
||||
9583319710123B0200C5137E /* abstract_state_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = abstract_state_manager.hpp; path = ../../guiengine/abstract_state_manager.hpp; sourceTree = SOURCE_ROOT; };
|
||||
9583319810123B0200C5137E /* abstract_state_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = abstract_state_manager.cpp; path = ../../guiengine/abstract_state_manager.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95833237101243ED00C5137E /* enter_player_name_dialog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = enter_player_name_dialog.cpp; path = ../../states_screens/dialogs/enter_player_name_dialog.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95833238101243ED00C5137E /* enter_player_name_dialog.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = enter_player_name_dialog.hpp; path = ../../states_screens/dialogs/enter_player_name_dialog.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95833239101243ED00C5137E /* player_info_dialog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = player_info_dialog.cpp; path = ../../states_screens/dialogs/player_info_dialog.cpp; sourceTree = SOURCE_ROOT; };
|
||||
9583323A101243ED00C5137E /* player_info_dialog.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = player_info_dialog.hpp; path = ../../states_screens/dialogs/player_info_dialog.hpp; sourceTree = SOURCE_ROOT; };
|
||||
9583323B101243ED00C5137E /* press_a_key_dialog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = press_a_key_dialog.cpp; path = ../../states_screens/dialogs/press_a_key_dialog.cpp; sourceTree = SOURCE_ROOT; };
|
||||
9583323C101243ED00C5137E /* press_a_key_dialog.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = press_a_key_dialog.hpp; path = ../../states_screens/dialogs/press_a_key_dialog.hpp; sourceTree = SOURCE_ROOT; };
|
||||
9583323D101243ED00C5137E /* track_info_dialog.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = track_info_dialog.cpp; path = ../../states_screens/dialogs/track_info_dialog.cpp; sourceTree = SOURCE_ROOT; };
|
||||
9583323E101243ED00C5137E /* track_info_dialog.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = track_info_dialog.hpp; path = ../../states_screens/dialogs/track_info_dialog.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95A118290F77EA3100B18B3D /* input.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = input.hpp; path = ../../input/input.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95A1182A0F77EA3100B18B3D /* input_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = input_manager.cpp; path = ../../input/input_manager.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95A1182B0F77EA3100B18B3D /* input_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = input_manager.hpp; path = ../../input/input_manager.hpp; sourceTree = SOURCE_ROOT; };
|
||||
@ -1135,6 +1147,7 @@
|
||||
958330C110122B4A00C5137E /* states_screens */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
95833236101243ED00C5137E /* dialogs */,
|
||||
958330C210122B4A00C5137E /* credits.cpp */,
|
||||
958330C310122B4A00C5137E /* credits.hpp */,
|
||||
958330C410122B4A00C5137E /* kart_selection.cpp */,
|
||||
@ -1150,6 +1163,22 @@
|
||||
path = ../../states_screens;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
95833236101243ED00C5137E /* dialogs */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
95833237101243ED00C5137E /* enter_player_name_dialog.cpp */,
|
||||
95833238101243ED00C5137E /* enter_player_name_dialog.hpp */,
|
||||
95833239101243ED00C5137E /* player_info_dialog.cpp */,
|
||||
9583323A101243ED00C5137E /* player_info_dialog.hpp */,
|
||||
9583323B101243ED00C5137E /* press_a_key_dialog.cpp */,
|
||||
9583323C101243ED00C5137E /* press_a_key_dialog.hpp */,
|
||||
9583323D101243ED00C5137E /* track_info_dialog.cpp */,
|
||||
9583323E101243ED00C5137E /* track_info_dialog.hpp */,
|
||||
);
|
||||
name = dialogs;
|
||||
path = ../../states_screens/dialogs;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
95A118280F77EA3100B18B3D /* input */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -2364,6 +2393,10 @@
|
||||
958330D710122B4A00C5137E /* race_gui.cpp in Sources */,
|
||||
958330D810122B4A00C5137E /* state_manager.cpp in Sources */,
|
||||
9583319910123B0200C5137E /* abstract_state_manager.cpp in Sources */,
|
||||
9583323F101243ED00C5137E /* enter_player_name_dialog.cpp in Sources */,
|
||||
95833240101243ED00C5137E /* player_info_dialog.cpp in Sources */,
|
||||
95833241101243ED00C5137E /* press_a_key_dialog.cpp in Sources */,
|
||||
95833242101243ED00C5137E /* track_info_dialog.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -21,13 +21,16 @@
|
||||
#include "config/player.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/modaldialog.hpp"
|
||||
#include "states_screens/options_screen.hpp"
|
||||
#include "guiengine/screen.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "guiengine/widget.hpp"
|
||||
#include "input/input_manager.hpp"
|
||||
#include "input/device_manager.hpp"
|
||||
#include "states_screens/dialogs/enter_player_name_dialog.hpp"
|
||||
#include "states_screens/dialogs/player_info_dialog.hpp"
|
||||
#include "states_screens/dialogs/press_a_key_dialog.hpp"
|
||||
#include "states_screens/options_screen.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "config/user_config.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/modaldialog.hpp"
|
||||
#include "guiengine/screen.hpp"
|
||||
#include "guiengine/widget.hpp"
|
||||
#include "input/device_manager.hpp"
|
||||
@ -37,6 +36,7 @@
|
||||
#include "states_screens/options_screen.hpp"
|
||||
#include "states_screens/kart_selection.hpp"
|
||||
#include "states_screens/credits.hpp"
|
||||
#include "states_screens/dialogs/track_info_dialog.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
using namespace GUIEngine;
|
||||
|
Loading…
Reference in New Issue
Block a user