first introduction of new GUI code. It does *not* work, consider this a backup (and the removal of the old UI)
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3256 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
4a85118dbd
commit
4acc6fc7c8
@ -1,149 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include <SDL/SDL.h>
|
||||
|
||||
#include "base_gui.hpp"
|
||||
#include "widget_manager.hpp"
|
||||
#include "menu_manager.hpp"
|
||||
void
|
||||
BaseGUI::animateWidget(const int PREV_SELECTED_WGT, const int SELECTED_WGT)
|
||||
{
|
||||
if( SELECTED_WGT != WidgetManager::WGT_NONE )
|
||||
{
|
||||
if( PREV_SELECTED_WGT != WidgetManager::WGT_NONE )
|
||||
{
|
||||
widget_manager->darkenWgtColor( PREV_SELECTED_WGT );
|
||||
}
|
||||
|
||||
widget_manager->lightenWgtColor( SELECTED_WGT );
|
||||
widget_manager->pulseWgt( SELECTED_WGT );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
BaseGUI::handle(GameAction action, int value)
|
||||
{
|
||||
if( m_locked ) return;
|
||||
|
||||
// Skip on keypress, act on keyrelease only.
|
||||
if (value) return;
|
||||
|
||||
int previous = widget_manager->getSelectedWgt();
|
||||
|
||||
switch ( action )
|
||||
{
|
||||
case GA_CURSOR_LEFT:
|
||||
animateWidget(previous,
|
||||
widget_manager->handleLeft());
|
||||
|
||||
break;
|
||||
case GA_CURSOR_RIGHT:
|
||||
animateWidget(previous,
|
||||
widget_manager->handleRight());
|
||||
break;
|
||||
case GA_CURSOR_UP:
|
||||
animateWidget(previous,
|
||||
widget_manager->handleUp());
|
||||
break;
|
||||
case GA_CURSOR_DOWN:
|
||||
animateWidget(previous,
|
||||
widget_manager->handleDown());
|
||||
break;
|
||||
case GA_INC_SCROLL_SPEED:
|
||||
widget_manager->increaseScrollSpeed();
|
||||
break;
|
||||
case GA_INC_SCROLL_SPEED_FAST:
|
||||
widget_manager->increaseScrollSpeed(true);
|
||||
break;
|
||||
case GA_DEC_SCROLL_SPEED:
|
||||
widget_manager->decreaseScrollSpeed();
|
||||
break;
|
||||
case GA_DEC_SCROLL_SPEED_FAST:
|
||||
widget_manager->decreaseScrollSpeed(true);
|
||||
break;
|
||||
case GA_ENTER:
|
||||
select();
|
||||
break;
|
||||
case GA_LEAVE:
|
||||
if (menu_manager->getMenuStackSize() > 1)
|
||||
{
|
||||
if(menu_manager->isCurrentMenu(MENUID_RACEMENU))
|
||||
RaceManager::getWorld()->unpause();
|
||||
|
||||
menu_manager->popMenu();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
} // switch
|
||||
} // handle
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
BaseGUI::inputPointer(int x, int y)
|
||||
{
|
||||
if( m_locked ) return;
|
||||
|
||||
const int PREV_SELECTED_WGT = widget_manager->getSelectedWgt();
|
||||
const int SELECTED_WGT = widget_manager->handlePointer( x, y );
|
||||
|
||||
if( SELECTED_WGT != WidgetManager::WGT_NONE )
|
||||
{
|
||||
if( PREV_SELECTED_WGT != WidgetManager::WGT_NONE )
|
||||
{
|
||||
widget_manager->darkenWgtColor( PREV_SELECTED_WGT );
|
||||
}
|
||||
|
||||
widget_manager->lightenWgtColor( SELECTED_WGT );
|
||||
widget_manager->pulseWgt( SELECTED_WGT );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
BaseGUI::update(float dt)
|
||||
{
|
||||
widget_manager->update(dt);
|
||||
} // update
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
BaseGUI::TimeToString(const double TIME, char *s) const
|
||||
{
|
||||
int min = (int) floor ( TIME / 60.0 ) ;
|
||||
int sec = (int) floor ( TIME - (double) ( 60 * min ) ) ;
|
||||
int tenths = (int) floor ( 10.0f * (TIME - (double)(sec + 60* min)));
|
||||
sprintf ( s, "%d:%02d:%d", min, sec, tenths ) ;
|
||||
} // TimeToString
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
BaseGUI::inputKeyboard(SDLKey, int)
|
||||
{
|
||||
// This method is not supposed to be called since BaseGUI does not
|
||||
// handle low-level keyboard input.
|
||||
assert(false);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void BaseGUI::countdown()
|
||||
{
|
||||
}
|
||||
/* EOF */
|
@ -1,59 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_BASE_GUI_HPP
|
||||
#define HEADER_BASE_GUI_HPP
|
||||
|
||||
#include <SDL/SDL.h>
|
||||
#include "input.hpp"
|
||||
|
||||
class BaseGUI
|
||||
{
|
||||
void animateWidget(const int, const int);
|
||||
|
||||
public:
|
||||
BaseGUI() : m_locked(false) {}
|
||||
virtual ~BaseGUI() {}
|
||||
|
||||
virtual void update(float dt);
|
||||
virtual void select() = 0;
|
||||
|
||||
virtual void handle(GameAction, int);
|
||||
|
||||
virtual void inputKeyboard(SDLKey, int);
|
||||
|
||||
virtual void countdown();
|
||||
|
||||
void inputPointer(int x, int y);
|
||||
|
||||
//At times, we want to make sure that we won't be getting any kind of
|
||||
//input to the gui, for example, during transitions from one screen
|
||||
//to another. At those times, it's best to lock the input and unlock it
|
||||
//afterwards.
|
||||
void lockInput() { m_locked = true; }
|
||||
void unlockInput() { m_locked = false; }
|
||||
|
||||
void TimeToString(const double time, char *s) const;
|
||||
protected:
|
||||
|
||||
bool m_locked;
|
||||
int m_menu_id;
|
||||
};
|
||||
|
||||
#endif // HEADER_BASEGUI_H
|
@ -1,93 +0,0 @@
|
||||
// $Id: challenges_menu.cpp 1305 2007-11-26 14:28:15Z hiker $
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "widget_manager.hpp"
|
||||
#include "menu_manager.hpp"
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "gui/challenges_menu.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_TITLE,
|
||||
WTOK_BACK,
|
||||
WTOK_DESCRIPTION,
|
||||
WTOK_CHALLENGES
|
||||
};
|
||||
|
||||
ChallengesMenu::ChallengesMenu()
|
||||
{
|
||||
widget_manager->addTitleWgt( WTOK_TITLE, 60, 10, _("Active Challenges"));
|
||||
widget_manager->hideWgtRect(WTOK_TITLE);
|
||||
widget_manager->breakLine();
|
||||
|
||||
m_all_challenges=unlock_manager->getActiveChallenges();
|
||||
for(int i=0; i<(int)m_all_challenges.size(); i++)
|
||||
{
|
||||
widget_manager->addTextButtonWgt(WTOK_CHALLENGES+i, 60, 10,
|
||||
_(m_all_challenges[i]->getName().c_str()) );
|
||||
widget_manager->breakLine();
|
||||
}
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_DESCRIPTION, 60, 30, "");
|
||||
widget_manager->deactivateWgt(WTOK_DESCRIPTION);
|
||||
widget_manager->hideWgtRect(WTOK_DESCRIPTION);
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addTextButtonWgt(WTOK_BACK, 50, 7,
|
||||
_("Go back to the main menu"));
|
||||
|
||||
widget_manager->layout(WGT_AREA_ALL);
|
||||
} // ChallengesMenu
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
ChallengesMenu::~ChallengesMenu()
|
||||
{
|
||||
widget_manager->reset();
|
||||
} // ~ChallengesMenu
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void ChallengesMenu::update(float dt)
|
||||
{
|
||||
const int challenge= widget_manager->getSelectedWgt() - WTOK_CHALLENGES;
|
||||
if(challenge>=0 && challenge<(int)m_all_challenges.size())
|
||||
{
|
||||
widget_manager->setWgtText(WTOK_DESCRIPTION,
|
||||
m_all_challenges[challenge]->getChallengeDescription());
|
||||
}
|
||||
widget_manager->update(dt);
|
||||
} // update
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void ChallengesMenu::select()
|
||||
{
|
||||
if(widget_manager->getSelectedWgt()==WTOK_BACK)
|
||||
{
|
||||
menu_manager->popMenu();
|
||||
return;
|
||||
}
|
||||
int n=widget_manager->getSelectedWgt()-WTOK_CHALLENGES;
|
||||
if(n>=0 && n<(int)m_all_challenges.size())
|
||||
{
|
||||
network_manager->initCharacterDataStructures();
|
||||
m_all_challenges[n]->setRace();
|
||||
menu_manager->pushMenu(MENUID_START_RACE_FEEDBACK);
|
||||
}
|
||||
} // select
|
@ -1,40 +0,0 @@
|
||||
// $Id: challenges.hpp 1305 2007-11-26 14:28:15Z hiker $
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_CHALLENGES_H
|
||||
#define HEADER_CHALLENGES_H
|
||||
|
||||
#include <vector>
|
||||
#include "challenges/challenge.hpp"
|
||||
#include "base_gui.hpp"
|
||||
|
||||
class ChallengesMenu: public BaseGUI
|
||||
{
|
||||
private:
|
||||
std::vector<const Challenge*> m_all_challenges;
|
||||
|
||||
public:
|
||||
ChallengesMenu();
|
||||
~ChallengesMenu();
|
||||
void select ();
|
||||
void update (float dt);
|
||||
|
||||
}; // ChallengesMenu
|
||||
|
||||
#endif
|
@ -1,585 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "char_sel.hpp"
|
||||
#include "widget_manager.hpp"
|
||||
#include "race_manager.hpp"
|
||||
#include "user_config.hpp"
|
||||
#include "material_manager.hpp"
|
||||
#include "material.hpp"
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "karts/kart_model.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_EMPTY_DOWN,
|
||||
WTOK_EMPTY_UP,
|
||||
WTOK_TITLE,
|
||||
WTOK_UP,
|
||||
WTOK_DOWN,
|
||||
WTOK_MESSAGE,
|
||||
WTOK_QUIT,
|
||||
WTOK_EMPTY0 = 10,
|
||||
WTOK_NAME0 = 2000,
|
||||
WTOK_RACER0 = 3000
|
||||
};
|
||||
|
||||
CharSel::CharSel(int whichPlayer)
|
||||
: m_kart(0), m_player_index(whichPlayer)
|
||||
{
|
||||
// First time this is called --> switch client and server
|
||||
// to character barrier mode
|
||||
// initCharacter ... must be called to clean the kart_info
|
||||
// in the server (even when NW_NONE), otherwise ghost karts
|
||||
// etc. can appear.
|
||||
m_first_frame = true;
|
||||
if(network_manager->getState()==NetworkManager::NS_MAIN_MENU ||
|
||||
network_manager->getMode()==NetworkManager::NW_NONE)
|
||||
network_manager->initCharacterDataStructures();
|
||||
|
||||
// For some strange reasons plib calls makeCurrent() in ssgContext
|
||||
// constructor, so we have to save the old one here and restore it
|
||||
ssgContext* oldContext = ssgGetCurrentContext();
|
||||
m_context = new ssgContext;
|
||||
oldContext->makeCurrent();
|
||||
|
||||
// If m_player_index is 0 then this is a single player game or the first
|
||||
// player of a multiplayer game so we need to ensure that all karts are available.
|
||||
// If m_player_index is less than the number of elements in selected_karts then
|
||||
// the user is moving back through the menus and the last value in the vector
|
||||
// needs to be made available again.
|
||||
if (m_player_index == 0)
|
||||
kart_properties_manager->clearAllSelectedKarts();
|
||||
|
||||
// Determine the list of all groups to display. A call to
|
||||
// kart_properties_manager->getAllGroups() will return even groups without
|
||||
// karts in it (e.g. because all karts are locked), so in this case we
|
||||
// don't want to display this list.
|
||||
m_all_groups = kart_properties_manager->getAllGroups();
|
||||
std::vector<std::string>::iterator it = m_all_groups.begin();
|
||||
while(it!=m_all_groups.end())
|
||||
{
|
||||
const std::vector<int> &kig=kart_properties_manager->getKartsInGroup(*it);
|
||||
bool can_be_deleted=true;
|
||||
for(unsigned int i=0; i<kig.size(); i++)
|
||||
{
|
||||
const KartProperties *k=kart_properties_manager->getKartById(kig[i]);
|
||||
if(!unlock_manager->isLocked(k->getIdent()))
|
||||
{
|
||||
can_be_deleted=false;
|
||||
break;
|
||||
} // if isLocked
|
||||
} // for i<kig.size
|
||||
if(can_be_deleted)
|
||||
it=m_all_groups.erase(it);
|
||||
else
|
||||
it++;
|
||||
}
|
||||
|
||||
|
||||
if (m_player_index < (int)kart_properties_manager->getNumSelectedKarts())
|
||||
kart_properties_manager->removeLastSelectedKart();
|
||||
|
||||
std::string heading = StringUtils::insert_values( _("Player %d, choose a driver"),
|
||||
m_player_index + 1);
|
||||
widget_manager->addTitleWgt( WTOK_TITLE, 100, 10, heading );
|
||||
widget_manager->hideWgtRect(WTOK_TITLE);
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 1, 2);
|
||||
widget_manager->breakLine();
|
||||
|
||||
const int HEIGHT = 10;
|
||||
widget_manager->addEmptyWgt(WTOK_EMPTY_UP, computeIndent(0), HEIGHT/2);
|
||||
widget_manager->addTextButtonWgt(WTOK_UP, 20, HEIGHT/2, "^");
|
||||
widget_manager->breakLine();
|
||||
|
||||
for (unsigned int i = 0; i < m_max_entries; i++)
|
||||
{
|
||||
// Depending on previously selected kart indx here might be a group,
|
||||
// i.e. indx is negative, and kp is not defined. To avoid this,
|
||||
// all widgets are _initialised_ with kart 0 (which surely exists),
|
||||
// before later calling switchCharacter, which will define the
|
||||
// proper icons and texts.
|
||||
const KartProperties* kp = kart_properties_manager->getKartById(0);
|
||||
widget_manager->addEmptyWgt(WTOK_EMPTY0+i, computeIndent(i), HEIGHT );
|
||||
widget_manager->addImgButtonWgt(WTOK_RACER0 + i, 8, HEIGHT,
|
||||
kp->getIconFile() );
|
||||
widget_manager->addTextButtonWgt(WTOK_NAME0+i, 30, HEIGHT, "");
|
||||
widget_manager->setWgtTextSize(WTOK_NAME0+i, WGT_FNT_SML);
|
||||
widget_manager->breakLine();
|
||||
}
|
||||
|
||||
widget_manager->addEmptyWgt(WTOK_EMPTY_DOWN, computeIndent(m_max_entries), HEIGHT/2);
|
||||
widget_manager->addTextButtonWgt(WTOK_DOWN, 20, HEIGHT/2, "v");
|
||||
|
||||
switchGroup(); // select all karts from the currently selected group
|
||||
|
||||
Widget *w=widget_manager->addTextWgt(WTOK_MESSAGE, 30, 7, "");
|
||||
w->setPosition(WGT_DIR_CENTER, 0, WGT_DIR_CENTER, 0);
|
||||
if(network_manager->getMode()==NetworkManager::NW_CLIENT)
|
||||
widget_manager->setWgtText(WTOK_MESSAGE, _("Waiting for server"));
|
||||
else
|
||||
widget_manager->setWgtText(WTOK_MESSAGE, _("Waiting for clients"));
|
||||
|
||||
widget_manager->layout(WGT_AREA_RGT);
|
||||
|
||||
m_current_kart = -1;
|
||||
|
||||
const int LAST_KART = user_config->m_player[m_player_index].getLastKartId();
|
||||
if( LAST_KART != -1 && kart_properties_manager->kartAvailable(LAST_KART))// is LAST_KART not in vector of selected karts
|
||||
{
|
||||
int local_index = computeOffset();
|
||||
widget_manager->setSelectedWgt(WTOK_NAME0 +(m_max_entries-1)/2);
|
||||
switchCharacter(local_index);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_offset = 0;
|
||||
switchCharacter(0);
|
||||
}
|
||||
if(network_manager->getState()==NetworkManager::NS_WAIT_FOR_AVAILABLE_CHARACTERS)
|
||||
{
|
||||
widget_manager->hideWgt(WTOK_TITLE, WTOK_DOWN);
|
||||
// Hide all widgets except the message widget
|
||||
for (unsigned int i = 0; i < m_max_entries; i++)
|
||||
{
|
||||
widget_manager->hideWgt(WTOK_NAME0+i);
|
||||
widget_manager->hideWgt(WTOK_RACER0+i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
widget_manager->hideWgt(WTOK_MESSAGE);
|
||||
updateScrollPosition();
|
||||
}
|
||||
|
||||
m_clock = 0;
|
||||
|
||||
} // CharSel
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
CharSel::~CharSel()
|
||||
{
|
||||
widget_manager->reset();
|
||||
ssgDeRefDelete(m_kart);
|
||||
|
||||
delete m_context;
|
||||
} // ~CharSel
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void CharSel::updateScrollPosition()
|
||||
{
|
||||
// Handle the special case of less karts (plus groups) than widgets.
|
||||
// Some of the widgets then need to be disabled.
|
||||
unsigned int start = 0, end=m_max_entries;
|
||||
if(m_index_avail_karts.size()<m_max_entries)
|
||||
{
|
||||
start = (unsigned int)(m_max_entries-m_index_avail_karts.size()+1)/2;
|
||||
end = start+m_index_avail_karts.size()-1;
|
||||
}
|
||||
|
||||
for(unsigned int i=0; i<m_max_entries; i++)
|
||||
{
|
||||
if(i<start || i>end)
|
||||
{
|
||||
widget_manager->hideWgt (WTOK_NAME0 +i);
|
||||
widget_manager->hideWgtRect (WTOK_RACER0+i);
|
||||
widget_manager->hideWgtTexture(WTOK_RACER0+i);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Otherwise enable the widgets again (just in case that they
|
||||
// had been disabled before)
|
||||
widget_manager->showWgt(WTOK_NAME0 +i);
|
||||
|
||||
int indx = (i+m_offset)%m_index_avail_karts.size();
|
||||
indx = m_index_avail_karts[indx];
|
||||
if(indx>=0) // It's a kart, not a group
|
||||
{
|
||||
const KartProperties* kp= kart_properties_manager->getKartById(indx);
|
||||
|
||||
if(unlock_manager->isLocked(kp->getIdent())) continue;
|
||||
widget_manager->setWgtText(WTOK_NAME0 + i, kp->getName());
|
||||
widget_manager->setWgtTexture(WTOK_RACER0 + i, kp->getIconFile() );
|
||||
widget_manager->showWgtTexture(WTOK_RACER0 + i);
|
||||
widget_manager->showWgtRect(WTOK_RACER0 + i);
|
||||
}
|
||||
else
|
||||
{
|
||||
widget_manager->setWgtText(WTOK_NAME0+i, m_all_groups[-indx-1]);
|
||||
widget_manager->hideWgtTexture(WTOK_RACER0 + i);
|
||||
widget_manager->hideWgtRect(WTOK_RACER0 + i);
|
||||
}
|
||||
} // for i
|
||||
// set the 'selection changed' flag in the widget_manager, since update
|
||||
// scroll position (when called on action up/down) will change the kart
|
||||
// to display, even though it's the same widget
|
||||
widget_manager->setSelectionChanged();
|
||||
} // updateScrollPosition
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void CharSel::switchGroup()
|
||||
{
|
||||
m_index_avail_karts.clear();
|
||||
bool group_exist =
|
||||
kart_properties_manager->getKartsInGroup(user_config->m_kart_group).size()>0;
|
||||
if(!group_exist) user_config->m_kart_group = "standard";
|
||||
|
||||
const std::vector<int> &karts =
|
||||
kart_properties_manager->getKartsInGroup(user_config->m_kart_group);
|
||||
|
||||
for(unsigned int i=0; i<karts.size(); i++)
|
||||
{
|
||||
if(kart_properties_manager->kartAvailable(karts[i]))
|
||||
{
|
||||
m_index_avail_karts.push_back(karts[i]);
|
||||
kart_properties_manager->getKartById(karts[i])->getKartModel()->resetWheels();
|
||||
}
|
||||
}
|
||||
|
||||
// Now add the groups, indicated by a negative number as kart index
|
||||
// ----------------------------------------------------------------
|
||||
for(int i =0; i<(int)m_all_groups.size(); i++)
|
||||
{
|
||||
// Only add groups other than the current one
|
||||
if(m_all_groups[i]!=user_config->m_kart_group) m_index_avail_karts.push_back(-i-1);
|
||||
}
|
||||
if(m_index_avail_karts.size()>=m_max_entries)
|
||||
{
|
||||
m_offset = 0;
|
||||
widget_manager->showWgtRect(WTOK_DOWN);
|
||||
widget_manager->showWgtText(WTOK_DOWN);
|
||||
widget_manager->showWgtRect(WTOK_UP);
|
||||
widget_manager->showWgtText(WTOK_UP);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Less entries than maximum -> set m_offset to a negative number, so
|
||||
// that the actual existing entries are displayed
|
||||
m_offset = - (int)(m_max_entries-m_index_avail_karts.size())/2-1;
|
||||
widget_manager->hideWgtRect(WTOK_DOWN);
|
||||
widget_manager->hideWgtText(WTOK_DOWN);
|
||||
widget_manager->hideWgtRect(WTOK_UP);
|
||||
widget_manager->hideWgtText(WTOK_UP);
|
||||
}
|
||||
|
||||
} // switchGroup
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** This forces a re-display of the available characters. It is used from the
|
||||
* network manager when a character confirm message is received from the
|
||||
* server.
|
||||
*/
|
||||
void CharSel::updateAvailableCharacters()
|
||||
{
|
||||
// This call computes the available characters (even though in this case
|
||||
// the group hasn't changed.
|
||||
switchGroup();
|
||||
|
||||
// This re-displays the characters (even though the scroll position has
|
||||
// not changed, one character might have been deleted).
|
||||
updateScrollPosition();
|
||||
// Forces a redraw of the model.
|
||||
m_current_kart = -1;
|
||||
} // updateAvailableCharacters
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void CharSel::switchCharacter(int n)
|
||||
{
|
||||
int indx=m_index_avail_karts[n];
|
||||
// if a group is hovered about, don't do anything
|
||||
if(indx<0)
|
||||
{
|
||||
m_current_kart = -1;
|
||||
ssgDeRefDelete(m_kart);
|
||||
m_kart = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
const KartProperties* kp= kart_properties_manager->getKartById(indx);
|
||||
if (m_current_kart != n && kp != NULL)
|
||||
{
|
||||
m_current_kart = n;
|
||||
ssgDeRefDelete(m_kart);
|
||||
m_kart = new ssgTransform;
|
||||
m_kart->ref();
|
||||
KartModel* kartentity = kp->getKartModel();
|
||||
#ifdef HAVE_IRRLICHT
|
||||
#else
|
||||
m_kart->addKid(kartentity->getRoot());
|
||||
#endif
|
||||
}
|
||||
} // switchCharacter
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void CharSel::update(float dt)
|
||||
{
|
||||
// If we are still waiting in the barrier, don't do anything
|
||||
if(network_manager->getState()==NetworkManager::NS_WAIT_FOR_AVAILABLE_CHARACTERS)
|
||||
{
|
||||
widget_manager->update(dt);
|
||||
return;
|
||||
}
|
||||
|
||||
// Are we still waiting for a confirmation?
|
||||
if(network_manager->getState()==NetworkManager::NS_WAIT_FOR_KART_CONFIRMATION)
|
||||
{
|
||||
widget_manager->update(dt);
|
||||
return;
|
||||
}
|
||||
|
||||
// The selection was confirmed, proceed:
|
||||
if(network_manager->getState()==NetworkManager::NS_KART_CONFIRMED)
|
||||
{
|
||||
nextMenu();
|
||||
return;
|
||||
}
|
||||
|
||||
if(m_first_frame)
|
||||
{
|
||||
// Switch group will update the list of selected karts, i.e. use the
|
||||
// information about kart availability just received from the server
|
||||
switchGroup();
|
||||
|
||||
// Now try to select the previously selected kart again (in network
|
||||
// karts might be removed if they are not available on all computers,
|
||||
// so we have to recompute offset)
|
||||
computeOffset();
|
||||
|
||||
// Now hide the message window and display the widgets:
|
||||
widget_manager->hideWgt(WTOK_MESSAGE);
|
||||
widget_manager->showWgt(WTOK_TITLE, WTOK_DOWN);
|
||||
// Hide all widgets except the message widget
|
||||
for (unsigned int i = 0; i < m_max_entries; i++)
|
||||
{
|
||||
widget_manager->showWgt(WTOK_NAME0+i);
|
||||
widget_manager->showWgt(WTOK_RACER0+i);
|
||||
}
|
||||
m_first_frame = false;
|
||||
updateScrollPosition();
|
||||
return;
|
||||
}
|
||||
|
||||
m_clock += dt * 40.0f;
|
||||
|
||||
if( widget_manager->selectionChanged() )
|
||||
{
|
||||
int token = widget_manager->getSelectedWgt() - WTOK_RACER0;
|
||||
if(token<0 || token>(int)m_index_avail_karts.size())
|
||||
token = widget_manager->getSelectedWgt() - WTOK_NAME0;
|
||||
switchCharacter((token+m_offset)%m_index_avail_karts.size());
|
||||
}
|
||||
|
||||
if (m_kart != NULL)
|
||||
{
|
||||
ssgContext* oldContext = ssgGetCurrentContext();
|
||||
m_context -> makeCurrent();
|
||||
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
// Puts the character in the center. Scaling is done by
|
||||
// applying a big camera FOV.
|
||||
int w = user_config->m_width;
|
||||
int h = user_config->m_height;
|
||||
glViewport ( 0, h*1/4, (int)(0.7f*w), (int)(0.7f*h));
|
||||
|
||||
m_context -> setFOV ( 65.0f, 65.0f * h/w ) ;
|
||||
m_context -> setNearFar ( 0.05f, 1000.0f ) ;
|
||||
|
||||
sgCoord cam_pos;
|
||||
sgSetCoord(&cam_pos, 0.5f, 0, 0.4f, 0, 0, 0);
|
||||
m_context -> setCamera ( &cam_pos ) ;
|
||||
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
sgCoord trans;
|
||||
sgSetCoord(&trans, 0, 3, -.4f, m_clock, 0, 0);
|
||||
m_kart->setTransform (&trans) ;
|
||||
//glShadeModel(GL_SMOOTH);
|
||||
ssgCullAndDraw ( m_kart ) ;
|
||||
glViewport ( 0, 0, user_config->m_width, user_config->m_height ) ;
|
||||
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
oldContext->makeCurrent();
|
||||
}
|
||||
|
||||
widget_manager->update(dt);
|
||||
} // update
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/** This computes m_offset so that the previously selected kart is selected
|
||||
* by default.
|
||||
*/
|
||||
int CharSel::computeOffset()
|
||||
{
|
||||
int local_index = 0;
|
||||
int last_kart = user_config->m_player[m_player_index].getLastKartId();
|
||||
for(unsigned int i=0; i<m_index_avail_karts.size(); i++)
|
||||
{
|
||||
if(m_index_avail_karts[i]==last_kart)
|
||||
{
|
||||
local_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_offset = local_index - m_max_entries/2;
|
||||
if(m_offset<0) m_offset+=(int)m_index_avail_karts.size();
|
||||
return local_index;
|
||||
} // recmoputeOffset
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
/** Pushes the next menu onto the stack. In case of split screen that might
|
||||
* be another instance of the character selection menu.
|
||||
*/
|
||||
void CharSel::nextMenu()
|
||||
{
|
||||
if(race_manager->getNumLocalPlayers() > 1 &&
|
||||
menu_manager->isCurrentMenu(MENUID_CHARSEL_P1))
|
||||
{
|
||||
menu_manager->pushMenu(MENUID_CHARSEL_P2);
|
||||
return;
|
||||
}
|
||||
|
||||
if(race_manager->getNumLocalPlayers() > 2 &&
|
||||
menu_manager->isCurrentMenu(MENUID_CHARSEL_P2))
|
||||
{
|
||||
menu_manager->pushMenu(MENUID_CHARSEL_P3);
|
||||
return;
|
||||
}
|
||||
|
||||
if (race_manager->getNumLocalPlayers() > 3 &&
|
||||
menu_manager->isCurrentMenu(MENUID_CHARSEL_P3))
|
||||
{
|
||||
menu_manager->pushMenu(MENUID_CHARSEL_P4);
|
||||
return;
|
||||
}
|
||||
|
||||
// Last character selected
|
||||
if(network_manager->getMode()==NetworkManager::NW_CLIENT)
|
||||
{
|
||||
// Switch state to wait for race information
|
||||
network_manager->waitForRaceInformation();
|
||||
menu_manager->pushMenu(MENUID_START_RACE_FEEDBACK);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// The state of the server does not change now (so that it can keep
|
||||
// on handling client selections). Waiting for all client infos
|
||||
// happens in the start_race_feedback menu (which then triggers
|
||||
// sending the race info).
|
||||
if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_GRAND_PRIX)
|
||||
menu_manager->pushMenu(MENUID_GRANDPRIXSELECT);
|
||||
else
|
||||
menu_manager->pushMenu(MENUID_TRACKSEL);
|
||||
}
|
||||
} // nextMenu
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Handles widget selection.
|
||||
*/
|
||||
void CharSel::select()
|
||||
{
|
||||
int wgt = widget_manager->getSelectedWgt();
|
||||
if(wgt==WTOK_UP)
|
||||
{
|
||||
m_offset--;
|
||||
if(m_offset < 0) m_offset = (int)m_index_avail_karts.size() - 1;
|
||||
updateScrollPosition();
|
||||
return;
|
||||
}
|
||||
if(wgt==WTOK_DOWN)
|
||||
{
|
||||
m_offset++;
|
||||
if( m_offset >= (int)m_index_avail_karts.size() ) m_offset=0;
|
||||
updateScrollPosition();
|
||||
return;
|
||||
}
|
||||
|
||||
// Now it must be a character selection:
|
||||
// -------------------------------------
|
||||
int token = widget_manager->getSelectedWgt() - WTOK_RACER0;
|
||||
if(token<0 || token>(int)m_index_avail_karts.size())
|
||||
{
|
||||
token = widget_manager->getSelectedWgt() - WTOK_NAME0;
|
||||
}
|
||||
|
||||
token = (token+m_offset) % (int)m_index_avail_karts.size();
|
||||
int kart_id = m_index_avail_karts[token];
|
||||
if(kart_id < 0) // group selected
|
||||
{
|
||||
user_config->m_kart_group = m_all_groups[-kart_id-1];
|
||||
switchGroup();
|
||||
// forces redraw of the model, otherwise (if m_current_kart=0) the new
|
||||
// model would not be displayed.
|
||||
m_current_kart = -1;
|
||||
switchCharacter(0);
|
||||
updateScrollPosition();
|
||||
return;
|
||||
}
|
||||
const KartProperties* KP = kart_properties_manager->getKartById(kart_id);
|
||||
if (!KP) return;
|
||||
|
||||
race_manager->setLocalKartInfo(m_player_index, KP->getIdent());
|
||||
user_config->m_player[m_player_index].setLastKartId(kart_id);
|
||||
// Send the confirmation message to all clients.
|
||||
network_manager->sendCharacterSelected(m_player_index,
|
||||
KP->getIdent());
|
||||
// In non-network more or on the server add selected kart (token) to
|
||||
// selected karts vector so it cannot be selected again
|
||||
if(network_manager->getMode()!=NetworkManager::NW_CLIENT)
|
||||
{
|
||||
kart_properties_manager->selectKart(kart_id);
|
||||
nextMenu();
|
||||
}
|
||||
} // select
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void CharSel::handle(GameAction action, int value)
|
||||
{
|
||||
// Forward keypresses to basegui
|
||||
if(value) return BaseGUI::handle(action, value);
|
||||
|
||||
if(action==GA_CURSOR_UP)
|
||||
{
|
||||
m_offset--;
|
||||
if(m_offset < 0) m_offset = (int)m_index_avail_karts.size() - 1;
|
||||
updateScrollPosition();
|
||||
return;
|
||||
|
||||
} // if cursor up
|
||||
if(action ==GA_CURSOR_DOWN)
|
||||
{
|
||||
m_offset++;
|
||||
if( m_offset >= (int)m_index_avail_karts.size() ) m_offset=0;
|
||||
updateScrollPosition();
|
||||
return;
|
||||
} // if cursor down
|
||||
BaseGUI::handle(action, value);
|
||||
} // handle
|
@ -1,63 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_CHAR_SEL_HPP
|
||||
#define HEADER_CHAR_SEL_HPP
|
||||
|
||||
#include <vector>
|
||||
#include "base_gui.hpp"
|
||||
|
||||
class ssgTransform;
|
||||
class ssgContext;
|
||||
|
||||
class CharSel: public BaseGUI
|
||||
{
|
||||
private:
|
||||
ssgContext *m_context;
|
||||
ssgTransform *m_kart;
|
||||
int m_current_kart;
|
||||
float m_clock;
|
||||
int m_player_index;
|
||||
int m_offset; // index of first racer displayed
|
||||
unsigned int m_num_entries; // number of entries to display
|
||||
/** Helps to switch off the displayed text once only. */
|
||||
bool m_first_frame;
|
||||
std::vector<int> m_index_avail_karts;
|
||||
/** List of all groups, but excluding empty groups (e.g. groups with all
|
||||
* karts still locked. */
|
||||
std::vector<std::string> m_all_groups;
|
||||
static const unsigned int m_max_entries=7;
|
||||
|
||||
void updateScrollPosition();
|
||||
int computeIndent(int n) {return 40+abs((int)(m_max_entries-1)/2 - n)*3;}
|
||||
void switchGroup();
|
||||
void nextMenu();
|
||||
void switchCharacter(int n);
|
||||
int computeOffset();
|
||||
public:
|
||||
CharSel(int which_player);
|
||||
~CharSel();
|
||||
|
||||
void update(float dt);
|
||||
void select();
|
||||
void updateAvailableCharacters();
|
||||
virtual void handle(GameAction, int);
|
||||
};
|
||||
|
||||
#endif
|
@ -1,77 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_controls.hpp"
|
||||
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_TITLE,
|
||||
|
||||
WTOK_PLYR1,
|
||||
WTOK_PLYR2,
|
||||
WTOK_PLYR3,
|
||||
WTOK_PLYR4,
|
||||
|
||||
WTOK_QUIT
|
||||
};
|
||||
|
||||
ConfigControls::ConfigControls()
|
||||
{
|
||||
widget_manager->switchOrder();
|
||||
widget_manager->addTitleWgt( WTOK_TITLE, 60, 7, _("Edit controls for who?"));
|
||||
widget_manager->hideWgtRect(WTOK_TITLE);
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_PLYR1 , 60, 7, _("Player 1"));
|
||||
widget_manager->addTextButtonWgt( WTOK_PLYR2 , 60, 7, _("Player 2"));
|
||||
widget_manager->addTextButtonWgt( WTOK_PLYR3 , 60, 7, _("Player 3"));
|
||||
widget_manager->addTextButtonWgt( WTOK_PLYR4 , 60, 7, _("Player 4"));
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 60, 5);
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_QUIT , 60, 7, _("Press <ESC> to go back"));
|
||||
widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML );
|
||||
|
||||
widget_manager->layout( WGT_AREA_ALL );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
ConfigControls::~ConfigControls()
|
||||
{
|
||||
widget_manager->reset();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void ConfigControls::select()
|
||||
{
|
||||
switch ( widget_manager->getSelectedWgt() )
|
||||
{
|
||||
case WTOK_PLYR1: menu_manager->pushMenu(MENUID_CONFIG_P1); break;
|
||||
case WTOK_PLYR2: menu_manager->pushMenu(MENUID_CONFIG_P2); break;
|
||||
case WTOK_PLYR3: menu_manager->pushMenu(MENUID_CONFIG_P3); break;
|
||||
case WTOK_PLYR4: menu_manager->pushMenu(MENUID_CONFIG_P4); break;
|
||||
case WTOK_QUIT: menu_manager->popMenu(); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,34 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_CONFIGCONTROLS_H
|
||||
#define HEADER_CONFIGCONTROLS_H
|
||||
|
||||
#include "base_gui.hpp"
|
||||
|
||||
class ConfigControls: public BaseGUI
|
||||
{
|
||||
public:
|
||||
ConfigControls();
|
||||
~ConfigControls();
|
||||
|
||||
void select();
|
||||
};
|
||||
|
||||
#endif
|
@ -1,436 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_display.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "main_loop.hpp"
|
||||
#include "sdldrv.hpp"
|
||||
#include "user_config.hpp"
|
||||
#include "menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_TITLE,
|
||||
|
||||
WTOK_FULLSCREEN,
|
||||
WTOK_NEXT_BACKGROUND,
|
||||
WTOK_INCR_RES,
|
||||
WTOK_DECR_RES,
|
||||
WTOK_CURRENT_RES,
|
||||
WTOK_APPLY_RES,
|
||||
WTOK_CLEAR_BLACKLIST,
|
||||
|
||||
WTOK_QUIT
|
||||
};
|
||||
|
||||
ConfigDisplay::ConfigDisplay()
|
||||
{
|
||||
getScreenModes(); //Fill the vector m_sizes with possible resolutions
|
||||
|
||||
m_curr_width = m_sizes[m_curr_res].first;
|
||||
m_curr_height = m_sizes[m_curr_res].second;
|
||||
|
||||
widget_manager->switchOrder();
|
||||
widget_manager->addTitleWgt( WTOK_TITLE, 60, 7, _("Display Settings"));
|
||||
widget_manager->hideWgtRect(WTOK_TITLE);
|
||||
|
||||
if( isBlacklisted( m_curr_width, m_curr_height ))
|
||||
{
|
||||
widget_manager->addEmptyWgt( WTOK_FULLSCREEN, 1, 7);
|
||||
|
||||
if (user_config->m_fullscreen)
|
||||
{
|
||||
std::cerr << "Warning: current screen mode is blacklisted.\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(user_config->m_fullscreen)
|
||||
{
|
||||
widget_manager->addTextButtonWgt( WTOK_FULLSCREEN, 60, 7,
|
||||
_("Window mode"));
|
||||
}
|
||||
else
|
||||
{
|
||||
widget_manager->addTextButtonWgt( WTOK_FULLSCREEN, 60, 7,
|
||||
_("Fullscreen mode"));
|
||||
}
|
||||
}
|
||||
|
||||
widget_manager->addTextButtonWgt(WTOK_NEXT_BACKGROUND, 60, 7, _("Next background"));
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 60, 2 );
|
||||
|
||||
//I18N: displays current resolution
|
||||
std::string msg = StringUtils::insert_values(_("Current: %dx%d"),
|
||||
m_curr_width, m_curr_height);
|
||||
widget_manager->addTextWgt( WTOK_CURRENT_RES, 60, 7, msg);
|
||||
widget_manager->hideWgtRect(WTOK_CURRENT_RES);
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_INCR_RES, 60, 7,
|
||||
_("Increase Resolution"));
|
||||
widget_manager->addTextButtonWgt( WTOK_DECR_RES, 60, 7,
|
||||
_("Decrease Resolution"));
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 1, 2 );
|
||||
widget_manager->addTextButtonWgt( WTOK_APPLY_RES, 60, 7, _("Apply "));
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 1, 2 );
|
||||
|
||||
widget_manager->addEmptyWgt( WTOK_CLEAR_BLACKLIST, 60, 7);
|
||||
widget_manager->setWgtText( WTOK_CLEAR_BLACKLIST,
|
||||
_("Clear from Blacklist") );
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 1, 2 );
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_QUIT, 60, 7, _("Press <ESC> to go back"));
|
||||
widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML );
|
||||
|
||||
widget_manager->layout( WGT_AREA_ALL );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
ConfigDisplay::~ConfigDisplay()
|
||||
{
|
||||
widget_manager->reset();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void ConfigDisplay::select()
|
||||
{
|
||||
switch ( widget_manager->getSelectedWgt() )
|
||||
{
|
||||
case WTOK_FULLSCREEN:
|
||||
inputDriver->toggleFullscreen();
|
||||
if( user_config->m_fullscreen )
|
||||
{
|
||||
menu_manager->pushMenu( MENUID_RESOLUTION_CONFIRM_WIN );
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(WIN32) ||defined(__CYGWIN__)
|
||||
// Problem: on windows the textures etc. are deleted
|
||||
// so we have to reload this object again (since all display
|
||||
// lists in the widget were deleted). So we force to re-create
|
||||
// this object by first pushing it from the menu stack, and
|
||||
// then adding it again.
|
||||
menu_manager->popMenu();
|
||||
menu_manager->pushMenu(MENUID_CONFIG_DISPLAY);
|
||||
return;
|
||||
#else
|
||||
//FIXME: maybe instead of 'Fullscreen mode' something like
|
||||
//'Switch to fullscreen mode' would be more user friendly?
|
||||
widget_manager->setWgtText(WTOK_FULLSCREEN, _("Fullscreen mode"));
|
||||
#endif
|
||||
}
|
||||
changeApplyButton();
|
||||
break;
|
||||
case WTOK_NEXT_BACKGROUND:
|
||||
user_config->nextBackgroundIndex();
|
||||
main_loop->loadBackgroundImages();
|
||||
break;
|
||||
case WTOK_INCR_RES:
|
||||
{
|
||||
const int NUM_RES = (int)m_sizes.size();
|
||||
m_curr_res = std::min(NUM_RES - 1, m_curr_res + 1);
|
||||
|
||||
if ( user_config->m_fullscreen &&
|
||||
isBlacklisted( m_curr_width, m_curr_height ))
|
||||
{
|
||||
showBlacklistButtons();
|
||||
}
|
||||
else changeApplyButton();
|
||||
}
|
||||
break;
|
||||
|
||||
case WTOK_DECR_RES:
|
||||
m_curr_res = std::max(0,m_curr_res-1);
|
||||
if ( user_config->m_fullscreen &&
|
||||
isBlacklisted( m_curr_width, m_curr_height ))
|
||||
{
|
||||
showBlacklistButtons();
|
||||
}
|
||||
else changeApplyButton();
|
||||
break;
|
||||
|
||||
case WTOK_APPLY_RES:
|
||||
if (m_curr_width != m_sizes[m_curr_res].first ||
|
||||
m_curr_height != m_sizes[m_curr_res].second)
|
||||
{
|
||||
changeResolution(m_sizes[m_curr_res].first,m_sizes[m_curr_res].second/*, false*/);
|
||||
|
||||
if (user_config->m_fullscreen)
|
||||
{
|
||||
menu_manager->pushMenu(MENUID_RESOLUTION_CONFIRM_FS);
|
||||
}
|
||||
else
|
||||
{
|
||||
//I18N: displays current resolution
|
||||
std::string s = StringUtils::insert_values(_("Current: %dx%d"),
|
||||
user_config->m_width,
|
||||
user_config->m_height);
|
||||
widget_manager->setWgtText(WTOK_CURRENT_RES, s);
|
||||
|
||||
if ( isBlacklisted( user_config->m_width,
|
||||
user_config->m_height ))
|
||||
{
|
||||
widget_manager->hideWgtText(WTOK_FULLSCREEN);
|
||||
widget_manager->hideWgtRect(WTOK_FULLSCREEN);
|
||||
widget_manager->deactivateWgt(WTOK_FULLSCREEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
widget_manager->setWgtText(WTOK_FULLSCREEN, _("Fullscreen mode"));
|
||||
widget_manager->showWgtText(WTOK_FULLSCREEN);
|
||||
widget_manager->showWgtRect(WTOK_FULLSCREEN);
|
||||
widget_manager->activateWgt(WTOK_FULLSCREEN);
|
||||
}
|
||||
widget_manager->layout();
|
||||
|
||||
user_config->m_prev_width = m_curr_width = user_config->m_width;
|
||||
user_config->m_prev_height = m_curr_height = user_config->m_height;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WTOK_CLEAR_BLACKLIST:
|
||||
{
|
||||
const int NUM_BLACKLISTED = (int)user_config->m_blacklist_res.size();
|
||||
int black_width, black_height = 0;
|
||||
int id = -1;
|
||||
|
||||
for ( int i = 0; i < NUM_BLACKLISTED; ++i )
|
||||
{
|
||||
sscanf(user_config->m_blacklist_res[i].c_str(),
|
||||
"%dx%d",& black_width, & black_height);
|
||||
|
||||
if ( m_sizes[m_curr_res].first == black_width &&
|
||||
m_sizes[m_curr_res].second == black_height )
|
||||
{
|
||||
id = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( id != -1 )
|
||||
{
|
||||
user_config->m_blacklist_res.erase(
|
||||
user_config->m_blacklist_res.begin() + id );
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Warning: tried to erase a resolution that " <<
|
||||
"is not blacklisted.\n";
|
||||
}
|
||||
}
|
||||
|
||||
changeApplyButton();
|
||||
widget_manager->layout();
|
||||
break;
|
||||
|
||||
case WTOK_QUIT:
|
||||
menu_manager->popMenu();
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void ConfigDisplay::changeResolution(int width, int height/*, bool reverse*/)
|
||||
{
|
||||
if (/*!reverse && */user_config->m_fullscreen )
|
||||
{
|
||||
//store previous width and height
|
||||
user_config->m_prev_width = user_config->m_width;
|
||||
user_config->m_prev_height = user_config->m_height;
|
||||
}
|
||||
|
||||
//change to new height and width
|
||||
user_config->m_width = width;
|
||||
user_config->m_height = height;
|
||||
|
||||
#if 0
|
||||
// if returning to prev res, change m_crashed to false as we didn't crash and save config
|
||||
if (reverse && user_config->m_fullscreen)
|
||||
{
|
||||
user_config->m_crashed = false;
|
||||
user_config->saveConfig();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (/*!reverse && */user_config->m_fullscreen )
|
||||
{
|
||||
// Store settings in user config file in case new video mode
|
||||
// causes a crash
|
||||
user_config->m_crashed = true;
|
||||
user_config->saveConfig();
|
||||
}
|
||||
|
||||
inputDriver->setVideoMode();
|
||||
glViewport(0,0,user_config->m_width, user_config->m_height);
|
||||
}
|
||||
|
||||
/**This gets the available screen resolutions available on the hardware and
|
||||
* populates a vector with them.
|
||||
*/
|
||||
void ConfigDisplay::getScreenModes()
|
||||
{
|
||||
SDL_Rect **modes = SDL_ListModes( NULL, SDL_OPENGL | SDL_FULLSCREEN | SDL_HWSURFACE );
|
||||
|
||||
if (modes == NULL)
|
||||
{
|
||||
std::cerr << "No fullscreen modes available.\n";
|
||||
|
||||
loadDefaultModes();
|
||||
|
||||
//FIXME: blacklist all resolutions
|
||||
|
||||
}
|
||||
else if (modes == (SDL_Rect **)-1) //Any screen size can be used
|
||||
{
|
||||
loadDefaultModes();
|
||||
}
|
||||
else
|
||||
{
|
||||
//modes[i] is used as the breaking condition because that's how SDL's
|
||||
//docs use it in their examples.
|
||||
for (int i = 0; modes[i]; ++i)
|
||||
{
|
||||
m_sizes.push_back (std::pair <int, int> (modes[i]->w,
|
||||
modes[i]->h));
|
||||
}
|
||||
|
||||
std::sort (m_sizes.begin(), m_sizes.end());
|
||||
|
||||
//Prevent use of very small resolutions
|
||||
const int MIN_WIDTH = 640;
|
||||
const int MIN_HEIGHT = 480;
|
||||
const int NUM_RES = (int)m_sizes.size();
|
||||
|
||||
for (int i = NUM_RES - 1; i >= 0; --i)
|
||||
{
|
||||
if ( m_sizes[i].first < MIN_WIDTH )
|
||||
{
|
||||
//Remove the resolutions with a width smaller than MIN_WIDTH
|
||||
m_sizes.erase( m_sizes.begin(), m_sizes.begin() + i + 1 );
|
||||
break;
|
||||
}
|
||||
else if ( m_sizes[i].first == MIN_WIDTH &&
|
||||
m_sizes[i].second < MIN_HEIGHT )
|
||||
{
|
||||
m_sizes.erase( m_sizes.begin(), m_sizes.begin() + i + 1 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Set the same resolution as the one in the config file; if it's not
|
||||
//found, set it to the lowest resolution available as a sane default.
|
||||
m_curr_res = -1;
|
||||
const int NUM_RES = (int)m_sizes.size();
|
||||
|
||||
for (int i = 0; i < NUM_RES; ++i)
|
||||
{
|
||||
if (m_sizes[i].first == user_config->m_width
|
||||
&& m_sizes[i].second == user_config->m_height)
|
||||
{
|
||||
m_curr_res = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_curr_res = 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void ConfigDisplay::changeApplyButton()
|
||||
{
|
||||
// change Apply button text
|
||||
std::string msg = StringUtils::insert_values(_("Apply %dx%d"),
|
||||
m_sizes[m_curr_res].first,
|
||||
m_sizes[m_curr_res].second);
|
||||
widget_manager->setWgtText(WTOK_APPLY_RES, msg);
|
||||
widget_manager->activateWgt(WTOK_APPLY_RES);
|
||||
|
||||
// hide Remove from blacklist button
|
||||
widget_manager->hideWgtRect(WTOK_CLEAR_BLACKLIST);
|
||||
widget_manager->hideWgtText(WTOK_CLEAR_BLACKLIST);
|
||||
widget_manager->deactivateWgt(WTOK_CLEAR_BLACKLIST);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool ConfigDisplay::isBlacklisted(int width, int height)
|
||||
{
|
||||
int black_width, black_height;
|
||||
const int NUM_BLACKLISTED = (int)user_config->m_blacklist_res.size();
|
||||
|
||||
for (int i = 0; i < NUM_BLACKLISTED; ++i)
|
||||
{
|
||||
sscanf(user_config->m_blacklist_res[i].c_str(),
|
||||
"%dx%d", &black_width, &black_height );
|
||||
|
||||
if (width == black_width && height == black_height) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void ConfigDisplay::showBlacklistButtons()
|
||||
{
|
||||
//change Apply button to Blacklisted button
|
||||
std::string msg = StringUtils::insert_values(_("%dx%d Blacklisted"),
|
||||
m_sizes[m_curr_res].first,
|
||||
m_sizes[m_curr_res].second);
|
||||
widget_manager->setWgtText(WTOK_APPLY_RES, msg);
|
||||
widget_manager->deactivateWgt(WTOK_APPLY_RES);
|
||||
|
||||
//show Remove from blacklist button
|
||||
widget_manager->showWgtRect( WTOK_CLEAR_BLACKLIST);
|
||||
widget_manager->showWgtText( WTOK_CLEAR_BLACKLIST);
|
||||
widget_manager->activateWgt( WTOK_CLEAR_BLACKLIST);
|
||||
}
|
||||
|
||||
/** loadDefaultModes() populates our list of resolutios manually, sorted from
|
||||
* smallest to biggest, first on the width, then the height. Useful when
|
||||
* no fullscreen resolutions are available or when any resolution is
|
||||
* available. The list of resolutions is taken from
|
||||
* http://www.tamingthebeast.net/blog/web-development/screen-resolution-statistics-0907.htm
|
||||
*/
|
||||
void ConfigDisplay::loadDefaultModes()
|
||||
{
|
||||
m_sizes.clear();
|
||||
|
||||
m_sizes.push_back( std::pair <int, int> (800, 600) ); // 4:3
|
||||
m_sizes.push_back( std::pair <int, int> (1024, 768) ); // 4:3
|
||||
m_sizes.push_back( std::pair <int, int> (1152, 864) ); // 4:3
|
||||
m_sizes.push_back( std::pair <int, int> (1280, 768) ); // 5:3
|
||||
m_sizes.push_back( std::pair <int, int> (1280, 800) ); // 8:5
|
||||
m_sizes.push_back( std::pair <int, int> (1280, 960) ); // 4:3
|
||||
m_sizes.push_back( std::pair <int, int> (1280, 1024) );// 5:4
|
||||
m_sizes.push_back( std::pair <int, int> (1440, 900) ); // 8:5
|
||||
m_sizes.push_back( std::pair <int, int> (1680, 1050) );// 8:5
|
||||
m_sizes.push_back( std::pair <int, int> (1920, 1200) );// 8:5
|
||||
};
|
||||
|
@ -1,60 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_CONFIG_DISPLAY_HPP
|
||||
#define HEADER_CONFIG_DISPLAY_HPP
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "gui/base_gui.hpp"
|
||||
#include "gui/display_res_confirm.hpp"
|
||||
|
||||
class ConfigDisplay: public BaseGUI
|
||||
{
|
||||
public:
|
||||
ConfigDisplay();
|
||||
~ConfigDisplay();
|
||||
|
||||
void select();
|
||||
|
||||
private:
|
||||
std::vector< std::pair<int,int> > m_sizes;
|
||||
int m_curr_res;
|
||||
|
||||
int m_curr_width;
|
||||
int m_curr_height;
|
||||
|
||||
// changeResolution() reverse param is set true when changing to a previous resolution,
|
||||
// thought it is disabled for now.
|
||||
void changeResolution(int width, int height/*, bool reverse*/);
|
||||
void getScreenModes();
|
||||
void changeApplyButton();
|
||||
|
||||
#if 0
|
||||
// isBlacklisted() returns the index of the resolution in the blacklist
|
||||
// or -1 if not in the blacklist
|
||||
int isBlacklisted();
|
||||
#endif
|
||||
bool isBlacklisted(int width, int height);
|
||||
void showBlacklistButtons();
|
||||
|
||||
void loadDefaultModes();
|
||||
};
|
||||
|
||||
#endif
|
@ -1,115 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "user_config.hpp"
|
||||
#include "gui/config_sound.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "audio/sound_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_TITLE,
|
||||
|
||||
WTOK_MUSIC,
|
||||
WTOK_SFX,
|
||||
|
||||
WTOK_QUIT,
|
||||
};
|
||||
|
||||
ConfigSound::ConfigSound()
|
||||
{
|
||||
widget_manager->switchOrder();
|
||||
widget_manager->addTitleWgt(WTOK_TITLE, 50, 7, _("Sound Settings"));
|
||||
widget_manager->hideWgtRect(WTOK_TITLE);
|
||||
|
||||
widget_manager->setInitialActivationState(true);
|
||||
if( user_config->doMusic() )
|
||||
{
|
||||
widget_manager->addTextButtonWgt( WTOK_MUSIC, 50, 7, _("Turn off music"));
|
||||
}
|
||||
else
|
||||
{
|
||||
widget_manager->addTextButtonWgt( WTOK_MUSIC, 50, 7, _("Turn on music"));
|
||||
}
|
||||
|
||||
if( user_config->doSFX() )
|
||||
{
|
||||
widget_manager->addTextButtonWgt( WTOK_SFX, 50, 7, _("Turn off sound effects"));
|
||||
}
|
||||
else
|
||||
{
|
||||
widget_manager->addTextButtonWgt( WTOK_SFX, 50, 7, _("Turn on sound effects"));
|
||||
}
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 1, 5);
|
||||
|
||||
widget_manager->addTextButtonWgt(WTOK_QUIT, 50, 7,_("Press <ESC> to go back"));
|
||||
widget_manager->setWgtTextSize(WTOK_QUIT, WGT_FNT_SML);
|
||||
|
||||
widget_manager->layout(WGT_AREA_ALL);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
ConfigSound::~ConfigSound()
|
||||
{
|
||||
widget_manager->reset();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void ConfigSound::select()
|
||||
{
|
||||
switch ( widget_manager->getSelectedWgt())
|
||||
{
|
||||
case WTOK_MUSIC:
|
||||
if(user_config->doMusic())
|
||||
{
|
||||
user_config->setMusic(UserConfig::UC_DISABLE);
|
||||
widget_manager->setWgtText(WTOK_MUSIC, _("Turn on music"));
|
||||
sound_manager->stopMusic();
|
||||
}
|
||||
else
|
||||
{
|
||||
user_config->setMusic(UserConfig::UC_ENABLE);
|
||||
widget_manager->setWgtText(WTOK_MUSIC, _("Turn off music"));
|
||||
sound_manager->startMusic(sound_manager->getCurrentMusic());
|
||||
}
|
||||
break;
|
||||
case WTOK_SFX:
|
||||
if(user_config->doSFX())
|
||||
{
|
||||
user_config->setSFX(UserConfig::UC_DISABLE);
|
||||
widget_manager->setWgtText(WTOK_SFX, _("Turn on sound effects"));
|
||||
}
|
||||
else
|
||||
{
|
||||
user_config->setSFX(UserConfig::UC_ENABLE);
|
||||
widget_manager->setWgtText(WTOK_SFX, _("Turn off sound effects"));
|
||||
}
|
||||
break;
|
||||
case WTOK_QUIT:
|
||||
menu_manager->popMenu();
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,38 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_CONFIGSOUND_H
|
||||
#define HEADER_CONFIGSOUND_H
|
||||
|
||||
#include "base_gui.hpp"
|
||||
|
||||
class ConfigSound: public BaseGUI
|
||||
{
|
||||
public:
|
||||
ConfigSound();
|
||||
~ConfigSound();
|
||||
|
||||
void select();
|
||||
|
||||
private:
|
||||
int m_music_menu_id;
|
||||
int m_sfx_menu_id;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,102 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 Joerg Henrichs
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "gui/credits_menu.hpp"
|
||||
|
||||
#include <fstream>
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_CREDITS,
|
||||
WTOK_QUIT
|
||||
};
|
||||
|
||||
|
||||
CreditsMenu::CreditsMenu()
|
||||
{
|
||||
std::string filename;
|
||||
std::string line;
|
||||
std::string credits_text;
|
||||
|
||||
filename = file_manager->getConfigFile("CREDITS");
|
||||
std::ifstream file(filename.c_str());
|
||||
|
||||
if( file.is_open() )
|
||||
{
|
||||
while( !file.eof() )
|
||||
{
|
||||
getline(file, line);
|
||||
credits_text.append(line);
|
||||
credits_text.push_back('\n');
|
||||
} // while
|
||||
file.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Couldn't load '%s'\n",filename.c_str());
|
||||
credits_text.append("CREDIT file was not installed properly!!\n");
|
||||
credits_text.append("Please check 'data/CREDITS'!!");
|
||||
}
|
||||
|
||||
|
||||
widget_manager->addTextWgt( WTOK_CREDITS, 100, 93, "" );
|
||||
widget_manager->setWgtTextSize( WTOK_CREDITS, WGT_FNT_SML );
|
||||
//FIXME: maybe I should make scroll names more consistent
|
||||
widget_manager->enableWgtScroll( WTOK_CREDITS );
|
||||
widget_manager->setWgtYScrollPos( WTOK_CREDITS, WGT_SCROLL_START_BOTTOM );
|
||||
widget_manager->setWgtCornerRadius( WTOK_CREDITS, 1);
|
||||
widget_manager->showWgtBorder( WTOK_CREDITS );
|
||||
widget_manager->setWgtBorderColor( WTOK_CREDITS, WGT_TRANS_GREEN );
|
||||
widget_manager->setWgtBorderPercentage( WTOK_CREDITS, 2);
|
||||
widget_manager->setWgtYScrollSpeed( WTOK_CREDITS, -80 );
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_QUIT, 40, 7,
|
||||
_("Go back to the main menu"));
|
||||
|
||||
widget_manager->layout( WGT_AREA_TOP );
|
||||
|
||||
//This is done after layout so the widget doesn't gets resized.
|
||||
widget_manager->setWgtText( WTOK_CREDITS, credits_text );
|
||||
} // CreditsMenu
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
CreditsMenu::~CreditsMenu()
|
||||
{
|
||||
widget_manager->reset() ;
|
||||
} // ~CreditsMenu
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void CreditsMenu::select()
|
||||
{
|
||||
switch( widget_manager->getSelectedWgt() )
|
||||
{
|
||||
case WTOK_QUIT:
|
||||
menu_manager->popMenu();
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* EOF */
|
@ -1,34 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 Joerg Henrichs
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_CREDITSMENU_H
|
||||
#define HEADER_CREDITSMENU_H
|
||||
|
||||
#include "base_gui.hpp"
|
||||
|
||||
class CreditsMenu: public BaseGUI
|
||||
{
|
||||
public:
|
||||
CreditsMenu();
|
||||
~CreditsMenu();
|
||||
|
||||
void select ();
|
||||
};
|
||||
|
||||
#endif
|
@ -1,173 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Paul Elms
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include "user_config.hpp"
|
||||
#include "sdldrv.hpp"
|
||||
#include "gui/display_res_confirm.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_TITLE,
|
||||
WTOK_APPLY_RES,
|
||||
|
||||
WTOK_QUIT
|
||||
};
|
||||
|
||||
|
||||
DisplayResConfirm::DisplayResConfirm( const bool FROM_WINDOW_ ) :
|
||||
FROM_WINDOW (FROM_WINDOW_)
|
||||
{
|
||||
m_counter = 5; // Number of seconds in which to confirm
|
||||
|
||||
widget_manager->switchOrder();
|
||||
widget_manager->addTitleWgt( WTOK_TITLE, 70, 7,
|
||||
_("Confirm Resolution Within 5 Seconds"));
|
||||
widget_manager->hideWgtRect(WTOK_TITLE);
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 40, 2);
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_APPLY_RES, 40, 7, _("Confirm Resolution") );
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 40, 2);
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_QUIT, 40, 7, _("Press <ESC> to Cancel") );
|
||||
widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML );
|
||||
|
||||
widget_manager->layout( WGT_AREA_ALL );
|
||||
|
||||
m_timer = SDL_AddTimer(1000,timeout,NULL);
|
||||
if (m_timer == NULL)
|
||||
{
|
||||
std::cerr << "Warning: Timer could not be initialised!\n";
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
DisplayResConfirm::~DisplayResConfirm()
|
||||
{
|
||||
widget_manager->reset();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void DisplayResConfirm::select()
|
||||
{
|
||||
switch ( widget_manager->getSelectedWgt())
|
||||
{
|
||||
case WTOK_APPLY_RES:
|
||||
user_config->m_prev_width = user_config->m_width;
|
||||
user_config->m_prev_height = user_config->m_height;
|
||||
|
||||
SDL_RemoveTimer(m_timer);
|
||||
menu_manager->popMenu();
|
||||
break;
|
||||
case WTOK_QUIT:
|
||||
SDL_RemoveTimer(m_timer);
|
||||
if (FROM_WINDOW)
|
||||
{
|
||||
inputDriver->toggleFullscreen();
|
||||
user_config->m_crashed = false;
|
||||
user_config->saveConfig();
|
||||
}
|
||||
menu_manager->popMenu();
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void DisplayResConfirm::countdown()
|
||||
{
|
||||
if (m_counter > 1)
|
||||
{
|
||||
m_counter--;
|
||||
m_count = StringUtils::insert_values(_("Confirm Resolution Within %d Seconds"),
|
||||
m_counter);
|
||||
widget_manager->setWgtText( WTOK_TITLE, m_count );
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_RemoveTimer(m_timer);
|
||||
|
||||
// blacklist the resolution
|
||||
std::ostringstream o;
|
||||
o << user_config->m_width << "x" << user_config->m_height;
|
||||
user_config->m_blacklist_res.push_back (o.str());
|
||||
|
||||
if( FROM_WINDOW )
|
||||
{
|
||||
inputDriver->toggleFullscreen();
|
||||
user_config->m_prev_windowed = false;
|
||||
user_config->m_crashed = false;
|
||||
user_config->saveConfig();
|
||||
}
|
||||
|
||||
|
||||
menu_manager->popMenu();
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void DisplayResConfirm::handle(GameAction ga, int value)
|
||||
{
|
||||
switch ( ga )
|
||||
{
|
||||
case GA_LEAVE:
|
||||
if (value)
|
||||
break;
|
||||
SDL_RemoveTimer(m_timer);
|
||||
if (FROM_WINDOW)
|
||||
{
|
||||
inputDriver->toggleFullscreen();
|
||||
user_config->m_crashed = false;
|
||||
user_config->saveConfig();
|
||||
}
|
||||
menu_manager->popMenu();
|
||||
break;
|
||||
|
||||
default:
|
||||
BaseGUI::handle(ga, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
Uint32 timeout(Uint32 interval, void *param)
|
||||
{
|
||||
SDL_Event event;
|
||||
SDL_UserEvent userevent;
|
||||
|
||||
userevent.type = SDL_USEREVENT;
|
||||
userevent.code = 0;
|
||||
userevent.data1 = NULL;
|
||||
userevent.data2 = NULL;
|
||||
|
||||
event.type = SDL_USEREVENT;
|
||||
event.user = userevent;
|
||||
|
||||
SDL_PushEvent(&event);
|
||||
|
||||
return (interval);
|
||||
}
|
||||
|
@ -1,47 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Paul Elms
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_DISPLAY_RES_CONFIRM_HPP
|
||||
#define HEADER_DISPLAY_RES_CONFIRM_HPP
|
||||
|
||||
#include "base_gui.hpp"
|
||||
|
||||
#include <SDL/SDL.h>
|
||||
|
||||
class DisplayResConfirm: public BaseGUI
|
||||
{
|
||||
public:
|
||||
DisplayResConfirm( const bool FROM_WINDOW_ );
|
||||
~DisplayResConfirm();
|
||||
|
||||
void select();
|
||||
void countdown();
|
||||
void handle(GameAction ga, int value);
|
||||
|
||||
private:
|
||||
std::string m_count;
|
||||
int m_counter;
|
||||
const bool FROM_WINDOW;
|
||||
|
||||
SDL_TimerID m_timer;
|
||||
};
|
||||
|
||||
Uint32 timeout(Uint32 interval, void *param);
|
||||
|
||||
#endif
|
110
src/gui/engine.cpp
Normal file
110
src/gui/engine.cpp
Normal file
@ -0,0 +1,110 @@
|
||||
#include "gui/engine.hpp"
|
||||
#include "gui/screen.hpp"
|
||||
#include "gui/skin.hpp"
|
||||
#include "gui/widget.hpp"
|
||||
#include <iostream>
|
||||
|
||||
namespace GUIEngine
|
||||
{
|
||||
|
||||
IGUIEnvironment* g_env;
|
||||
IGUISkin* g_skin;
|
||||
IGUIFont* g_font;
|
||||
IrrlichtDevice* g_device;
|
||||
irr::video::IVideoDriver* g_driver;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
IrrlichtDevice* getDevice()
|
||||
{
|
||||
return g_device;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
IGUIFont* getFont()
|
||||
{
|
||||
return g_font;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
IVideoDriver* getDriver()
|
||||
{
|
||||
return g_driver;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
IGUIEnvironment* getGUIEnv()
|
||||
{
|
||||
return g_env;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
std::vector<Screen*> g_loaded_screens;
|
||||
Screen* g_current_screen = NULL;
|
||||
|
||||
void switchToScreen(const char* screen_name)
|
||||
{
|
||||
// clean what was left by the previous screen
|
||||
g_env->clear();
|
||||
g_current_screen = NULL;
|
||||
Widget::resetIDCounters();
|
||||
|
||||
// check if we already loaded this screen
|
||||
const int screen_amount = g_loaded_screens.size();
|
||||
for(int n=0; n<screen_amount; n++)
|
||||
{
|
||||
if((*g_loaded_screens[n]) == screen_name)
|
||||
{
|
||||
g_current_screen = g_loaded_screens[n];
|
||||
break;
|
||||
}
|
||||
}
|
||||
// screen not found in list of existing ones, so let's create it
|
||||
if(g_current_screen == NULL)
|
||||
{
|
||||
GUIEngine::Screen* new_screen = new GUIEngine::Screen(screen_name);
|
||||
g_loaded_screens.push_back(new_screen);
|
||||
g_current_screen = new_screen;
|
||||
}
|
||||
|
||||
// show screen
|
||||
g_current_screen->addWidgets();
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
Screen* getCurrentScreen()
|
||||
{
|
||||
assert(g_current_screen != NULL);
|
||||
return g_current_screen;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
void (*g_event_callback)(Widget* widget, std::string& name);
|
||||
void init(IrrlichtDevice* device_a, IVideoDriver* driver_a, void (*eventCallback)(Widget* widget, std::string& name) )
|
||||
{
|
||||
g_env = device_a->getGUIEnvironment();
|
||||
g_device = device_a;
|
||||
g_driver = driver_a;
|
||||
g_event_callback = eventCallback;
|
||||
|
||||
/*
|
||||
To make the g_font a little bit nicer, we load an external g_font
|
||||
and set it as the new default g_font in the g_skin.
|
||||
To keep the standard g_font for tool tip text, we set it to
|
||||
the built-in g_font.
|
||||
*/
|
||||
g_skin = new Skin(g_env->getSkin());
|
||||
g_env->setSkin(g_skin);
|
||||
//g_skin = g_env->getSkin();
|
||||
g_font = g_env->getFont("fonthaettenschweiler.bmp");
|
||||
if (g_font) g_skin->setFont(g_font);
|
||||
|
||||
//g_skin->setFont(g_env->getBuiltInFont(), EGDF_TOOLTIP);
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
void transmitEvent(Widget* widget, std::string& name)
|
||||
{
|
||||
assert(g_event_callback != NULL);
|
||||
g_event_callback(widget, name);
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
void render()
|
||||
{
|
||||
g_env->drawAll();
|
||||
}
|
||||
|
||||
}
|
34
src/gui/engine.hpp
Normal file
34
src/gui/engine.hpp
Normal file
@ -0,0 +1,34 @@
|
||||
#ifndef HEADER_ENGINE_HPP
|
||||
#define HEADER_ENGINE_HPP
|
||||
|
||||
#include <irrlicht.h>
|
||||
#include <string>
|
||||
|
||||
using namespace irr;
|
||||
using namespace core;
|
||||
using namespace scene;
|
||||
using namespace video;
|
||||
using namespace io;
|
||||
using namespace gui;
|
||||
|
||||
|
||||
namespace GUIEngine
|
||||
{
|
||||
class Screen;
|
||||
class Widget;
|
||||
|
||||
extern IrrlichtDevice* getDevice();
|
||||
extern IGUIEnvironment* getGUIEnv();
|
||||
extern IVideoDriver* getDriver();
|
||||
extern IGUIFont* getFont();
|
||||
|
||||
void init(irr::IrrlichtDevice* device, irr::video::IVideoDriver* driver, void (*eventCallback)(Widget* widget, std::string& name) );
|
||||
void switchToScreen(const char* );
|
||||
Screen* getCurrentScreen();
|
||||
|
||||
void render();
|
||||
void transmitEvent(Widget* widget, std::string& name);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -1,74 +0,0 @@
|
||||
// $Id: feature_unlocked.cpp 1305 2007-11-26 14:28:15Z hiker $
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "gui/feature_unlocked.hpp"
|
||||
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_TITLE,
|
||||
WTOK_CONTINUE,
|
||||
WTOK_DESCRIPTION
|
||||
};
|
||||
|
||||
FeatureUnlocked::FeatureUnlocked()
|
||||
{
|
||||
widget_manager->switchOrder();
|
||||
widget_manager->addTitleWgt( WTOK_TITLE, 60, 10,
|
||||
_("New Feature Unlocked"));
|
||||
widget_manager->hideWgtRect(WTOK_TITLE);
|
||||
|
||||
m_new_features=unlock_manager->getUnlockedFeatures();
|
||||
assert(m_new_features.size()>0);
|
||||
unlock_manager->clearUnlocked();
|
||||
|
||||
widget_manager->addTextWgt( WTOK_DESCRIPTION, 60, 30,
|
||||
m_new_features[0]->getUnlockedMessage());
|
||||
|
||||
widget_manager->addTextButtonWgt(WTOK_CONTINUE, 50, 7,
|
||||
_("Continue"));
|
||||
|
||||
widget_manager->layout(WGT_AREA_ALL);
|
||||
} // FeatureUnlocked
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
FeatureUnlocked::~FeatureUnlocked()
|
||||
{
|
||||
widget_manager->reset();
|
||||
} // ~FeatureUnlocked
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void FeatureUnlocked::select()
|
||||
{
|
||||
assert(widget_manager->getSelectedWgt()==WTOK_CONTINUE);
|
||||
m_new_features.erase(m_new_features.begin());
|
||||
if(m_new_features.size()>0)
|
||||
{
|
||||
widget_manager->setWgtText( WTOK_DESCRIPTION, m_new_features[0]->getUnlockedMessage() );
|
||||
}
|
||||
else
|
||||
{
|
||||
menu_manager->popMenu();
|
||||
}
|
||||
} // select
|
@ -1,38 +0,0 @@
|
||||
// $Id: feature_unlocked.hpp 1305 2007-11-26 14:28:15Z hiker $
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_FEATURE_UNLOCKED_H
|
||||
#define HEADER_FEATURE_UNLOCKED_H
|
||||
|
||||
#include <vector>
|
||||
#include "challenges/challenge.hpp"
|
||||
#include "base_gui.hpp"
|
||||
|
||||
class FeatureUnlocked: public BaseGUI
|
||||
{
|
||||
private:
|
||||
std::vector<const Challenge*> m_new_features;
|
||||
|
||||
public:
|
||||
FeatureUnlocked();
|
||||
~FeatureUnlocked();
|
||||
void select ();
|
||||
}; // FeatureUnlocked
|
||||
|
||||
#endif
|
@ -1,4 +1,4 @@
|
||||
// $Id: font.hpp 907 2007-02-04 01:38:54Z coz $
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 Joerg Henrichs
|
||||
@ -19,9 +19,9 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "file_manager.hpp"
|
||||
#include "user_config.hpp"
|
||||
#include "gui/font.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
|
||||
Font* font_gui;
|
||||
@ -67,7 +67,7 @@ Font::~Font()
|
||||
|
||||
void Font::Print(const char *text, int size,
|
||||
int x, int y,
|
||||
const GLfloat* color,
|
||||
const float* color,
|
||||
float scale_x, float scale_y,
|
||||
int left, int right, int top, int bottom, bool doShadow)
|
||||
{
|
||||
@ -102,11 +102,11 @@ void Font::Print(const char *text, int size,
|
||||
m_text_out->setPointSize((float)sz);
|
||||
if(doShadow)
|
||||
{
|
||||
m_text_out->start2f((GLfloat)x-2, (GLfloat)y-2);
|
||||
m_text_out->start2f((float)x-2, (float)y-2);
|
||||
glColor4ub(0, 0, 0, 100);
|
||||
m_text_out->puts(text);
|
||||
}
|
||||
m_text_out->start2f((GLfloat)x, (GLfloat)y);
|
||||
m_text_out->start2f((float)x, (float)y);
|
||||
|
||||
if( color == NULL )
|
||||
{
|
||||
@ -123,7 +123,7 @@ void Font::Print(const char *text, int size,
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void Font::PrintBold(const std::string &text, int size, int x, int y,
|
||||
const GLfloat* color, float scale_x, float scale_y,
|
||||
const float* color, float scale_x, float scale_y,
|
||||
int left, int right, int top, int bottom )
|
||||
{
|
||||
// Only scale for lower resolution
|
||||
@ -159,8 +159,8 @@ void Font::PrintBold(const std::string &text, int size, int x, int y,
|
||||
// print shadow
|
||||
// ------------
|
||||
glColor4f(0.0f,0.0f,0.0f,1.0f);
|
||||
float xf=(GLfloat)x+2;
|
||||
float yf=(GLfloat)y-2;
|
||||
float xf=(float)x+2;
|
||||
float yf=(float)y-2;
|
||||
for(float r=-1; r<=0; r+=0.5)
|
||||
{
|
||||
m_text_out->start2f(xf-r, yf-r);
|
||||
@ -175,8 +175,8 @@ void Font::PrintBold(const std::string &text, int size, int x, int y,
|
||||
{
|
||||
glColor4fv(color);
|
||||
}
|
||||
xf=(GLfloat)x;
|
||||
yf=(GLfloat)y;
|
||||
xf=(float)x;
|
||||
yf=(float)y;
|
||||
for(float r=-1.0f; r<=0.0f; r+=0.5f)
|
||||
{
|
||||
// This kind of simulates an outline, but it's not too good
|
||||
@ -185,7 +185,7 @@ void Font::PrintBold(const std::string &text, int size, int x, int y,
|
||||
//else
|
||||
// glColor4f(1.0f,1.0f,1.0f,1.0f);
|
||||
|
||||
m_text_out->start2f((GLfloat)x+r, (GLfloat)y+r);
|
||||
m_text_out->start2f((float)x+r, (float)y+r);
|
||||
m_text_out->puts(text.c_str());
|
||||
}
|
||||
m_text_out->end();
|
||||
|
@ -1,4 +1,4 @@
|
||||
// $Id: font.hpp 907 2007-02-04 01:38:54Z coz $
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 Joerg Henrichs
|
||||
@ -22,14 +22,9 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <plib/fnt.h>
|
||||
|
||||
class Font
|
||||
{
|
||||
private:
|
||||
fntTexFont *m_fnt;
|
||||
fntRenderer *m_text_out;
|
||||
|
||||
public:
|
||||
//CENTER_OF_SCREEN has to be bigger or smaller than Widget::MAX_SCROLL
|
||||
const static int CENTER_OF_SCREEN=-1000001;
|
||||
@ -46,13 +41,13 @@ public:
|
||||
// ----------------------------------------------
|
||||
void Print( const char *text, int size,
|
||||
int x, int y,
|
||||
const GLfloat* color = NULL,
|
||||
const float* color = NULL,
|
||||
float scale_x=1.0f, float scale_y=1.0f,
|
||||
int left=-1, int right=-1, int top=-1, int bottom=-1,
|
||||
bool doShadow=false);
|
||||
void Print( std::string const &text, int size,
|
||||
int x, int y,
|
||||
const GLfloat* color = NULL,
|
||||
const float* color = NULL,
|
||||
float scale_x=1.0f, float scale_y=1.0f,
|
||||
int left=-1, int right=-1, int top=-1, int bottom=-1,
|
||||
bool doShadow=false)
|
||||
@ -64,7 +59,7 @@ public:
|
||||
|
||||
void PrintShadow(const char *text, int size,
|
||||
int x, int y,
|
||||
const GLfloat* color = NULL,
|
||||
const float* color = NULL,
|
||||
float scale_x=1.0f, float scale_y=1.0f,
|
||||
int left=-1, int right=-1, int top=-1, int bottom=-1)
|
||||
{
|
||||
@ -74,7 +69,7 @@ public:
|
||||
}
|
||||
void PrintBold( std::string const &text, int size,
|
||||
int x, int y,
|
||||
const GLfloat* color = NULL,
|
||||
const float* color = NULL,
|
||||
float scale_x=1.0f, float scale_y=1.0f,
|
||||
int left=-1, int right=-1, int top=-1, int bottom=-1);
|
||||
};
|
||||
|
@ -1,218 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "game_mode.hpp"
|
||||
|
||||
#include "race_manager.hpp"
|
||||
#include "material_manager.hpp"
|
||||
#include "user_config.hpp"
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_TITLE_SINGLE,
|
||||
WTOK_QUICK_RACE_SINGLE,
|
||||
WTOK_TIMETRIAL_SINGLE,
|
||||
WTOK_FOLLOW_LEADER_SINGLE,
|
||||
WTOK_3_STRIKES_SINGLE,
|
||||
|
||||
WTOK_TITLE_GP,
|
||||
WTOK_QUICK_RACE_GP,
|
||||
WTOK_TIMETRIAL_GP,
|
||||
WTOK_FOLLOW_LEADER_GP,
|
||||
|
||||
WTOK_HELP,
|
||||
WTOK_QUIT
|
||||
};
|
||||
|
||||
GameMode::GameMode()
|
||||
{
|
||||
const int HEIGHT = 7;
|
||||
const int WIDTH = 5;
|
||||
|
||||
const WidgetDirection column_1_dir = WGT_DIR_FROM_LEFT;
|
||||
const float column_1_loc = 0.1f;
|
||||
|
||||
const WidgetDirection column_2_dir = WGT_DIR_FROM_RIGHT;
|
||||
const float column_2_loc = 0.1f;
|
||||
|
||||
// First the single race events
|
||||
// ============================
|
||||
Widget *w=widget_manager->addTextWgt(WTOK_TITLE_SINGLE, WIDTH,
|
||||
HEIGHT, _("Single Race"));
|
||||
widget_manager->hideWgtRect(WTOK_TITLE_SINGLE);
|
||||
w->setPosition(column_1_dir, column_1_loc, NULL,
|
||||
WGT_DIR_FROM_TOP, 0.2f, NULL);
|
||||
Widget *w_prev=w;
|
||||
w=widget_manager->addTextButtonWgt(WTOK_QUICK_RACE_SINGLE, WIDTH, HEIGHT,
|
||||
_("Quick Race"));
|
||||
w->setPosition(column_1_dir, column_1_loc, NULL,
|
||||
WGT_DIR_UNDER_WIDGET, 0.0f, w_prev);
|
||||
w_prev=w;
|
||||
w=widget_manager->addTextButtonWgt(WTOK_TIMETRIAL_SINGLE, WIDTH, HEIGHT,
|
||||
_("Time Trial"));
|
||||
w->setPosition(column_1_dir, column_1_loc, NULL,
|
||||
WGT_DIR_UNDER_WIDGET, 0.0f, w_prev);
|
||||
w_prev=w;
|
||||
w=widget_manager->addTextButtonWgt(WTOK_FOLLOW_LEADER_SINGLE, WIDTH, HEIGHT,
|
||||
_("Follow the Leader"));
|
||||
w->setPosition(column_1_dir, column_1_loc, NULL,
|
||||
WGT_DIR_UNDER_WIDGET, 0.0f, w_prev);
|
||||
w_prev=w;
|
||||
|
||||
// don't activate battle mode in single-player mode
|
||||
if(race_manager->getNumLocalPlayers()>1 ||
|
||||
network_manager->getMode()!=NetworkManager::NW_NONE)
|
||||
{
|
||||
w=widget_manager->addTextButtonWgt(WTOK_3_STRIKES_SINGLE, WIDTH, HEIGHT,
|
||||
_("3 Strikes Battle"));
|
||||
w->setPosition(column_1_dir, column_1_loc, NULL,
|
||||
WGT_DIR_UNDER_WIDGET, 0.0f, w_prev);
|
||||
w_prev=w;
|
||||
widget_manager->sameWidth(WTOK_TITLE_SINGLE, WTOK_3_STRIKES_SINGLE);
|
||||
}
|
||||
else
|
||||
widget_manager->sameWidth(WTOK_TITLE_SINGLE, WTOK_FOLLOW_LEADER_SINGLE);
|
||||
|
||||
// Then the GPs
|
||||
// ============
|
||||
w=widget_manager->addTextWgt(WTOK_TITLE_GP, WIDTH,
|
||||
HEIGHT, _("Grand Prix"));
|
||||
widget_manager->hideWgtRect(WTOK_TITLE_GP);
|
||||
w->setPosition(column_2_dir, column_2_loc, NULL,
|
||||
WGT_DIR_FROM_TOP, 0.2f, NULL);
|
||||
w_prev=w;
|
||||
w=widget_manager->addTextButtonWgt(WTOK_QUICK_RACE_GP, WIDTH, HEIGHT,
|
||||
_("Quick Race"));
|
||||
w->setPosition(column_2_dir, column_2_loc, NULL,
|
||||
WGT_DIR_UNDER_WIDGET, 0.0f, w_prev);
|
||||
w_prev=w;
|
||||
w=widget_manager->addTextButtonWgt(WTOK_TIMETRIAL_GP, WIDTH, HEIGHT,
|
||||
_("Time Trial"));
|
||||
w->setPosition(column_2_dir, column_2_loc, NULL,
|
||||
WGT_DIR_UNDER_WIDGET, 0.0f, w_prev);
|
||||
w_prev=w;
|
||||
w=widget_manager->addTextButtonWgt(WTOK_FOLLOW_LEADER_GP, WIDTH, HEIGHT,
|
||||
_("Follow the Leader"));
|
||||
w->setPosition(column_2_dir, column_2_loc, NULL,
|
||||
WGT_DIR_UNDER_WIDGET, 0.0f, w_prev);
|
||||
w_prev=w;
|
||||
widget_manager->sameWidth(WTOK_TITLE_GP, WTOK_FOLLOW_LEADER_GP);
|
||||
|
||||
if(unlock_manager->isLocked("grandprix"))
|
||||
{
|
||||
for(int i=WTOK_QUICK_RACE_GP; i<=WTOK_FOLLOW_LEADER_GP; i++)
|
||||
{
|
||||
widget_manager->hideWgtText(i);
|
||||
widget_manager->deactivateWgt(i);
|
||||
|
||||
widget_manager->setWgtColor(i, WGT_WHITE);
|
||||
widget_manager->setWgtLockTexture(i);
|
||||
widget_manager->showWgtTexture(i);
|
||||
}
|
||||
}
|
||||
|
||||
if(unlock_manager->isLocked("followtheleader"))
|
||||
{
|
||||
widget_manager->hideWgtText(WTOK_FOLLOW_LEADER_SINGLE);
|
||||
widget_manager->deactivateWgt(WTOK_FOLLOW_LEADER_SINGLE);
|
||||
widget_manager->setWgtLockTexture(WTOK_FOLLOW_LEADER_SINGLE);
|
||||
widget_manager->showWgtTexture(WTOK_FOLLOW_LEADER_SINGLE);
|
||||
//widget_manager->setWgtText(WTOK_FOLLOW_LEADER_SINGLE,
|
||||
// _("Fulfil challenge to unlock"));
|
||||
widget_manager->hideWgtText(WTOK_FOLLOW_LEADER_GP);
|
||||
widget_manager->deactivateWgt(WTOK_FOLLOW_LEADER_GP);
|
||||
widget_manager->setWgtLockTexture(WTOK_FOLLOW_LEADER_GP);
|
||||
widget_manager->showWgtTexture(WTOK_FOLLOW_LEADER_GP);
|
||||
//widget_manager->setWgtText(WTOK_FOLLOW_LEADER_GP,
|
||||
// _("Fulfil challenge to unlock"));
|
||||
}
|
||||
|
||||
|
||||
// help
|
||||
w=widget_manager->addTextButtonWgt( WTOK_HELP, WIDTH, HEIGHT, _("Game mode help"));
|
||||
widget_manager->setWgtTextSize( WTOK_HELP, WGT_FNT_SML );
|
||||
w->setPosition(WGT_DIR_CENTER, 0.0f, NULL, WGT_DIR_UNDER_WIDGET, 0.1f, w_prev);
|
||||
w_prev=w;
|
||||
|
||||
// return button
|
||||
w=widget_manager->addTextButtonWgt(WTOK_QUIT, WIDTH, HEIGHT, _("Press <ESC> to go back"));
|
||||
widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML );
|
||||
w->setPosition(WGT_DIR_CENTER, 0.0f, NULL, WGT_DIR_FROM_BOTTOM, 0.0f, w_prev);
|
||||
|
||||
widget_manager->layout(WGT_AREA_ALL);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
GameMode::~GameMode()
|
||||
{
|
||||
widget_manager->reset();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void GameMode::select()
|
||||
{
|
||||
int mode = widget_manager->getSelectedWgt();
|
||||
switch (mode)
|
||||
{
|
||||
case WTOK_QUICK_RACE_SINGLE:
|
||||
race_manager->setMajorMode(RaceManager::MAJOR_MODE_SINGLE);
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_QUICK_RACE);
|
||||
break;
|
||||
case WTOK_TIMETRIAL_SINGLE:
|
||||
race_manager->setMajorMode(RaceManager::MAJOR_MODE_SINGLE);
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_TIME_TRIAL);
|
||||
break;
|
||||
case WTOK_FOLLOW_LEADER_SINGLE:
|
||||
race_manager->setMajorMode(RaceManager::MAJOR_MODE_SINGLE);
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_FOLLOW_LEADER);
|
||||
break;
|
||||
case WTOK_3_STRIKES_SINGLE:
|
||||
race_manager->setMajorMode(RaceManager::MAJOR_MODE_SINGLE);
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_3_STRIKES);
|
||||
break;
|
||||
case WTOK_QUICK_RACE_GP:
|
||||
race_manager->setMajorMode(RaceManager::MAJOR_MODE_GRAND_PRIX);
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_QUICK_RACE);
|
||||
break;
|
||||
case WTOK_TIMETRIAL_GP:
|
||||
race_manager->setMajorMode(RaceManager::MAJOR_MODE_GRAND_PRIX);
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_TIME_TRIAL);
|
||||
break;
|
||||
case WTOK_FOLLOW_LEADER_GP:
|
||||
race_manager->setMajorMode(RaceManager::MAJOR_MODE_GRAND_PRIX);
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_FOLLOW_LEADER);
|
||||
break;
|
||||
case WTOK_HELP:
|
||||
menu_manager->pushMenu(MENUID_HELP3);
|
||||
return;
|
||||
case WTOK_QUIT:
|
||||
menu_manager->popMenu();
|
||||
return;
|
||||
default: break;
|
||||
}
|
||||
menu_manager->pushMenu(MENUID_CHARSEL_P1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,34 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_GAMEMODE_H
|
||||
#define HEADER_GAMEMODE_H
|
||||
|
||||
#include "base_gui.hpp"
|
||||
|
||||
class GameMode: public BaseGUI
|
||||
{
|
||||
public:
|
||||
GameMode();
|
||||
~GameMode();
|
||||
|
||||
void select();
|
||||
};
|
||||
|
||||
#endif
|
@ -1,228 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 Eduardo Hernandez Munoz
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "gui/grand_prix_ending.hpp"
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include <SDL/SDL.h>
|
||||
|
||||
#include "loader.hpp"
|
||||
#include "race_manager.hpp"
|
||||
#include "user_config.hpp"
|
||||
#include "audio/sfx_manager.hpp"
|
||||
#include "audio/sfx_base.hpp"
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "graphics/scene.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "karts/kart.hpp"
|
||||
#include "karts/kart_model.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_TITLE,
|
||||
WTOK_QUIT,
|
||||
|
||||
WTOK_FIRSTKART
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
GrandPrixEnd::GrandPrixEnd()
|
||||
: m_kart(0)
|
||||
{
|
||||
m_winner_sound = sfx_manager->newSFX(SFXManager::SOUND_WINNER);
|
||||
// for some strange reasons plib calls makeCurrent() in ssgContext
|
||||
// constructor, so we have to save the old one here and restore it
|
||||
ssgContext* oldContext = ssgGetCurrentContext();
|
||||
m_context = new ssgContext;
|
||||
oldContext->makeCurrent();
|
||||
|
||||
const unsigned int MAX_STR_LEN = 60;
|
||||
const unsigned int NUM_KARTS = race_manager->getNumKarts();
|
||||
|
||||
// Ignore the first kart if it's a follow-the-leader race.
|
||||
int start=(race_manager->getMinorMode()==RaceManager::MINOR_MODE_FOLLOW_LEADER) ? 1 : 0;
|
||||
|
||||
|
||||
int winner_kart_id = -1;
|
||||
// find which kart ended at rank '0'
|
||||
for(unsigned int j=start; j < NUM_KARTS; ++j)
|
||||
{
|
||||
if( race_manager->getKartFinalGPRank(j) == 0 )
|
||||
{
|
||||
winner_kart_id = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::string output = StringUtils::insert_values(_("The winner is %s!"),
|
||||
race_manager->getKartName(winner_kart_id));
|
||||
widget_manager->addWgt( WTOK_TITLE, 60, 10);
|
||||
widget_manager->showWgtRect(WTOK_TITLE);
|
||||
widget_manager->showWgtText(WTOK_TITLE);
|
||||
widget_manager->setWgtText(WTOK_TITLE, output);
|
||||
widget_manager->setWgtTextSize(WTOK_TITLE, WGT_FNT_LRG);
|
||||
widget_manager->breakLine();
|
||||
|
||||
m_score = new char[MAX_STR_LEN*NUM_KARTS];
|
||||
|
||||
for(unsigned int i=start; i < NUM_KARTS; ++i)
|
||||
{
|
||||
// char sTime[20];sTime[0]=0;
|
||||
// if(RaceManager::isLinearRaceMode(race_manager->getMinorMode()) &&
|
||||
// RaceManager::modeHasLaps(race_manager->getMinorMode()) )
|
||||
// TimeToString(race_time[i], sTime);
|
||||
|
||||
int this_kart_id = -1;
|
||||
// find which kart ended at rank 'i'
|
||||
for(unsigned int j=start; j < NUM_KARTS; ++j)
|
||||
{
|
||||
if( (int)race_manager->getKartFinalGPRank(j) == (int)(i-start) )
|
||||
{
|
||||
this_kart_id = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sprintf((char*)(m_score + MAX_STR_LEN * i), "#%d (%d) : %s",
|
||||
i-start + 1 /* add 1 because, while the inner ranks start at 0, users expect them to start at 1 */,
|
||||
race_manager->getKartScore(this_kart_id),
|
||||
race_manager->getKartName(this_kart_id).c_str() );
|
||||
|
||||
widget_manager->addWgt(WTOK_FIRSTKART + i, 40, 5);
|
||||
widget_manager->showWgtRect(WTOK_FIRSTKART + i);
|
||||
widget_manager->showWgtText(WTOK_FIRSTKART + i);
|
||||
widget_manager->setWgtText(WTOK_FIRSTKART + i,
|
||||
(char*)(m_score + MAX_STR_LEN * i));
|
||||
widget_manager->setWgtTextSize(WTOK_FIRSTKART + i, WGT_FNT_SML);
|
||||
widget_manager->breakLine();
|
||||
}
|
||||
const std::string WINNER_KART_NAME = race_manager->getKartName(winner_kart_id);
|
||||
const KartProperties* WINNING_KART = kart_properties_manager->getKart(WINNER_KART_NAME);
|
||||
|
||||
widget_manager->addWgt(WTOK_QUIT, 50, 7);
|
||||
widget_manager->activateWgt(WTOK_QUIT);
|
||||
widget_manager->showWgtRect(WTOK_QUIT);
|
||||
widget_manager->showWgtText(WTOK_QUIT);
|
||||
if(unlock_manager->getUnlockedFeatures().size()>0)
|
||||
{
|
||||
widget_manager->setWgtText(WTOK_QUIT, _("Continue"));
|
||||
}
|
||||
else
|
||||
{
|
||||
widget_manager->setWgtText(WTOK_QUIT, _("Back to the main menu"));
|
||||
}
|
||||
|
||||
widget_manager->layout(WGT_AREA_TOP);
|
||||
|
||||
m_kart = new ssgTransform;
|
||||
m_kart->ref();
|
||||
KartModel* kartentity = WINNING_KART->getKartModel();
|
||||
#ifdef HAVE_IRRLICHT
|
||||
#else
|
||||
m_kart->addKid(kartentity->getRoot());
|
||||
#endif
|
||||
|
||||
m_winner_sound->play();
|
||||
|
||||
m_clock = 0;
|
||||
|
||||
//FIXME: this is taken from RaceMode::exit_race,
|
||||
//this should be organized better.
|
||||
stk_scene->clear();
|
||||
RaceManager::setWorld(NULL);
|
||||
race_manager->m_active_race = false;
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
GrandPrixEnd::~GrandPrixEnd()
|
||||
{
|
||||
sfx_manager->deleteSFX(m_winner_sound);
|
||||
widget_manager->reset();
|
||||
ssgDeRefDelete(m_kart);
|
||||
|
||||
delete m_context;
|
||||
delete[] m_score;
|
||||
|
||||
//The next line prevents textures like the background of the main menu from
|
||||
//going white after finishing the grandprix
|
||||
// FIXME: I think this is not necessary anymore after the
|
||||
// texture bug fix (r733) - but I can't currently test this.
|
||||
loader->shared_textures.removeAll();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void GrandPrixEnd::update(float dt)
|
||||
{
|
||||
m_clock += dt * 40.0f;
|
||||
|
||||
glClearColor (0.1f, 0.1f, 0.1f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
ssgContext* oldContext = ssgGetCurrentContext();
|
||||
m_context -> makeCurrent();
|
||||
|
||||
// FIXME: A bit hackish...
|
||||
glViewport ( 0, 0, 800, 320);
|
||||
|
||||
m_context -> setFOV ( 45.0f, 45.0f * 320.0f/800.0f ) ;
|
||||
m_context -> setNearFar ( 0.05f, 1000.0f ) ;
|
||||
|
||||
sgCoord cam_pos;
|
||||
sgSetCoord(&cam_pos, 0, 0, 0, 0, 0, 0);
|
||||
m_context -> setCamera ( &cam_pos ) ;
|
||||
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
sgCoord trans;
|
||||
sgSetCoord(&trans, 0, 3, -.4f, m_clock, 0, 0);
|
||||
m_kart->setTransform (&trans) ;
|
||||
//glShadeModel(GL_SMOOTH);
|
||||
ssgCullAndDraw ( m_kart ) ;
|
||||
glViewport ( 0, 0, user_config->m_width, user_config->m_height ) ;
|
||||
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
oldContext->makeCurrent();
|
||||
BaseGUI::update(dt);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void GrandPrixEnd::select()
|
||||
{
|
||||
// If a new feature was unlocked, display the new feature first
|
||||
// before returning to the main menu
|
||||
if(unlock_manager->getUnlockedFeatures().size()>0)
|
||||
{
|
||||
// This removes this menu from the stack, and adds the main menu.
|
||||
// Then we push the new feature menu on top, so that it will be
|
||||
// displayed next, and on return the main menu is shown.
|
||||
menu_manager->switchToMainMenu();
|
||||
menu_manager->pushMenu(MENUID_UNLOCKED_FEATURE);
|
||||
return;
|
||||
}
|
||||
|
||||
menu_manager->switchToMainMenu();
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 Eduardo Hernandez Munoz
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_GRAND_PRIX_ENDING_H
|
||||
#define HEADER_GRAND_PRIX_ENDING_H
|
||||
|
||||
#include "base_gui.hpp"
|
||||
|
||||
class ssgBranch;
|
||||
class ssgTransform;
|
||||
class ssgContext;
|
||||
class SFXBase;
|
||||
|
||||
class GrandPrixEnd: public BaseGUI
|
||||
{
|
||||
private:
|
||||
ssgContext *m_context;
|
||||
ssgTransform *m_kart;
|
||||
int m_current_kart;
|
||||
int m_kart_name_label;
|
||||
char *m_score;
|
||||
float m_clock;
|
||||
SFXBase *m_winner_sound;
|
||||
|
||||
|
||||
public:
|
||||
GrandPrixEnd();
|
||||
~GrandPrixEnd();
|
||||
void update(float dt);
|
||||
void select();
|
||||
};
|
||||
|
||||
#endif
|
@ -1,192 +0,0 @@
|
||||
// $Id: track_sel.cpp 694 2006-08-29 07:42:36Z hiker $
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 Joerg Henrichs
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include <set>
|
||||
#include "grand_prix_select.hpp"
|
||||
#include "race_manager.hpp"
|
||||
#include "material_manager.hpp"
|
||||
#include "grand_prix_manager.hpp"
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "tracks/track_manager.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_TITLE,
|
||||
|
||||
//FIXME: finish the tokens
|
||||
|
||||
WTOK_DESCRIPTION,
|
||||
WTOK_TRACKS,
|
||||
WTOK_IMG,
|
||||
WTOK_QUIT,
|
||||
|
||||
WTOK_FIRSTPRIX
|
||||
};
|
||||
|
||||
GrandPrixSelect::GrandPrixSelect() : m_curr_track_img(0), m_clock(0.0f)
|
||||
{
|
||||
widget_manager->switchOrder();
|
||||
widget_manager->addEmptyWgt(WTOK_TITLE, 60, 7);
|
||||
|
||||
int nId=0;
|
||||
m_gp_index.clear();
|
||||
for(unsigned int i=0; i<grand_prix_manager->getNumberOfGrandPrix(); i++)
|
||||
{
|
||||
const GrandPrixData *gp = grand_prix_manager->getGrandPrix(i);
|
||||
if(unlock_manager->isLocked(gp->getId())) continue;
|
||||
widget_manager->addTextButtonWgt(WTOK_FIRSTPRIX + nId, 60, 7, gp->getName() );
|
||||
m_gp_index.push_back(i);
|
||||
nId++;
|
||||
} // for i
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 1 );
|
||||
|
||||
widget_manager->addTextWgt( WTOK_DESCRIPTION, 80, 7, _("No Grand Prix selected") );
|
||||
widget_manager->setWgtTextSize(WTOK_DESCRIPTION, WGT_FNT_SML);
|
||||
widget_manager->hideWgtRect(WTOK_DESCRIPTION);
|
||||
widget_manager->breakLine();
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addTextWgt( WTOK_TRACKS, 60, 40, _("No Grand Prix selected"));
|
||||
widget_manager->enableWgtScroll( WTOK_TRACKS );
|
||||
widget_manager->setWgtYScrollSpeed( WTOK_TRACKS, -60 );
|
||||
|
||||
widget_manager->addImgWgt( WTOK_IMG, 40, 40, 0 );
|
||||
widget_manager->setWgtColor( WTOK_IMG, WGT_BLACK );
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 1 );
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addTextButtonWgt(WTOK_QUIT, 40, 7, _("Press <ESC> to go back") );
|
||||
widget_manager->setWgtTextSize(WTOK_QUIT, WGT_FNT_SML);
|
||||
|
||||
widget_manager->layout(WGT_AREA_ALL);
|
||||
} // GrandPrixSelect
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
GrandPrixSelect::~GrandPrixSelect()
|
||||
{
|
||||
widget_manager->reset();
|
||||
} // GrandPrixSelect
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void GrandPrixSelect::update(float dt)
|
||||
{
|
||||
const int SELECTED_TOKEN = widget_manager->getSelectedWgt();
|
||||
|
||||
if( widget_manager->selectionChanged() &&
|
||||
!( SELECTED_TOKEN < WTOK_FIRSTPRIX ))
|
||||
{
|
||||
const int NUM = m_gp_index[SELECTED_TOKEN - WTOK_FIRSTPRIX];
|
||||
const GrandPrixData *gp = grand_prix_manager->getGrandPrix(NUM);
|
||||
const int NUM_TRACKS = gp->getTrackCount();
|
||||
|
||||
widget_manager->setWgtText(WTOK_DESCRIPTION, gp->getDescription());
|
||||
|
||||
|
||||
std::string track_list;
|
||||
m_gp_tracks = gp->getTracks();
|
||||
|
||||
for( int i = 0; i < NUM_TRACKS; ++i )
|
||||
{
|
||||
track_list.append( track_manager->getTrack( m_gp_tracks[i] )->getName() );
|
||||
track_list.push_back('\n');
|
||||
}
|
||||
widget_manager->setWgtText( WTOK_TRACKS, track_list );
|
||||
|
||||
|
||||
std::string img_filename;
|
||||
Material *mat;
|
||||
|
||||
m_track_imgs.clear();
|
||||
|
||||
for( int i = 0; i < NUM_TRACKS; ++i )
|
||||
{
|
||||
img_filename = track_manager->getTrack( m_gp_tracks[i] )->getTopviewFile();
|
||||
if( img_filename.empty() )
|
||||
{
|
||||
img_filename = track_manager->getTrack( m_gp_tracks[i] )->getScreenshotFile();
|
||||
if( img_filename.empty() ) continue;
|
||||
}
|
||||
|
||||
mat = material_manager->getMaterial( img_filename, true );
|
||||
#ifndef HAVE_IRRLICHT
|
||||
m_track_imgs.push_back(mat->getState()->getTextureHandle());
|
||||
#endif
|
||||
}
|
||||
|
||||
if( !m_track_imgs.empty() )
|
||||
{
|
||||
m_clock = 0.0f;
|
||||
m_curr_track_img = 0;
|
||||
|
||||
widget_manager->showWgtTexture( WTOK_IMG );
|
||||
widget_manager->setWgtTexture( WTOK_IMG,
|
||||
m_track_imgs[ m_curr_track_img ] );
|
||||
widget_manager->setWgtColor( WTOK_IMG, WGT_WHITE );
|
||||
}
|
||||
else
|
||||
{
|
||||
widget_manager->hideWgtTexture( WTOK_IMG );
|
||||
widget_manager->setWgtColor( WTOK_IMG, WGT_BLACK );
|
||||
}
|
||||
}
|
||||
|
||||
if( !m_track_imgs.empty() )
|
||||
{
|
||||
m_clock += dt;
|
||||
|
||||
if( m_clock > 1.0f )
|
||||
{
|
||||
m_clock = 0.0f;
|
||||
|
||||
++m_curr_track_img;
|
||||
if( m_curr_track_img >= m_track_imgs.size() ) m_curr_track_img = 0;
|
||||
|
||||
widget_manager->setWgtTexture(WTOK_IMG,
|
||||
m_track_imgs[ m_curr_track_img ] );
|
||||
}
|
||||
}
|
||||
|
||||
widget_manager->update(dt);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//FIXME:Should select() be renamed for 'click()' or 'enter()' or something?
|
||||
void GrandPrixSelect::select()
|
||||
{
|
||||
const int CLICKED_TOKEN = widget_manager->getSelectedWgt();
|
||||
if(CLICKED_TOKEN == WTOK_QUIT)
|
||||
{
|
||||
menu_manager->popMenu();
|
||||
return;
|
||||
}
|
||||
const GrandPrixData *gp=grand_prix_manager->getGrandPrix(m_gp_index[CLICKED_TOKEN-WTOK_FIRSTPRIX]);
|
||||
race_manager->setGrandPrix(*gp);
|
||||
menu_manager->pushMenu(MENUID_RACE_OPTIONS);
|
||||
} // select
|
||||
|
||||
/* EOF */
|
@ -1,43 +0,0 @@
|
||||
// $Id: track_sel.hpp 694 2006-08-29 07:42:36Z hiker $
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 Joerg Henrichs
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_GRAND_PRIX_SELECT_H
|
||||
#define HEADER_GRAND_PRIX_SELECT_H
|
||||
|
||||
#include <vector>
|
||||
#include "base_gui.hpp"
|
||||
#include "grand_prix_data.hpp"
|
||||
|
||||
class GrandPrixSelect: public BaseGUI
|
||||
{
|
||||
private:
|
||||
std::vector<std::string> m_gp_tracks;
|
||||
std::vector<int> m_track_imgs;
|
||||
std::vector<unsigned int> m_gp_index;
|
||||
unsigned int m_curr_track_img;
|
||||
float m_clock;
|
||||
public:
|
||||
GrandPrixSelect();
|
||||
~GrandPrixSelect();
|
||||
|
||||
void update(float dt);
|
||||
void select();
|
||||
};
|
||||
|
||||
#endif
|
@ -1,248 +0,0 @@
|
||||
// $Id: help_menu.cpp 812 2006-10-07 11:43:57Z hiker $
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 Joerg Henrichs
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "gui/help_page_one.hpp"
|
||||
|
||||
#include "user_config.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "items/item_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_MSG1,
|
||||
WTOK_MSG2,
|
||||
WTOK_MSG3,
|
||||
WTOK_MSG4,
|
||||
WTOK_MSG5,
|
||||
WTOK_MSG6,
|
||||
WTOK_MSG7,
|
||||
WTOK_MSG8,
|
||||
|
||||
WTOK_LOCK,
|
||||
|
||||
WTOK_SECOND_PAGE,
|
||||
WTOK_QUIT
|
||||
};
|
||||
|
||||
HelpPageOne::HelpPageOne()
|
||||
{
|
||||
//The ssgContext constructor calls makeCurrent(), it has to be restored
|
||||
ssgContext* oldContext = ssgGetCurrentContext();
|
||||
m_context = new ssgContext;
|
||||
oldContext->makeCurrent();
|
||||
|
||||
m_box = 0;
|
||||
m_silver_coin = 0;
|
||||
m_gold_coin = 0;
|
||||
m_banana = 0;
|
||||
|
||||
m_clock = 0;
|
||||
|
||||
//FIXME: instead of using setInitialTextState, the gui & widget manager macros should improve it's design
|
||||
widget_manager->setInitialTextState
|
||||
(
|
||||
false,
|
||||
"",
|
||||
WGT_FNT_SML,
|
||||
WGT_FONT_GUI,
|
||||
WGT_WHITE,
|
||||
true
|
||||
);
|
||||
widget_manager->addTextWgt( WTOK_MSG1, 50, 7,
|
||||
_("Force your rivals bite *your* dust!") );
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addTextWgt( WTOK_MSG2, 60, 7,
|
||||
_("Grab blue boxes and nitro") );
|
||||
widget_manager->addTextWgt( WTOK_MSG3, 30, 7, _("Avoid bananas") );
|
||||
widget_manager->breakLine();
|
||||
|
||||
/*Rotating 3D models*/
|
||||
#ifdef HAVE_IRRLICHT
|
||||
#else
|
||||
ssgEntity* hm = item_manager->getItemModel(Item::ITEM_BONUS_BOX);
|
||||
ssgDeRefDelete(m_box);
|
||||
m_box = new ssgTransform;
|
||||
m_box->ref();
|
||||
m_box->addKid(hm);
|
||||
hm = item_manager->getItemModel(Item::ITEM_SILVER_COIN);
|
||||
ssgDeRefDelete(m_silver_coin);
|
||||
|
||||
m_silver_coin = new ssgTransform;
|
||||
m_silver_coin->ref();
|
||||
m_silver_coin->addKid(hm);
|
||||
|
||||
hm = item_manager->getItemModel(Item::ITEM_GOLD_COIN);
|
||||
ssgDeRefDelete(m_gold_coin);
|
||||
m_gold_coin = new ssgTransform;
|
||||
m_gold_coin->ref();
|
||||
m_gold_coin->addKid(hm);
|
||||
|
||||
hm = item_manager->getItemModel(Item::ITEM_BANANA);
|
||||
ssgDeRefDelete(m_banana);
|
||||
m_banana = new ssgTransform;
|
||||
m_banana->ref();
|
||||
m_banana->addKid(hm);
|
||||
#endif
|
||||
|
||||
/*Empty widget to cover the space for the 3D models*/
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 15);
|
||||
widget_manager->breakLine();
|
||||
/*
|
||||
widget_manager->addTextWgt(WTOK_MSG4, 100, 13,
|
||||
//Next line starts at column 0 to avoid spaces in the GUI
|
||||
_("At high speeds wheelies drive you faster, but you can't steer. If you\n\
|
||||
get stuck or fall too far, use the rescue button to get back on track."));
|
||||
widget_manager->setWgtResizeToText( WTOK_MSG4, false );
|
||||
widget_manager->breakLine();*/
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 1);
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addTextWgt(WTOK_MSG5, 80, 10,
|
||||
_("The current key bindings can be seen/changed in the\nOptions->Player Config menu."));
|
||||
widget_manager->breakLine();
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 1);
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addTextWgt(WTOK_MSG6, 100, 17,
|
||||
_("Collecting nitro allows you to get speed boosts whenever you\nwish by pressing the appropriate key. You can see your\ncurrent level of nitro in the bar at the right of the game screen."));
|
||||
widget_manager->setWgtResizeToText( WTOK_MSG6, false);
|
||||
widget_manager->breakLine();
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 1);
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addTextWgt(WTOK_MSG7, 87, 8,
|
||||
_("If you see a button with a lock like the one to the right,\n\
|
||||
you need to complete a challenge to unlock it."));
|
||||
|
||||
widget_manager->addImgWgt(WTOK_LOCK, 20, 8, 0);
|
||||
widget_manager->setWgtLockTexture(WTOK_LOCK);
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 1);
|
||||
widget_manager->breakLine();
|
||||
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 1);
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addTextWgt(WTOK_MSG8, 87, 8,
|
||||
_("The 'sharp turn' key allows you to do sharp turns\nand have better control in tight curves"));
|
||||
widget_manager->breakLine();
|
||||
|
||||
/*Buttons at the bottom*/
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 16);
|
||||
widget_manager->breakLine();
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 30, 7);
|
||||
widget_manager->addTextButtonWgt(WTOK_QUIT, 40, 7,
|
||||
_("Back to the menu"));
|
||||
|
||||
widget_manager->addTextButtonWgt(WTOK_SECOND_PAGE, 30, 7,
|
||||
_("Next >"));
|
||||
|
||||
widget_manager->layout( WGT_AREA_TOP );
|
||||
} // HelpPageOne
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HelpPageOne::~HelpPageOne()
|
||||
{
|
||||
widget_manager->reset();
|
||||
|
||||
if (m_box != NULL && m_silver_coin != NULL && m_gold_coin != NULL
|
||||
&& m_banana != NULL )
|
||||
{
|
||||
ssgDeRefDelete(m_box);
|
||||
ssgDeRefDelete(m_silver_coin);
|
||||
ssgDeRefDelete(m_gold_coin);
|
||||
ssgDeRefDelete(m_banana);
|
||||
}
|
||||
|
||||
delete m_context;
|
||||
|
||||
} // ~HelpPageOne
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void HelpPageOne::update(float dt)
|
||||
{
|
||||
m_clock += dt * 40.0f;
|
||||
|
||||
if (m_box != NULL && m_silver_coin != NULL && m_gold_coin != NULL
|
||||
&& m_banana != NULL )
|
||||
{
|
||||
ssgContext* oldContext = ssgGetCurrentContext();
|
||||
m_context -> makeCurrent();
|
||||
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
sgCoord cam_pos;
|
||||
sgSetCoord(&cam_pos, 0, 0, 0, 0, 0, 0);
|
||||
m_context -> setCamera ( &cam_pos ) ;
|
||||
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
sgCoord trans;
|
||||
sgSetCoord(&trans, -4, 10, 1.85f, m_clock, 0, 0);
|
||||
m_box->setTransform (&trans);
|
||||
|
||||
sgSetCoord(&trans, -2, 8, 1.5f, m_clock, 0, 0);
|
||||
m_silver_coin->setTransform (&trans);
|
||||
|
||||
sgSetCoord(&trans, -1, 8, 1.5f, m_clock, 0, 0);
|
||||
m_gold_coin->setTransform (&trans);
|
||||
|
||||
sgSetCoord(&trans, 5, 15, 3, m_clock, 0, 0);
|
||||
m_banana->setTransform (&trans);
|
||||
|
||||
//glShadeModel(GL_SMOOTH);
|
||||
ssgCullAndDraw ( m_box ) ;
|
||||
ssgCullAndDraw ( m_silver_coin ) ;
|
||||
ssgCullAndDraw ( m_gold_coin ) ;
|
||||
ssgCullAndDraw ( m_banana ) ;
|
||||
glViewport ( 0, 0, user_config->m_width, user_config->m_height ) ;
|
||||
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
oldContext->makeCurrent();
|
||||
}
|
||||
|
||||
widget_manager->update(dt);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void HelpPageOne::select()
|
||||
{
|
||||
switch ( widget_manager->getSelectedWgt() )
|
||||
{
|
||||
case WTOK_SECOND_PAGE:
|
||||
//This switches the first page with the second page, so they
|
||||
//are not stacked by the menu manager, and the menu that called
|
||||
//this help is the one that gets called back when the next page
|
||||
//is popped.
|
||||
menu_manager->popMenu();
|
||||
menu_manager->pushMenu(MENUID_HELP2);
|
||||
break;
|
||||
|
||||
case WTOK_QUIT:
|
||||
menu_manager->popMenu();
|
||||
break;
|
||||
}
|
||||
} // select
|
||||
|
||||
/* EOF */
|
@ -1,47 +0,0 @@
|
||||
// $Id: help_menu.hpp 694 2006-08-29 07:42:36Z hiker $
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 Joerg Henrichs
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_HELPPAGEONE_H
|
||||
#define HEADER_HELPPAGEONE_H
|
||||
|
||||
#include <string>
|
||||
#include "base_gui.hpp"
|
||||
|
||||
class ssgTransform;
|
||||
class ssgContext;
|
||||
|
||||
class HelpPageOne: public BaseGUI
|
||||
{
|
||||
private:
|
||||
ssgContext* m_context;
|
||||
ssgTransform* m_box;
|
||||
ssgTransform* m_banana;
|
||||
ssgTransform* m_silver_coin;
|
||||
ssgTransform* m_gold_coin;
|
||||
float m_clock;
|
||||
|
||||
public:
|
||||
HelpPageOne();
|
||||
~HelpPageOne();
|
||||
void select ();
|
||||
|
||||
void update(float dt);
|
||||
};
|
||||
|
||||
#endif
|
@ -1,117 +0,0 @@
|
||||
// $Id: help_menu.cpp 812 2006-10-07 11:43:57Z hiker $
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 Joerg Henrichs
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "gui/help_page_three.hpp"
|
||||
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_TITLE,
|
||||
|
||||
WTOK_TXT1,
|
||||
WTOK_TXT2,
|
||||
WTOK_TXT3,
|
||||
WTOK_TXT4,
|
||||
WTOK_TXT5,
|
||||
|
||||
WTOK_SECOND_PAGE,
|
||||
WTOK_QUIT
|
||||
};
|
||||
|
||||
HelpPageThree::HelpPageThree()
|
||||
{
|
||||
widget_manager->switchOrder();
|
||||
widget_manager->addTitleWgt( WTOK_TITLE, 100, 8, _("Game modes"));
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 2 );
|
||||
|
||||
if(!unlock_manager->isLocked("grandprix"))
|
||||
{
|
||||
widget_manager->addTextWgt( WTOK_TXT1, 100, 15,
|
||||
_("Grand Prix: Win victory points \n\
|
||||
by racing through a group of tracks, \n\
|
||||
most points wins (shortest time in case of a tie!) "));
|
||||
widget_manager->setWgtTextSize( WTOK_TXT1, WGT_FNT_SML );
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 1 );
|
||||
}
|
||||
|
||||
widget_manager->addTextWgt( WTOK_TXT2, 100, 15,
|
||||
_("Quick race: Pick a single track, shortest time wins. "));
|
||||
widget_manager->setWgtTextSize( WTOK_TXT2, WGT_FNT_SML );
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 1 );
|
||||
|
||||
widget_manager->addTextWgt( WTOK_TXT3, 100, 15,
|
||||
_("Time Trial: Contains no powerups, so only your driving skills matter!"));
|
||||
widget_manager->setWgtTextSize( WTOK_TXT3, WGT_FNT_SML );
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 1 );
|
||||
|
||||
if(!unlock_manager->isLocked("followleader"))
|
||||
{
|
||||
widget_manager->addTextWgt( WTOK_TXT4, 100, 15,
|
||||
_("Follow the leader: run for second place, as the last kart\nwill be disqualified every time the counter hits zero.\n Beware : going in front of the leader will get you eliminated too!"));
|
||||
widget_manager->setWgtTextSize( WTOK_TXT4, WGT_FNT_SML );
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 1 );
|
||||
}
|
||||
widget_manager->addTextWgt( WTOK_TXT5, 100, 15,
|
||||
_("3 Strikes Battle : only in multiplayer games.\nHit others with weapons until they lose all their lives."));
|
||||
widget_manager->setWgtTextSize( WTOK_TXT5, WGT_FNT_SML );
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 4 );
|
||||
|
||||
/*Buttons at the bottom*/
|
||||
widget_manager->switchOrder();
|
||||
widget_manager->addTextButtonWgt( WTOK_SECOND_PAGE, 30, 7,
|
||||
_("< Back"));
|
||||
widget_manager->setWgtTextSize( WTOK_SECOND_PAGE, WGT_FNT_SML );
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_QUIT, 40, 7,
|
||||
_("Back to the menu"));
|
||||
widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML );
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 30, 7);
|
||||
|
||||
widget_manager->layout( WGT_AREA_TOP );
|
||||
} // HelpMenu
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HelpPageThree::~HelpPageThree()
|
||||
{
|
||||
widget_manager->reset();
|
||||
} // ~HelpMenu
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void HelpPageThree::select()
|
||||
{
|
||||
switch ( widget_manager->getSelectedWgt() )
|
||||
{
|
||||
case WTOK_SECOND_PAGE:
|
||||
menu_manager->popMenu();
|
||||
menu_manager->pushMenu(MENUID_HELP2);
|
||||
break;
|
||||
|
||||
case WTOK_QUIT:
|
||||
menu_manager->popMenu();
|
||||
break;
|
||||
}
|
||||
} // select
|
||||
|
||||
/* EOF */
|
@ -1,34 +0,0 @@
|
||||
// $Id: help_menu.hpp 694 2006-08-29 07:42:36Z hiker $
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 Joerg Henrichs
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_HELPPAGETHREE_H
|
||||
#define HEADER_HELPPAGETHREE_H
|
||||
|
||||
#include <string>
|
||||
#include "base_gui.hpp"
|
||||
|
||||
class HelpPageThree: public BaseGUI
|
||||
{
|
||||
public:
|
||||
HelpPageThree();
|
||||
~HelpPageThree();
|
||||
void select ();
|
||||
};
|
||||
|
||||
#endif
|
@ -1,175 +0,0 @@
|
||||
// $Id: help_menu.cpp 812 2006-10-07 11:43:57Z hiker $
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 Joerg Henrichs
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "gui/help_page_two.hpp"
|
||||
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_MSG,
|
||||
|
||||
WTOK_IMG1, WTOK_TXT1,
|
||||
WTOK_IMG2, WTOK_TXT2,
|
||||
WTOK_IMG3, WTOK_TXT3,
|
||||
WTOK_IMG4, WTOK_TXT4,
|
||||
WTOK_IMG5, WTOK_TXT5,
|
||||
WTOK_IMG6, WTOK_TXT6,
|
||||
WTOK_IMG7, WTOK_TXT7,
|
||||
|
||||
WTOK_FIRST_PAGE,
|
||||
WTOK_THIRD_PAGE,
|
||||
WTOK_QUIT
|
||||
|
||||
};
|
||||
|
||||
HelpPageTwo::HelpPageTwo()
|
||||
{
|
||||
//FIXME: instead of using setInitialTextState, the gui & widget manager macros should improve it's design
|
||||
widget_manager->setInitialTextState
|
||||
(
|
||||
false,
|
||||
"",
|
||||
WGT_FNT_SML,
|
||||
WGT_FONT_GUI,
|
||||
WGT_WHITE,
|
||||
false
|
||||
);
|
||||
|
||||
widget_manager->addTextWgt( WTOK_MSG, 100, 7,
|
||||
_("To help you win, there are certain powerups you can grab:"));
|
||||
widget_manager->breakLine();
|
||||
|
||||
// ------ bubble gum -----
|
||||
#ifndef HAVE_IRRLICHT
|
||||
widget_manager->addImgWgt( WTOK_IMG1, 10, 12,
|
||||
powerup_manager->getIcon(POWERUP_BUBBLEGUM)->getState()->getTextureHandle());
|
||||
#endif
|
||||
widget_manager->addTextWgt( WTOK_TXT1, 90, 12,
|
||||
_("BubbleGum - leave a sticky pink puddle behind you"));
|
||||
widget_manager->setWgtRoundCorners( WTOK_TXT1, WGT_AREA_RGT );
|
||||
widget_manager->breakLine();
|
||||
|
||||
// ------ cakes -----
|
||||
#ifndef HAVE_IRRLICHT
|
||||
widget_manager->addImgWgt(WTOK_IMG2, 10, 12,
|
||||
powerup_manager->getIcon(POWERUP_CAKE)->getState()->getTextureHandle());
|
||||
#endif
|
||||
widget_manager->addTextWgt(WTOK_TXT2, 90, 12,
|
||||
_("Cake - thrown at the closest rival,\nbest on short ranges and long straights"));
|
||||
widget_manager->setWgtRoundCorners( WTOK_TXT2, WGT_AREA_RGT );
|
||||
widget_manager->breakLine();
|
||||
|
||||
// ------ bowling balls -----
|
||||
#ifndef HAVE_IRRLICHT
|
||||
widget_manager->addImgWgt(WTOK_IMG3, 10, 12,
|
||||
powerup_manager->getIcon(POWERUP_BOWLING)->getState()->getTextureHandle());
|
||||
#endif
|
||||
widget_manager->addTextWgt(WTOK_TXT3, 90, 12,
|
||||
_("Bowling Ball - bounces off walls. If you are looking back,\nit will be thrown backwards."));
|
||||
widget_manager->setWgtRoundCorners( WTOK_TXT3, WGT_AREA_RGT );
|
||||
widget_manager->breakLine();
|
||||
|
||||
// ------ zipper -----
|
||||
#ifndef HAVE_IRRLICHT
|
||||
widget_manager->addImgWgt(WTOK_IMG4, 10, 12,
|
||||
powerup_manager->getIcon(POWERUP_ZIPPER)->getState()->getTextureHandle());
|
||||
#endif
|
||||
widget_manager->addTextWgt(WTOK_TXT4, 90, 12,
|
||||
_("Zipper - speed boost"));
|
||||
widget_manager->setWgtRoundCorners(WTOK_TXT4, WGT_AREA_RGT);
|
||||
widget_manager->breakLine();
|
||||
|
||||
// ------ parachute -----
|
||||
#ifndef HAVE_IRRLICHT
|
||||
widget_manager->addImgWgt(WTOK_IMG5, 10, 12,
|
||||
powerup_manager->getIcon(POWERUP_PARACHUTE)->getState()->getTextureHandle());
|
||||
#endif
|
||||
|
||||
widget_manager->addTextWgt(WTOK_TXT5, 90, 12,
|
||||
_("Parachute - slows down all karts in a better position!"));
|
||||
widget_manager->setWgtRoundCorners(WTOK_TXT5, WGT_AREA_RGT);
|
||||
widget_manager->breakLine();
|
||||
|
||||
// ------ anvil -----
|
||||
#ifndef HAVE_IRRLICHT
|
||||
widget_manager->addImgWgt(WTOK_IMG6, 10, 12,
|
||||
powerup_manager->getIcon(POWERUP_ANVIL)->getState()->getTextureHandle());
|
||||
#endif
|
||||
|
||||
widget_manager->addTextWgt(WTOK_TXT6, 90, 12,
|
||||
_("Anvil - slows down greatly the kart in the first position"));
|
||||
widget_manager->setWgtRoundCorners(WTOK_TXT6, WGT_AREA_RGT);
|
||||
widget_manager->breakLine();
|
||||
|
||||
// ------ plunger -----
|
||||
#ifndef HAVE_IRRLICHT
|
||||
widget_manager->addImgWgt(WTOK_IMG7, 10, 12,
|
||||
powerup_manager->getIcon(POWERUP_PLUNGER)->getState()->getTextureHandle());
|
||||
#endif
|
||||
widget_manager->addTextWgt(WTOK_TXT7, 90, 12,
|
||||
_("Plunger - throw straight to pull an opponent back,\nor throw while looking back to make one lose sight!"));
|
||||
widget_manager->setWgtRoundCorners( WTOK_TXT7, WGT_AREA_RGT );
|
||||
widget_manager->breakLine();
|
||||
|
||||
/*Buttons at the bottom*/
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 100, 2);
|
||||
widget_manager->breakLine();
|
||||
widget_manager->addTextButtonWgt(WTOK_FIRST_PAGE, 30, 7,
|
||||
_("< Back"));
|
||||
|
||||
widget_manager->addTextButtonWgt(WTOK_QUIT, 40, 7,
|
||||
_("Back to the menu"));
|
||||
|
||||
widget_manager->addTextButtonWgt(WTOK_THIRD_PAGE, 30, 7,
|
||||
_("Next >"));
|
||||
|
||||
widget_manager->layout( WGT_AREA_TOP );
|
||||
} // HelpMenu
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HelpPageTwo::~HelpPageTwo()
|
||||
{
|
||||
widget_manager->reset();
|
||||
} // ~HelpMenu
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void HelpPageTwo::select()
|
||||
{
|
||||
switch ( widget_manager->getSelectedWgt() )
|
||||
{
|
||||
case WTOK_FIRST_PAGE:
|
||||
menu_manager->popMenu();
|
||||
menu_manager->pushMenu(MENUID_HELP1);
|
||||
break;
|
||||
|
||||
case WTOK_THIRD_PAGE:
|
||||
menu_manager->popMenu();
|
||||
menu_manager->pushMenu(MENUID_HELP3);
|
||||
break;
|
||||
|
||||
case WTOK_QUIT:
|
||||
menu_manager->popMenu();
|
||||
break;
|
||||
}
|
||||
} // select
|
||||
|
||||
/* EOF */
|
@ -1,34 +0,0 @@
|
||||
// $Id: help_menu.hpp 694 2006-08-29 07:42:36Z hiker $
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 Joerg Henrichs
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_HELPPAGETWO_H
|
||||
#define HEADER_HELPPAGETWO_H
|
||||
|
||||
#include <string>
|
||||
#include "base_gui.hpp"
|
||||
|
||||
class HelpPageTwo: public BaseGUI
|
||||
{
|
||||
public:
|
||||
HelpPageTwo();
|
||||
~HelpPageTwo();
|
||||
void select ();
|
||||
};
|
||||
|
||||
#endif
|
@ -1,155 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "gui/main_menu.hpp"
|
||||
|
||||
#include <SDL/SDL.h>
|
||||
|
||||
#include "race_manager.hpp"
|
||||
#include "user_config.hpp"
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_SINGLE,
|
||||
WTOK_MULTI,
|
||||
WTOK_NETWORK,
|
||||
WTOK_CHALLENGES,
|
||||
WTOK_OPTIONS,
|
||||
WTOK_QUIT,
|
||||
WTOK_HELP,
|
||||
WTOK_CREDITS,
|
||||
WTOK_WARNING
|
||||
};
|
||||
|
||||
MainMenu::MainMenu()
|
||||
{
|
||||
widget_manager->switchOrder();
|
||||
|
||||
// Only allow challenges if not networking for now!
|
||||
std::vector<const Challenge*> all_challenges=unlock_manager->getActiveChallenges();
|
||||
const bool challenges_active = all_challenges.size()>0 && network_manager->getMode()==NetworkManager::NW_NONE;
|
||||
|
||||
const int WIDTH=30;
|
||||
widget_manager->addTextButtonWgt( WTOK_SINGLE, WIDTH, 7, _("Single Player") );
|
||||
widget_manager->addTextButtonWgt( WTOK_MULTI, WIDTH, 7, _("Splitscreen") );
|
||||
|
||||
// Only display the networking entry when not already connected (and networking is enabled)
|
||||
if(network_manager->getMode()==NetworkManager::NW_NONE && stk_config->m_enable_networking)
|
||||
widget_manager->addTextButtonWgt( WTOK_NETWORK, WIDTH, 7, _("Networking") );
|
||||
|
||||
if(challenges_active)
|
||||
widget_manager->addTextButtonWgt( WTOK_CHALLENGES, WIDTH, 7, _("Challenges") );
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_OPTIONS, WIDTH, 7, _("Options") );
|
||||
widget_manager->addTextButtonWgt( WTOK_QUIT, WIDTH, 7, _("Quit") );
|
||||
|
||||
if(user_config->getWarning()!="")
|
||||
{
|
||||
widget_manager->addTextWgt( WTOK_WARNING, 80, 6, user_config->getWarning().c_str() );
|
||||
widget_manager->setWgtTextSize( WTOK_WARNING, WGT_FNT_SML );
|
||||
widget_manager->hideWgtRect(WTOK_WARNING);
|
||||
}
|
||||
else
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, WIDTH, 6 );
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_HELP, WIDTH, 7, _("Help") );
|
||||
widget_manager->setWgtTextSize( WTOK_HELP, WGT_FNT_SML );
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_CREDITS, WIDTH, 7, _("Credits") );
|
||||
widget_manager->setWgtTextSize( WTOK_CREDITS, WGT_FNT_SML );
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, WIDTH, 15 );
|
||||
|
||||
widget_manager->activateWgt(WTOK_SINGLE);
|
||||
widget_manager->layout(WGT_AREA_ALL);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
MainMenu::~MainMenu()
|
||||
{
|
||||
widget_manager->reset();
|
||||
user_config->resetWarning();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void MainMenu::select()
|
||||
{
|
||||
switch ( widget_manager->getSelectedWgt() )
|
||||
{
|
||||
case WTOK_SINGLE:
|
||||
race_manager->setNumLocalPlayers(1);
|
||||
race_manager->setNumPlayers(1); // reset since this is used to determine the minimum number of players
|
||||
// The clients do not do any mode selection, they go immediately
|
||||
// to the character selection screen.
|
||||
if(network_manager->getMode()==NetworkManager::NW_CLIENT)
|
||||
{
|
||||
menu_manager->pushMenu(MENUID_CHARSEL_P1);
|
||||
}
|
||||
else
|
||||
{
|
||||
menu_manager->pushMenu(MENUID_GAMEMODE);
|
||||
}
|
||||
break;
|
||||
case WTOK_MULTI:
|
||||
menu_manager->pushMenu(MENUID_NUMPLAYERS);
|
||||
break;
|
||||
case WTOK_NETWORK:
|
||||
menu_manager->pushMenu(MENUID_NETWORK_GUI);
|
||||
break;
|
||||
case WTOK_CHALLENGES:
|
||||
menu_manager->pushMenu(MENUID_CHALLENGES);
|
||||
break;
|
||||
case WTOK_OPTIONS:
|
||||
menu_manager->pushMenu(MENUID_OPTIONS);
|
||||
break;
|
||||
|
||||
case WTOK_QUIT:
|
||||
menu_manager->pushMenu(MENUID_EXITGAME);
|
||||
break;
|
||||
case WTOK_HELP:
|
||||
menu_manager->pushMenu(MENUID_HELP1);
|
||||
break;
|
||||
case WTOK_CREDITS:
|
||||
menu_manager->pushMenu(MENUID_CREDITS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void MainMenu::handle(GameAction ga, int value)
|
||||
{
|
||||
switch ( ga )
|
||||
{
|
||||
case GA_LEAVE:
|
||||
if(!value) break;
|
||||
menu_manager->pushMenu(MENUID_EXITGAME);
|
||||
break;
|
||||
|
||||
default:
|
||||
BaseGUI::handle(ga, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* EOF */
|
@ -1,36 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_MAINMENU_H
|
||||
#define HEADER_MAINMENU_H
|
||||
|
||||
#include "base_gui.hpp"
|
||||
|
||||
class MainMenu: public BaseGUI
|
||||
{
|
||||
public:
|
||||
MainMenu();
|
||||
~MainMenu();
|
||||
|
||||
void select();
|
||||
void handle(GameAction, int);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -1,345 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 Patrick Ammann <pammann@aro.ch>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include <cassert>
|
||||
|
||||
//This is needed in various platforms, but not all
|
||||
# include <algorithm>
|
||||
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/main_menu.hpp"
|
||||
#include "gui/char_sel.hpp"
|
||||
#include "gui/game_mode.hpp"
|
||||
#include "gui/race_options.hpp"
|
||||
#include "gui/options.hpp"
|
||||
#include "gui/track_sel.hpp"
|
||||
#include "gui/num_players.hpp"
|
||||
#include "gui/config_controls.hpp"
|
||||
#include "gui/config_display.hpp"
|
||||
#include "gui/display_res_confirm.hpp"
|
||||
#include "gui/config_sound.hpp"
|
||||
#include "gui/player_controls.hpp"
|
||||
#include "gui/race_gui.hpp"
|
||||
#include "gui/race_results_gui.hpp"
|
||||
#include "gui/grand_prix_ending.hpp"
|
||||
#include "gui/race_menu.hpp"
|
||||
#include "gui/help_page_one.hpp"
|
||||
#include "gui/help_page_two.hpp"
|
||||
#include "gui/help_page_three.hpp"
|
||||
#include "gui/credits_menu.hpp"
|
||||
#include "gui/grand_prix_select.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "gui/challenges_menu.hpp"
|
||||
#include "gui/feature_unlocked.hpp"
|
||||
#include "gui/start_race_feedback.hpp"
|
||||
#include "gui/network_gui.hpp"
|
||||
#include "audio/sfx_manager.hpp"
|
||||
#include "audio/sfx_base.hpp"
|
||||
#include "race_manager.hpp"
|
||||
#include "sdldrv.hpp"
|
||||
#include "main_loop.hpp"
|
||||
#include "user_config.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
MenuManager* menu_manager = 0;
|
||||
|
||||
/** Initialises the menu manager and creates the SFX objects.
|
||||
*/
|
||||
MenuManager::MenuManager()
|
||||
{
|
||||
m_current_menu = NULL;
|
||||
m_RaceGUI = NULL;
|
||||
m_change_menu = false;
|
||||
m_select_sound = sfx_manager->newSFX(SFXManager::SOUND_SELECT_MENU);
|
||||
m_back_sound = sfx_manager->newSFX(SFXManager::SOUND_BACK_MENU);
|
||||
} // MenuManager
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Destroys the menu manager and frees any allocated memory.
|
||||
*/
|
||||
MenuManager::~MenuManager()
|
||||
{
|
||||
delete m_current_menu;
|
||||
sfx_manager->deleteSFX(m_back_sound);
|
||||
sfx_manager->deleteSFX(m_select_sound);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Puts the given menu into the menu stack and saves the widgetToken of
|
||||
* the last selected widget for later reactivation.
|
||||
*/
|
||||
void MenuManager::pushMenu(MenuManagerIDs id)
|
||||
{
|
||||
// If we store the selected widget when we have send the order to change
|
||||
// the menu but haven't done it, we would change the previous menu, not
|
||||
// the current menu.
|
||||
if ( m_menu_stack.size() && m_change_menu != true )
|
||||
{
|
||||
m_menu_stack.back().second = widget_manager->getSelectedWgt();
|
||||
}
|
||||
|
||||
// used to suppress select-sound on startup
|
||||
static bool is_startup = true;
|
||||
|
||||
if( MENUID_EXITGAME == id )
|
||||
{
|
||||
m_back_sound->play();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!is_startup) m_select_sound->play();
|
||||
else is_startup = false;
|
||||
}
|
||||
|
||||
// Creates a new entry for the to be displayed menu.
|
||||
pair <MenuManagerIDs, int> element;
|
||||
element.first = id;
|
||||
element.second = WidgetManager::WGT_NONE;
|
||||
|
||||
m_menu_stack.push_back(element);
|
||||
|
||||
if( m_current_menu) m_current_menu->lockInput();
|
||||
m_change_menu = true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
const bool MenuManager::isMainMenuActive() const
|
||||
{
|
||||
return m_menu_stack[ m_menu_stack.size()-1 ].first == MENUID_MAINMENU;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void MenuManager::popMenu()
|
||||
{
|
||||
m_back_sound->play();
|
||||
|
||||
m_menu_stack.pop_back();
|
||||
if( m_current_menu ) m_current_menu->lockInput();
|
||||
m_change_menu = true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void MenuManager::update()
|
||||
{
|
||||
|
||||
if ( m_change_menu )
|
||||
{
|
||||
m_change_menu = false;
|
||||
|
||||
if (m_RaceGUI
|
||||
&& m_current_menu == m_RaceGUI)
|
||||
{
|
||||
m_RaceGUI = 0;
|
||||
inputDriver->setMode(SDLDriver::MENU);
|
||||
}
|
||||
|
||||
delete m_current_menu;
|
||||
m_current_menu= NULL;
|
||||
|
||||
if (!m_menu_stack.empty())
|
||||
{
|
||||
pair<MenuManagerIDs, int> saved = m_menu_stack.back();
|
||||
MenuManagerIDs id = saved.first;
|
||||
int saved_widget = saved.second;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case MENUID_MAINMENU:
|
||||
m_current_menu= new MainMenu();
|
||||
// in this case the network entry can be removed, resulting
|
||||
// in warnings etc. if the widget manager then tries to select
|
||||
// the widget again. To avoid this, set the saved widget to NONE.
|
||||
if(network_manager->getMode()!=NetworkManager::NW_NONE)
|
||||
saved_widget=WidgetManager::WGT_NONE;
|
||||
break;
|
||||
case MENUID_CHALLENGES:
|
||||
m_current_menu= new ChallengesMenu();
|
||||
break;
|
||||
case MENUID_CHARSEL_P1:
|
||||
case MENUID_CHARSEL_P2:
|
||||
case MENUID_CHARSEL_P3:
|
||||
case MENUID_CHARSEL_P4:
|
||||
m_current_menu= new CharSel(id - MENUID_CHARSEL_P1);
|
||||
break;
|
||||
case MENUID_RACE_OPTIONS:
|
||||
m_current_menu= new RaceOptions();
|
||||
break;
|
||||
case MENUID_GAMEMODE:
|
||||
m_current_menu= new GameMode();
|
||||
break;
|
||||
case MENUID_OPTIONS:
|
||||
m_current_menu= new Options();
|
||||
break;
|
||||
case MENUID_TRACKSEL:
|
||||
m_current_menu= new TrackSel();
|
||||
break;
|
||||
case MENUID_UNLOCKED_FEATURE:
|
||||
m_current_menu = new FeatureUnlocked();
|
||||
break;
|
||||
case MENUID_NUMPLAYERS:
|
||||
m_current_menu= new NumPlayers();
|
||||
break;
|
||||
case MENUID_RACE:
|
||||
inputDriver->setMode(SDLDriver::INGAME);
|
||||
m_current_menu = new RaceGUI();
|
||||
m_RaceGUI = m_current_menu;
|
||||
break;
|
||||
case MENUID_RACERESULT:
|
||||
m_current_menu= new RaceResultsGUI();
|
||||
break;
|
||||
case MENUID_GRANDPRIXEND:
|
||||
m_current_menu= new GrandPrixEnd();
|
||||
break;
|
||||
case MENUID_GRANDPRIXSELECT:
|
||||
m_current_menu= new GrandPrixSelect();
|
||||
break;
|
||||
case MENUID_RACEMENU:
|
||||
m_current_menu= new RaceMenu();
|
||||
break;
|
||||
case MENUID_EXITGAME:
|
||||
m_menu_stack.clear();
|
||||
main_loop->abort();
|
||||
break;
|
||||
|
||||
case MENUID_CONFIG_CONTROLS:
|
||||
m_current_menu= new ConfigControls();
|
||||
break;
|
||||
case MENUID_CONFIG_P1:
|
||||
case MENUID_CONFIG_P2:
|
||||
case MENUID_CONFIG_P3:
|
||||
case MENUID_CONFIG_P4:
|
||||
m_current_menu= new PlayerControls(id - MENUID_CONFIG_P1);
|
||||
break;
|
||||
case MENUID_CONFIG_DISPLAY:
|
||||
m_current_menu= new ConfigDisplay();
|
||||
break;
|
||||
case MENUID_RESOLUTION_CONFIRM_FS:
|
||||
{
|
||||
const bool FROM_FULLSCREEN = false;
|
||||
m_current_menu= new DisplayResConfirm( FROM_FULLSCREEN );
|
||||
}
|
||||
break;
|
||||
case MENUID_RESOLUTION_CONFIRM_WIN:
|
||||
{
|
||||
const bool FROM_WINDOW = true;
|
||||
m_current_menu= new DisplayResConfirm( FROM_WINDOW );
|
||||
}
|
||||
break;
|
||||
case MENUID_CONFIG_SOUND:
|
||||
m_current_menu= new ConfigSound();
|
||||
break;
|
||||
case MENUID_HELP1:
|
||||
m_current_menu = new HelpPageOne();
|
||||
break;
|
||||
case MENUID_HELP2:
|
||||
m_current_menu = new HelpPageTwo();
|
||||
break;
|
||||
case MENUID_HELP3:
|
||||
m_current_menu = new HelpPageThree();
|
||||
break;
|
||||
case MENUID_CREDITS:
|
||||
m_current_menu = new CreditsMenu();
|
||||
break;
|
||||
case MENUID_START_RACE_FEEDBACK:
|
||||
m_current_menu = new StartRaceFeedback();
|
||||
break;
|
||||
case MENUID_NETWORK_GUI:
|
||||
m_current_menu = new NetworkGUI();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
} // switch
|
||||
|
||||
|
||||
if( id != MENUID_EXITGAME )
|
||||
{
|
||||
// Restores the previously selected widget if there was one.
|
||||
if (saved_widget != WidgetManager::WGT_NONE)
|
||||
{
|
||||
widget_manager->lightenWgtColor( saved_widget );
|
||||
widget_manager->pulseWgt( saved_widget );
|
||||
widget_manager->setSelectedWgt(saved_widget);
|
||||
} else if( widget_manager->getSelectedWgt() != WidgetManager::WGT_NONE )
|
||||
{
|
||||
widget_manager->lightenWgtColor (
|
||||
widget_manager->getSelectedWgt() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static ulClock now = ulClock();
|
||||
now.update();
|
||||
|
||||
if (m_current_menu != NULL)
|
||||
{
|
||||
m_current_menu->update((float)now.getDeltaTime());
|
||||
}
|
||||
} // update
|
||||
|
||||
//----------k-------------------------------------------------------------------
|
||||
void MenuManager::switchToGrandPrixEnding()
|
||||
{
|
||||
if (m_current_menu != NULL)
|
||||
{
|
||||
if(m_current_menu==m_RaceGUI) m_RaceGUI=0;
|
||||
delete m_current_menu;
|
||||
m_current_menu= NULL;
|
||||
}
|
||||
|
||||
m_menu_stack.clear();
|
||||
pushMenu(MENUID_GRANDPRIXEND);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void MenuManager::switchToRace()
|
||||
{
|
||||
m_menu_stack.clear();
|
||||
pushMenu(MENUID_RACE);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Returns true if the id is somewhere on the stack. This can be used to detect
|
||||
// if the config_display menu was called from the race_gui, or main_menu
|
||||
bool MenuManager::isSomewhereOnStack(MenuManagerIDs id)
|
||||
{
|
||||
for(vector<pair<MenuManagerIDs,int> >::iterator i = m_menu_stack.begin(); i != m_menu_stack.end(); i++)
|
||||
{
|
||||
if ((*i).first == id)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
} // isSomewhereOnStack
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void MenuManager::switchToMainMenu()
|
||||
{
|
||||
if (m_current_menu != NULL)
|
||||
{
|
||||
if(m_current_menu == m_RaceGUI) m_RaceGUI = 0;
|
||||
delete m_current_menu;
|
||||
m_current_menu= NULL;
|
||||
}
|
||||
|
||||
m_menu_stack.clear();
|
||||
pushMenu(MENUID_MAINMENU);
|
||||
}
|
@ -1,109 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 Patrick Ammann <pammann@aro.ch>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_MENUMANAGER_H
|
||||
#define HEADER_MENUMANAGER_H
|
||||
|
||||
#include <vector>
|
||||
#include "gui/race_gui.hpp"
|
||||
#include "gui/base_gui.hpp"
|
||||
|
||||
class SFXBase;
|
||||
|
||||
enum MenuManagerIDs
|
||||
{
|
||||
// menu
|
||||
MENUID_MAINMENU,
|
||||
MENUID_CHARSEL_P1,
|
||||
MENUID_CHARSEL_P2,
|
||||
MENUID_CHARSEL_P3,
|
||||
MENUID_CHARSEL_P4,
|
||||
MENUID_CHALLENGES,
|
||||
MENUID_RACE_OPTIONS,
|
||||
MENUID_GAMEMODE,
|
||||
MENUID_RACERESULT,
|
||||
MENUID_GRANDPRIXEND,
|
||||
MENUID_RACEMENU,
|
||||
MENUID_TRACKSEL,
|
||||
MENUID_NUMPLAYERS,
|
||||
MENUID_OPTIONS,
|
||||
MENUID_EXITGAME,
|
||||
MENUID_GRANDPRIXSELECT,
|
||||
MENUID_UNLOCKED_FEATURE,
|
||||
MENUID_START_RACE_FEEDBACK, // 'loading'
|
||||
MENUID_NETWORK_GUI,
|
||||
MENUID_NETWORK_INFO, // wait for clients to connect
|
||||
|
||||
// menu configuration
|
||||
MENUID_CONFIG_DISPLAY,
|
||||
MENUID_RESOLUTION_CONFIRM_FS,
|
||||
MENUID_RESOLUTION_CONFIRM_WIN,
|
||||
MENUID_CONFIG_SOUND,
|
||||
MENUID_CONFIG_CONTROLS,
|
||||
MENUID_CONFIG_P1,
|
||||
MENUID_CONFIG_P2,
|
||||
MENUID_CONFIG_P3,
|
||||
MENUID_CONFIG_P4,
|
||||
|
||||
// help and credit menu
|
||||
MENUID_HELP1,
|
||||
MENUID_HELP2,
|
||||
MENUID_HELP3,
|
||||
MENUID_CREDITS,
|
||||
|
||||
// race gui
|
||||
MENUID_RACE,
|
||||
};
|
||||
|
||||
class MenuManager
|
||||
{
|
||||
public:
|
||||
MenuManager();
|
||||
virtual ~MenuManager();
|
||||
|
||||
// general functions
|
||||
void switchToGrandPrixEnding();
|
||||
void switchToRace();
|
||||
void switchToMainMenu();
|
||||
|
||||
// use this function within menu classes
|
||||
void pushMenu(MenuManagerIDs);
|
||||
void popMenu();
|
||||
int getMenuStackSize() {return (int)m_menu_stack.size();}
|
||||
bool isSomewhereOnStack(MenuManagerIDs id);
|
||||
bool isCurrentMenu(MenuManagerIDs id)
|
||||
{return (m_menu_stack.back().first == id);}
|
||||
BaseGUI* getCurrentMenu() const {return m_current_menu;}
|
||||
RaceGUI* getRaceMenu () const {return (RaceGUI*)m_RaceGUI;}
|
||||
void update();
|
||||
const bool isMainMenuActive() const;
|
||||
|
||||
private:
|
||||
std::vector< std::pair<MenuManagerIDs, int> >
|
||||
m_menu_stack;
|
||||
BaseGUI* m_current_menu;
|
||||
BaseGUI* m_RaceGUI;
|
||||
bool m_change_menu;
|
||||
SFXBase *m_back_sound;
|
||||
SFXBase *m_select_sound;
|
||||
};
|
||||
|
||||
extern MenuManager* menu_manager;
|
||||
|
||||
#endif // HEADER_MENUMANAGER_H
|
500
src/gui/my_button.cpp
Normal file
500
src/gui/my_button.cpp
Normal file
@ -0,0 +1,500 @@
|
||||
// The contents of CGUIButtom.cpp from irrLicht sources, but with a patch applied.
|
||||
// Copyright (C) 2002-2008 Nikolaus Gebhardt
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#include <irrlicht.h>
|
||||
#include "gui/my_button.hpp"
|
||||
|
||||
using namespace GUIEngine;
|
||||
|
||||
//! constructor
|
||||
MyGUIButton::MyGUIButton(IGUIEnvironment* environment, IGUIElement* parent,
|
||||
s32 id, core::rect<s32> rectangle, bool noclip)
|
||||
: IGUIButton(environment, parent, id, rectangle), Pressed(false),
|
||||
IsPushButton(false), UseAlphaChannel(false), Border(true),
|
||||
ClickTime(0), SpriteBank(0), OverrideFont(0), Image(0), PressedImage(0)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("MyGUIButton");
|
||||
#endif
|
||||
setNotClipped(noclip);
|
||||
|
||||
// Initialize the sprites.
|
||||
for (u32 i=0; i<EGBS_COUNT; ++i)
|
||||
ButtonSprites[i].Index = -1;
|
||||
|
||||
// This element can be tabbed.
|
||||
setTabStop(true);
|
||||
setTabOrder(-1);
|
||||
}
|
||||
|
||||
|
||||
//! destructor
|
||||
MyGUIButton::~MyGUIButton()
|
||||
{
|
||||
if (OverrideFont)
|
||||
OverrideFont->drop();
|
||||
|
||||
if (Image)
|
||||
Image->drop();
|
||||
|
||||
if (PressedImage)
|
||||
PressedImage->drop();
|
||||
|
||||
if (SpriteBank)
|
||||
SpriteBank->drop();
|
||||
}
|
||||
|
||||
|
||||
//! Sets if the button should use the skin to draw its border
|
||||
void MyGUIButton::setDrawBorder(bool border)
|
||||
{
|
||||
Border = border;
|
||||
}
|
||||
|
||||
|
||||
void MyGUIButton::setSpriteBank(IGUISpriteBank* sprites)
|
||||
{
|
||||
if (sprites)
|
||||
sprites->grab();
|
||||
|
||||
if (SpriteBank)
|
||||
SpriteBank->drop();
|
||||
|
||||
SpriteBank = sprites;
|
||||
}
|
||||
|
||||
|
||||
void MyGUIButton::setSprite(EGUI_BUTTON_STATE state, s32 index, video::SColor color, bool loop)
|
||||
{
|
||||
if (SpriteBank)
|
||||
{
|
||||
ButtonSprites[(u32)state].Index = index;
|
||||
ButtonSprites[(u32)state].Color = color;
|
||||
ButtonSprites[(u32)state].Loop = loop;
|
||||
}
|
||||
else
|
||||
{
|
||||
ButtonSprites[(u32)state].Index = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//! called if an event happened.
|
||||
bool MyGUIButton::OnEvent(const SEvent& event)
|
||||
{
|
||||
if (!IsEnabled)
|
||||
return IGUIElement::OnEvent(event);
|
||||
|
||||
switch(event.EventType)
|
||||
{
|
||||
case EET_KEY_INPUT_EVENT:
|
||||
if (event.KeyInput.PressedDown &&
|
||||
(event.KeyInput.Key == KEY_RETURN ||
|
||||
event.KeyInput.Key == KEY_SPACE))
|
||||
{
|
||||
if (!IsPushButton)
|
||||
setPressed(true);
|
||||
else
|
||||
setPressed(!Pressed);
|
||||
|
||||
return true;
|
||||
}
|
||||
if (Pressed && !IsPushButton && event.KeyInput.PressedDown && event.KeyInput.Key == KEY_ESCAPE)
|
||||
{
|
||||
setPressed(false);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
if (!event.KeyInput.PressedDown && Pressed &&
|
||||
(event.KeyInput.Key == KEY_RETURN ||
|
||||
event.KeyInput.Key == KEY_SPACE))
|
||||
{
|
||||
//Environment->removeFocus(this);
|
||||
|
||||
if (!IsPushButton)
|
||||
setPressed(false);
|
||||
|
||||
if (Parent)
|
||||
{
|
||||
SEvent newEvent;
|
||||
newEvent.EventType = EET_GUI_EVENT;
|
||||
newEvent.GUIEvent.Caller = this;
|
||||
newEvent.GUIEvent.Element = 0;
|
||||
newEvent.GUIEvent.EventType = EGET_BUTTON_CLICKED;
|
||||
Parent->OnEvent(newEvent);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case EET_GUI_EVENT:
|
||||
if (event.GUIEvent.EventType == EGET_ELEMENT_FOCUS_LOST)
|
||||
{
|
||||
if (event.GUIEvent.Caller == this && !IsPushButton)
|
||||
setPressed(false);
|
||||
}
|
||||
break;
|
||||
case EET_MOUSE_INPUT_EVENT:
|
||||
if (event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
|
||||
{
|
||||
if (Environment->hasFocus(this) &&
|
||||
!AbsoluteClippingRect.isPointInside(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y)))
|
||||
{
|
||||
Environment->removeFocus(this);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IsPushButton)
|
||||
setPressed(true);
|
||||
|
||||
Environment->setFocus(this);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
if (event.MouseInput.Event == EMIE_LMOUSE_LEFT_UP)
|
||||
{
|
||||
bool wasPressed = Pressed;
|
||||
//Environment->removeFocus(this);
|
||||
|
||||
if ( !AbsoluteClippingRect.isPointInside( core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y ) ) )
|
||||
{
|
||||
if (!IsPushButton)
|
||||
setPressed(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!IsPushButton)
|
||||
setPressed(false);
|
||||
else
|
||||
{
|
||||
setPressed(!Pressed);
|
||||
}
|
||||
|
||||
if ((!IsPushButton && wasPressed && Parent) ||
|
||||
(IsPushButton && wasPressed != Pressed))
|
||||
{
|
||||
SEvent newEvent;
|
||||
newEvent.EventType = EET_GUI_EVENT;
|
||||
newEvent.GUIEvent.Caller = this;
|
||||
newEvent.GUIEvent.Element = 0;
|
||||
newEvent.GUIEvent.EventType = EGET_BUTTON_CLICKED;
|
||||
Parent->OnEvent(newEvent);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return Parent ? Parent->OnEvent(event) : false;
|
||||
}
|
||||
|
||||
#define AutoScale true
|
||||
|
||||
//! draws the element and its children
|
||||
void MyGUIButton::draw()
|
||||
{
|
||||
if (!IsVisible)
|
||||
return;
|
||||
|
||||
IGUISkin* skin = Environment->getSkin();
|
||||
video::IVideoDriver* driver = Environment->getVideoDriver();
|
||||
|
||||
IGUIFont* font = OverrideFont;
|
||||
if (!OverrideFont)
|
||||
font = skin->getFont(EGDF_BUTTON);
|
||||
|
||||
core::rect<s32> rect = AbsoluteRect;
|
||||
|
||||
// todo: move sprite up and text down if the pressed state has a sprite
|
||||
// draw sprites for focused and mouse-over
|
||||
core::position2di spritePos = AbsoluteRect.getCenter();
|
||||
|
||||
if (!Pressed)
|
||||
{
|
||||
if (Border)
|
||||
skin->draw3DButtonPaneStandard(this, rect, &AbsoluteClippingRect);
|
||||
|
||||
if (Image)
|
||||
{
|
||||
if(!AutoScale)
|
||||
{
|
||||
core::position2d<s32> pos = AbsoluteRect.getCenter();
|
||||
pos.X -= ImageRect.getWidth() / 2;
|
||||
pos.Y -= ImageRect.getHeight() / 2;
|
||||
|
||||
driver->draw2DImage(Image, pos, ImageRect, &AbsoluteClippingRect,
|
||||
video::SColor(255,255,255,255), UseAlphaChannel);
|
||||
}
|
||||
else
|
||||
{
|
||||
driver->draw2DImage(Image, AbsoluteRect, ImageRect,
|
||||
&AbsoluteClippingRect, 0, UseAlphaChannel);
|
||||
}
|
||||
/*
|
||||
core::position2d<s32> pos = AbsoluteRect.getCenter();
|
||||
pos.X -= ImageRect.getWidth() / 2;
|
||||
pos.Y -= ImageRect.getHeight() / 2;
|
||||
|
||||
driver->draw2DImage(Image, pos, ImageRect, &AbsoluteClippingRect,
|
||||
video::SColor(255,255,255,255), UseAlphaChannel);
|
||||
*/
|
||||
}
|
||||
if (SpriteBank && ButtonSprites[EGBS_BUTTON_UP].Index != -1)
|
||||
{
|
||||
// draw pressed sprite
|
||||
/*
|
||||
SpriteBank->draw2DSprite(ButtonSprites[EGBS_BUTTON_UP].Index, spritePos,
|
||||
&AbsoluteClippingRect, ButtonSprites[EGBS_BUTTON_UP].Color, ClickTime, os::Timer::getTime(),
|
||||
ButtonSprites[EGBS_BUTTON_UP].Loop, true);
|
||||
*/
|
||||
printf("Sorry, sprite support for buttons was disabled in order to avoid os-specific timing stuff\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Border)
|
||||
skin->draw3DButtonPanePressed(this, rect, &AbsoluteClippingRect);
|
||||
|
||||
if (PressedImage)
|
||||
{
|
||||
|
||||
|
||||
if(!AutoScale)
|
||||
{
|
||||
core::position2d<s32> pos = AbsoluteRect.getCenter();
|
||||
pos.X -= PressedImageRect.getWidth() / 2;
|
||||
pos.Y -= PressedImageRect.getHeight() / 2;
|
||||
// patch by Alan Tyndall/Jonas Petersen
|
||||
if (Image == PressedImage && PressedImageRect == ImageRect)
|
||||
{
|
||||
pos.X += 1;
|
||||
pos.Y += 1;
|
||||
}
|
||||
|
||||
driver->draw2DImage(Image, pos, ImageRect, &AbsoluteClippingRect,
|
||||
video::SColor(255,255,255,255), UseAlphaChannel);
|
||||
}
|
||||
else
|
||||
{
|
||||
driver->draw2DImage(Image, AbsoluteRect, ImageRect,
|
||||
&AbsoluteClippingRect, 0, UseAlphaChannel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (SpriteBank && ButtonSprites[EGBS_BUTTON_DOWN].Index != -1)
|
||||
{
|
||||
/*
|
||||
// draw sprite
|
||||
SpriteBank->draw2DSprite(ButtonSprites[EGBS_BUTTON_DOWN].Index, spritePos,
|
||||
&AbsoluteClippingRect, ButtonSprites[EGBS_BUTTON_DOWN].Color, ClickTime, os::Timer::getTime(),
|
||||
ButtonSprites[EGBS_BUTTON_DOWN].Loop, true);
|
||||
*/
|
||||
printf("Sorry, sprite support for buttons was disabled in order to avoid os-specific timing stuff\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (Text.size())
|
||||
{
|
||||
rect = AbsoluteRect;
|
||||
if (Pressed)
|
||||
rect.UpperLeftCorner.Y += 2;
|
||||
|
||||
if (font)
|
||||
font->draw(Text.c_str(), rect,
|
||||
skin->getColor(IsEnabled ? EGDC_BUTTON_TEXT : EGDC_GRAY_TEXT), true, true,
|
||||
&AbsoluteClippingRect);
|
||||
}
|
||||
|
||||
IGUIElement::draw();
|
||||
}
|
||||
|
||||
|
||||
//! sets another skin independent font. if this is set to zero, the button uses the font of the skin.
|
||||
void MyGUIButton::setOverrideFont(IGUIFont* font)
|
||||
{
|
||||
if (OverrideFont)
|
||||
OverrideFont->drop();
|
||||
|
||||
OverrideFont = font;
|
||||
|
||||
if (OverrideFont)
|
||||
OverrideFont->grab();
|
||||
}
|
||||
|
||||
|
||||
//! Sets an image which should be displayed on the button when it is in normal state.
|
||||
void MyGUIButton::setImage(video::ITexture* image)
|
||||
{
|
||||
if (Image)
|
||||
Image->drop();
|
||||
|
||||
Image = image;
|
||||
if (image)
|
||||
ImageRect = core::rect<s32>(core::position2d<s32>(0,0), image->getOriginalSize());
|
||||
|
||||
if (Image)
|
||||
Image->grab();
|
||||
|
||||
if (!PressedImage)
|
||||
setPressedImage(Image);
|
||||
}
|
||||
|
||||
|
||||
//! Sets the image which should be displayed on the button when it is in its normal state.
|
||||
void MyGUIButton::setImage(video::ITexture* image, const core::rect<s32>& pos)
|
||||
{
|
||||
if (Image)
|
||||
Image->drop();
|
||||
|
||||
Image = image;
|
||||
ImageRect = pos;
|
||||
|
||||
if (Image)
|
||||
Image->grab();
|
||||
|
||||
if (!PressedImage)
|
||||
setPressedImage(Image, pos);
|
||||
}
|
||||
|
||||
|
||||
//! Sets an image which should be displayed on the button when it is in pressed state.
|
||||
void MyGUIButton::setPressedImage(video::ITexture* image)
|
||||
{
|
||||
if (PressedImage)
|
||||
PressedImage->drop();
|
||||
|
||||
PressedImage = image;
|
||||
if (image)
|
||||
PressedImageRect = core::rect<s32>(core::position2d<s32>(0,0), image->getOriginalSize());
|
||||
|
||||
if (PressedImage)
|
||||
PressedImage->grab();
|
||||
}
|
||||
|
||||
|
||||
//! Sets the image which should be displayed on the button when it is in its pressed state.
|
||||
void MyGUIButton::setPressedImage(video::ITexture* image, const core::rect<s32>& pos)
|
||||
{
|
||||
if (PressedImage)
|
||||
PressedImage->drop();
|
||||
|
||||
PressedImage = image;
|
||||
PressedImageRect = pos;
|
||||
|
||||
if (PressedImage)
|
||||
PressedImage->grab();
|
||||
}
|
||||
|
||||
|
||||
//! Sets if the button should behave like a push button. Which means it
|
||||
//! can be in two states: Normal or Pressed. With a click on the button,
|
||||
//! the user can change the state of the button.
|
||||
void MyGUIButton::setIsPushButton(bool isPushButton)
|
||||
{
|
||||
IsPushButton = isPushButton;
|
||||
}
|
||||
|
||||
|
||||
//! Returns if the button is currently pressed
|
||||
bool MyGUIButton::isPressed() const
|
||||
{
|
||||
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
||||
return Pressed;
|
||||
}
|
||||
|
||||
|
||||
//! Sets the pressed state of the button if this is a pushbutton
|
||||
void MyGUIButton::setPressed(bool pressed)
|
||||
{
|
||||
if (Pressed != pressed)
|
||||
{
|
||||
//ClickTime = os::Timer::getTime();
|
||||
Pressed = pressed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//! Returns whether the button is a push button
|
||||
bool MyGUIButton::isPushButton() const
|
||||
{
|
||||
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
||||
return IsPushButton;
|
||||
}
|
||||
|
||||
|
||||
//! Sets if the alpha channel should be used for drawing images on the button (default is false)
|
||||
void MyGUIButton::setUseAlphaChannel(bool useAlphaChannel)
|
||||
{
|
||||
UseAlphaChannel = useAlphaChannel;
|
||||
}
|
||||
|
||||
|
||||
//! Returns if the alpha channel should be used for drawing images on the button
|
||||
bool MyGUIButton::isAlphaChannelUsed() const
|
||||
{
|
||||
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
||||
return UseAlphaChannel;
|
||||
}
|
||||
|
||||
|
||||
bool MyGUIButton::isDrawingBorder() const
|
||||
{
|
||||
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
|
||||
return Border;
|
||||
}
|
||||
|
||||
|
||||
//! Writes attributes of the element.
|
||||
void MyGUIButton::serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
|
||||
{
|
||||
IGUIButton::serializeAttributes(out,options);
|
||||
|
||||
out->addBool ("PushButton", IsPushButton );
|
||||
if (IsPushButton)
|
||||
out->addBool("Pressed", Pressed);
|
||||
|
||||
out->addTexture ("Image", Image);
|
||||
out->addRect ("ImageRect", ImageRect);
|
||||
out->addTexture ("PressedImage", PressedImage);
|
||||
out->addRect ("PressedImageRect", PressedImageRect);
|
||||
|
||||
out->addBool ("Border", Border);
|
||||
out->addBool ("UseAlphaChannel", UseAlphaChannel);
|
||||
|
||||
// out->addString ("OverrideFont", OverrideFont);
|
||||
}
|
||||
|
||||
|
||||
//! Reads attributes of the element
|
||||
void MyGUIButton::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
|
||||
{
|
||||
IGUIButton::deserializeAttributes(in,options);
|
||||
|
||||
IsPushButton = in->getAttributeAsBool("PushButton");
|
||||
Pressed = IsPushButton ? in->getAttributeAsBool("Pressed") : false;
|
||||
|
||||
core::rect<s32> rec = in->getAttributeAsRect("ImageRect");
|
||||
if (rec.isValid())
|
||||
setImage( in->getAttributeAsTexture("Image"), rec);
|
||||
else
|
||||
setImage( in->getAttributeAsTexture("Image") );
|
||||
|
||||
rec = in->getAttributeAsRect("PressedImageRect");
|
||||
if (rec.isValid())
|
||||
setPressedImage( in->getAttributeAsTexture("PressedImage"), rec);
|
||||
else
|
||||
setPressedImage( in->getAttributeAsTexture("PressedImage") );
|
||||
|
||||
setDrawBorder(in->getAttributeAsBool("Border"));
|
||||
UseAlphaChannel = in->getAttributeAsBool("UseAlphaChannel");
|
||||
|
||||
// setOverrideFont(in->getAttributeAsString("OverrideFont"));
|
||||
|
||||
updateAbsolutePosition();
|
||||
}
|
121
src/gui/my_button.hpp
Normal file
121
src/gui/my_button.hpp
Normal file
@ -0,0 +1,121 @@
|
||||
#ifndef HEADER_MY_BUTTON_HPP
|
||||
#define HEADER_MY_BUTTON_HPP
|
||||
|
||||
#include <irrlicht.h>
|
||||
|
||||
using namespace irr;
|
||||
using namespace core;
|
||||
using namespace scene;
|
||||
using namespace video;
|
||||
using namespace io;
|
||||
using namespace gui;
|
||||
|
||||
namespace GUIEngine
|
||||
{
|
||||
|
||||
class MyGUIButton : public IGUIButton
|
||||
{
|
||||
public:
|
||||
|
||||
//! constructor
|
||||
MyGUIButton(IGUIEnvironment* environment, IGUIElement* parent,
|
||||
s32 id, core::rect<s32> rectangle, bool noclip=false);
|
||||
|
||||
//! destructor
|
||||
virtual ~MyGUIButton();
|
||||
|
||||
//! called if an event happened.
|
||||
virtual bool OnEvent(const SEvent& event);
|
||||
|
||||
//! draws the element and its children
|
||||
virtual void draw();
|
||||
|
||||
//! sets another skin independent font. if this is set to zero, the button uses the font of the skin.
|
||||
virtual void setOverrideFont(IGUIFont* font=0);
|
||||
|
||||
//! Sets an image which should be displayed on the button when it is in normal state.
|
||||
virtual void setImage(video::ITexture* image);
|
||||
|
||||
//! Sets an image which should be displayed on the button when it is in normal state.
|
||||
virtual void setImage(video::ITexture* image, const core::rect<s32>& pos);
|
||||
|
||||
//! Sets an image which should be displayed on the button when it is in pressed state.
|
||||
virtual void setPressedImage(video::ITexture* image);
|
||||
|
||||
//! Sets an image which should be displayed on the button when it is in pressed state.
|
||||
virtual void setPressedImage(video::ITexture* image, const core::rect<s32>& pos);
|
||||
|
||||
//! Sets the sprite bank used by the button
|
||||
virtual void setSpriteBank(IGUISpriteBank* bank);
|
||||
|
||||
//! Sets the animated sprite for a specific button state
|
||||
/** \param index: Number of the sprite within the sprite bank, use -1 for no sprite
|
||||
\param state: State of the button to set the sprite for
|
||||
\param index: The sprite number from the current sprite bank
|
||||
\param color: The color of the sprite
|
||||
*/
|
||||
virtual void setSprite(EGUI_BUTTON_STATE state, s32 index,
|
||||
video::SColor color=video::SColor(255,255,255,255), bool loop=false);
|
||||
|
||||
//! Sets if the button should behave like a push button. Which means it
|
||||
//! can be in two states: Normal or Pressed. With a click on the button,
|
||||
//! the user can change the state of the button.
|
||||
virtual void setIsPushButton(bool isPushButton);
|
||||
|
||||
//! Returns if the button is currently pressed
|
||||
virtual bool isPressed() const;
|
||||
|
||||
//! Sets the pressed state of the button if this is a pushbutton
|
||||
virtual void setPressed(bool pressed);
|
||||
|
||||
//! Sets if the button should use the skin to draw its border
|
||||
virtual void setDrawBorder(bool border);
|
||||
|
||||
//! Sets if the alpha channel should be used for drawing images on the button (default is false)
|
||||
virtual void setUseAlphaChannel(bool useAlphaChannel);
|
||||
|
||||
//! Returns if the alpha channel should be used for drawing images on the button
|
||||
virtual bool isAlphaChannelUsed() const;
|
||||
|
||||
//! Returns if the button face and border are being drawn
|
||||
virtual bool isDrawingBorder() const;
|
||||
|
||||
//! Returns whether the button is a push button
|
||||
virtual bool isPushButton() const;
|
||||
|
||||
//! Writes attributes of the element.
|
||||
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
|
||||
|
||||
//! Reads attributes of the element
|
||||
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
|
||||
|
||||
private:
|
||||
|
||||
struct ButtonSprite
|
||||
{
|
||||
s32 Index;
|
||||
video::SColor Color;
|
||||
bool Loop;
|
||||
};
|
||||
|
||||
bool Pressed;
|
||||
bool IsPushButton;
|
||||
bool UseAlphaChannel;
|
||||
|
||||
bool Border;
|
||||
|
||||
u32 ClickTime;
|
||||
|
||||
IGUISpriteBank* SpriteBank;
|
||||
IGUIFont* OverrideFont;
|
||||
|
||||
ButtonSprite ButtonSprites[EGBS_COUNT];
|
||||
|
||||
video::ITexture* Image;
|
||||
video::ITexture* PressedImage;
|
||||
|
||||
core::rect<s32> ImageRect;
|
||||
core::rect<s32> PressedImageRect;
|
||||
};
|
||||
}
|
||||
#endif
|
@ -1,304 +0,0 @@
|
||||
// $Id: network_gui.cpp 2148 2008-07-03 03:14:27Z hikerstk $
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "gui/network_gui.hpp"
|
||||
|
||||
#include <sstream>
|
||||
#include <SDL/SDL.h>
|
||||
|
||||
#include "sdldrv.hpp"
|
||||
#include "user_config.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_TITLE,
|
||||
WTOK_CONNECT,
|
||||
WTOK_SERVER,
|
||||
WTOK_SERVER_ADDRESS,
|
||||
WTOK_CONNECTED,
|
||||
WTOK_MESSAGE,
|
||||
WTOK_QUIT
|
||||
};
|
||||
|
||||
/** Limits the maximum length of the player name. */
|
||||
const int NetworkGUI::SERVER_NAME_MAX = 50;
|
||||
|
||||
|
||||
NetworkGUI::NetworkGUI()
|
||||
{
|
||||
m_num_clients = 0;
|
||||
Widget *w=widget_manager->addTitleWgt( WTOK_TITLE, 60, 7, _("Select network mode"));
|
||||
widget_manager->hideWgtRect(WTOK_TITLE);
|
||||
w->setPosition(WGT_DIR_CENTER, 0.0, WGT_DIR_FROM_TOP, 0.15f);
|
||||
|
||||
Widget *w_prev=widget_manager->addTextButtonWgt( WTOK_CONNECT, 30, 7, _("Connect to server") );
|
||||
widget_manager->resizeWgtToText(WTOK_CONNECT);
|
||||
w_prev->setPosition(WGT_DIR_FROM_LEFT, 0.05f, WGT_DIR_FROM_TOP, 0.25f);
|
||||
|
||||
w=widget_manager->addTextButtonWgt( WTOK_SERVER, 30, 7, _("Become server") );
|
||||
widget_manager->resizeWgtToText(WTOK_SERVER);
|
||||
w->setPosition(WGT_DIR_FROM_LEFT, 0.05f, NULL,
|
||||
WGT_DIR_UNDER_WIDGET, 0, w_prev);
|
||||
widget_manager->sameWidth(WTOK_CONNECT, WTOK_SERVER);
|
||||
|
||||
std::ostringstream s;
|
||||
s<<user_config->m_server_address<<":"<<user_config->m_server_port;
|
||||
m_server_address=s.str();
|
||||
w=widget_manager->addTextButtonWgt(WTOK_SERVER_ADDRESS, 50, 7, m_server_address);
|
||||
w->setPosition(WGT_DIR_RIGHT_WIDGET, 0.05f, w_prev,
|
||||
WGT_DIR_FROM_TOP, 0.25f, NULL);
|
||||
|
||||
w=widget_manager->addTextButtonWgt(WTOK_CONNECTED, 50, 20, " ");
|
||||
w->setPosition(WGT_DIR_RIGHT_WIDGET, 0.05f, w_prev,
|
||||
WGT_DIR_FROM_TOP, 0.25f, NULL);
|
||||
widget_manager->hideWgt(WTOK_CONNECTED);
|
||||
widget_manager->deactivateWgt(WTOK_CONNECTED);
|
||||
|
||||
w=widget_manager->addTextButtonWgt( WTOK_QUIT, 60, 7, _("Press <ESC> to go back") );
|
||||
w->setPosition(WGT_DIR_CENTER, 0, WGT_DIR_FROM_BOTTOM, 0);
|
||||
|
||||
w=widget_manager->addTextWgt(WTOK_MESSAGE, 30, 7, "");
|
||||
w->setPosition(WGT_DIR_CENTER, 0, WGT_DIR_CENTER, 0);
|
||||
widget_manager->hideWgt(WTOK_MESSAGE);
|
||||
|
||||
// This can happen either when going back here, or when a command line
|
||||
// option was specified causing the connection to already have happened
|
||||
if(network_manager->getMode()==NetworkManager::NW_SERVER)
|
||||
switchToWaitForConnectionMode();
|
||||
widget_manager->layout(WGT_AREA_ALL);
|
||||
m_state=NGS_NONE;
|
||||
|
||||
} // NetworkGUI
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
NetworkGUI::~NetworkGUI()
|
||||
{
|
||||
widget_manager->reset();
|
||||
} // ~NetworkGUI
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void NetworkGUI::select()
|
||||
{
|
||||
const int selected = widget_manager->getSelectedWgt();
|
||||
switch (selected)
|
||||
{
|
||||
case WTOK_SERVER_ADDRESS:
|
||||
// Switch to typing in the address of the server
|
||||
widget_manager->setWgtText(WTOK_SERVER_ADDRESS, (m_server_address + "<").c_str());
|
||||
inputDriver->setMode(SDLDriver::LOWLEVEL);
|
||||
break;
|
||||
case WTOK_CONNECT:
|
||||
// If we could connect here, no message could be displayed since
|
||||
// glflush isn't called. So we only set a message for the network
|
||||
// manager to display, and set the state so that the actual
|
||||
// connection is done later when updating.
|
||||
m_state=NGS_CONNECT_DISPLAY;
|
||||
widget_manager->setWgtText(WTOK_MESSAGE, _("Waiting for server"));
|
||||
widget_manager->resizeWgtToText(WTOK_MESSAGE);
|
||||
widget_manager->showWgt(WTOK_MESSAGE);
|
||||
widget_manager->hideWgt(WTOK_CONNECT, WTOK_SERVER_ADDRESS);
|
||||
widget_manager->hideWgt(WTOK_QUIT);
|
||||
break;
|
||||
case WTOK_SERVER:
|
||||
network_manager->becomeServer();
|
||||
widget_manager->hideWgt(WTOK_MESSAGE);
|
||||
widget_manager->resizeWgtToText(WTOK_MESSAGE);
|
||||
widget_manager->showWgt(WTOK_MESSAGE);
|
||||
// Initialising the server does not block, so we don't have to
|
||||
// do this in the update loop (to enable updates of the display).
|
||||
if(!network_manager->initialiseConnections())
|
||||
{
|
||||
fprintf(stderr, "Problems initialising network connections,\n"
|
||||
"Running in non-network mode.\n");
|
||||
}
|
||||
switchToWaitForConnectionMode();
|
||||
break;
|
||||
case WTOK_QUIT:
|
||||
// Disable accepting of clients
|
||||
if(network_manager->getMode()==NetworkManager::NW_SERVER)
|
||||
network_manager->setState(NetworkManager::NS_MAIN_MENU);
|
||||
// Don't do networking if no clients are connected
|
||||
if(network_manager->getNumClients()==0)
|
||||
network_manager->disableNetworking();
|
||||
// Leave menu.
|
||||
menu_manager->popMenu();
|
||||
|
||||
break;
|
||||
}
|
||||
} // select
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void NetworkGUI::switchToWaitForConnectionMode()
|
||||
{
|
||||
widget_manager->setWgtText(WTOK_CONNECT, _("Connected:"));
|
||||
widget_manager->hideWgtRect(WTOK_CONNECT);
|
||||
widget_manager->deactivateWgt(WTOK_CONNECT); //make it non-selectable
|
||||
widget_manager->setWgtText(WTOK_QUIT, _("OK"));
|
||||
widget_manager->hideWgt(WTOK_SERVER_ADDRESS);
|
||||
widget_manager->showWgt(WTOK_CONNECTED);
|
||||
widget_manager->hideWgt(WTOK_SERVER);
|
||||
widget_manager->setWgtText(WTOK_TITLE,_("Waiting for clients"));
|
||||
widget_manager->hideWgt(WTOK_MESSAGE);
|
||||
m_num_clients = 0;
|
||||
} // switchToWaitForConnectionMode
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void NetworkGUI::update(float dt)
|
||||
{
|
||||
// We need one 'in between' frame (finite state machine goes from
|
||||
// NGS_CONNECT_DISPLAY to NGS_CONNECT_DOIT) since otherwise the text
|
||||
// set for the message widget is not displayed (since glFlush isn't
|
||||
// called before the blocking initialiseConnection call).
|
||||
if(m_state==NGS_CONNECT_DOIT)
|
||||
{
|
||||
network_manager->becomeClient();
|
||||
if(!network_manager->initialiseConnections())
|
||||
{
|
||||
widget_manager->setWgtText(WTOK_MESSAGE, _("Can't connect to server"));
|
||||
widget_manager->resizeWgtToText(WTOK_MESSAGE);
|
||||
widget_manager->showWgt(WTOK_QUIT);
|
||||
network_manager->disableNetworking();
|
||||
}
|
||||
else
|
||||
{
|
||||
network_manager->sendConnectMessage();
|
||||
menu_manager->popMenu();
|
||||
}
|
||||
m_state=NGS_NONE;
|
||||
}
|
||||
else if(m_state==NGS_CONNECT_DISPLAY)
|
||||
m_state=NGS_CONNECT_DOIT;
|
||||
|
||||
widget_manager->update(0.0f);
|
||||
if(m_num_clients==network_manager->getNumClients()) return;
|
||||
|
||||
// At least one new client has connected:
|
||||
std::string s="";
|
||||
m_num_clients = network_manager->getNumClients();
|
||||
for(unsigned int i=1; i<=m_num_clients; i++)
|
||||
{
|
||||
s+=network_manager->getClientName(i)+"\n";
|
||||
}
|
||||
widget_manager->setWgtText(WTOK_CONNECTED, s);
|
||||
} // update
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void NetworkGUI::inputKeyboard(SDLKey key, int unicode)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case SDLK_RSHIFT:
|
||||
case SDLK_LSHIFT:
|
||||
// Ignore shift, otherwise shift will disable input
|
||||
// (making it impossible to enter upper case characters)
|
||||
case SDLK_SPACE:
|
||||
// Ignore space to prevent invisible names.
|
||||
|
||||
// Note: This will never happen as long as SPACE has a mapping which
|
||||
// causes GA_ENTER and therefore finishes the typing. Please leave this
|
||||
// because I am not sure whether this is good behavior (that SPACE
|
||||
// cannot reach inputKeyboard()) and with some changes to the input
|
||||
// driver this code has suddenly a useful effect.
|
||||
case SDLK_KP_ENTER:
|
||||
case SDLK_RETURN:
|
||||
case SDLK_ESCAPE:
|
||||
// Ignore some control keys. What they could provide is implemented
|
||||
// in the handle() method.
|
||||
return;
|
||||
case SDLK_BACKSPACE:
|
||||
// Handle backspace.
|
||||
if (m_server_address.size() >=1)
|
||||
m_server_address.erase(m_server_address.size()-1, 1);
|
||||
|
||||
widget_manager->setWgtText(WTOK_SERVER_ADDRESS, (m_server_address + "<").c_str());
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
// Adds the character to the name.
|
||||
// For this menu only unicode translation is enabled.
|
||||
// So we use the unicode character here, since this will
|
||||
// take care of upper/lower case etc.
|
||||
if (unicode && (int)m_server_address.size() <= SERVER_NAME_MAX)
|
||||
m_server_address += (char) unicode;
|
||||
widget_manager->setWgtText(WTOK_SERVER_ADDRESS, (m_server_address + "<").c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void NetworkGUI::handle(GameAction ga, int value)
|
||||
{
|
||||
if (value)
|
||||
return;
|
||||
|
||||
switch (ga)
|
||||
{
|
||||
case GA_ENTER:
|
||||
// If the user is typing her name this will be finished at this
|
||||
// point.
|
||||
if (inputDriver->isInMode(SDLDriver::LOWLEVEL))
|
||||
{
|
||||
// Prevents zero-length names.
|
||||
if (m_server_address.length() == 0)
|
||||
m_server_address = "localhost:2305";
|
||||
std::vector<std::string> sl=StringUtils::split(m_server_address,':');
|
||||
if(sl.size()>1)
|
||||
{
|
||||
user_config->m_server_address = sl[0];
|
||||
user_config->m_server_port = atoi(sl[1].c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
user_config->m_server_address = m_server_address;
|
||||
std::ostringstream s;
|
||||
s<<m_server_address<<":"<<user_config->m_server_port;
|
||||
m_server_address=s.str();
|
||||
}
|
||||
widget_manager->setWgtText(WTOK_SERVER_ADDRESS, m_server_address.c_str());
|
||||
|
||||
inputDriver->setMode(SDLDriver::MENU);
|
||||
}
|
||||
else
|
||||
select();
|
||||
break;
|
||||
case GA_LEAVE:
|
||||
// If the user is typing her name this will be cancelled at this
|
||||
// point.
|
||||
if (inputDriver->isInMode(SDLDriver::LOWLEVEL))
|
||||
{
|
||||
std::ostringstream s;
|
||||
s<<user_config->m_server_address<<":"<<user_config->m_server_port;
|
||||
m_server_address=s.str();
|
||||
widget_manager->setWgtText(WTOK_SERVER_ADDRESS, m_server_address.c_str());
|
||||
|
||||
inputDriver->setMode(SDLDriver::MENU);
|
||||
break;
|
||||
}
|
||||
// Fall through to reach the usual GA_LEAVE code (leave menu).
|
||||
default:
|
||||
BaseGUI::handle(ga, value);
|
||||
}
|
||||
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
// $Id: network_gui.hpp 2128 2008-06-13 00:53:52Z cosmosninja $
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2008 Joerg Henrichs
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_NETWORK_GUI_H
|
||||
#define HEADER_NETWORK_GUI_H
|
||||
|
||||
#include <string>
|
||||
#include <SDL/SDL.h>
|
||||
#include "base_gui.hpp"
|
||||
#include "player.hpp"
|
||||
|
||||
class NetworkGUI: public BaseGUI
|
||||
{
|
||||
private:
|
||||
unsigned int m_num_clients;
|
||||
std::string m_server_address;
|
||||
enum {NGS_NONE, NGS_CONNECT_DISPLAY, NGS_CONNECT_DOIT}
|
||||
m_state;
|
||||
|
||||
static const int SERVER_NAME_MAX;
|
||||
|
||||
void switchToWaitForConnectionMode();
|
||||
public:
|
||||
NetworkGUI();
|
||||
~NetworkGUI();
|
||||
void select();
|
||||
void update(float dt);
|
||||
void handle(GameAction, int);
|
||||
void inputKeyboard(SDLKey, int);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -1,82 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "gui/num_players.hpp"
|
||||
|
||||
#include "race_manager.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_PLAYER_2 = 2,
|
||||
WTOK_PLAYER_3,
|
||||
WTOK_PLAYER_4,
|
||||
|
||||
WTOK_QUIT
|
||||
};
|
||||
|
||||
NumPlayers::NumPlayers()
|
||||
{
|
||||
widget_manager->switchOrder();
|
||||
widget_manager->addTextButtonWgt( WTOK_PLAYER_2, 35, 7, _("Two Players") );
|
||||
widget_manager->addTextButtonWgt( WTOK_PLAYER_3, 35, 7, _("Three Players") );
|
||||
widget_manager->addTextButtonWgt( WTOK_PLAYER_4, 35, 7, _("Four Players") );
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 35, 7 );
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_QUIT, 35, 7,
|
||||
_("Press <ESC> to go back") );
|
||||
widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML );
|
||||
|
||||
widget_manager->layout(WGT_AREA_ALL);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
NumPlayers::~NumPlayers()
|
||||
{
|
||||
widget_manager->reset() ;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void NumPlayers::select()
|
||||
{
|
||||
switch ( widget_manager->getSelectedWgt() )
|
||||
{
|
||||
case WTOK_PLAYER_2:
|
||||
case WTOK_PLAYER_3:
|
||||
case WTOK_PLAYER_4:
|
||||
race_manager->setNumLocalPlayers(widget_manager->getSelectedWgt());
|
||||
if(network_manager->getMode()==NetworkManager::NW_CLIENT)
|
||||
menu_manager->pushMenu(MENUID_CHARSEL_P1);
|
||||
else
|
||||
menu_manager->pushMenu(MENUID_GAMEMODE);
|
||||
break;
|
||||
case WTOK_QUIT:
|
||||
menu_manager->popMenu();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,34 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_NUMPLAYERS_H
|
||||
#define HEADER_NUMPLAYERS_H
|
||||
|
||||
#include "base_gui.hpp"
|
||||
|
||||
class NumPlayers: public BaseGUI
|
||||
{
|
||||
public:
|
||||
NumPlayers();
|
||||
~NumPlayers();
|
||||
|
||||
void select();
|
||||
};
|
||||
|
||||
#endif
|
@ -1,104 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "gui/options.hpp"
|
||||
|
||||
#include "user_config.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_TITLE,
|
||||
|
||||
WTOK_CONTROLS,
|
||||
WTOK_DISPLAY,
|
||||
WTOK_SOUND,
|
||||
|
||||
WTOK_QUIT
|
||||
};
|
||||
|
||||
Options::Options()
|
||||
{
|
||||
widget_manager->switchOrder();
|
||||
widget_manager->addTitleWgt( WTOK_TITLE, 45, 7, _("Options") );
|
||||
widget_manager->hideWgtRect(WTOK_TITLE);
|
||||
widget_manager->addTextButtonWgt( WTOK_CONTROLS, 45, 7, _("Player Config") );
|
||||
|
||||
// Don't display the fullscreen menu when called from within the race.
|
||||
// The fullscreen mode will reload all textures, reload the models,
|
||||
// ... basically creating a big mess!! (and all of this only thanks
|
||||
// to windows, who discards all textures, ...)
|
||||
if(!menu_manager->isSomewhereOnStack( MENUID_RACE ))
|
||||
{
|
||||
widget_manager->addTextButtonWgt( WTOK_DISPLAY, 45, 7, _("Display") );
|
||||
}
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_SOUND, 45, 7, _("Sound") );
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 1, 7 );
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_QUIT, 45, 7,
|
||||
_("Press <ESC> to go back") );
|
||||
widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML );
|
||||
|
||||
widget_manager->layout(WGT_AREA_ALL);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
Options::~Options()
|
||||
{
|
||||
widget_manager->reset() ;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void Options::select()
|
||||
{
|
||||
switch ( widget_manager->getSelectedWgt() )
|
||||
{
|
||||
case WTOK_CONTROLS:
|
||||
menu_manager->pushMenu(MENUID_CONFIG_CONTROLS);
|
||||
break;
|
||||
case WTOK_DISPLAY:
|
||||
menu_manager->pushMenu(MENUID_CONFIG_DISPLAY);
|
||||
break;
|
||||
case WTOK_SOUND:
|
||||
menu_manager->pushMenu(MENUID_CONFIG_SOUND);
|
||||
break;
|
||||
case WTOK_QUIT:
|
||||
//FIXME: this shouldn't be in this screen
|
||||
// Make config changes permanent.
|
||||
user_config->saveConfig();
|
||||
|
||||
menu_manager->popMenu();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
} // switch
|
||||
}
|
||||
|
||||
void Options::handle(GameAction action, int value)
|
||||
{
|
||||
// Save config on leave.
|
||||
if (!value && action == GA_LEAVE)
|
||||
user_config->saveConfig();
|
||||
|
||||
BaseGUI::handle(action, value);
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_OPTIONS_H
|
||||
#define HEADER_OPTIONS_H
|
||||
|
||||
#include "base_gui.hpp"
|
||||
|
||||
class Options: public BaseGUI
|
||||
{
|
||||
public:
|
||||
Options();
|
||||
~Options();
|
||||
|
||||
void select();
|
||||
void handle(GameAction, int);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -1,325 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "gui/player_controls.hpp"
|
||||
|
||||
#include <SDL/SDL.h>
|
||||
|
||||
#include "sdldrv.hpp"
|
||||
#include "user_config.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_TITLE,
|
||||
WTOK_PLYR_NAME0,
|
||||
WTOK_PLYR_NAME1,
|
||||
|
||||
WTOK_LEFT,
|
||||
WTOK_RIGHT,
|
||||
WTOK_ACCEL,
|
||||
WTOK_BRAKE,
|
||||
WTOK_NITRO,
|
||||
WTOK_DRIFT,
|
||||
WTOK_RESCUE,
|
||||
WTOK_FIRE,
|
||||
WTOK_LOOK_BACK,
|
||||
|
||||
WTOK_KEY0,
|
||||
WTOK_KEY1,
|
||||
WTOK_KEY2,
|
||||
WTOK_KEY3,
|
||||
WTOK_KEY4,
|
||||
WTOK_KEY5,
|
||||
WTOK_KEY6,
|
||||
WTOK_KEY7,
|
||||
WTOK_KEY8,
|
||||
|
||||
WTOK_QUIT
|
||||
};
|
||||
|
||||
/** Limits the maximum length of the player name. */
|
||||
const size_t PlayerControls::PLAYER_NAME_MAX = 10;
|
||||
|
||||
|
||||
const char *sKartAction2String[KA_LAST+1] =
|
||||
{
|
||||
//I18N: name of controls
|
||||
_("Left"),
|
||||
//I18N: name of controls (here, 'right' is the opposite of 'left' not the opposite of 'wrong')
|
||||
_("Right"),
|
||||
//I18N: name of controls
|
||||
_("Accelerate"), _("Brake"), _("Nitro"), _("Sharp Turn"), _("Rescue"),
|
||||
//I18N: name of controls, like in "fire missile"
|
||||
_("Fire"),
|
||||
//I18N: name of controls
|
||||
_("Look back")
|
||||
};
|
||||
|
||||
|
||||
PlayerControls::PlayerControls(int whichPlayer):
|
||||
m_player_index(whichPlayer),
|
||||
m_grab_input(false)
|
||||
{
|
||||
std::string s = StringUtils::insert_values( _("Choose your controls, %s"),
|
||||
user_config->m_player[m_player_index].getName());
|
||||
|
||||
widget_manager->addTitleWgt( WTOK_TITLE, 60, 7, s);
|
||||
widget_manager->hideWgtRect(WTOK_TITLE);
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addTextWgt( WTOK_PLYR_NAME0, 30, 7, _("Player name") );
|
||||
|
||||
m_name = user_config->m_player[m_player_index].getName();
|
||||
widget_manager->addTextButtonWgt( WTOK_PLYR_NAME1, 30, 7, m_name );
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->switchOrder();
|
||||
for(int i = KA_FIRST; i <= KA_LAST; i++)
|
||||
{
|
||||
// Note: even though that all strings in sKartAction2Strings above
|
||||
// are in _(), they are not translated (since gettext is actually
|
||||
// called at startup (just after loading) of the program, when
|
||||
// gettext is not yet initialised - so it returns the untranslated
|
||||
// strings). So we add an additional _() here (and in help_page_one).
|
||||
widget_manager->addTextWgt( WTOK_KEY0 + i, 30, 7, _(sKartAction2String[i]) );
|
||||
}
|
||||
widget_manager->breakLine();
|
||||
|
||||
|
||||
KartAction control;
|
||||
widget_manager->switchOrder();
|
||||
for(int i = KA_FIRST; i <= KA_LAST; i++)
|
||||
{
|
||||
control = (KartAction)i;
|
||||
m_key_names[control] = user_config->getMappingAsString(m_player_index, control);
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_LEFT + i, 30, 7,
|
||||
m_key_names[control].c_str());
|
||||
}
|
||||
widget_manager->breakLine();
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_QUIT, 60, 7, _("Press <ESC> to go back") );
|
||||
widget_manager->setWgtTextSize( WTOK_QUIT, WGT_FNT_SML);
|
||||
|
||||
widget_manager->layout(WGT_AREA_ALL);
|
||||
} // PlayerControls
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
PlayerControls::~PlayerControls()
|
||||
{
|
||||
widget_manager->reset();
|
||||
// The unicode translation is not generally needed, so disable it again.
|
||||
} // ~PlayerControls
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
PlayerControls::select()
|
||||
{
|
||||
const int selected = widget_manager->getSelectedWgt();
|
||||
switch (selected)
|
||||
{
|
||||
case WTOK_PLYR_NAME1:
|
||||
// Switch to typing in the player's name.
|
||||
widget_manager->setWgtText(WTOK_PLYR_NAME1, (m_name + "<").c_str());
|
||||
|
||||
inputDriver->setMode(SDLDriver::LOWLEVEL);
|
||||
|
||||
break;
|
||||
case WTOK_QUIT:
|
||||
// Leave menu.
|
||||
menu_manager->popMenu();
|
||||
|
||||
break;
|
||||
default:
|
||||
// Switch to input sensing.
|
||||
|
||||
// If the only remaining and not yet handled widgets are the ones
|
||||
// that deal with the kart controls and the values are still in the
|
||||
// correct order the assertion should hold. If not did something
|
||||
// bad.
|
||||
assert (selected >= WTOK_LEFT
|
||||
&& selected <= WTOK_LOOK_BACK);
|
||||
|
||||
|
||||
m_edit_action = static_cast<KartAction>(selected - WTOK_LEFT);
|
||||
widget_manager->setWgtText(selected, _("Press key"));
|
||||
// Prefer axis (in case of gamepads that deliver two different
|
||||
// events for buttons, e.g. a digital event and an anlogue one)
|
||||
// for left/right, in all other cases prefer the button.
|
||||
inputDriver->setMode( (selected==WTOK_RIGHT||selected==WTOK_LEFT)
|
||||
? SDLDriver::INPUT_SENSE_PREFER_AXIS
|
||||
: SDLDriver::INPUT_SENSE_PREFER_BUTTON );
|
||||
|
||||
break;
|
||||
}
|
||||
} // select
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
PlayerControls::inputKeyboard(SDLKey key, int unicode)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case SDLK_RSHIFT:
|
||||
case SDLK_LSHIFT:
|
||||
// Ignore shift, otherwise shift will disable input
|
||||
// (making it impossible to enter upper case characters)
|
||||
case SDLK_SPACE:
|
||||
// Ignore space to prevent invisible names.
|
||||
|
||||
// Note: This will never happen as long as SPACE has a mapping which
|
||||
// causes GA_ENTER and therefore finishes the typing. Please leave this
|
||||
// because I am not sure whether this is good behavior (that SPACE
|
||||
// cannot reach inputKeyboard()) and with some changes to the input
|
||||
// driver this code has suddenly a useful effect.
|
||||
case SDLK_KP_ENTER:
|
||||
case SDLK_RETURN:
|
||||
case SDLK_ESCAPE:
|
||||
// Ignore some control keys. What they could provide is implemented
|
||||
// in the handle() method.
|
||||
return;
|
||||
case SDLK_BACKSPACE:
|
||||
// Handle backspace.
|
||||
if (m_name.size() >=1)
|
||||
m_name.erase(m_name.size()-1, 1);
|
||||
|
||||
widget_manager->setWgtText(WTOK_PLYR_NAME1, (m_name + "<").c_str());
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
// Adds the character to the name.
|
||||
// For this menu only unicode translation is enabled.
|
||||
// So we use the unicode character here, since this will
|
||||
// take care of upper/lower case etc.
|
||||
if (unicode && m_name.size() <= PLAYER_NAME_MAX)
|
||||
m_name += (char) unicode;
|
||||
widget_manager->setWgtText(WTOK_PLYR_NAME1, (m_name + "<").c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
PlayerControls::clearMapping()
|
||||
{
|
||||
const int selected = widget_manager->getSelectedWgt();
|
||||
if (selected >= WTOK_LEFT && selected <= WTOK_LOOK_BACK)
|
||||
{
|
||||
user_config->clearInput(m_player_index,
|
||||
(KartAction) (selected - WTOK_LEFT));
|
||||
updateAllKeyLabels();
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
void PlayerControls::handle(GameAction ga, int value)
|
||||
{
|
||||
if (value)
|
||||
return;
|
||||
|
||||
switch (ga)
|
||||
{
|
||||
case GA_CLEAR_MAPPING:
|
||||
clearMapping();
|
||||
|
||||
break;
|
||||
case GA_SENSE_COMPLETE:
|
||||
{
|
||||
// Updates the configuration with the newly sensed input.
|
||||
const Input &new_input = inputDriver->getSensedInput();
|
||||
// Don't use reference for old_input, otherwise old_input
|
||||
// is changed when setInput is called.
|
||||
const Input old_input = user_config->getInput(m_player_index,
|
||||
m_edit_action);
|
||||
user_config->setInput(m_player_index,
|
||||
m_edit_action,
|
||||
new_input);
|
||||
// If left/right is set to a stick motion, and right/left is
|
||||
// currently set to be something else
|
||||
if(new_input.type == Input::IT_STICKMOTION &&
|
||||
new_input.id2 != Input::AD_NEUTRAL &&
|
||||
old_input.type != Input::IT_STICKMOTION)
|
||||
{
|
||||
Input inp(new_input);
|
||||
inp.id2 = (inp.id2==Input::AD_NEGATIVE) ? Input::AD_POSITIVE
|
||||
: Input::AD_NEGATIVE;
|
||||
user_config->setInput(m_player_index,
|
||||
m_edit_action==KA_LEFT ? KA_RIGHT
|
||||
: KA_LEFT,
|
||||
inp);
|
||||
}
|
||||
|
||||
// Fall through to recover the widget labels.
|
||||
}
|
||||
case GA_SENSE_CANCEL:
|
||||
inputDriver->setMode(SDLDriver::MENU);
|
||||
|
||||
// Refresh all key labels since they mave changed because of
|
||||
// conflicting bindings.
|
||||
updateAllKeyLabels();
|
||||
break;
|
||||
case GA_ENTER:
|
||||
// If the user is typing her name this will be finished at this
|
||||
// point.
|
||||
if (inputDriver->isInMode(SDLDriver::LOWLEVEL))
|
||||
{
|
||||
// Prevents zero-length names.
|
||||
if (m_name.length() == 0)
|
||||
//I18N: as in 'Player 2'
|
||||
m_name = _("Player ") + m_player_index;
|
||||
user_config->m_player[m_player_index].setName(m_name);
|
||||
widget_manager->setWgtText(WTOK_PLYR_NAME1, m_name.c_str());
|
||||
|
||||
inputDriver->setMode(SDLDriver::MENU);
|
||||
}
|
||||
else
|
||||
select();
|
||||
break;
|
||||
case GA_LEAVE:
|
||||
// If the user is typing her name this will be cancelled at this
|
||||
// point.
|
||||
if (inputDriver->isInMode(SDLDriver::LOWLEVEL))
|
||||
{
|
||||
m_name = user_config->m_player[m_player_index].getName();
|
||||
widget_manager->setWgtText(WTOK_PLYR_NAME1, m_name.c_str());
|
||||
|
||||
inputDriver->setMode(SDLDriver::MENU);
|
||||
break;
|
||||
}
|
||||
// Fall through to reach the usual GA_LEAVE code (leave menu).
|
||||
default:
|
||||
BaseGUI::handle(ga, value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
PlayerControls::updateAllKeyLabels()
|
||||
{
|
||||
for (int i = KA_FIRST; i <= KA_LAST; i++)
|
||||
{
|
||||
m_key_names[i] = user_config->getMappingAsString(m_player_index,
|
||||
(KartAction) i);
|
||||
widget_manager->setWgtText(WTOK_LEFT + i, m_key_names[i].c_str());
|
||||
}
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_PLAYER_CONTROLS_HPP
|
||||
#define HEADER_PLAYER_CONTROLS_HPP
|
||||
|
||||
#include <string>
|
||||
#include <SDL/SDL.h>
|
||||
#include "base_gui.hpp"
|
||||
#include "player.hpp"
|
||||
|
||||
class PlayerControls: public BaseGUI
|
||||
{
|
||||
public:
|
||||
PlayerControls(int whichPlayer);
|
||||
~PlayerControls();
|
||||
|
||||
void select();
|
||||
void clearMapping();
|
||||
|
||||
void handle(GameAction, int);
|
||||
void inputKeyboard(SDLKey, int);
|
||||
void addKeyLabel(int change_id, KartAction control, bool start);
|
||||
void setKeyInfoString(KartAction control);
|
||||
|
||||
private:
|
||||
void updateAllKeyLabels();
|
||||
|
||||
int m_player_index;
|
||||
bool m_grab_input;
|
||||
|
||||
/** Stores the KartAction for which the input is being sensed. */
|
||||
KartAction m_edit_action;
|
||||
|
||||
std::string m_name;
|
||||
std::string m_key_names[KC_COUNT];
|
||||
|
||||
static const size_t PLAYER_NAME_MAX;
|
||||
};
|
||||
|
||||
#endif
|
213
src/gui/ptr_vector.hpp
Normal file
213
src/gui/ptr_vector.hpp
Normal file
@ -0,0 +1,213 @@
|
||||
/*
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* I made this class to work like a regular vector, except that contentsVector are placed
|
||||
* one the heap so third-party contentsVector can keep pointers to them.
|
||||
*/
|
||||
|
||||
#ifndef HEADER_PTR_VECTOR_HPP
|
||||
#define HEADER_PTR_VECTOR_HPP
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
enum VECTOR_TYPE
|
||||
{
|
||||
REF,
|
||||
HOLD
|
||||
};
|
||||
|
||||
template<typename TYPE, VECTOR_TYPE type=HOLD>
|
||||
class ptr_vector
|
||||
{
|
||||
|
||||
public:
|
||||
std::vector<TYPE*> contentsVector;
|
||||
|
||||
ptr_vector()
|
||||
{
|
||||
}
|
||||
|
||||
~ptr_vector()
|
||||
{
|
||||
if(type == HOLD) clearAndDeleteAll();
|
||||
}
|
||||
|
||||
void push_back(TYPE* t)
|
||||
{
|
||||
contentsVector.push_back(t);
|
||||
}
|
||||
|
||||
void add(TYPE* t, int index)
|
||||
{
|
||||
contentsVector.insert(contentsVector.begin()+index, t);
|
||||
}
|
||||
|
||||
void swap(int ID1, int ID2)
|
||||
{
|
||||
assert(ID1 > -1);
|
||||
assert((unsigned int)ID1 < contentsVector.size());
|
||||
assert(ID2 > -1);
|
||||
assert((unsigned int)ID2 < contentsVector.size());
|
||||
|
||||
|
||||
TYPE* temp = contentsVector[ID2];
|
||||
|
||||
contentsVector[ID2] = contentsVector[ID1];
|
||||
contentsVector[ID1] = temp;
|
||||
}
|
||||
|
||||
// mark is a way to delete an object without changing the order of the element sin the vector
|
||||
// it can be useful in a 'for' loop when the loop relies on object IDs and vector size not changing
|
||||
|
||||
void markToBeDeleted(const int ID) // object is removed from vector and deleted
|
||||
{
|
||||
assert(ID > -1);
|
||||
assert((unsigned int)ID < contentsVector.size());
|
||||
|
||||
delete ( TYPE *) contentsVector[ID];
|
||||
|
||||
contentsVector[ID] = 0;
|
||||
|
||||
}
|
||||
void markToBeRemoved(const int ID) // object is removed from vector but not deleted
|
||||
{
|
||||
assert(ID > -1);
|
||||
assert((unsigned int)ID < contentsVector.size());
|
||||
|
||||
contentsVector[ID] = 0;
|
||||
|
||||
}
|
||||
|
||||
bool isMarked(const int ID) const
|
||||
{
|
||||
assert(ID > -1);
|
||||
assert((unsigned int)ID < contentsVector.size());
|
||||
|
||||
return (contentsVector[ID] == 0);
|
||||
}
|
||||
|
||||
void removeMarked()
|
||||
{
|
||||
int size = contentsVector.size();
|
||||
for(int n=0; n<size; n++)
|
||||
{
|
||||
|
||||
if( contentsVector[n] == 0 )
|
||||
{
|
||||
contentsVector.erase(contentsVector.begin()+n);
|
||||
size = contentsVector.size();
|
||||
n -= 2;
|
||||
if(n < -1) n=-1;
|
||||
}
|
||||
}//next
|
||||
|
||||
}
|
||||
|
||||
TYPE* get(const int ID)
|
||||
{
|
||||
|
||||
assert(ID > -1);
|
||||
assert((unsigned int)ID < contentsVector.size());
|
||||
|
||||
return contentsVector[ID];
|
||||
}
|
||||
|
||||
int size() const
|
||||
{
|
||||
return contentsVector.size();
|
||||
}
|
||||
|
||||
void erase(const int ID)
|
||||
{
|
||||
assert(ID > -1);
|
||||
assert((unsigned int)ID < contentsVector.size());
|
||||
|
||||
delete ( TYPE *) contentsVector[ID];
|
||||
|
||||
contentsVector.erase(contentsVector.begin()+ID);
|
||||
}
|
||||
|
||||
void remove(const int ID)
|
||||
{
|
||||
assert(ID > -1);
|
||||
assert((unsigned int)ID < contentsVector.size());
|
||||
|
||||
contentsVector.erase(contentsVector.begin()+ID);
|
||||
}
|
||||
|
||||
bool contains( TYPE* instance ) const
|
||||
{
|
||||
const unsigned int amount = contentsVector.size();
|
||||
for(unsigned int n=0; n<amount; n++)
|
||||
{
|
||||
TYPE * pointer = contentsVector[n];
|
||||
if(pointer == instance) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void clearAndDeleteAll()
|
||||
{
|
||||
for(unsigned int n=0; n<contentsVector.size(); n++)
|
||||
{
|
||||
TYPE * pointer = contentsVector[n];
|
||||
delete pointer;
|
||||
}
|
||||
contentsVector.clear();
|
||||
}
|
||||
|
||||
TYPE& operator[](const unsigned int ID)
|
||||
{
|
||||
assert((unsigned int)ID < contentsVector.size());
|
||||
|
||||
return *(contentsVector[ID]);
|
||||
}
|
||||
const TYPE& operator[](const unsigned int ID) const
|
||||
{
|
||||
assert((unsigned int)ID < contentsVector.size());
|
||||
|
||||
return *(contentsVector[ID]);
|
||||
}
|
||||
|
||||
void clearWithoutDeleting()
|
||||
{
|
||||
contentsVector.clear();
|
||||
}
|
||||
|
||||
void remove(TYPE* obj)
|
||||
{
|
||||
for(unsigned int n=0; n<contentsVector.size(); n++)
|
||||
{
|
||||
|
||||
TYPE * pointer = contentsVector[n];
|
||||
if(pointer == obj)
|
||||
{
|
||||
contentsVector.erase(contentsVector.begin()+n);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -29,11 +29,25 @@
|
||||
#include "audio/sound_manager.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "gui/font.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "utils/constants.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
RaceGUI* instance = NULL;
|
||||
RaceGUI* getRaceGUI()
|
||||
{
|
||||
if(instance == NULL) instance = new RaceGUI();
|
||||
return instance;
|
||||
}
|
||||
|
||||
void timeToString(const double TIME, char *s)
|
||||
{
|
||||
int min = (int) floor ( TIME / 60.0 ) ;
|
||||
int sec = (int) floor ( TIME - (double) ( 60 * min ) ) ;
|
||||
int tenths = (int) floor ( 10.0f * (TIME - (double)(sec + 60* min)));
|
||||
sprintf ( s, "%d:%02d:%d", min, sec, tenths ) ;
|
||||
} // TimeToString
|
||||
|
||||
|
||||
RaceGUI::RaceGUI()
|
||||
{
|
||||
@ -52,11 +66,10 @@ RaceGUI::RaceGUI()
|
||||
|
||||
#ifdef HAVE_IRRLICHT
|
||||
gui::IGUIEnvironment *gui_env = irr_driver->getGUI();
|
||||
core::rect<s32> pos(user_config->m_width-160, 10,
|
||||
user_config->m_width, 150);
|
||||
core::rect<s32> pos(user_config->m_width-60, 10,
|
||||
user_config->m_width, 50);
|
||||
m_time = gui_env->addStaticText(L"", pos);
|
||||
m_time->setOverrideFont(irr_driver->getRaceFont());
|
||||
m_time->setOverrideColor(video::SColor(255, 255, 255, 255));
|
||||
|
||||
int icon_width=40;
|
||||
int icon_player_width=50;
|
||||
@ -177,8 +190,11 @@ RaceGUI::handle(GameAction ga, int value)
|
||||
// Fall through to put the game into pause mode.
|
||||
#endif
|
||||
case GA_LEAVE_RACE:
|
||||
// TODO - show race menu
|
||||
/*
|
||||
RaceManager::getWorld()->pause();
|
||||
menu_manager->pushMenu(MENUID_RACEMENU);
|
||||
*/
|
||||
break;
|
||||
case GA_DEBUG_HISTORY:
|
||||
history->Save();
|
||||
@ -195,7 +211,7 @@ void RaceGUI::update(float dt)
|
||||
drawStatusText(dt);
|
||||
cleanupMessages(dt);
|
||||
|
||||
BaseGUI::update( dt );
|
||||
//BaseGUI::update( dt );
|
||||
} // update
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -222,7 +238,7 @@ void RaceGUI::drawTimer ()
|
||||
if(!RaceManager::getWorld()->shouldDrawTimer()) return;
|
||||
char str[256];
|
||||
|
||||
TimeToString(RaceManager::getWorld()->getTime(), str);
|
||||
timeToString(RaceManager::getWorld()->getTime(), str);
|
||||
#ifdef HAVE_IRRLICHT
|
||||
m_time->setText(core::stringw(str).c_str());
|
||||
#else
|
||||
|
@ -29,7 +29,6 @@ using namespace irr;
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base_gui.hpp"
|
||||
#include "material.hpp"
|
||||
#include "player.hpp"
|
||||
#include "race_manager.hpp"
|
||||
@ -54,7 +53,10 @@ struct KartIconDisplayInfo
|
||||
int lap;
|
||||
};
|
||||
|
||||
class RaceGUI: public BaseGUI
|
||||
extern RaceGUI* getRaceGUI();
|
||||
void timeToString(const double TIME, char *s);
|
||||
|
||||
class RaceGUI
|
||||
{
|
||||
private:
|
||||
class TimedMessage
|
||||
|
@ -1,134 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "gui/race_menu.hpp"
|
||||
|
||||
#include <SDL/SDL.h>
|
||||
|
||||
#include "user_config.hpp"
|
||||
|
||||
#include "race_manager.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_PAUSE,
|
||||
WTOK_RETURN_RACE,
|
||||
WTOK_OPTIONS,
|
||||
WTOK_HELP,
|
||||
WTOK_RESTART_RACE,
|
||||
WTOK_SETUP_NEW_RACE,
|
||||
WTOK_QUIT,
|
||||
};
|
||||
|
||||
RaceMenu::RaceMenu()
|
||||
{
|
||||
widget_manager->switchOrder();
|
||||
|
||||
widget_manager->addTitleWgt( WTOK_PAUSE, 50, 7, _("Paused") );
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_RETURN_RACE, 50, 7, _("Return To Race"));
|
||||
widget_manager->addTextButtonWgt( WTOK_OPTIONS, 50, 7, _("Options") );
|
||||
widget_manager->addTextButtonWgt( WTOK_HELP, 50, 7, _("Help") );
|
||||
widget_manager->addTextButtonWgt( WTOK_RESTART_RACE, 50, 7, _("Restart Race") );
|
||||
|
||||
if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_QUICK_RACE)
|
||||
{
|
||||
widget_manager->addTextButtonWgt( WTOK_SETUP_NEW_RACE, 50, 7,
|
||||
_("Setup New Race") );
|
||||
}
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_QUIT, 50, 7, _("Exit Race") );
|
||||
|
||||
widget_manager->layout(WGT_AREA_ALL);
|
||||
if(user_config->m_fullscreen) SDL_ShowCursor(SDL_ENABLE);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
RaceMenu::~RaceMenu()
|
||||
{
|
||||
widget_manager->reset();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void RaceMenu::select()
|
||||
{
|
||||
int clicked_token = widget_manager->getSelectedWgt();
|
||||
|
||||
switch (clicked_token)
|
||||
{
|
||||
case WTOK_RETURN_RACE:
|
||||
RaceManager::getWorld()->unpause();
|
||||
menu_manager->popMenu();
|
||||
if(user_config->m_fullscreen) SDL_ShowCursor(SDL_DISABLE);
|
||||
break;
|
||||
|
||||
case WTOK_SETUP_NEW_RACE:
|
||||
RaceManager::getWorld()->unpause();
|
||||
race_manager->exit_race();
|
||||
menu_manager->pushMenu(MENUID_CHARSEL_P1);
|
||||
break;
|
||||
|
||||
case WTOK_RESTART_RACE:
|
||||
menu_manager->popMenu();
|
||||
if(user_config->m_fullscreen) SDL_ShowCursor(SDL_DISABLE);
|
||||
RaceManager::getWorld()->restartRace();
|
||||
break;
|
||||
|
||||
case WTOK_OPTIONS:
|
||||
menu_manager->pushMenu(MENUID_OPTIONS);
|
||||
break;
|
||||
|
||||
case WTOK_HELP:
|
||||
menu_manager->pushMenu(MENUID_HELP1);
|
||||
break;
|
||||
|
||||
case WTOK_QUIT:
|
||||
RaceManager::getWorld()->unpause();
|
||||
race_manager->exit_race();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void RaceMenu::handle(GameAction ga, int value)
|
||||
{
|
||||
switch ( ga )
|
||||
{
|
||||
case GA_LEAVE:
|
||||
if (value)
|
||||
break;
|
||||
|
||||
RaceManager::getWorld()->unpause();
|
||||
menu_manager->popMenu();
|
||||
break;
|
||||
|
||||
default:
|
||||
BaseGUI::handle(ga, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,35 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_RACEMENU_H
|
||||
#define HEADER_RACEMENU_H
|
||||
|
||||
#include "base_gui.hpp"
|
||||
|
||||
class RaceMenu: public BaseGUI
|
||||
{
|
||||
public:
|
||||
RaceMenu();
|
||||
~RaceMenu();
|
||||
|
||||
void select();
|
||||
void handle(GameAction ga, int value);
|
||||
};
|
||||
|
||||
#endif
|
@ -1,332 +0,0 @@
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "gui/race_options.hpp"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "race_manager.hpp"
|
||||
#include "user_config.hpp"
|
||||
#include "material_manager.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_TITLE,
|
||||
|
||||
WTOK_DIFFICULTY_TITLE,
|
||||
WTOK_DIFFICULTY_UP,
|
||||
WTOK_DIFFICULTY,
|
||||
WTOK_DIFFICULTY_DOWN,
|
||||
|
||||
WTOK_KARTS_TITLE,
|
||||
WTOK_KARTS_UP,
|
||||
WTOK_KARTS,
|
||||
WTOK_KARTS_DOWN,
|
||||
|
||||
WTOK_LAPS_TITLE,
|
||||
WTOK_LAPS_UP,
|
||||
WTOK_LAPS,
|
||||
WTOK_LAPS_DOWN,
|
||||
|
||||
WTOK_START,
|
||||
|
||||
WTOK_QUIT
|
||||
};
|
||||
|
||||
RaceOptions::RaceOptions()
|
||||
{
|
||||
|
||||
m_difficulty=user_config->getDefaultDifficulty();
|
||||
m_num_laps=user_config->getDefaultNumLaps();
|
||||
// Determine the minimum number of karts
|
||||
m_min_karts = (int)race_manager->getNumPlayers();
|
||||
if(race_manager->getMinorMode() == RaceManager::MINOR_MODE_FOLLOW_LEADER)
|
||||
{
|
||||
// if playing follow the leader single mode, there should be at
|
||||
// least one opponent in addition to the leader
|
||||
m_min_karts += (race_manager->getNumPlayers()==1 ? 2 : 1);
|
||||
}
|
||||
m_num_karts=std::max(user_config->getDefaultNumKarts(), m_min_karts);
|
||||
|
||||
|
||||
const int DESC_WIDTH=48;
|
||||
const int ITEM_WIDTH=35;
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 10, 20);
|
||||
widget_manager->breakLine();
|
||||
|
||||
// Difficulty
|
||||
// ==========
|
||||
// if there is no AI, no point asking for its difficulty...
|
||||
// There's also no point asking the player for the amount of karts
|
||||
// since tt will always be the same as the number of human players
|
||||
if(!RaceManager::isBattleMode( race_manager->getMinorMode() ))
|
||||
{
|
||||
widget_manager->addTextWgt( WTOK_DIFFICULTY_TITLE, DESC_WIDTH, 7, _("Difficulty") );
|
||||
widget_manager->hideWgtRect(WTOK_DIFFICULTY_TITLE);
|
||||
widget_manager->setWgtTextSize(WTOK_DIFFICULTY_TITLE, WGT_FNT_LRG);
|
||||
widget_manager->addTextButtonWgt( WTOK_DIFFICULTY_DOWN, 3, 7, " < " );
|
||||
|
||||
widget_manager->addTextWgt( WTOK_DIFFICULTY, ITEM_WIDTH, 7, getDifficultyString(m_difficulty));
|
||||
widget_manager->setWgtBorderPercentage( WTOK_DIFFICULTY, 10 );
|
||||
widget_manager->showWgtBorder( WTOK_DIFFICULTY );
|
||||
widget_manager->hideWgtRect( WTOK_DIFFICULTY );
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_DIFFICULTY_UP, 3, 7, " > " );
|
||||
|
||||
widget_manager->breakLine();
|
||||
|
||||
// Number of karts
|
||||
// ===============
|
||||
widget_manager->addTextWgt( WTOK_KARTS_TITLE, DESC_WIDTH, 7, _("Number of karts") );
|
||||
widget_manager->hideWgtRect(WTOK_KARTS_TITLE);
|
||||
widget_manager->setWgtTextSize(WTOK_KARTS_TITLE, WGT_FNT_LRG);
|
||||
widget_manager->addTextButtonWgt( WTOK_KARTS_DOWN, 3, 7, " < " );
|
||||
|
||||
std::ostringstream string_num_karts;
|
||||
string_num_karts << m_num_karts;
|
||||
widget_manager->addTextWgt( WTOK_KARTS, ITEM_WIDTH, 7, string_num_karts.str() );
|
||||
widget_manager->setWgtBorderPercentage( WTOK_KARTS, 10 );
|
||||
widget_manager->showWgtBorder( WTOK_KARTS );
|
||||
widget_manager->hideWgtRect( WTOK_KARTS );
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_KARTS_UP, 3, 7, " > " );
|
||||
|
||||
widget_manager->breakLine();
|
||||
}
|
||||
|
||||
// Number of laps
|
||||
// ==============
|
||||
if( race_manager->getMajorMode() != RaceManager::MAJOR_MODE_GRAND_PRIX &&
|
||||
RaceManager::modeHasLaps( race_manager->getMinorMode() ) )
|
||||
{
|
||||
widget_manager->addTextWgt( WTOK_LAPS_TITLE, DESC_WIDTH, 7, _("Number of laps") );
|
||||
widget_manager->hideWgtRect(WTOK_LAPS_TITLE);
|
||||
widget_manager->setWgtTextSize(WTOK_LAPS_TITLE, WGT_FNT_LRG);
|
||||
widget_manager->addTextButtonWgt( WTOK_LAPS_DOWN, 3, 7, " < " );
|
||||
|
||||
std::ostringstream string_num_laps;
|
||||
string_num_laps << m_num_laps;
|
||||
widget_manager->addTextWgt( WTOK_LAPS, ITEM_WIDTH, 7, string_num_laps.str() );
|
||||
widget_manager->setWgtBorderPercentage( WTOK_LAPS, 10 );
|
||||
widget_manager->showWgtBorder( WTOK_LAPS );
|
||||
widget_manager->hideWgtRect( WTOK_LAPS );
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_LAPS_UP, 3, 7, " > " );
|
||||
}
|
||||
widget_manager->breakLine();
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 10, 10 );
|
||||
widget_manager->breakLine();
|
||||
|
||||
// Bottom buttons
|
||||
// ==============
|
||||
widget_manager->addTextButtonWgt( WTOK_START, 60, 7, _("Start race") );
|
||||
widget_manager->setWgtBorderPercentage( WTOK_START, 20 );
|
||||
widget_manager->setWgtBorderColor( WTOK_START, WGT_TRANS_BLUE );
|
||||
widget_manager->showWgtBorder( WTOK_START );
|
||||
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addEmptyWgt( WidgetManager::WGT_NONE, 10, 30);
|
||||
widget_manager->breakLine();
|
||||
|
||||
widget_manager->addTextButtonWgt( WTOK_QUIT, 60, 7, _("Press <ESC> to go back") );
|
||||
|
||||
widget_manager->layout(WGT_AREA_ALL);
|
||||
|
||||
// Select 'start' by default.
|
||||
widget_manager->setSelectedWgt( WTOK_START );
|
||||
|
||||
// hack. in battle mode this screen is totally useless. so I'm calling 'select'
|
||||
// to select the start button, so the screen is entirely skipped (FIXME - find cleaner way)
|
||||
if(RaceManager::isBattleMode( race_manager->getMinorMode() )) select();
|
||||
|
||||
} // RaceOptions
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
RaceOptions::~RaceOptions()
|
||||
{
|
||||
widget_manager->reset();
|
||||
} // ~RaceOptions
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void RaceOptions::update(float dt)
|
||||
{
|
||||
BaseGUI::update(dt);
|
||||
} // update
|
||||
//-----------------------------------------------------------------------------
|
||||
void RaceOptions::select()
|
||||
{
|
||||
switch ( widget_manager->getSelectedWgt() )
|
||||
{
|
||||
case WTOK_DIFFICULTY_UP:
|
||||
if( m_difficulty == RaceManager::RD_HARD )
|
||||
{
|
||||
m_difficulty = RaceManager::RD_EASY;
|
||||
}
|
||||
else if( m_difficulty == RaceManager::RD_MEDIUM )
|
||||
{
|
||||
m_difficulty = RaceManager::RD_HARD;
|
||||
}
|
||||
else if( m_difficulty == RaceManager::RD_EASY )
|
||||
{
|
||||
m_difficulty = RaceManager::RD_MEDIUM;
|
||||
}
|
||||
widget_manager->setWgtText(WTOK_DIFFICULTY, getDifficultyString(m_difficulty) );
|
||||
break;
|
||||
|
||||
case WTOK_DIFFICULTY_DOWN:
|
||||
if( m_difficulty == RaceManager::RD_HARD )
|
||||
{
|
||||
m_difficulty = RaceManager::RD_MEDIUM;
|
||||
}
|
||||
else if( m_difficulty == RaceManager::RD_MEDIUM )
|
||||
{
|
||||
m_difficulty = RaceManager::RD_EASY;
|
||||
}
|
||||
else if( m_difficulty == RaceManager::RD_EASY )
|
||||
{
|
||||
m_difficulty = RaceManager::RD_HARD;
|
||||
}
|
||||
widget_manager->setWgtText(WTOK_DIFFICULTY,
|
||||
getDifficultyString(m_difficulty) );
|
||||
|
||||
break;
|
||||
|
||||
case WTOK_KARTS_UP:
|
||||
{
|
||||
m_num_karts = m_num_karts==stk_config->m_max_karts
|
||||
? m_min_karts : m_num_karts + 1;
|
||||
|
||||
std::ostringstream label;
|
||||
label << m_num_karts;
|
||||
widget_manager->setWgtText(WTOK_KARTS, label.str() );
|
||||
}
|
||||
break;
|
||||
|
||||
case WTOK_KARTS_DOWN:
|
||||
{
|
||||
m_num_karts = m_num_karts==m_min_karts
|
||||
? stk_config->m_max_karts : m_num_karts-1;
|
||||
std::ostringstream label;
|
||||
label << m_num_karts;
|
||||
widget_manager->setWgtText(WTOK_KARTS, label.str() );
|
||||
}
|
||||
break;
|
||||
|
||||
case WTOK_LAPS_UP:
|
||||
{
|
||||
m_num_laps++;
|
||||
if(m_num_laps>10) m_num_laps=1;
|
||||
|
||||
std::ostringstream label;
|
||||
label << m_num_laps;
|
||||
widget_manager->setWgtText(WTOK_LAPS, label.str());
|
||||
}
|
||||
break;
|
||||
|
||||
case WTOK_LAPS_DOWN:
|
||||
{
|
||||
m_num_laps--;
|
||||
if(m_num_laps<1) m_num_laps=10;
|
||||
|
||||
std::ostringstream label;
|
||||
label << m_num_laps;
|
||||
widget_manager->setWgtText(WTOK_LAPS, label.str());
|
||||
}
|
||||
break;
|
||||
|
||||
case WTOK_START:
|
||||
setAllValues();
|
||||
menu_manager->pushMenu(MENUID_START_RACE_FEEDBACK);
|
||||
break;
|
||||
case WTOK_QUIT:
|
||||
// Save the current values as a default for later.
|
||||
setAllValues();
|
||||
menu_manager->popMenu();
|
||||
break;
|
||||
default: break;
|
||||
} // switch
|
||||
} // select
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** If the user presses a leave key, still save the values as default. */
|
||||
void RaceOptions::handle(GameAction ga, int value)
|
||||
{
|
||||
// Attempts to close the menu are silently discarded
|
||||
// since they do not make sense at this point.
|
||||
if(ga == GA_LEAVE)
|
||||
setAllValues();
|
||||
BaseGUI::handle(ga, value);
|
||||
} // handle
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Stores the selected parameters (#laps etc) in the race manager and in
|
||||
* user_config, so that they will be available as default next time.
|
||||
*/
|
||||
void RaceOptions::setAllValues()
|
||||
{
|
||||
if( m_difficulty >= RaceManager::RD_EASY &&
|
||||
m_difficulty <= RaceManager::RD_HARD)
|
||||
{
|
||||
race_manager->setDifficulty((RaceManager::Difficulty)m_difficulty);
|
||||
user_config->setDefaultNumDifficulty(m_difficulty);
|
||||
}
|
||||
else // invalid difficulty
|
||||
{
|
||||
race_manager->setDifficulty( RaceManager::RD_EASY );
|
||||
user_config->setDefaultNumDifficulty(RaceManager::RD_EASY);
|
||||
}
|
||||
|
||||
// if there is no AI, there's no point asking the player for the amount of karts.
|
||||
// It will always be the same as the number of human players
|
||||
if(RaceManager::isBattleMode( race_manager->getMinorMode() ))
|
||||
{
|
||||
race_manager->setNumKarts(race_manager->getNumLocalPlayers());
|
||||
// Don't change the default number of karts in user_config
|
||||
}
|
||||
else
|
||||
{
|
||||
race_manager->setNumKarts(m_num_karts);
|
||||
user_config->setDefaultNumKarts(race_manager->getNumKarts());
|
||||
}
|
||||
|
||||
if( race_manager->getMajorMode() != RaceManager::MAJOR_MODE_GRAND_PRIX &&
|
||||
RaceManager::modeHasLaps( race_manager->getMinorMode() ) )
|
||||
{
|
||||
race_manager->setNumLaps( m_num_laps );
|
||||
user_config->setDefaultNumLaps(m_num_laps);
|
||||
}
|
||||
// Might still be set from a previous challenge
|
||||
race_manager->setCoinTarget(0);
|
||||
} // setAllValues
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
const char *RaceOptions::getDifficultyString(int difficulty) const
|
||||
{
|
||||
switch(difficulty)
|
||||
{
|
||||
case RaceManager::RD_EASY: return _("Novice");
|
||||
case RaceManager::RD_MEDIUM: return _("Driver");
|
||||
case RaceManager::RD_HARD: return _("Racer" );
|
||||
default: return _("Novice");
|
||||
|
||||
} // switch
|
||||
} // getDifficultyString
|
@ -1,41 +0,0 @@
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_RACE_OPTIONS_H
|
||||
#define HEADER_RACE_OPTIONS_H
|
||||
|
||||
#include "base_gui.hpp"
|
||||
|
||||
class RaceOptions: public BaseGUI
|
||||
{
|
||||
private:
|
||||
int m_difficulty;
|
||||
int m_num_karts;
|
||||
int m_min_karts; // minimum number of karts, depending on mode etc.
|
||||
int m_num_laps;
|
||||
const char *getDifficultyString(int) const;
|
||||
void setAllValues();
|
||||
public:
|
||||
RaceOptions();
|
||||
~RaceOptions();
|
||||
|
||||
void select();
|
||||
void update(float dt);
|
||||
virtual void handle(GameAction, int);
|
||||
};
|
||||
|
||||
#endif
|
@ -1,342 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 Eduardo Hernandez Munoz
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "gui/race_results_gui.hpp"
|
||||
|
||||
#include <SDL/SDL.h>
|
||||
|
||||
#include "race_manager.hpp"
|
||||
#include "highscore_manager.hpp"
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
RaceResultsGUI::RaceResultsGUI()
|
||||
{
|
||||
m_first_time = true;
|
||||
m_selected_widget = WTOK_NONE;
|
||||
|
||||
// Switch to barrier mode: server waits for ack from each client
|
||||
network_manager->beginRaceResultBarrier();
|
||||
Widget *bottom_of_list;
|
||||
|
||||
bottom_of_list = displayRaceResults();
|
||||
|
||||
// If it's a server, the user can only select 'ok', since the
|
||||
// server does all the game mode selection etc.
|
||||
if(network_manager->getMode()==NetworkManager::NW_CLIENT)
|
||||
{
|
||||
Widget *w=widget_manager->addTextButtonWgt( WTOK_CONTINUE, 60, 7, _("OK") );
|
||||
w->setPosition(WGT_DIR_CENTER, 0, NULL, WGT_DIR_UNDER_WIDGET, 0.1f, bottom_of_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If a new feature was unlocked, only offer 'continue' otherwise add the
|
||||
// full menu choices. The new feature menu returns to this menu, and will
|
||||
// then display the whole menu.
|
||||
if(unlock_manager->getUnlockedFeatures().size()>0)
|
||||
{
|
||||
Widget *w=widget_manager->addTextButtonWgt( WTOK_CONTINUE, 60, 7, _("Continue") );
|
||||
w->setPosition(WGT_DIR_CENTER, 0, NULL, WGT_DIR_UNDER_WIDGET, 0.1f, bottom_of_list);
|
||||
} else
|
||||
{
|
||||
Widget *w;
|
||||
if(race_manager->getMajorMode()==RaceManager::MAJOR_MODE_GRAND_PRIX)
|
||||
{
|
||||
w=widget_manager->addTextButtonWgt( WTOK_CONTINUE, 60, 7, _("Continue Grand Prix"));
|
||||
}
|
||||
else
|
||||
{
|
||||
w=widget_manager->addTextButtonWgt( WTOK_CONTINUE, 60, 7, _("Back to the main menu"));
|
||||
}
|
||||
w->setPosition(WGT_DIR_CENTER, 0.0, NULL, WGT_DIR_UNDER_WIDGET, 0.1f, bottom_of_list);
|
||||
Widget *w_prev = w;
|
||||
w=widget_manager->addTextButtonWgt( WTOK_RESTART_RACE, 60, 7, _("Race in this track again"));
|
||||
w->setPosition(WGT_DIR_CENTER, 0.0, NULL, WGT_DIR_UNDER_WIDGET, 0, w_prev);
|
||||
w_prev = w;
|
||||
if(race_manager->getMajorMode()==RaceManager::MAJOR_MODE_SINGLE)
|
||||
{
|
||||
w=widget_manager->addTextButtonWgt( WTOK_SETUP_NEW_RACE, 60, 7, _("Setup New Race"));
|
||||
w->setPosition(WGT_DIR_CENTER, 0, NULL, WGT_DIR_UNDER_WIDGET, 0, w_prev);
|
||||
}
|
||||
} // if !unlock_manager has something unlocked*/
|
||||
} // if not server
|
||||
widget_manager->layout(WGT_AREA_ALL);
|
||||
|
||||
} // RaceResultsGUI
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Widget *RaceResultsGUI::displayRaceResults()
|
||||
{
|
||||
Widget *w_prev=widget_manager->addTextWgt( WTOK_RESULTS, 5, 7, _("Race results") );
|
||||
widget_manager->hideWgtRect(WTOK_RESULTS);
|
||||
w_prev->setPosition(WGT_DIR_FROM_LEFT, 0.01f, NULL, WGT_DIR_FROM_TOP, 0.01f, NULL);
|
||||
|
||||
const unsigned int MAX_STR_LEN = 60;
|
||||
const unsigned int NUM_KARTS = race_manager->getNumKarts();
|
||||
|
||||
int* order = new int [NUM_KARTS];
|
||||
RaceManager::getWorld()->raceResultOrder( order );
|
||||
|
||||
unsigned int max_name_len = 1;
|
||||
|
||||
for(unsigned int i=0; i < NUM_KARTS; i++)
|
||||
{
|
||||
Kart *k = RaceManager::getKart(i); // Display even for eliminated karts!
|
||||
const std::string& s = k->getName();
|
||||
unsigned int l = (unsigned int)s.size();
|
||||
if(l>max_name_len) max_name_len = l;
|
||||
} // for i
|
||||
|
||||
// save bottom of result list for later
|
||||
Widget *bottom_of_list=displayKartList(w_prev, order, 0.01f);
|
||||
|
||||
delete[] order;
|
||||
|
||||
const HighscoreEntry *hs = RaceManager::getWorld()->getHighscores();
|
||||
if(hs != NULL)
|
||||
{
|
||||
w_prev=widget_manager->addTextWgt( WTOK_HIGHSCORES, 5, 7, _("Highscores") );
|
||||
widget_manager->hideWgtRect(WTOK_HIGHSCORES);
|
||||
w_prev->setPosition(WGT_DIR_FROM_RIGHT, 0.01f, NULL, WGT_DIR_FROM_TOP, 0.01f, NULL);
|
||||
|
||||
unsigned int num_scores = hs->getNumberEntries();
|
||||
char *highscores = new char[num_scores * MAX_STR_LEN];
|
||||
|
||||
for(unsigned int i=0; i<num_scores; i++)
|
||||
{
|
||||
std::string kart_name, name;
|
||||
float T;
|
||||
hs->getEntry(i, kart_name, name, &T);
|
||||
const int MINS = (int) floor ( T / 60.0 ) ;
|
||||
const int SECS = (int) floor ( T - (float) ( 60 * MINS ) ) ;
|
||||
const int TENTHS = (int) floor ( 10.0f * (T - (float)(SECS + 60*MINS)));
|
||||
sprintf((char*)( highscores + MAX_STR_LEN * i ),
|
||||
"%s: %3d:%02d.%01d", name.c_str(), MINS, SECS, TENTHS);
|
||||
|
||||
Widget *w=widget_manager->addTextWgt(WTOK_FIRST_HIGHSCORE + i, 5, 7,
|
||||
(char*)( highscores+MAX_STR_LEN*i ) );
|
||||
w->setPosition(WGT_DIR_FROM_RIGHT, 0.05f, NULL, WGT_DIR_UNDER_WIDGET, 0, w_prev);
|
||||
w_prev=w;
|
||||
} // next score
|
||||
|
||||
widget_manager->sameWidth(WTOK_HIGHSCORES, WTOK_FIRST_HIGHSCORE+num_scores-1);
|
||||
|
||||
bottom_of_list = (num_scores > NUM_KARTS) ? w_prev : bottom_of_list;
|
||||
} // end if hs != NULL
|
||||
|
||||
return bottom_of_list;
|
||||
} // displayRaceResults
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
Widget *RaceResultsGUI::displayKartList(Widget *w_prev, int *order, float horizontal)
|
||||
{
|
||||
const bool display_time = RaceManager::getWorld()->getClockMode() == CHRONO;
|
||||
const unsigned int NUM_KARTS = race_manager->getNumKarts();
|
||||
|
||||
const int MAX_STR_LEN=60;
|
||||
char *score = new char[NUM_KARTS * MAX_STR_LEN];
|
||||
int kart_id = 0; // 'i' below is not reliable because some karts (e.g. leader) will be skipped
|
||||
for(unsigned int i = 0; i < NUM_KARTS; ++i)
|
||||
{
|
||||
if(order[i] == -1) continue;
|
||||
|
||||
const Kart *current_kart = RaceManager::getKart(order[i]);
|
||||
const std::string& kart_name = current_kart->getName();
|
||||
char sTime[20];sTime[0]=0;
|
||||
const float T = current_kart->getFinishTime();
|
||||
|
||||
if(display_time)
|
||||
TimeToString(T, sTime);
|
||||
|
||||
//This shows position + driver name + time + points earned + total points
|
||||
if(race_manager->getMajorMode()==RaceManager::MAJOR_MODE_GRAND_PRIX)
|
||||
{
|
||||
const int prev_score = race_manager->getKartPrevScore(order[i]);
|
||||
const int new_score = race_manager->getKartScore(order[i]);
|
||||
|
||||
sprintf((char*)(score + MAX_STR_LEN * i), "#%d. %s (%d + %d = %d)",
|
||||
current_kart->getPosition(), kart_name.c_str(),// sTime,
|
||||
prev_score, (new_score - prev_score), new_score);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf((char*)(score + MAX_STR_LEN * i), "%d. %s %s",
|
||||
current_kart->getPosition(), kart_name.c_str(), sTime);
|
||||
}
|
||||
|
||||
Widget *image=widget_manager->addImgButtonWgt(WTOK_FIRST_IMAGE + kart_id, 5, 7,
|
||||
current_kart->getKartProperties()->getIconFile() );
|
||||
widget_manager->deactivateWgt(WTOK_FIRST_IMAGE+kart_id);
|
||||
|
||||
image->setPosition(WGT_DIR_FROM_LEFT, horizontal, NULL,
|
||||
WGT_DIR_UNDER_WIDGET, 0.0f, w_prev);
|
||||
Widget *w=widget_manager->addTextWgt(WTOK_FIRST_RESULT + kart_id, 6, 7,
|
||||
(char*)(score + MAX_STR_LEN * i) );
|
||||
w->setPosition(WGT_DIR_RIGHT_WIDGET, 0.0f, image,
|
||||
WGT_DIR_UNDER_WIDGET, 0.0f, w_prev);
|
||||
w_prev=w;
|
||||
|
||||
kart_id++;
|
||||
}
|
||||
widget_manager->sameWidth(WTOK_FIRST_RESULT, WTOK_FIRST_RESULT+kart_id-1);
|
||||
return w_prev;
|
||||
} // displayKartList
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
RaceResultsGUI::~RaceResultsGUI()
|
||||
{
|
||||
widget_manager->reset();
|
||||
} // ~RaceResultsGUI
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** If an item is selected, store the selection to be handled in the next
|
||||
* update call. This is necessary for network support so that the right
|
||||
* action is executed once clients and server are all synchronised.
|
||||
*/
|
||||
void RaceResultsGUI::select()
|
||||
{
|
||||
// Push the unlocked-feature menu in for now
|
||||
if(unlock_manager->getUnlockedFeatures().size()>0)
|
||||
{
|
||||
// Push the new feature menu on the stack, from where
|
||||
// control will be returned to this menu.
|
||||
menu_manager->pushMenu(MENUID_UNLOCKED_FEATURE);
|
||||
return;
|
||||
}
|
||||
// The selected token is saved here, which triggers a change of the text
|
||||
// in update().
|
||||
m_selected_widget = (WidgetTokens)widget_manager->getSelectedWgt();
|
||||
|
||||
// Clients send the ack to the server
|
||||
if(network_manager->getMode()==NetworkManager::NW_CLIENT)
|
||||
network_manager->sendRaceResultAck();
|
||||
|
||||
} // select
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void RaceResultsGUI::handle(GameAction ga, int value)
|
||||
{
|
||||
// Only accept 'esc' when it's the end of a race, otherwise silently
|
||||
// discard attempts to close the menu with esc.
|
||||
if (ga == GA_LEAVE)
|
||||
{
|
||||
// Don't accept it when a GP is done, or a new feature is unlocked
|
||||
if(widget_manager &&
|
||||
race_manager->getMajorMode()!=RaceManager::MAJOR_MODE_GRAND_PRIX &&
|
||||
unlock_manager->getUnlockedFeatures().size()==0)
|
||||
{
|
||||
RaceManager::getWorld()->unpause();
|
||||
widget_manager->setWgtText(WTOK_CONTINUE, _("Loading race..."));
|
||||
race_manager->next();
|
||||
}
|
||||
return;
|
||||
}
|
||||
BaseGUI::handle(ga, value);
|
||||
} // handle
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Sets the selected token. This is used on the clients to allow the
|
||||
* NetworkManager to set the widget selected on the server. The clients will
|
||||
* then be able to select the correct next menu.
|
||||
* \param token Token to set as being selected.
|
||||
*/
|
||||
void RaceResultsGUI::setSelectedWidget(int token)
|
||||
{
|
||||
m_selected_widget = (WidgetTokens)token;
|
||||
} // setSelectedToken
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** This is used on the client and server to display a message while waiting
|
||||
* in a barrier for clients and server to ack the display.
|
||||
*/
|
||||
void RaceResultsGUI::update(float dt)
|
||||
{
|
||||
BaseGUI::update(dt);
|
||||
// If an item is selected (for the first time), change the text
|
||||
// so that the user has feedback about his selection.
|
||||
if(m_selected_widget!=WTOK_NONE && m_first_time)
|
||||
{
|
||||
m_first_time = false;
|
||||
// User feedback on first selection: display message, and on the
|
||||
// server remove unnecessary widgets.
|
||||
widget_manager->setWgtText(WTOK_CONTINUE, _("Synchronising."));
|
||||
if(network_manager->getMode()==NetworkManager::NW_SERVER)
|
||||
{
|
||||
widget_manager->hideWgt(WTOK_RESTART_RACE);
|
||||
widget_manager->hideWgt(WTOK_SETUP_NEW_RACE);
|
||||
}
|
||||
} // m_selected_token defined and not first time
|
||||
|
||||
// Wait till the barrier is finished. On the server this is the case when
|
||||
// the state ie MAIN_MENU, on the client when it is wait_for_available_characters.
|
||||
if(network_manager->getMode() !=NetworkManager::NW_NONE &&
|
||||
network_manager->getState()!=NetworkManager::NS_MAIN_MENU &&
|
||||
network_manager->getState()!=NetworkManager::NS_RACE_RESULT_BARRIER_OVER )
|
||||
return;
|
||||
|
||||
// Send selected menu to all clients
|
||||
if(m_selected_widget!=WTOK_NONE &&
|
||||
network_manager->getMode()==NetworkManager::NW_SERVER)
|
||||
{
|
||||
network_manager->sendRaceResultAck(m_selected_widget);
|
||||
}
|
||||
|
||||
switch(m_selected_widget)
|
||||
{
|
||||
case WTOK_CONTINUE:
|
||||
// Gets called when:
|
||||
// 1) something was unlocked
|
||||
// 2) a Grand Prix is run
|
||||
// 3) "back to the main menu" otherwise
|
||||
RaceManager::getWorld()->unpause();
|
||||
widget_manager->setWgtText(WTOK_CONTINUE, _("Loading race..."));
|
||||
race_manager->next();
|
||||
break;
|
||||
case WTOK_RESTART_RACE:
|
||||
network_manager->setState(NetworkManager::NS_MAIN_MENU);
|
||||
RaceManager::getWorld()->unpause();
|
||||
menu_manager->popMenu();
|
||||
race_manager->rerunRace();
|
||||
break;
|
||||
case WTOK_SETUP_NEW_RACE:
|
||||
RaceManager::getWorld()->unpause();
|
||||
race_manager->exit_race();
|
||||
if(network_manager->getMode()==NetworkManager::NW_CLIENT)
|
||||
{
|
||||
network_manager->setState(NetworkManager::NS_WAIT_FOR_AVAILABLE_CHARACTERS);
|
||||
menu_manager->pushMenu(MENUID_CHARSEL_P1);
|
||||
}
|
||||
else
|
||||
{
|
||||
menu_manager->pushMenu(MENUID_GAMEMODE);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
} // update
|
||||
/* EOF */
|
@ -1,65 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 Eduardo Hernandez Munoz
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_RACERESULTSGUI_H
|
||||
#define HEADER_RACERESULTSGUI_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "base_gui.hpp"
|
||||
#include "widget.hpp"
|
||||
|
||||
/** GUI that shows the RaceResults, times and such */
|
||||
class RaceResultsGUI : public BaseGUI
|
||||
{
|
||||
private:
|
||||
/** Widgets. WTOK_NONE is used for detecting in update when
|
||||
* a selection was made (see m_selected_token). */
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_NONE,
|
||||
WTOK_CONTINUE,
|
||||
WTOK_RESTART_RACE,
|
||||
WTOK_SETUP_NEW_RACE,
|
||||
WTOK_RESULTS,
|
||||
WTOK_FIRST_RESULT,
|
||||
WTOK_FIRST_IMAGE = 1000,
|
||||
WTOK_HIGHSCORES = 2000,
|
||||
WTOK_FIRST_HIGHSCORE = 2001,
|
||||
};
|
||||
private:
|
||||
std::vector<int> m_order;
|
||||
bool m_first_time;
|
||||
/** The widget selected by the user, so that the right action can be done
|
||||
* once clients and server are synchronised. */
|
||||
WidgetTokens m_selected_widget;
|
||||
Widget *displayRaceResults();
|
||||
Widget *displayKartList(Widget *w_prev, int *order, float horizontal);
|
||||
public:
|
||||
RaceResultsGUI();
|
||||
~RaceResultsGUI();
|
||||
void handle(GameAction, int);
|
||||
void select();
|
||||
virtual void update(float dt);
|
||||
void setSelectedWidget(int);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/* EOF */
|
460
src/gui/screen.cpp
Normal file
460
src/gui/screen.cpp
Normal file
@ -0,0 +1,460 @@
|
||||
#include "gui/screen.hpp"
|
||||
#include "gui/engine.hpp"
|
||||
#include "gui/widget.hpp"
|
||||
#include <irrlicht.h>
|
||||
#include <iostream>
|
||||
#include <irrXML.h>
|
||||
#include <sstream>
|
||||
|
||||
using namespace irr;
|
||||
|
||||
using namespace core;
|
||||
using namespace scene;
|
||||
using namespace video;
|
||||
using namespace io;
|
||||
using namespace gui;
|
||||
using namespace GUIEngine;
|
||||
|
||||
Screen::Screen(const char* file)
|
||||
{
|
||||
m_mouse_x = 0;
|
||||
m_mouse_y = 0;
|
||||
this->m_filename = file;
|
||||
m_loaded = false;
|
||||
loadFromFile();
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
void Screen::loadFromFile()
|
||||
{
|
||||
IrrXMLReader* xml = irr::io::createIrrXMLReader( m_filename.c_str() );
|
||||
parseScreenFileDiv(xml, m_widgets);
|
||||
m_loaded = true;
|
||||
calculateLayout();
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
void Screen::addWidgets()
|
||||
{
|
||||
if(!m_loaded) loadFromFile();
|
||||
|
||||
addWidgetsRecursively( m_widgets );
|
||||
|
||||
// And tell the device to use our custom event receiver.
|
||||
GUIEngine::getDevice()->setEventReceiver(this);
|
||||
|
||||
// select the first widget
|
||||
Widget* w = getFirstWidget();
|
||||
if(w != NULL) GUIEngine::getGUIEnv()->setFocus( w->m_element );
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
void Screen::calculateLayout()
|
||||
{
|
||||
// build layout
|
||||
calculateLayout( m_widgets );
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
void Screen::calculateLayout(ptr_vector<Widget>& widgets, Widget* parent)
|
||||
{
|
||||
const unsigned short widgets_amount = widgets.size();
|
||||
|
||||
// ----- read x/y/size parameters
|
||||
for(unsigned short n=0; n<widgets_amount; n++)
|
||||
{
|
||||
widgets[n].readCoords(parent);
|
||||
}//next widget
|
||||
|
||||
// ----- manage 'layout's if relevant
|
||||
do // i'm using 'while false' here just to be able to 'break' ...
|
||||
{
|
||||
if(parent == NULL) break;
|
||||
|
||||
std::string layout_name = parent->m_properties[PROP_LAYOUT];
|
||||
if(layout_name.size() < 1) break;
|
||||
|
||||
bool horizontal = false;
|
||||
|
||||
if (!strcmp("horizontal-row", layout_name.c_str()))
|
||||
horizontal = true;
|
||||
else if(!strcmp("vertical-row", layout_name.c_str()))
|
||||
horizontal = false;
|
||||
else break;
|
||||
|
||||
const int w = parent->w, h = parent->h;
|
||||
|
||||
// find space left after placing all absolutely-sized widgets in a row
|
||||
// (the space left will be divided between remaining widgets later)
|
||||
int left_space = (horizontal ? w : h);
|
||||
unsigned short total_proportion = 0;
|
||||
for(int n=0; n<widgets_amount; n++)
|
||||
{
|
||||
// relatively-sized widget
|
||||
std::string prop = widgets[n].m_properties[ PROP_PROPORTION ];
|
||||
if(prop.size() != 0)
|
||||
{
|
||||
total_proportion += atoi( prop.c_str() );
|
||||
continue;
|
||||
}
|
||||
|
||||
// absolutely-sized widgets
|
||||
left_space -= (horizontal ? widgets[n].w : widgets[n].h);
|
||||
} // next widget
|
||||
|
||||
// lay widgets in row
|
||||
int x = parent->x, y = parent->y;
|
||||
for(int n=0; n<widgets_amount; n++)
|
||||
{
|
||||
std::string prop = widgets[n].m_properties[ PROP_PROPORTION ];
|
||||
if(prop.size() != 0)
|
||||
{
|
||||
// proportional size
|
||||
int proportion = 1;
|
||||
std::istringstream myStream(prop);
|
||||
if(!(myStream >> proportion))
|
||||
std::cerr << "/!\\ Warning /!\\ : proportion '" << prop.c_str() << "' is not a number in widget " << widgets[n].m_properties[PROP_ID].c_str() << std::endl;
|
||||
|
||||
const float fraction = (float)proportion/(float)total_proportion;
|
||||
|
||||
if(horizontal)
|
||||
{
|
||||
widgets[n].x = x;
|
||||
widgets[n].y = y;
|
||||
|
||||
widgets[n].w = left_space*fraction;
|
||||
x += widgets[n].w;
|
||||
}
|
||||
else
|
||||
{
|
||||
widgets[n].h = left_space*fraction;
|
||||
|
||||
std::string align = widgets[n].m_properties[ PROP_ALIGN ];
|
||||
if(align.size() < 1 || align == "left") widgets[n].x = x;
|
||||
else if(align == "center") widgets[n].x = x + w/2 - widgets[n].w/2;
|
||||
else if(align == "right") widgets[n].x = x + w - widgets[n].w;
|
||||
else std::cerr << "/!\\ Warning /!\\ : alignment '" << align.c_str() << "' is unknown in widget " << widgets[n].m_properties[PROP_ID].c_str() << std::endl;
|
||||
widgets[n].y = y;
|
||||
|
||||
y += widgets[n].h;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// absolute size
|
||||
|
||||
if(horizontal)
|
||||
{
|
||||
widgets[n].x = x;
|
||||
widgets[n].y = y;
|
||||
|
||||
//widgets[n].w = abs_var;
|
||||
x += widgets[n].w;
|
||||
}
|
||||
else
|
||||
{
|
||||
//widgets[n].h = abs_var;
|
||||
|
||||
std::string align = widgets[n].m_properties[ PROP_ALIGN ];
|
||||
if(align.size() < 1 || align == "left") widgets[n].x = x;
|
||||
else if(align == "center") widgets[n].x = x + w/2 - widgets[n].w/2;
|
||||
else if(align == "right") widgets[n].x = x + w - widgets[n].w;
|
||||
else std::cerr << "/!\\ Warning /!\\ : alignment '" << align.c_str() << "' is unknown in widget " << widgets[n].m_properties[PROP_ID].c_str() << std::endl;
|
||||
widgets[n].y = y;
|
||||
|
||||
y += widgets[n].h;
|
||||
}
|
||||
} // end if property or absolute size
|
||||
|
||||
} // next widget
|
||||
|
||||
} while(false);
|
||||
|
||||
// ----- also deal with containers' children
|
||||
for(int n=0; n<widgets_amount; n++)
|
||||
{
|
||||
if(widgets[n].m_type == WTYPE_DIV) calculateLayout(widgets[n].m_children, &widgets[n]);
|
||||
}
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
void Screen::addWidgetsRecursively(ptr_vector<Widget>& widgets, Widget* parent)
|
||||
{
|
||||
const unsigned short widgets_amount = widgets.size();
|
||||
|
||||
// ------- add widgets
|
||||
for(int n=0; n<widgets_amount; n++)
|
||||
{
|
||||
if(widgets[n].m_type == WTYPE_DIV)
|
||||
{
|
||||
addWidgetsRecursively(widgets[n].m_children, &widgets[n]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// warn if widget has no dimensions (except for ribbons and icons, where it is normal since it adjusts to its contents)
|
||||
if((widgets[n].w < 1 || widgets[n].h < 1) && widgets[n].m_type != WTYPE_RIBBON && widgets[n].m_type != WTYPE_ICON_BUTTON)
|
||||
std::cerr << "/!\\ Warning /!\\ : widget " << widgets[n].m_properties[PROP_ID].c_str() << " has no dimensions" << std::endl;
|
||||
|
||||
if(widgets[n].x == -1 || widgets[n].y == -1)
|
||||
std::cerr << "/!\\ Warning /!\\ : widget " << widgets[n].m_properties[PROP_ID].c_str() << " has no position" << std::endl;
|
||||
|
||||
widgets[n].add();
|
||||
}
|
||||
|
||||
} // next widget
|
||||
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
Widget* Screen::getWidget(const char* name)
|
||||
{
|
||||
return getWidget(name, &m_widgets);
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
Widget* Screen::getWidget(const char* name, ptr_vector<Widget>* within_vector)
|
||||
{
|
||||
if(within_vector == NULL) within_vector = &m_widgets;
|
||||
|
||||
const unsigned short widgets_amount = within_vector->size();
|
||||
|
||||
for(int n=0; n<widgets_amount; n++)
|
||||
{
|
||||
Widget& widget = (*within_vector)[n];
|
||||
|
||||
if(widget.m_properties[PROP_ID] == name) return &widget;
|
||||
|
||||
if(widget.m_type == WTYPE_DIV)
|
||||
{
|
||||
Widget* el = getWidget(name, &(widget.m_children));
|
||||
if(el != NULL) return el;
|
||||
}
|
||||
} // next
|
||||
|
||||
return NULL;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
Widget* Screen::getWidget(const int id, ptr_vector<Widget>* within_vector)
|
||||
{
|
||||
if(within_vector == NULL) within_vector = &m_widgets;
|
||||
const unsigned short widgets_amount = within_vector->size();
|
||||
|
||||
for(int n=0; n<widgets_amount; n++)
|
||||
{
|
||||
Widget& widget = (*within_vector)[n];
|
||||
|
||||
if(widget.m_element != NULL && widget.m_element->getID() == id) return &widget;
|
||||
|
||||
if(widget.m_children.size() > 0)
|
||||
{
|
||||
Widget* el = getWidget(id, &(widget.m_children));
|
||||
if(el != NULL) return el;
|
||||
}
|
||||
} // next
|
||||
|
||||
return NULL;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
bool Screen::OnEvent(const SEvent& event)
|
||||
{
|
||||
assert(transmitEvent != NULL);
|
||||
//if (event.EventType != EET_GUI_EVENT) return false;
|
||||
|
||||
|
||||
if(event.EventType == EET_KEY_INPUT_EVENT && event.KeyInput.PressedDown)
|
||||
{
|
||||
const int key = event.KeyInput.Key;
|
||||
|
||||
switch(key)
|
||||
{
|
||||
case KEY_SPACE :
|
||||
break;
|
||||
case KEY_LEFT:
|
||||
{
|
||||
IGUIElement *el = GUIEngine::getGUIEnv()->getFocus();
|
||||
if(el == NULL) break;
|
||||
Widget* w = getWidget( el->getID() );
|
||||
if(w == NULL) break;
|
||||
|
||||
Widget* widget_to_call = w;
|
||||
while(widget_to_call->m_parent != NULL) widget_to_call = widget_to_call->m_parent; // Find topmost parent
|
||||
|
||||
if(widget_to_call->leftPressed())
|
||||
transmitEvent(w, w->m_properties[PROP_ID]);
|
||||
break;
|
||||
}
|
||||
|
||||
case KEY_RIGHT:
|
||||
IGUIElement *el = GUIEngine::getGUIEnv()->getFocus();
|
||||
if(el == NULL) break;
|
||||
Widget* w = getWidget( el->getID() );
|
||||
if(w == NULL) break;
|
||||
|
||||
Widget* widget_to_call = w;
|
||||
while(widget_to_call->m_parent != NULL) widget_to_call = widget_to_call->m_parent; // Find topmost parent
|
||||
|
||||
if(widget_to_call->rightPressed())
|
||||
transmitEvent(widget_to_call, w->m_properties[PROP_ID]);
|
||||
break;
|
||||
|
||||
case KEY_UP:
|
||||
{
|
||||
IGUIElement *el, *first=NULL, *closest=NULL;
|
||||
el = GUIEngine::getGUIEnv()->getFocus();
|
||||
if(el != NULL && el->getTabGroup() != NULL)
|
||||
{
|
||||
if( el->getTabGroup()->getNextElement(el->getTabOrder(), true, false, first, closest) )
|
||||
GUIEngine::getGUIEnv()->setFocus(closest);
|
||||
}
|
||||
else
|
||||
{
|
||||
// select the first widget
|
||||
Widget* w = getFirstWidget();
|
||||
if(w != NULL) GUIEngine::getGUIEnv()->setFocus( w->m_element );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
case KEY_DOWN:
|
||||
{
|
||||
IGUIElement *el, *first = NULL, *closest = NULL;
|
||||
el = GUIEngine::getGUIEnv()->getFocus();
|
||||
|
||||
if(el != NULL && el->getTabGroup() != NULL &&
|
||||
el->getTabGroup()->getNextElement(el->getTabOrder(), false, false, first, closest))
|
||||
{
|
||||
GUIEngine::getGUIEnv()->setFocus(closest);
|
||||
}
|
||||
else
|
||||
{
|
||||
// select the first widget
|
||||
Widget* w = getFirstWidget();
|
||||
if(w != NULL) GUIEngine::getGUIEnv()->setFocus( w->m_element );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//std::cout << "key!" << std::endl;
|
||||
}
|
||||
else if(event.EventType == EET_MOUSE_INPUT_EVENT)
|
||||
{
|
||||
const int type = event.MouseInput.Event;
|
||||
|
||||
if(type == EMIE_MOUSE_MOVED)
|
||||
{
|
||||
m_mouse_x = event.MouseInput.X;
|
||||
m_mouse_y = event.MouseInput.Y;
|
||||
//const int wheel = event.MouseInput.Wheel;
|
||||
}
|
||||
|
||||
//if(type == EMIE_LMOUSE_PRESSED_DOWN ) std::cout << "mouse button pressed!" << std::endl;
|
||||
//if(type == EMIE_LMOUSE_LEFT_UP ) std::cout << "mouse button released!" << std::endl;
|
||||
/*
|
||||
EMIE_LMOUSE_PRESSED_DOWN Left mouse button was pressed down.
|
||||
EMIE_RMOUSE_PRESSED_DOWN Right mouse button was pressed down.
|
||||
EMIE_MMOUSE_PRESSED_DOWN Middle mouse button was pressed down.
|
||||
EMIE_LMOUSE_LEFT_UP Left mouse button was left up.
|
||||
EMIE_RMOUSE_LEFT_UP Right mouse button was left up.
|
||||
EMIE_MMOUSE_LEFT_UP Middle mouse button was left up.
|
||||
EMIE_MOUSE_MOVED The mouse cursor changed its position.
|
||||
EMIE_MOUSE_WHEEL The mouse wheel was moved. Use Wheel value in event data to find out in what direction and how fast.
|
||||
*/
|
||||
}
|
||||
else if(event.EventType == EET_GUI_EVENT)
|
||||
{
|
||||
s32 id = event.GUIEvent.Caller->getID();
|
||||
|
||||
switch(event.GUIEvent.EventType)
|
||||
{
|
||||
case EGET_BUTTON_CLICKED:
|
||||
case EGET_SCROLL_BAR_CHANGED:
|
||||
case EGET_CHECKBOX_CHANGED:
|
||||
Widget* w = getWidget(id);
|
||||
if(w == NULL) break;
|
||||
|
||||
Widget* parent = w->m_parent;
|
||||
if(w->m_parent != NULL)
|
||||
{
|
||||
while(parent->m_parent != NULL) parent = parent->m_parent; // Find topmost parent
|
||||
|
||||
if(parent->transmitEvent(w, w->m_properties[PROP_ID]))
|
||||
transmitEvent(parent, parent->m_properties[PROP_ID]);
|
||||
}
|
||||
else transmitEvent(w, w->m_properties[PROP_ID]);
|
||||
break;
|
||||
|
||||
case EGET_ELEMENT_HOVERED:
|
||||
{
|
||||
Widget* w = getWidget(id);
|
||||
if(w == NULL) break;
|
||||
|
||||
// select ribbons on hover
|
||||
if(w->m_parent != NULL && w->m_parent->m_type == WTYPE_RIBBON)
|
||||
{
|
||||
RibbonWidget* ribbon = dynamic_cast<RibbonWidget*>(w->m_parent);
|
||||
if(ribbon == NULL) break;
|
||||
if(ribbon->mouseHovered(w))
|
||||
transmitEvent(ribbon, ribbon->m_properties[PROP_ID]);
|
||||
if(ribbon->m_parent != NULL) ribbon->m_parent->mouseHovered(w);
|
||||
getGUIEnv()->setFocus(ribbon->m_element);
|
||||
}
|
||||
else
|
||||
{
|
||||
// focus on hover for other widgets
|
||||
getGUIEnv()->setFocus(w->m_element);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
/*
|
||||
case EGET_ELEMENT_LEFT:
|
||||
{
|
||||
Widget* el = getWidget(id);
|
||||
if(el == NULL) break;
|
||||
|
||||
break;
|
||||
}
|
||||
*/
|
||||
case EGET_ELEMENT_FOCUSED:
|
||||
{
|
||||
Widget* el = getWidget(id);
|
||||
if(el == NULL) break;
|
||||
|
||||
el->focused();
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
} // end switch
|
||||
}
|
||||
|
||||
/*
|
||||
EGET_BUTTON_CLICKED, EGET_SCROLL_BAR_CHANGED, EGET_CHECKBOX_CHANGED, EGET_TAB_CHANGED,
|
||||
EGET_MENU_ITEM_SELECTED, EGET_COMBO_BOX_CHANGED, EGET_SPINBOX_CHANGED, EGET_EDITBOX_ENTER,
|
||||
|
||||
EGET_LISTBOX_CHANGED, EGET_LISTBOX_SELECTED_AGAIN,
|
||||
EGET_FILE_SELECTED, EGET_FILE_CHOOSE_DIALOG_CANCELLED,
|
||||
EGET_MESSAGEBOX_YES, EGET_MESSAGEBOX_NO, EGET_MESSAGEBOX_OK, EGET_MESSAGEBOX_CANCEL,
|
||||
EGET_TABLE_CHANGED, EGET_TABLE_HEADER_CHANGED, EGET_TABLE_SELECTED_AGAIN
|
||||
EGET_ELEMENT_FOCUS_LOST, EGET_ELEMENT_FOCUSED, EGET_ELEMENT_HOVERED, EGET_ELEMENT_LEFT,
|
||||
EGET_ELEMENT_CLOSED,
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
Widget* Screen::getFirstWidget(ptr_vector<Widget>* within_vector)
|
||||
{
|
||||
if(within_vector == NULL) within_vector = &m_widgets;
|
||||
|
||||
for(int i = 0; i < within_vector->size(); i++)
|
||||
{
|
||||
// if container, also checks children
|
||||
if(within_vector->get(i)->m_children.size() > 0 &&
|
||||
within_vector->get(i)->m_type != WTYPE_RIBBON &&
|
||||
within_vector->get(i)->m_type != WTYPE_SPINNER)
|
||||
{
|
||||
Widget* w = getFirstWidget(&within_vector->get(i)->m_children);
|
||||
if(w != NULL) return w;
|
||||
}
|
||||
|
||||
if(within_vector->get(i)->m_element == NULL || within_vector->get(i)->m_element->getTabOrder() == -1) continue;
|
||||
|
||||
return within_vector->get(i);
|
||||
}
|
||||
return NULL;
|
||||
}
|
54
src/gui/screen.hpp
Normal file
54
src/gui/screen.hpp
Normal file
@ -0,0 +1,54 @@
|
||||
#ifndef HEADER_SCREEN_HPP
|
||||
#define HEADER_SCREEN_HPP
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "ptr_vector.hpp"
|
||||
|
||||
#include <irrlicht.h>
|
||||
|
||||
using namespace irr;
|
||||
using namespace core;
|
||||
using namespace scene;
|
||||
using namespace video;
|
||||
using namespace io;
|
||||
using namespace gui;
|
||||
|
||||
|
||||
namespace GUIEngine
|
||||
{
|
||||
class Widget;
|
||||
|
||||
void parseScreenFileDiv(irr::io::IrrXMLReader* xml, ptr_vector<Widget>& append_to);
|
||||
|
||||
class Screen : public IEventReceiver
|
||||
{
|
||||
bool m_loaded;
|
||||
std::string m_filename;
|
||||
ptr_vector<Widget, HOLD> m_widgets;
|
||||
void loadFromFile();
|
||||
|
||||
static void addWidgetsRecursively(ptr_vector<Widget>& widgets, Widget* parent=NULL);
|
||||
void calculateLayout(ptr_vector<Widget>& widgets, Widget* parent=NULL);
|
||||
public:
|
||||
// current mouse position, read-only...
|
||||
int m_mouse_x, m_mouse_y;
|
||||
|
||||
Screen(const char* filename);
|
||||
bool operator ==(const char* filename) const { return m_filename == filename; }
|
||||
|
||||
Widget* getWidget(const char* name);
|
||||
Widget* getWidget(const char* name, ptr_vector<Widget>* within_vector);
|
||||
Widget* getWidget(const int id, ptr_vector<Widget>* within_vector=NULL);
|
||||
|
||||
Widget* getFirstWidget(ptr_vector<Widget>* within_vector=NULL);
|
||||
|
||||
void addWidgets();
|
||||
void calculateLayout();
|
||||
|
||||
virtual bool OnEvent(const SEvent& event);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
162
src/gui/screen_loader.cpp
Normal file
162
src/gui/screen_loader.cpp
Normal file
@ -0,0 +1,162 @@
|
||||
#include "gui/screen.hpp"
|
||||
#include "gui/engine.hpp"
|
||||
#include "gui/widget.hpp"
|
||||
#include <irrlicht.h>
|
||||
#include <iostream>
|
||||
#include <irrXML.h>
|
||||
#include <sstream>
|
||||
|
||||
using namespace irr;
|
||||
|
||||
using namespace core;
|
||||
using namespace scene;
|
||||
using namespace video;
|
||||
using namespace io;
|
||||
using namespace gui;
|
||||
using namespace GUIEngine;
|
||||
|
||||
namespace GUIEngine
|
||||
{
|
||||
|
||||
void parseScreenFileDiv(irr::io::IrrXMLReader* xml, ptr_vector<Widget>& append_to)
|
||||
{
|
||||
// parse XML file
|
||||
|
||||
while(xml && xml->read())
|
||||
{
|
||||
|
||||
switch(xml->getNodeType())
|
||||
{
|
||||
case irr::io::EXN_TEXT:
|
||||
break;
|
||||
case irr::io::EXN_ELEMENT:
|
||||
{
|
||||
WidgetType type;
|
||||
|
||||
if (!strcmp("div", xml->getNodeName()))
|
||||
{
|
||||
type = WTYPE_DIV;
|
||||
append_to.push_back(new Widget());
|
||||
}
|
||||
else if (!strcmp("ribbon", xml->getNodeName()))
|
||||
{
|
||||
type = WTYPE_RIBBON;
|
||||
append_to.push_back(new RibbonWidget());
|
||||
}
|
||||
else if (!strcmp("buttonbar", xml->getNodeName()))
|
||||
{
|
||||
type = WTYPE_RIBBON;
|
||||
append_to.push_back(new RibbonWidget(RIBBON_TOOLBAR));
|
||||
}
|
||||
else if (!strcmp("tabs", xml->getNodeName()))
|
||||
{
|
||||
type = WTYPE_RIBBON;
|
||||
append_to.push_back(new RibbonWidget(RIBBON_TABS));
|
||||
}
|
||||
else if (!strcmp("spinner", xml->getNodeName()))
|
||||
{
|
||||
type = WTYPE_SPINNER;
|
||||
append_to.push_back(new SpinnerWidget());
|
||||
}
|
||||
else if (!strcmp("button", xml->getNodeName()))
|
||||
{
|
||||
type = WTYPE_BUTTON;
|
||||
append_to.push_back(new ButtonWidget());
|
||||
}
|
||||
else if (!strcmp("gauge", xml->getNodeName()))
|
||||
{
|
||||
type = WTYPE_GAUGE;
|
||||
append_to.push_back(new GaugeWidget());
|
||||
}
|
||||
else if (!strcmp("icon-button", xml->getNodeName()))
|
||||
{
|
||||
type = WTYPE_ICON_BUTTON;
|
||||
append_to.push_back(new IconButtonWidget());
|
||||
}
|
||||
else if (!strcmp("icon", xml->getNodeName()))
|
||||
{
|
||||
type = WTYPE_ICON_BUTTON;
|
||||
append_to.push_back(new IconButtonWidget(false));
|
||||
}
|
||||
else if (!strcmp("checkbox", xml->getNodeName()))
|
||||
{
|
||||
type = WTYPE_CHECKBOX;
|
||||
append_to.push_back(new CheckBoxWidget());
|
||||
}
|
||||
else if (!strcmp("label", xml->getNodeName()))
|
||||
{
|
||||
type = WTYPE_LABEL;
|
||||
append_to.push_back(new LabelWidget());
|
||||
}
|
||||
else if (!strcmp("model", xml->getNodeName()))
|
||||
{
|
||||
type = WTYPE_MODEL;
|
||||
append_to.push_back(new Widget()); // TODO
|
||||
}
|
||||
else if (!strcmp("spacer", xml->getNodeName()))
|
||||
{
|
||||
type = WTYPE_NONE;
|
||||
append_to.push_back(new Widget());
|
||||
}
|
||||
else if (!strcmp("ribbon_grid", xml->getNodeName()))
|
||||
{
|
||||
type = WTYPE_RIBBON_GRID;
|
||||
append_to.push_back(new RibbonGridWidget());
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "/!\\ Warning /!\\ : unknown tag found in STK GUI file : '" << xml->getNodeName() << "'" << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
Widget& widget = append_to[append_to.size()-1];
|
||||
widget.m_type = type;
|
||||
|
||||
#define READ_PROPERTY( prop_name, prop_flag ) const char* prop_name = xml->getAttributeValue( #prop_name ); \
|
||||
if(prop_name != NULL) widget.m_properties[prop_flag] = prop_name; else widget.m_properties[prop_flag] = ""
|
||||
|
||||
READ_PROPERTY(id, PROP_ID);
|
||||
READ_PROPERTY(proportion, PROP_PROPORTION);
|
||||
READ_PROPERTY(width, PROP_WIDTH);
|
||||
READ_PROPERTY(height, PROP_HEIGHT);
|
||||
READ_PROPERTY(child_width, PROP_CHILD_WIDTH);
|
||||
READ_PROPERTY(child_height, PROP_CHILD_HEIGHT);
|
||||
READ_PROPERTY(word_wrap, PROP_WORD_WRAP);
|
||||
READ_PROPERTY(grow_with_text, PROP_GROW_WITH_TEXT);
|
||||
READ_PROPERTY(x, PROP_X);
|
||||
READ_PROPERTY(y, PROP_Y);
|
||||
READ_PROPERTY(layout, PROP_LAYOUT);
|
||||
READ_PROPERTY(align, PROP_ALIGN);
|
||||
READ_PROPERTY(text, PROP_TEXT);
|
||||
READ_PROPERTY(icon, PROP_ICON);
|
||||
READ_PROPERTY(text_align, PROP_TEXT_ALIGN);
|
||||
READ_PROPERTY(min_value, PROP_MIN_VALUE);
|
||||
READ_PROPERTY(max_value, PROP_MAX_VALUE);
|
||||
#undef READ_PROPERTY
|
||||
|
||||
// new div, continue parsing with this new div as new parent
|
||||
if( widget.m_type == WTYPE_DIV || widget.m_type == WTYPE_RIBBON)
|
||||
parseScreenFileDiv( xml, append_to[append_to.size()-1].m_children );
|
||||
}// end case EXN_ELEMENT
|
||||
|
||||
break;
|
||||
case irr::io::EXN_ELEMENT_END:
|
||||
{
|
||||
// we're done parsing this 'div', return one step back in the recursive call
|
||||
if (!strcmp("div", xml->getNodeName()))
|
||||
return;
|
||||
|
||||
// we're done parsing this 'ribbon', return one step back in the recursive call
|
||||
if (!strcmp("ribbon", xml->getNodeName()) ||
|
||||
!strcmp("buttonbar", xml->getNodeName()) ||
|
||||
!strcmp("tabs", xml->getNodeName()))
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}//end switch
|
||||
} // end while
|
||||
} // end function
|
||||
|
||||
} // end namespace
|
270
src/gui/skin.cpp
Normal file
270
src/gui/skin.cpp
Normal file
@ -0,0 +1,270 @@
|
||||
#include "gui/skin.hpp"
|
||||
#include "gui/engine.hpp"
|
||||
#include "gui/screen.hpp"
|
||||
#include "gui/widget.hpp"
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
using namespace GUIEngine;
|
||||
|
||||
Skin::Skin(IGUISkin* fallback_skin)
|
||||
{
|
||||
m_fallback_skin = fallback_skin;
|
||||
m_fallback_skin->grab();
|
||||
assert(fallback_skin != NULL);
|
||||
}
|
||||
|
||||
Skin::~Skin()
|
||||
{
|
||||
m_fallback_skin->drop();
|
||||
}
|
||||
|
||||
/*
|
||||
driver->draw2DImage(texture,
|
||||
core::rect<s32>(img_x1, img_y1, img_x2, img_y2),
|
||||
core::rect<s32>(0,0,texture_size.Width, texture_size.Height) );
|
||||
*/
|
||||
void Skin::draw2DRectangle (IGUIElement *element, const video::SColor &color, const core::rect< s32 > &pos, const core::rect< s32 > *clip)
|
||||
{
|
||||
|
||||
// scrollbar backgound
|
||||
|
||||
//printf("draw rectangle\n");
|
||||
GUIEngine::getDriver()->draw2DRectangle( SColor(255, 0, 150, 150), pos );
|
||||
}
|
||||
|
||||
void Skin::draw3DButtonPanePressed (IGUIElement *element, const core::rect< s32 > &rect, const core::rect< s32 > *clip)
|
||||
{
|
||||
const bool focused = GUIEngine::getGUIEnv()->hasFocus(element);
|
||||
|
||||
if(focused)
|
||||
GUIEngine::getDriver()->draw2DRectangle( SColor(255, 100, 0, 0), rect );
|
||||
else
|
||||
GUIEngine::getDriver()->draw2DRectangle( SColor(255, 0, 100, 0), rect );
|
||||
}
|
||||
|
||||
void Skin::draw3DButtonPaneStandard (IGUIElement *element, const core::rect< s32 > &rect, const core::rect< s32 > *clip)
|
||||
{
|
||||
//printf("draw 3D button pane\n");
|
||||
bool focused = GUIEngine::getGUIEnv()->hasFocus(element);
|
||||
|
||||
bool draw_border = true;
|
||||
bool mark_selected = false;
|
||||
|
||||
// buttons are used for other uses than plain clickable buttons because irrLicht
|
||||
// does not have widgets for everything we need. so at render time, we just check
|
||||
// which type this button represents and set render options accordingly
|
||||
if(element->getType() == EGUIET_BUTTON)
|
||||
{
|
||||
const int id = element->getID();
|
||||
if(id != -1)
|
||||
{
|
||||
Widget* widget = GUIEngine::getCurrentScreen()->getWidget(id);
|
||||
|
||||
if(widget != NULL)
|
||||
{
|
||||
// don't draw border around bitmaps
|
||||
if(widget->m_type == WTYPE_ICON_BUTTON && !focused) draw_border = false;
|
||||
|
||||
// draw border around ribbon only if focused.
|
||||
if(widget->m_type == WTYPE_RIBBON && !focused) draw_border = false;
|
||||
|
||||
// check if one of its children has focus (will happen when directly clicking on them)
|
||||
if(widget->m_type == WTYPE_RIBBON)
|
||||
{
|
||||
const int amount = widget->m_children.size();
|
||||
for(int n=0; n<amount; n++)
|
||||
{
|
||||
if(GUIEngine::getGUIEnv()->hasFocus(widget->m_children[n].m_element))
|
||||
{
|
||||
draw_border = true;
|
||||
focused = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for ribbon children
|
||||
if(widget->isSelected()) mark_selected = true;
|
||||
if(widget->m_parent != NULL && widget->m_parent->m_type == WTYPE_RIBBON &&
|
||||
((RibbonWidget*)widget->m_parent)->getRibbonType() == RIBBON_TOOLBAR &&
|
||||
!GUIEngine::getGUIEnv()->hasFocus(widget->m_parent->m_element)) mark_selected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!draw_border && !mark_selected) return;
|
||||
|
||||
if(mark_selected)
|
||||
{
|
||||
const core::rect< s32 > rect2 = core::rect< s32 >(rect.UpperLeftCorner.X - 5, rect.UpperLeftCorner.Y - 5,
|
||||
rect.UpperLeftCorner.X + rect.getWidth() + 5,
|
||||
rect.UpperLeftCorner.Y + rect.getHeight() + 5);
|
||||
GUIEngine::getDriver()->draw2DRectangle( SColor(2555, 0, 175, 255), rect2 );
|
||||
}
|
||||
else if(focused)
|
||||
GUIEngine::getDriver()->draw2DRectangle( SColor(255, 150, 0, 0), rect );
|
||||
else
|
||||
GUIEngine::getDriver()->draw2DRectangle( SColor(255, 0, 150, 0), rect );
|
||||
}
|
||||
|
||||
void Skin::draw3DMenuPane (IGUIElement *element, const core::rect< s32 > &rect, const core::rect< s32 > *clip)
|
||||
{
|
||||
//printf("draw menu pane\n");
|
||||
}
|
||||
|
||||
void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor, bool flat, bool fillBackGround, const core::rect< s32 > &rect, const core::rect< s32 > *clip)
|
||||
{
|
||||
// e.g. the checkbox square
|
||||
//printf("draw sunken pane\n");
|
||||
const bool focused = GUIEngine::getGUIEnv()->getFocus() == element;
|
||||
|
||||
if(focused)
|
||||
GUIEngine::getDriver()->draw2DRectangle( SColor(255, 150, 0, 0), rect );
|
||||
else
|
||||
GUIEngine::getDriver()->draw2DRectangle( SColor(255, 0, 150, 0), rect );
|
||||
}
|
||||
|
||||
void Skin::draw3DTabBody (IGUIElement *element, bool border, bool background, const core::rect< s32 > &rect, const core::rect< s32 > *clip, s32 tabHeight, gui::EGUI_ALIGNMENT alignment)
|
||||
{
|
||||
//printf("draw tab body\n");
|
||||
}
|
||||
|
||||
void Skin::draw3DTabButton (IGUIElement *element, bool active, const core::rect< s32 > &rect, const core::rect< s32 > *clip, gui::EGUI_ALIGNMENT alignment)
|
||||
{
|
||||
//printf("draw tab button\n");
|
||||
}
|
||||
|
||||
void Skin::draw3DToolBar (IGUIElement *element, const core::rect< s32 > &rect, const core::rect< s32 > *clip)
|
||||
{
|
||||
//printf("draw toolbar\n");
|
||||
}
|
||||
|
||||
core::rect< s32 > Skin::draw3DWindowBackground (IGUIElement *element, bool drawTitleBar, video::SColor titleBarColor, const core::rect< s32 > &rect, const core::rect< s32 > *clip)
|
||||
{
|
||||
//printf("draw 3d window bg\n");
|
||||
return rect;
|
||||
}
|
||||
|
||||
void Skin::drawIcon (IGUIElement *element, EGUI_DEFAULT_ICON icon, const core::position2di position, u32 starttime, u32 currenttime, bool loop, const core::rect< s32 > *clip)
|
||||
{
|
||||
//printf("draw icon\n");
|
||||
m_fallback_skin->drawIcon(element, icon, position, starttime, currenttime, loop, clip);
|
||||
}
|
||||
|
||||
video::SColor Skin::getColor (EGUI_DEFAULT_COLOR color) const
|
||||
{
|
||||
//printf("getting color\n");
|
||||
/*
|
||||
EGDC_3D_DARK_SHADOW Dark shadow for three-dimensional display elements.
|
||||
EGDC_3D_SHADOW Shadow color for three-dimensional display elements (for edges facing away from the light source).
|
||||
EGDC_3D_FACE Face color for three-dimensional display elements and for dialog box backgrounds.
|
||||
EGDC_3D_HIGH_LIGHT Highlight color for three-dimensional display elements (for edges facing the light source.).
|
||||
EGDC_3D_LIGHT Light color for three-dimensional display elements (for edges facing the light source.).
|
||||
EGDC_ACTIVE_BORDER Active window border.
|
||||
EGDC_ACTIVE_CAPTION Active window title bar text.
|
||||
EGDC_APP_WORKSPACE Background color of multiple document interface (MDI) applications.
|
||||
EGDC_BUTTON_TEXT Text on a button.
|
||||
EGDC_GRAY_TEXT Grayed (disabled) text.
|
||||
EGDC_HIGH_LIGHT Item(s) selected in a control.
|
||||
EGDC_HIGH_LIGHT_TEXT Text of item(s) selected in a control.
|
||||
EGDC_INACTIVE_BORDER Inactive window border.
|
||||
EGDC_INACTIVE_CAPTION Inactive window caption.
|
||||
EGDC_TOOLTIP Tool tip text color.
|
||||
EGDC_TOOLTIP_BACKGROUND Tool tip background color.
|
||||
EGDC_SCROLLBAR Scrollbar gray area.
|
||||
EGDC_WINDOW Window background.
|
||||
EGDC_WINDOW_SYMBOL Window symbols like on close buttons, scroll bars and check boxes.
|
||||
EGDC_ICON Icons in a list or tree.
|
||||
EGDC_ICON_HIGH_LIGHT Selected icons in a list or tree.
|
||||
*/
|
||||
|
||||
switch(color)
|
||||
{
|
||||
case EGDC_BUTTON_TEXT:
|
||||
return SColor(255, 0, 0, 0);
|
||||
break;
|
||||
|
||||
case EGDC_GRAY_TEXT:
|
||||
return SColor(255, 80, 80, 80);
|
||||
break;
|
||||
|
||||
case EGDC_HIGH_LIGHT:
|
||||
case EGDC_ICON_HIGH_LIGHT:
|
||||
case EGDC_HIGH_LIGHT_TEXT:
|
||||
return SColor(255, 0, 150, 0);
|
||||
|
||||
default:
|
||||
return SColor(255, 255, 255, 255);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const wchar_t* Skin::getDefaultText (EGUI_DEFAULT_TEXT text) const
|
||||
{
|
||||
//printf("getting default text\n");
|
||||
return L"SuperTuxKart";
|
||||
}
|
||||
|
||||
IGUIFont* Skin::getFont (EGUI_DEFAULT_FONT which) const
|
||||
{
|
||||
//printf("getting font\n");
|
||||
return GUIEngine::getFont();
|
||||
}
|
||||
|
||||
u32 Skin::getIcon (EGUI_DEFAULT_ICON icon) const
|
||||
{
|
||||
//printf("getting icon\n");
|
||||
return m_fallback_skin->getIcon(icon);
|
||||
}
|
||||
|
||||
s32 Skin::getSize (EGUI_DEFAULT_SIZE size) const
|
||||
{
|
||||
//printf("getting size\n");
|
||||
return m_fallback_skin->getSize(size);
|
||||
}
|
||||
|
||||
IGUISpriteBank* Skin::getSpriteBank () const
|
||||
{
|
||||
//printf("getting bank\n");
|
||||
return m_fallback_skin->getSpriteBank();
|
||||
}
|
||||
|
||||
//EGUI_SKIN_TYPE getType () const
|
||||
|
||||
void Skin::setColor (EGUI_DEFAULT_COLOR which, video::SColor newColor)
|
||||
{
|
||||
m_fallback_skin->setColor(which, newColor);
|
||||
//printf("setting color\n");
|
||||
}
|
||||
|
||||
void Skin::setDefaultText (EGUI_DEFAULT_TEXT which, const wchar_t *newText)
|
||||
{
|
||||
m_fallback_skin->setDefaultText(which, newText);
|
||||
//printf("setting default text\n");
|
||||
}
|
||||
|
||||
void Skin::setFont (IGUIFont *font, EGUI_DEFAULT_FONT which)
|
||||
{
|
||||
m_fallback_skin->setFont(font, which);
|
||||
//printf("setting font\n");
|
||||
}
|
||||
|
||||
void Skin::setIcon (EGUI_DEFAULT_ICON icon, u32 index)
|
||||
{
|
||||
m_fallback_skin->setIcon(icon, index);
|
||||
//printf("setting icon\n");
|
||||
}
|
||||
|
||||
void Skin::setSize (EGUI_DEFAULT_SIZE which, s32 size)
|
||||
{
|
||||
m_fallback_skin->setSize(which, size);
|
||||
//printf("setting size\n");
|
||||
}
|
||||
|
||||
void Skin::setSpriteBank (IGUISpriteBank *bank)
|
||||
{
|
||||
//printf("setting sprite bank\n");
|
||||
m_fallback_skin->setSpriteBank(bank);
|
||||
//this->m_bank = bank;
|
||||
}
|
70
src/gui/skin.hpp
Normal file
70
src/gui/skin.hpp
Normal file
@ -0,0 +1,70 @@
|
||||
#ifndef HEADER_SKIN_HPP
|
||||
#define HEADER_SKIN_HPP
|
||||
|
||||
#include <irrlicht.h>
|
||||
using namespace irr;
|
||||
using namespace core;
|
||||
using namespace scene;
|
||||
using namespace video;
|
||||
using namespace io;
|
||||
using namespace gui;
|
||||
|
||||
namespace GUIEngine
|
||||
{
|
||||
|
||||
class Skin : public IGUISkin
|
||||
{
|
||||
IGUISkin* m_fallback_skin;
|
||||
public:
|
||||
Skin(IGUISkin* fallback_skin);
|
||||
~Skin();
|
||||
|
||||
virtual void draw2DRectangle (IGUIElement *element, const video::SColor &color, const core::rect< s32 > &pos, const core::rect< s32 > *clip);
|
||||
|
||||
virtual void draw3DButtonPanePressed (IGUIElement *element, const core::rect< s32 > &rect, const core::rect< s32 > *clip);
|
||||
|
||||
virtual void draw3DButtonPaneStandard (IGUIElement *element, const core::rect< s32 > &rect, const core::rect< s32 > *clip);
|
||||
|
||||
virtual void draw3DMenuPane (IGUIElement *element, const core::rect< s32 > &rect, const core::rect< s32 > *clip);
|
||||
|
||||
virtual void draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor, bool flat, bool fillBackGround, const core::rect< s32 > &rect, const core::rect< s32 > *clip);
|
||||
|
||||
virtual void draw3DTabBody (IGUIElement *element, bool border, bool background, const core::rect< s32 > &rect, const core::rect< s32 > *clip, s32 tabHeight=-1, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT);
|
||||
|
||||
virtual void draw3DTabButton (IGUIElement *element, bool active, const core::rect< s32 > &rect, const core::rect< s32 > *clip, gui::EGUI_ALIGNMENT alignment=EGUIA_UPPERLEFT);
|
||||
|
||||
virtual void draw3DToolBar (IGUIElement *element, const core::rect< s32 > &rect, const core::rect< s32 > *clip);
|
||||
|
||||
virtual core::rect< s32 > draw3DWindowBackground (IGUIElement *element, bool drawTitleBar, video::SColor titleBarColor, const core::rect< s32 > &rect, const core::rect< s32 > *clip);
|
||||
|
||||
virtual void drawIcon (IGUIElement *element, EGUI_DEFAULT_ICON icon, const core::position2di position, u32 starttime, u32 currenttime, bool loop=false, const core::rect< s32 > *clip=NULL);
|
||||
|
||||
virtual video::SColor getColor (EGUI_DEFAULT_COLOR color) const;
|
||||
|
||||
virtual const wchar_t * getDefaultText (EGUI_DEFAULT_TEXT text) const;
|
||||
|
||||
virtual IGUIFont * getFont (EGUI_DEFAULT_FONT which=EGDF_DEFAULT) const ;
|
||||
|
||||
virtual u32 getIcon (EGUI_DEFAULT_ICON icon) const ;
|
||||
|
||||
virtual s32 getSize (EGUI_DEFAULT_SIZE size) const ;
|
||||
|
||||
virtual IGUISpriteBank * getSpriteBank () const ;
|
||||
|
||||
//virtual EGUI_SKIN_TYPE getType () const;
|
||||
|
||||
virtual void setColor (EGUI_DEFAULT_COLOR which, video::SColor newColor);
|
||||
|
||||
virtual void setDefaultText (EGUI_DEFAULT_TEXT which, const wchar_t *newText);
|
||||
|
||||
virtual void setFont (IGUIFont *font, EGUI_DEFAULT_FONT which=EGDF_DEFAULT);
|
||||
|
||||
virtual void setIcon (EGUI_DEFAULT_ICON icon, u32 index);
|
||||
|
||||
virtual void setSize (EGUI_DEFAULT_SIZE which, s32 size);
|
||||
|
||||
virtual void setSpriteBank (IGUISpriteBank *bank);
|
||||
|
||||
};
|
||||
}
|
||||
#endif
|
@ -1,103 +0,0 @@
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "start_race_feedback.hpp"
|
||||
|
||||
#include "race_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_MSG
|
||||
};
|
||||
|
||||
/** Constructor for feedback screen. */
|
||||
StartRaceFeedback::StartRaceFeedback()
|
||||
{
|
||||
m_is_first_frame = true;
|
||||
//Add some feedback so people know they are going to start the race
|
||||
widget_manager->reset();
|
||||
widget_manager->addTextWgt( WTOK_MSG, 60, 7, "" );
|
||||
|
||||
widget_manager->setWgtText(WTOK_MSG, _("Synchronising network..."));
|
||||
|
||||
if(network_manager->getMode()==NetworkManager::NW_NONE)
|
||||
{
|
||||
// This copies the local player information to the global
|
||||
// player information in the race manager.
|
||||
network_manager->setupPlayerKartInfo();
|
||||
}
|
||||
|
||||
widget_manager->layout(WGT_AREA_ALL);
|
||||
} // StartRaceFeedback
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Destructor for feedback screen.
|
||||
*/
|
||||
StartRaceFeedback::~StartRaceFeedback()
|
||||
{
|
||||
widget_manager->reset();
|
||||
} // ~StartRaceFeedback
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Updates the feedback screen. Depending on the state of the network manager
|
||||
* it will change the displayed text.
|
||||
* \param delta Time step size.
|
||||
*/
|
||||
void StartRaceFeedback::update(float delta)
|
||||
{
|
||||
// First test if we are still waiting
|
||||
// ===================================
|
||||
|
||||
// If the server hasn't received all client information, keep on waiting
|
||||
if(network_manager->getMode()==NetworkManager::NW_SERVER &&
|
||||
network_manager->getState()!=NetworkManager::NS_ALL_REMOTE_CHARACTERS_DONE)
|
||||
{
|
||||
widget_manager->update(delta);
|
||||
return;
|
||||
}
|
||||
// If the client hasn't received the race data yet, keep on waiting
|
||||
if(network_manager->getMode()==NetworkManager::NW_CLIENT &&
|
||||
network_manager->getState()==NetworkManager::NS_WAIT_FOR_RACE_DATA)
|
||||
{
|
||||
widget_manager->update(delta);
|
||||
return;
|
||||
}
|
||||
|
||||
// Waiting is finished, switch to loading
|
||||
// ======================================
|
||||
widget_manager->setWgtText(WTOK_MSG, _("Loading race..."));
|
||||
widget_manager->update(delta);
|
||||
|
||||
// We can't do the actual loading etc. in the first call here, since then
|
||||
// the text 'loading' would not be displayed. So a simple state variable
|
||||
// 'is_first_frame' is used to make sure that the text is displayed
|
||||
// before initiating the loading of the race.
|
||||
if(!m_is_first_frame)
|
||||
{
|
||||
if(network_manager->getMode()==NetworkManager::NW_SERVER)
|
||||
{
|
||||
network_manager->sendRaceInformationToClients();
|
||||
}
|
||||
race_manager->startNew();
|
||||
}
|
||||
m_is_first_frame = false;
|
||||
|
||||
} // update
|
||||
|
@ -1,44 +0,0 @@
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_START_RACE_FEEDBACK_H
|
||||
#define HEADER_START_RACE_FEEDBACK_H
|
||||
|
||||
#include "base_gui.hpp"
|
||||
|
||||
/** This class is used to give feedback to the user while loading the track.
|
||||
* It either displays a 'Loading track' or a 'Wait for synchronisation'
|
||||
* message (dependent on the stage of the race manager).
|
||||
*/
|
||||
class StartRaceFeedback: public BaseGUI
|
||||
{
|
||||
protected:
|
||||
/** Flag used to make sure that the text is actually displayed (i.e
|
||||
* update was called once) before loading the track - otherwise the
|
||||
* text is set in the widget, but not on the screen since the screen
|
||||
* wasn't updated.
|
||||
*/
|
||||
bool m_is_first_frame;
|
||||
public:
|
||||
StartRaceFeedback();
|
||||
~StartRaceFeedback();
|
||||
|
||||
void update(float DELTA);
|
||||
void select(){};
|
||||
};
|
||||
|
||||
#endif
|
@ -1,444 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "gui/track_sel.hpp"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "race_manager.hpp"
|
||||
#include "user_config.hpp"
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "tracks/track_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
|
||||
enum WidgetTokens
|
||||
{
|
||||
WTOK_TITLE,
|
||||
|
||||
WTOK_IMG0,
|
||||
WTOK_IMG1,
|
||||
WTOK_AUTHOR,
|
||||
WTOK_UP,
|
||||
WTOK_DOWN,
|
||||
WTOK_EMPTY0 = 1000,
|
||||
WTOK_TRACK0 = 2000
|
||||
|
||||
};
|
||||
|
||||
TrackSel::TrackSel()
|
||||
{
|
||||
const int HEIGHT = 10;
|
||||
|
||||
const float arrows_x = 0.15f;
|
||||
|
||||
Widget *prev_widget=NULL, *w;
|
||||
w = widget_manager->addTextButtonWgt(WTOK_UP, 20, HEIGHT/2, "^");
|
||||
w->setPosition(WGT_DIR_FROM_RIGHT, arrows_x, WGT_DIR_UNDER_WIDGET, 0.12f);
|
||||
prev_widget = w;
|
||||
for (unsigned int i = 0; i <m_max_entries; i++)
|
||||
{
|
||||
float offset = (float)(m_max_entries-1)/2.0f+(float)abs((int)(i-(m_max_entries-1)/2))*0.7f+1.0f;
|
||||
w = widget_manager->addTextButtonWgt(WTOK_TRACK0+i, 40, HEIGHT, "");
|
||||
widget_manager->setWgtTextSize(WTOK_TRACK0+i, WGT_FNT_SML);
|
||||
w->setPosition(WGT_DIR_FROM_RIGHT, 0.03f*offset-0.12f, NULL,
|
||||
WGT_DIR_UNDER_WIDGET, 0.f, prev_widget);
|
||||
prev_widget = w;
|
||||
} // for i
|
||||
widget_manager->sameWidth(WTOK_TRACK0, WTOK_TRACK0+m_max_entries-1);
|
||||
|
||||
w = widget_manager->addTextButtonWgt(WTOK_DOWN, 20, HEIGHT/2, "v");
|
||||
w->setPosition(WGT_DIR_FROM_RIGHT, arrows_x, NULL, WGT_DIR_UNDER_WIDGET, 0, prev_widget);
|
||||
|
||||
w = widget_manager->addImgWgt(WTOK_IMG0, 35, 29, 0);
|
||||
w->setPosition(WGT_DIR_FROM_LEFT, 0.1f, WGT_DIR_FROM_TOP, 0.2f);
|
||||
prev_widget = w;
|
||||
w = widget_manager->addImgWgt(WTOK_IMG1, 35, 35, 0);
|
||||
w->setPosition(WGT_DIR_FROM_LEFT, 0.1f, NULL, WGT_DIR_UNDER_WIDGET,0, prev_widget);
|
||||
prev_widget = w;
|
||||
w = widget_manager->addTextWgt(WTOK_AUTHOR, 60, 9, "" );
|
||||
widget_manager->setWgtResizeToText(WTOK_AUTHOR, true);
|
||||
widget_manager->hideWgtRect(WTOK_AUTHOR);
|
||||
|
||||
// Loop through all tracks to determine the longest description
|
||||
for(unsigned int i=0; i<track_manager->getNumberOfTracks(); i++)
|
||||
{
|
||||
widget_manager->setWgtText(WTOK_AUTHOR, track_manager->getTrack(i)->getDescription());
|
||||
w->resizeToText();
|
||||
}
|
||||
w->setPosition(WGT_DIR_FROM_LEFT, 0.1f, NULL, WGT_DIR_FROM_BOTTOM, 0.0f, prev_widget);
|
||||
|
||||
m_offset = 0;
|
||||
switchGroup();
|
||||
m_current_track = -1;
|
||||
for(unsigned int i=0; i<m_index_avail_tracks.size(); i++)
|
||||
{
|
||||
// Ignore track groups (which are negative)
|
||||
if(m_index_avail_tracks[i]<0) continue;
|
||||
if(track_manager->getTrack(m_index_avail_tracks[i])->getIdent()==
|
||||
user_config->m_last_track)
|
||||
{
|
||||
m_offset = i-m_max_entries/2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
updateScrollPosition();
|
||||
|
||||
widget_manager->layout(WGT_AREA_TOP);
|
||||
// Make sure to select one track. The call to update() here is necessary,
|
||||
// since it guarantees that selectedWgt is indeed a track (otherwise the
|
||||
// manager might select e.g. arrow up, and then no track is displayed).
|
||||
widget_manager->setSelectedWgt(WTOK_TRACK0+(m_max_entries-1)/2);
|
||||
displayImages(0);
|
||||
//update(0);
|
||||
} // TrackSel
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
TrackSel::~TrackSel()
|
||||
{
|
||||
widget_manager->reset();
|
||||
} // ~TrackSel
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void TrackSel::updateScrollPosition()
|
||||
{
|
||||
unsigned int start = 0, end=m_max_entries;
|
||||
if(m_index_avail_tracks.size()<m_max_entries)
|
||||
{
|
||||
start = (unsigned int)(m_max_entries-m_index_avail_tracks.size()+1)/2;
|
||||
end = start+m_index_avail_tracks.size()-1;
|
||||
}
|
||||
|
||||
for(unsigned int i=0; i<(unsigned int)m_max_entries; i++)
|
||||
{
|
||||
if(i<start || i>end)
|
||||
{
|
||||
widget_manager->hideWgtRect(WTOK_TRACK0+i);
|
||||
widget_manager->hideWgtText(WTOK_TRACK0+i);
|
||||
widget_manager->deactivateWgt(WTOK_TRACK0+i);
|
||||
continue;
|
||||
}
|
||||
// Make them visible again (e.g. after a change of groups)
|
||||
widget_manager->activateWgt(WTOK_TRACK0+i);
|
||||
widget_manager->showWgtRect(WTOK_TRACK0+i);
|
||||
widget_manager->showWgtText(WTOK_TRACK0+i);
|
||||
|
||||
int i_with_scrolling = i+m_offset;
|
||||
while(i_with_scrolling < 0) i_with_scrolling += m_index_avail_tracks.size();
|
||||
while(i_with_scrolling >=(int)m_index_avail_tracks.size() )
|
||||
i_with_scrolling -= m_index_avail_tracks.size();
|
||||
// We can't use simply % here, since e.g. 4 % 2 = 2 (probably because of
|
||||
// the unsigned involved).
|
||||
int indx = m_index_avail_tracks[ i_with_scrolling];
|
||||
if(indx>=0)
|
||||
{
|
||||
const Track *track = track_manager->getTrack(indx);
|
||||
widget_manager->setWgtText(WTOK_TRACK0+i, track->getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::vector<std::string>& g=track_manager->getAllGroups();
|
||||
widget_manager->setWgtText(WTOK_TRACK0+i, g[-indx-1]);
|
||||
}
|
||||
} // for i
|
||||
m_current_track = -1; // force new display of tracks
|
||||
} // updateScrollPosition
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void TrackSel::switchGroup()
|
||||
{
|
||||
m_index_avail_tracks.clear();
|
||||
bool is_battle_mode = RaceManager::isBattleMode(race_manager->getMinorMode());
|
||||
bool group_available = is_battle_mode
|
||||
? track_manager->getArenasInGroup(user_config->m_track_group).size()>0
|
||||
: track_manager->getTracksInGroup(user_config->m_track_group).size()>0;
|
||||
if(!group_available)
|
||||
user_config->m_track_group = "standard";
|
||||
|
||||
const std::vector<int> &tracks = is_battle_mode
|
||||
? track_manager->getArenasInGroup(user_config->m_track_group)
|
||||
: track_manager->getTracksInGroup(user_config->m_track_group);
|
||||
|
||||
for(unsigned int i=0; i<tracks.size(); i++)
|
||||
{
|
||||
if(!unlock_manager->isLocked(track_manager->getTrack(tracks[i])->getIdent()))
|
||||
{
|
||||
m_index_avail_tracks.push_back(tracks[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Now add the groups, indicated by a negative number as kart index
|
||||
// ----------------------------------------------------------------
|
||||
const std::vector<std::string>& groups=track_manager->getAllGroups();
|
||||
const int group_size = (int)groups.size();
|
||||
for(int i =0; i<group_size; i++)
|
||||
{
|
||||
// Only add groups other than the current one
|
||||
if(groups[i]==user_config->m_track_group) continue;
|
||||
|
||||
// Check if there are any tracks available in this group - i.e. not only locked
|
||||
// tracks, and not only non-arena if arena mode (and vice versa).
|
||||
const std::vector<int> &tracks_in_group = is_battle_mode
|
||||
? track_manager->getArenasInGroup(groups[i])
|
||||
: track_manager->getTracksInGroup(groups[i]);
|
||||
bool ignore_group=true;
|
||||
for(unsigned int j=0; j<tracks_in_group.size(); j++)
|
||||
{
|
||||
const Track *track = track_manager->getTrack(tracks_in_group[j]);
|
||||
// Locked tracks are not available
|
||||
if(unlock_manager->isLocked(track->getIdent())) continue;
|
||||
// Tracks of a different type are not available
|
||||
ignore_group = is_battle_mode != track->isArena();
|
||||
if(!ignore_group) break;
|
||||
}
|
||||
|
||||
if(!ignore_group)
|
||||
m_index_avail_tracks.push_back(-i-1);
|
||||
}
|
||||
if(m_index_avail_tracks.size()>=m_max_entries)
|
||||
{
|
||||
m_offset = 0;
|
||||
widget_manager->showWgtRect(WTOK_DOWN);
|
||||
widget_manager->showWgtText(WTOK_DOWN);
|
||||
widget_manager->showWgtRect(WTOK_UP);
|
||||
widget_manager->showWgtText(WTOK_UP);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Less entries than maximum -> set m_offset to a negative number, so
|
||||
// that the actual existing entries are displayed
|
||||
m_offset = - (int)(1+m_max_entries-m_index_avail_tracks.size())/2;
|
||||
widget_manager->hideWgtRect(WTOK_DOWN);
|
||||
widget_manager->hideWgtText(WTOK_DOWN);
|
||||
widget_manager->hideWgtRect(WTOK_UP);
|
||||
widget_manager->hideWgtText(WTOK_UP);
|
||||
}
|
||||
} // switchGroup
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void TrackSel::displayImages(int selected_track)
|
||||
{
|
||||
if( m_current_track == selected_track) return;
|
||||
m_current_track = selected_track;
|
||||
if(selected_track<0)
|
||||
{
|
||||
widget_manager->hideWgtTexture(WTOK_IMG0);
|
||||
widget_manager->hideWgtTexture(WTOK_IMG1);
|
||||
widget_manager->hideWgtRect(WTOK_IMG0);
|
||||
widget_manager->hideWgtRect(WTOK_IMG1);
|
||||
widget_manager->hideWgtBorder(WTOK_IMG0);
|
||||
widget_manager->hideWgtBorder(WTOK_IMG1);
|
||||
widget_manager->hideWgtRect(WTOK_AUTHOR);
|
||||
widget_manager->hideWgtText(WTOK_AUTHOR);
|
||||
return;
|
||||
}
|
||||
|
||||
// Now we have to display new images
|
||||
// ---------------------------------
|
||||
widget_manager->showWgtBorder(WTOK_IMG0);
|
||||
widget_manager->showWgtBorder(WTOK_IMG1);
|
||||
widget_manager->showWgtRect(WTOK_AUTHOR);
|
||||
widget_manager->showWgtText(WTOK_AUTHOR);
|
||||
|
||||
widget_manager->hideWgtRect(WTOK_AUTHOR);
|
||||
|
||||
const Track* TRACK = track_manager->getTrack(selected_track);
|
||||
bool isAvailable = !unlock_manager->isLocked(TRACK->getIdent());
|
||||
|
||||
if( isAvailable )
|
||||
{
|
||||
|
||||
const std::string& description = TRACK->getDescription();
|
||||
if(description!="")
|
||||
{
|
||||
widget_manager->setWgtText( WTOK_AUTHOR, TRACK->getDescription() );
|
||||
widget_manager->hideWgtRect(WTOK_AUTHOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::ostringstream designedby;
|
||||
designedby<<"Designed by "<<TRACK->getDesigner();
|
||||
widget_manager->setWgtText( WTOK_AUTHOR, designedby.str() );
|
||||
}
|
||||
const std::string& screenshot = TRACK->getScreenshotFile();
|
||||
const std::string& topview = TRACK->getTopviewFile();
|
||||
|
||||
if( !screenshot.empty() && !topview.empty() )
|
||||
{
|
||||
widget_manager->setWgtColor( WTOK_IMG0, WGT_WHITE);
|
||||
widget_manager->showWgtRect( WTOK_IMG0 );
|
||||
widget_manager->setWgtTexture( WTOK_IMG0, screenshot.c_str() );
|
||||
widget_manager->showWgtTexture( WTOK_IMG0 );
|
||||
widget_manager->hideWgtTrack( WTOK_IMG0 );
|
||||
|
||||
widget_manager->setWgtColor( WTOK_IMG1, WGT_WHITE);
|
||||
widget_manager->showWgtRect( WTOK_IMG1 );
|
||||
widget_manager->setWgtTexture( WTOK_IMG1, topview.c_str() );
|
||||
widget_manager->showWgtTexture( WTOK_IMG1 );
|
||||
widget_manager->hideWgtTrack( WTOK_IMG1 );
|
||||
}
|
||||
else if( topview.empty() )
|
||||
{
|
||||
widget_manager->setWgtColor( WTOK_IMG0, WGT_WHITE);
|
||||
widget_manager->showWgtRect( WTOK_IMG0 );
|
||||
widget_manager->setWgtTexture( WTOK_IMG0, screenshot.c_str() );
|
||||
widget_manager->showWgtTexture( WTOK_IMG0 );
|
||||
widget_manager->hideWgtTrack( WTOK_IMG0 );
|
||||
|
||||
widget_manager->hideWgtRect( WTOK_IMG1 );
|
||||
widget_manager->hideWgtTexture( WTOK_IMG1 );
|
||||
widget_manager->setWgtTrackNum( WTOK_IMG1, selected_track );
|
||||
widget_manager->showWgtTrack( WTOK_IMG1 );
|
||||
}
|
||||
else if( screenshot.empty() )
|
||||
{
|
||||
widget_manager->hideWgtRect( WTOK_IMG0 );
|
||||
widget_manager->hideWgtTexture( WTOK_IMG0 );
|
||||
widget_manager->setWgtTrackNum( WTOK_IMG0, selected_track );
|
||||
widget_manager->showWgtTrack( WTOK_IMG0 );
|
||||
|
||||
widget_manager->setWgtColor( WTOK_IMG1, WGT_WHITE);
|
||||
widget_manager->showWgtRect( WTOK_IMG1 );
|
||||
widget_manager->setWgtTexture( WTOK_IMG1, topview.c_str() );
|
||||
widget_manager->showWgtTexture( WTOK_IMG1 );
|
||||
widget_manager->hideWgtTrack( WTOK_IMG1 );
|
||||
}
|
||||
else //if( screenshot.empty() && topview.empty() )
|
||||
{
|
||||
widget_manager->hideWgtRect( WTOK_IMG0 );
|
||||
widget_manager->hideWgtTexture( WTOK_IMG0 );
|
||||
widget_manager->setWgtTrackNum( WTOK_IMG0, selected_track );
|
||||
widget_manager->showWgtTrack( WTOK_IMG0 );
|
||||
|
||||
widget_manager->hideWgtRect( WTOK_IMG1 );
|
||||
widget_manager->hideWgtTexture( WTOK_IMG1 );
|
||||
widget_manager->hideWgtTrack( WTOK_IMG1 );
|
||||
}
|
||||
} // isAvailable
|
||||
} // displayImages
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void TrackSel::update(float dt)
|
||||
{
|
||||
int indx = widget_manager->getSelectedWgt() - WTOK_TRACK0;
|
||||
if(indx<0 || indx >= (int)m_max_entries)
|
||||
{
|
||||
widget_manager->update(dt);
|
||||
return;
|
||||
}
|
||||
|
||||
indx = m_offset + indx;
|
||||
// Don't use modulo here, otherwise (one extreme short lists, e.g. 1 track,
|
||||
// 1 group, the track is selected when hovering over invisible menu entries.
|
||||
// While is necessary, e.g. with two tracks index can be 4, i.e. the
|
||||
// subtraction must be done more than once.
|
||||
while(indx< 0 ) indx += m_index_avail_tracks.size();
|
||||
while(indx>=(int)m_index_avail_tracks.size()) indx -= m_index_avail_tracks.size();
|
||||
if(indx<0 || indx >= (int)m_index_avail_tracks.size())
|
||||
{
|
||||
widget_manager->update(dt);
|
||||
return;
|
||||
}
|
||||
displayImages(m_index_avail_tracks[indx]);
|
||||
widget_manager->update(dt);
|
||||
} // update
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void TrackSel::select()
|
||||
{
|
||||
const int CLICKED_TOKEN = widget_manager->getSelectedWgt();
|
||||
if(CLICKED_TOKEN==WTOK_UP)
|
||||
{
|
||||
m_offset--;
|
||||
if(m_offset < 0) m_offset = (int)m_index_avail_tracks.size() - 1;
|
||||
updateScrollPosition();
|
||||
return;
|
||||
}
|
||||
if(CLICKED_TOKEN==WTOK_DOWN)
|
||||
{
|
||||
m_offset++;
|
||||
if(m_offset >=(int)m_index_avail_tracks.size()) m_offset = 0;
|
||||
updateScrollPosition();
|
||||
return;
|
||||
}
|
||||
unsigned int track_number = CLICKED_TOKEN - WTOK_TRACK0;
|
||||
if(track_number<0 || track_number >= m_max_entries)
|
||||
{
|
||||
return; // not clicked on a track, ignore
|
||||
}
|
||||
track_number = (track_number+m_offset) % (int)m_index_avail_tracks.size();
|
||||
int indx = m_index_avail_tracks[track_number];
|
||||
if(indx<0) // group selected
|
||||
{
|
||||
user_config->m_track_group = track_manager->getAllGroups()[-indx-1];
|
||||
switchGroup();
|
||||
// forces redraw of the model, otherwise (if m_current_kart=0) the new
|
||||
// model would not be displayed.
|
||||
//m_current_kart = -1;
|
||||
updateScrollPosition();
|
||||
return;
|
||||
}
|
||||
|
||||
const Track* TRACK = track_manager->getTrack(m_index_avail_tracks[track_number]);
|
||||
// Only save the last track if it's not in battle mode.
|
||||
if(!RaceManager::isBattleMode(race_manager->getMinorMode()))
|
||||
user_config->m_last_track = TRACK->getIdent();
|
||||
bool isAvailable = !unlock_manager->isLocked(TRACK->getIdent());
|
||||
|
||||
if( isAvailable )
|
||||
{
|
||||
race_manager->setTrack(TRACK->getIdent());
|
||||
menu_manager->pushMenu(MENUID_RACE_OPTIONS);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
widget_manager->showWgtText( CLICKED_TOKEN );
|
||||
widget_manager->setWgtTextColor( CLICKED_TOKEN, WGT_TRANS_GRAY);
|
||||
widget_manager->setWgtColor( CLICKED_TOKEN, WGT_TRANS_GRAY);
|
||||
}
|
||||
} // select
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void TrackSel::handle(GameAction action, int value)
|
||||
{
|
||||
// Forward keypresses to basegui
|
||||
if(value) return BaseGUI::handle(action, value);
|
||||
|
||||
if(action==GA_CURSOR_UP)
|
||||
{
|
||||
m_offset--;
|
||||
if(m_offset < 0) m_offset = (int)m_index_avail_tracks.size() - 1;
|
||||
updateScrollPosition();
|
||||
return;
|
||||
|
||||
} // if cursor up
|
||||
if(action ==GA_CURSOR_DOWN)
|
||||
{
|
||||
m_offset++;
|
||||
if(m_offset >= (int)m_index_avail_tracks.size()) m_offset = 0;
|
||||
updateScrollPosition();
|
||||
return;
|
||||
} // if cursor down
|
||||
BaseGUI::handle(action, value);
|
||||
} // handle
|
||||
/* EOF */
|
@ -1,48 +0,0 @@
|
||||
// $Id$
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2006 SuperTuxKart-Team
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_TRACKSEL_H
|
||||
#define HEADER_TRACKSEL_H
|
||||
|
||||
#include <vector>
|
||||
#include "base_gui.hpp"
|
||||
|
||||
class TrackSel: public BaseGUI
|
||||
{
|
||||
private:
|
||||
unsigned int m_num_entries; // number of entries in scrolling menu
|
||||
int m_offset; // index of first track
|
||||
int m_current_track; // id of current track
|
||||
std::vector<int> m_index_avail_tracks;
|
||||
const static unsigned int m_max_entries = 7;
|
||||
|
||||
int computeIndent(int n) {return 40+abs((int)(m_num_entries-1)/2 - n)*3;}
|
||||
void updateScrollPosition();
|
||||
void switchGroup();
|
||||
void displayImages(int selected_track);
|
||||
public:
|
||||
TrackSel();
|
||||
~TrackSel();
|
||||
|
||||
void update(float dt);
|
||||
virtual void handle(GameAction, int);
|
||||
void select();
|
||||
};
|
||||
|
||||
#endif
|
1750
src/gui/widget.cpp
1750
src/gui/widget.cpp
File diff suppressed because it is too large
Load Diff
@ -1,246 +1,287 @@
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// This code originally from Neverball copyright (C) 2003 Robert Kooima
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_WIDGET_HPP
|
||||
#define HEADER_WIDGET_HPP
|
||||
|
||||
/* This file should only be used directly by the widget manager. Also, all
|
||||
* the coordinates in the widget.* and widget_manager.* are based on OpenGL,
|
||||
* which means that the 0 in the Y-axis is in the bottom, not the top.
|
||||
*/
|
||||
#include <irrlicht.h>
|
||||
#include "ptr_vector.hpp"
|
||||
|
||||
#ifndef HEADER_WIDGET_H
|
||||
#define HEADER_WIDGET_H
|
||||
using namespace irr;
|
||||
using namespace gui;
|
||||
|
||||
// This include strings causes very many warning in the gui subdir:
|
||||
// xlocnum(590) : warning C4312: 'type cast' : conversion from 'uintptr_t' to 'void *' of greater size
|
||||
// These can apparently be removed by removing 64 bit compatibility warnings, or
|
||||
// just disable the warning during the include:
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
# pragma warning(disable:4312)
|
||||
#endif
|
||||
#include <string>
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
# pragma warning(default:4312)
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
# include <OpenGL/gl.h>
|
||||
#else
|
||||
# ifdef WIN32
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
# endif
|
||||
# include <GL/gl.h>
|
||||
#endif
|
||||
#include "gui/font.hpp"
|
||||
#include "user_config.hpp"
|
||||
|
||||
// For widgets with fixed position
|
||||
enum WidgetDirection{ WGT_DIR_FROM_LEFT, WGT_DIR_FROM_RIGHT,
|
||||
WGT_DIR_LEFT_WIDGET, WGT_DIR_RIGHT_WIDGET, WGT_DIR_CENTER,
|
||||
WGT_DIR_FROM_TOP, WGT_DIR_FROM_BOTTOM,
|
||||
WGT_DIR_ABOVE_WIDGET, WGT_DIR_UNDER_WIDGET};
|
||||
|
||||
enum WidgetFontSize { WGT_FNT_SML = 18, WGT_FNT_MED = 24, WGT_FNT_LRG = 30};
|
||||
|
||||
enum WidgetArea //One of the uses of this, is for rounded corners
|
||||
namespace GUIEngine
|
||||
{
|
||||
WGT_AREA_NONE = 0,
|
||||
WGT_AREA_NW = 1, WGT_AREA_SW = 2, WGT_AREA_NE = 4, WGT_AREA_SE = 8,
|
||||
WGT_AREA_LFT = (WGT_AREA_NW | WGT_AREA_SW),
|
||||
WGT_AREA_RGT = (WGT_AREA_NE | WGT_AREA_SE),
|
||||
WGT_AREA_TOP = (WGT_AREA_NW | WGT_AREA_NE),
|
||||
WGT_AREA_BOT = (WGT_AREA_SW | WGT_AREA_SE),
|
||||
WGT_AREA_ALL = (WGT_AREA_TOP | WGT_AREA_BOT)
|
||||
};
|
||||
|
||||
enum WidgetFont
|
||||
{
|
||||
WGT_FONT_GUI,
|
||||
WGT_FONT_RACE
|
||||
};
|
||||
|
||||
//The lowest scroll values here must be bigger than
|
||||
//Widget::MAX_SCROLL or lower than -Widget::MAX_SCROLL
|
||||
enum WidgetScrollPos
|
||||
{
|
||||
//For the X axis
|
||||
WGT_SCROLL_START_LEFT = 2000001,
|
||||
WGT_SCROLL_START_RIGHT = 2000002,
|
||||
WGT_SCROLL_END_LEFT = -2000001,
|
||||
WGT_SCROLL_END_RIGHT = -2000002,
|
||||
//For the Y axis
|
||||
WGT_SCROLL_START_TOP = 1000001,
|
||||
WGT_SCROLL_START_BOTTOM = 1000002,
|
||||
WGT_SCROLL_END_TOP = -1000001,
|
||||
WGT_SCROLL_END_BOTTOM = -1000002,
|
||||
//Works for both axis
|
||||
WGT_SCROLL_CENTER = 3000000
|
||||
};
|
||||
|
||||
//I suggest that you do not use the white or light colors for the rects in
|
||||
//most cases, because they don't have lighter versions that can be used to
|
||||
//highlight those rects and then revert them, for example, when you select a
|
||||
//widget. For textures, you should use WGT_WHITE usually, thought you can get
|
||||
//nice effects by using other colors.
|
||||
extern const GLfloat WGT_WHITE [4];
|
||||
extern const GLfloat WGT_GRAY [4];
|
||||
extern const GLfloat WGT_BLACK [4];
|
||||
extern const GLfloat WGT_YELLOW [4];
|
||||
extern const GLfloat WGT_RED [4];
|
||||
extern const GLfloat WGT_GREEN [4];
|
||||
extern const GLfloat WGT_BLUE [4];
|
||||
extern const GLfloat WGT_TRANS_WHITE [4];
|
||||
extern const GLfloat WGT_TRANS_GRAY [4];
|
||||
extern const GLfloat WGT_TRANS_BLACK [4];
|
||||
extern const GLfloat WGT_TRANS_YELLOW [4];
|
||||
extern const GLfloat WGT_TRANS_RED [4];
|
||||
extern const GLfloat WGT_TRANS_GREEN [4];
|
||||
extern const GLfloat WGT_TRANS_BLUE [4];
|
||||
|
||||
extern const GLfloat WGT_LIGHT_GRAY [4];
|
||||
extern const GLfloat WGT_LIGHT_BLACK [4];
|
||||
extern const GLfloat WGT_LIGHT_YELLOW [4];
|
||||
extern const GLfloat WGT_LIGHT_RED [4];
|
||||
extern const GLfloat WGT_LIGHT_GREEN [4];
|
||||
extern const GLfloat WGT_LIGHT_BLUE [4];
|
||||
extern const GLfloat WGT_LIGHT_TRANS_GRAY [4];
|
||||
extern const GLfloat WGT_LIGHT_TRANS_BLACK [4];
|
||||
extern const GLfloat WGT_LIGHT_TRANS_YELLOW [4];
|
||||
extern const GLfloat WGT_LIGHT_TRANS_RED [4];
|
||||
extern const GLfloat WGT_LIGHT_TRANS_GREEN [4];
|
||||
extern const GLfloat WGT_LIGHT_TRANS_BLUE [4];
|
||||
|
||||
extern const GLfloat WGT_TRANSPARENT [4];
|
||||
|
||||
|
||||
class Widget
|
||||
{
|
||||
//The only class that can access the Widget class is WidgetManager;
|
||||
//they are meant to always be used together, and the widgets should only
|
||||
//be used through the WidgetManager class.
|
||||
friend class WidgetManager;
|
||||
|
||||
/* Basic widget properties that will always be used. */
|
||||
int m_x, m_y;
|
||||
int m_width, m_height;
|
||||
int m_radius;
|
||||
|
||||
/* support for specifying the position of a widget */
|
||||
bool m_fixed_position;
|
||||
WidgetDirection m_horizontal, m_vertical;
|
||||
float m_percentage_x, m_percentage_y;
|
||||
const Widget *m_widget_horizontal,
|
||||
*m_widget_vertical;
|
||||
|
||||
/* Low level features. They are off by default. */
|
||||
bool m_enable_rect;
|
||||
GLuint m_rect_list; //A display list number that draws the rectangle with
|
||||
//possibly rounded corners.
|
||||
const GLfloat *m_rect_color; //This const cannot change the value it points to, but it
|
||||
//can change where it points to.
|
||||
WidgetArea m_round_corners;
|
||||
|
||||
bool m_enable_border;
|
||||
GLuint m_border_list; //Display list for the border
|
||||
float m_border_percentage;
|
||||
const GLfloat *m_border_color;
|
||||
|
||||
bool m_enable_texture;
|
||||
GLuint m_texture;
|
||||
|
||||
bool m_enable_text;
|
||||
std::string m_text;
|
||||
WidgetFontSize m_text_size;
|
||||
Font *m_font;
|
||||
const GLfloat *m_text_color;
|
||||
|
||||
//TODO: This variable exists only to go around a bug; should be removed
|
||||
//after better restructuration.
|
||||
WidgetFont m_curr_widget_font;
|
||||
|
||||
static const int MAX_SCROLL;
|
||||
bool m_enable_scroll;
|
||||
float m_scroll_pos_x;
|
||||
float m_scroll_pos_y;
|
||||
int m_scroll_speed_x;
|
||||
int m_scroll_speed_y;
|
||||
|
||||
bool m_enable_rotation;
|
||||
float m_rotation_angle;
|
||||
int m_rotation_speed;
|
||||
|
||||
|
||||
//The widget calls the Track::drawScaled2D() function to draw a given
|
||||
//track, and m_track_num tells which track to draw.
|
||||
int m_enable_track;
|
||||
int m_track_num;
|
||||
|
||||
/* High level, pattern following features; they deactivate themselves
|
||||
* after they follow their pattern, and might use low level features.*/
|
||||
static const float MAX_TEXT_SCALE;
|
||||
static const float MIN_TEXT_SCALE;
|
||||
float m_text_scale; //Used for the pulse effect
|
||||
|
||||
Widget
|
||||
(
|
||||
const int X_,
|
||||
const int Y_,
|
||||
const int WIDTH_,
|
||||
const int HEIGHT_
|
||||
);
|
||||
~Widget();
|
||||
|
||||
void update(const float DELTA);
|
||||
|
||||
/* Time limited features' functions. */
|
||||
void pulse() {m_text_scale = MAX_TEXT_SCALE;}
|
||||
|
||||
/* Convenience functions. */
|
||||
|
||||
void lightenColor();
|
||||
void darkenColor();
|
||||
|
||||
void setFont( const WidgetFont FONT );
|
||||
void setTexture( const std::string& FILENAME, const bool is_full_path=true );
|
||||
|
||||
/* position support */
|
||||
bool hasFixedPosition() const {return m_fixed_position;}
|
||||
void layout();
|
||||
/* Functions created simply to organize the code */
|
||||
bool createRect();
|
||||
void updateVariables( const float DELTA );
|
||||
void draw();
|
||||
void applyTransformations();
|
||||
public:
|
||||
void setPosition(WidgetDirection horizontal, float percentage_horizontal,
|
||||
WidgetDirection vertical, float percentage_vertical)
|
||||
|
||||
enum WidgetType
|
||||
{
|
||||
setPosition(horizontal, percentage_horizontal, NULL,
|
||||
vertical, percentage_vertical, NULL);
|
||||
}
|
||||
void setPosition(WidgetDirection horizontal, float percentage_horizontal,
|
||||
const Widget *w_hori,
|
||||
WidgetDirection vertical, float percentage_vertical,
|
||||
const Widget *w_verti);
|
||||
void resizeToText(); //This checks if the widget is smaller than the
|
||||
//text, and if so, changes the width and height.
|
||||
WTYPE_NONE = -1,
|
||||
WTYPE_RIBBON,
|
||||
WTYPE_SPINNER,
|
||||
WTYPE_BUTTON,
|
||||
WTYPE_GAUGE,
|
||||
WTYPE_ICON_BUTTON,
|
||||
WTYPE_CHECKBOX,
|
||||
WTYPE_LABEL,
|
||||
WTYPE_MODEL,
|
||||
WTYPE_SPACER,
|
||||
WTYPE_DIV,
|
||||
WTYPE_RIBBON_GRID
|
||||
};
|
||||
|
||||
enum Property
|
||||
{
|
||||
PROP_ID = 100,
|
||||
PROP_PROPORTION,
|
||||
PROP_WIDTH,
|
||||
PROP_HEIGHT,
|
||||
PROP_CHILD_WIDTH,
|
||||
PROP_CHILD_HEIGHT,
|
||||
PROP_WORD_WRAP,
|
||||
PROP_GROW_WITH_TEXT, // yet unused
|
||||
PROP_X,
|
||||
PROP_Y,
|
||||
PROP_LAYOUT,
|
||||
PROP_ALIGN,
|
||||
PROP_TEXT,
|
||||
PROP_ICON,
|
||||
PROP_TEXT_ALIGN,
|
||||
PROP_MIN_VALUE,
|
||||
PROP_MAX_VALUE
|
||||
};
|
||||
|
||||
class Widget
|
||||
{
|
||||
protected:
|
||||
friend class RibbonWidget;
|
||||
friend class Screen;
|
||||
friend class SpinnerWidget;
|
||||
friend class Skin;
|
||||
friend class RibbonGridWidget;
|
||||
|
||||
/**
|
||||
* Can be used in children to indicate whether a widget is selected or not
|
||||
* - in widgets where it makes sense (e.g. ribbon children) and where the
|
||||
* irrLicht widget can not directly contain this state
|
||||
*/
|
||||
bool m_selected;
|
||||
|
||||
/**
|
||||
* Create and add the irrLicht widget(s) associated with this object.
|
||||
* Call after Widget was read from XML file and laid out.
|
||||
*/
|
||||
virtual void add() {}
|
||||
|
||||
/**
|
||||
* called when left/right keys pressed and focus is on widget.
|
||||
* Returns 'true' if main event handler should be notified of a change.
|
||||
* Override in children to be notified of left/right events.
|
||||
*/
|
||||
virtual bool rightPressed() { return false; }
|
||||
virtual bool leftPressed() { return false; }
|
||||
|
||||
/** used when you set parents - see m_parent explainations below.
|
||||
returns whether main event callback should be notified or not */
|
||||
virtual bool transmitEvent(Widget* w, std::string& originator) { return true; }
|
||||
|
||||
/** used when you set eventSupervisors - see m_parent explainations below
|
||||
called when one of a widget's children is hovered.
|
||||
Returns 'true' if main event handler should be notified of a change. */
|
||||
virtual bool mouseHovered(Widget* child) { return false; }
|
||||
|
||||
/** override in children if you need to know when the widget is focused */
|
||||
virtual void focused() {}
|
||||
|
||||
void readCoords(Widget* parent=NULL);
|
||||
|
||||
/**
|
||||
* This is set to NULL by default; set to something else in a child to mean
|
||||
* that events happening on the said child should not go straight into the
|
||||
* event handler. Instead, they will first be passed to m_parent->transmitEvent,
|
||||
* which is usually the parent analysing events from its children.
|
||||
* This is especially useful with logical widgets built with more than
|
||||
* one irrlicht widgets (e.g. Spinner, Ribbon)
|
||||
*/
|
||||
Widget* m_parent;
|
||||
|
||||
static bool convertToCoord(std::string& x, int* absolute, int* percentage);
|
||||
public:
|
||||
virtual ~Widget() {}
|
||||
|
||||
/**
|
||||
* If this widget has any children, they go here. Children can be either
|
||||
* specified in the XML file (e.g. Ribbon or Div children), or can also
|
||||
* be created automatically for logical widgets built with more than
|
||||
* one irrlicht widgets (e.g. Spinner)
|
||||
*/
|
||||
ptr_vector<Widget> m_children;
|
||||
|
||||
/** Type of this widget */
|
||||
WidgetType m_type;
|
||||
|
||||
/** coordinates of the widget */
|
||||
int x, y, w, h;
|
||||
|
||||
/** numerical ID used by irrLicht to identify this widget
|
||||
* (not the same as the string identificator specified in the XML file)
|
||||
*/
|
||||
int id;
|
||||
|
||||
/**
|
||||
* IrrLicht widget created to represent this object.
|
||||
*/
|
||||
IGUIElement* m_element;
|
||||
|
||||
/** A map that holds values for all specified widget properties (in the XML file)*/
|
||||
std::map<Property, std::string> m_properties;
|
||||
|
||||
|
||||
Widget();
|
||||
|
||||
};
|
||||
static void resetIDCounters();
|
||||
|
||||
bool isSelected() const { return m_selected; }
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
class ButtonWidget : public Widget
|
||||
{
|
||||
void add();
|
||||
public:
|
||||
virtual ~ButtonWidget() {}
|
||||
};
|
||||
|
||||
class LabelWidget : public Widget
|
||||
{
|
||||
void add();
|
||||
public:
|
||||
virtual ~LabelWidget() {}
|
||||
};
|
||||
|
||||
class CheckBoxWidget : public Widget
|
||||
{
|
||||
void add();
|
||||
public:
|
||||
virtual ~CheckBoxWidget() {}
|
||||
};
|
||||
|
||||
|
||||
/* EOF */
|
||||
class GaugeWidget : public Widget
|
||||
{
|
||||
void add();
|
||||
public:
|
||||
virtual ~GaugeWidget() {}
|
||||
};
|
||||
|
||||
class SpinnerWidget : public Widget
|
||||
{
|
||||
int m_value, m_min, m_max;
|
||||
std::vector<std::string> m_labels;
|
||||
bool m_graphical;
|
||||
|
||||
bool transmitEvent(Widget* w, std::string& originator);
|
||||
bool rightPressed();
|
||||
bool leftPressed();
|
||||
void add();
|
||||
public:
|
||||
virtual ~SpinnerWidget() {}
|
||||
void setValue(const int new_value);
|
||||
void addLabel(std::string label);
|
||||
};
|
||||
|
||||
class IconButtonWidget : public Widget
|
||||
{
|
||||
bool clickable;
|
||||
void add();
|
||||
public:
|
||||
virtual ~IconButtonWidget() {}
|
||||
IconButtonWidget(const bool clickable=true);
|
||||
};
|
||||
|
||||
enum RibbonType
|
||||
{
|
||||
RIBBON_COMBO, /* select one item out of many, like in a combo box */
|
||||
RIBBON_TOOLBAR, /* a row of individual buttons */
|
||||
RIBBON_TABS /* a tab bar */
|
||||
};
|
||||
|
||||
class RibbonWidget : public Widget
|
||||
{
|
||||
friend class RibbonGridWidget;
|
||||
friend class Screen;
|
||||
|
||||
int m_selection;
|
||||
RibbonType m_ribbon_type;
|
||||
|
||||
void add();
|
||||
|
||||
bool rightPressed();
|
||||
bool leftPressed();
|
||||
bool mouseHovered(Widget* child);
|
||||
|
||||
void updateSelection();
|
||||
bool transmitEvent(Widget* w, std::string& originator);
|
||||
void focused();
|
||||
public:
|
||||
virtual ~RibbonWidget() {}
|
||||
|
||||
int getSelection() const { return m_selection; }
|
||||
RibbonType getRibbonType() const { return m_ribbon_type; }
|
||||
const std::string& getSelectionName() { return m_children[m_selection].m_properties[PROP_ID]; }
|
||||
|
||||
RibbonWidget(const RibbonType type=RIBBON_COMBO);
|
||||
};
|
||||
|
||||
struct ItemDescription
|
||||
{
|
||||
std::string m_user_name;
|
||||
std::string m_code_name;
|
||||
std::string m_sshot_file;
|
||||
};
|
||||
|
||||
class RibbonGridWidget : public Widget
|
||||
{
|
||||
friend class RibbonWidget;
|
||||
|
||||
virtual ~RibbonGridWidget() {}
|
||||
|
||||
/* reference pointers only, the actual instances are owned by m_children */
|
||||
ptr_vector<RibbonWidget, REF> m_rows;
|
||||
|
||||
std::vector<ItemDescription> m_items;
|
||||
IGUIStaticText* m_label;
|
||||
RibbonWidget* getSelectedRibbon() const;
|
||||
RibbonWidget* getRowContaining(Widget* w) const;
|
||||
|
||||
void updateLabel(RibbonWidget* from_this_ribbon=NULL);
|
||||
|
||||
void propagateSelection();
|
||||
void focused();
|
||||
|
||||
bool transmitEvent(Widget* w, std::string& originator);
|
||||
|
||||
void scroll(const int x_delta);
|
||||
|
||||
int m_scroll_offset;
|
||||
int m_needed_cols;
|
||||
int m_col_amount;
|
||||
|
||||
bool m_has_label;
|
||||
|
||||
/* reference pointers only, the actual instances are owned by m_children */
|
||||
Widget* m_left_widget;
|
||||
Widget* m_right_widget;
|
||||
public:
|
||||
RibbonGridWidget();
|
||||
|
||||
void add();
|
||||
bool rightPressed();
|
||||
bool leftPressed();
|
||||
|
||||
void addItem( std::string user_name, std::string code_name, std::string image_file );
|
||||
void updateItemDisplay();
|
||||
|
||||
bool mouseHovered(Widget* child);
|
||||
|
||||
const std::string& getSelectionName();
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -1,382 +0,0 @@
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// This code originally from Neverball copyright (C) 2003 Robert Kooima
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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_WIDGET_MANAGER_H
|
||||
#define HEADER_WIDGET_MANAGER_H
|
||||
|
||||
#include "widget.hpp"
|
||||
#include <vector>
|
||||
|
||||
|
||||
/* Big-picture instructions: the extern widget_manager is a global interface
|
||||
* to the class. Call add*Wgt() to insert new widgets, and change details
|
||||
* using the 'switch features'. By default no feature besides the one for
|
||||
* each widget type are enabled.
|
||||
*
|
||||
* After you defined the entire screen, call layout(), that creates and
|
||||
* places the widgets. Call the activated functions during the time the
|
||||
* widgets are alive, and make sure that update() is called each frame.
|
||||
*
|
||||
* To remove the widgets, you have to call reset().
|
||||
*/
|
||||
|
||||
class WidgetManager
|
||||
{
|
||||
struct WidgetID
|
||||
{
|
||||
int token;
|
||||
bool active; //If true, then this widget is interactive(though by
|
||||
//definition, widgets are supposed to be interactive).
|
||||
|
||||
//The percentages for the widget's rect
|
||||
int min_width;
|
||||
int min_height;
|
||||
int min_radius;
|
||||
|
||||
//The last given preset scroll position is stored, to restore it in
|
||||
//case that the text is changed it needs to be restored.
|
||||
WidgetScrollPos last_preset_scroll_x;
|
||||
WidgetScrollPos last_preset_scroll_y;
|
||||
|
||||
bool resize_to_text; //This has to do with layout, so it shouldn't
|
||||
//inside the Widget class, even thought
|
||||
//conceptually most people will asociate it with
|
||||
//text
|
||||
|
||||
Widget *widget;
|
||||
};
|
||||
|
||||
enum ElementTypes
|
||||
{
|
||||
ET_WGT,
|
||||
ET_BREAK,
|
||||
ET_SWITCH //Switch orientation
|
||||
};
|
||||
|
||||
/* I decided to waste one integer per break/switch with the pos
|
||||
* variable inside the WidgetElement struct, since otherwise we
|
||||
* would need 2 vectors for breaks and columns, which would use more
|
||||
* memory, be slower and more complex than this; another approach
|
||||
* is to use classes for each ElementType, but this most likely will also
|
||||
* waste more resources. -Coz
|
||||
*/
|
||||
struct WidgetElement
|
||||
{
|
||||
ElementTypes type;
|
||||
int pos; //If the element is a widget, the position of the widget
|
||||
//in it's vector
|
||||
|
||||
WidgetElement(ElementTypes _type, int _pos):type(_type), pos(_pos){};
|
||||
};
|
||||
|
||||
std::vector<WidgetElement> m_elems;
|
||||
std::vector<WidgetID> m_widgets;
|
||||
|
||||
WidgetArea m_prev_layout_pos;
|
||||
|
||||
int m_x;
|
||||
int m_y;
|
||||
|
||||
int m_selected_wgt_token;
|
||||
bool m_selection_change;
|
||||
|
||||
bool m_default_active;
|
||||
bool m_default_resize_to_text;
|
||||
|
||||
bool m_default_show_rect;
|
||||
WidgetArea m_default_rect_round_corners;
|
||||
int m_default_rect_radius;
|
||||
const GLfloat *m_default_rect_color;
|
||||
|
||||
bool m_default_show_border;
|
||||
float m_default_border_percentage;
|
||||
const GLfloat *m_default_border_color;
|
||||
|
||||
bool m_default_show_texture;
|
||||
int m_default_texture;
|
||||
|
||||
bool m_default_show_text;
|
||||
std::string m_default_text;
|
||||
WidgetFontSize m_default_text_size;
|
||||
WidgetFont m_default_font;
|
||||
const GLfloat* m_default_text_color;
|
||||
|
||||
bool m_default_enable_scroll;
|
||||
WidgetScrollPos m_default_scroll_preset_x;
|
||||
WidgetScrollPos m_default_scroll_preset_y;
|
||||
int m_default_scroll_x_speed;
|
||||
int m_default_scroll_y_speed;
|
||||
|
||||
bool m_default_enable_rotation;
|
||||
float m_default_rotation_angle;
|
||||
int m_default_rotation_speed;
|
||||
|
||||
int m_default_show_track;
|
||||
int m_default_track_num;
|
||||
public:
|
||||
int findId(const int TOKEN) const;
|
||||
private:
|
||||
|
||||
int calcLineWidth( const int POS );
|
||||
int calcLineHeight( const int POS );
|
||||
int calcColumnWidth( const int POS );
|
||||
int calcColumnHeight( const int POS );
|
||||
|
||||
//These get* functions return the same thing as the above functions, but
|
||||
//they modify pos and set it to the position of the last element
|
||||
int getLineWidth( int& pos);
|
||||
int getLineHeight( int& pos );
|
||||
int getColumnWidth( int& pos );
|
||||
int getColumnHeight( int& pos );
|
||||
|
||||
int calcLineX( const int POS );
|
||||
int calcColumnX( const int POS );
|
||||
|
||||
int calcWidth();
|
||||
int calcHeight();
|
||||
|
||||
bool layoutLine( int& x, int& y, int& pos );
|
||||
bool layoutColumn( int& x, int& y, int& pos );
|
||||
|
||||
int findLeftWidget(const int START_WGT) const;
|
||||
int findRightWidget(const int START_WGT) const;
|
||||
int findTopWidget(const int START_WGT) const;
|
||||
int findBottomWidget(const int START_WGT) const;
|
||||
|
||||
int handleFinish(const int);
|
||||
|
||||
void setSelectedWgtToken(const int TOKEN);
|
||||
|
||||
public:
|
||||
//TODO: remove return values that we don't check
|
||||
static const int WGT_NONE;
|
||||
|
||||
WidgetManager();
|
||||
~WidgetManager();
|
||||
|
||||
bool isEmpty() { return m_widgets.empty(); }
|
||||
|
||||
Widget *addWgt
|
||||
(
|
||||
const int TOKEN, //A number that names the widget.
|
||||
const int MIN_WIDTH, //These values are percentages not pixels. 100%
|
||||
//is the whole screen.
|
||||
const int MIN_HEIGHT
|
||||
);
|
||||
|
||||
bool breakLine();
|
||||
void switchOrder(); //This changes the orientation from horizontal to
|
||||
//vertical. It's reverted at line breaks. There are
|
||||
//no situations where you cannot use a switch order
|
||||
//so it should always succeed.
|
||||
|
||||
void reset();
|
||||
|
||||
void update(const float DELTA);
|
||||
|
||||
bool layout(); //This calls the other layout() function with the
|
||||
//POSITION given to the previous call to any of the two
|
||||
//layout functions. Besides the conditions under the other
|
||||
//layour() function fails, itm ay also fail if no previous
|
||||
//call to the layout(POSITION) function has been done.
|
||||
bool layout( const WidgetArea POSITION );
|
||||
|
||||
//TODO: make all get functions const
|
||||
int getSelectedWgt() const { return m_selected_wgt_token; }
|
||||
void setSelectedWgt(const int TOKEN);
|
||||
|
||||
/** Checks if the selected widget changed since the last call to update() */
|
||||
bool selectionChanged() const { return m_selection_change; }
|
||||
|
||||
/** Forces the changed selection mode. */
|
||||
void setSelectionChanged() { m_selection_change = true; }
|
||||
|
||||
/* Macro functions. They are widgets with special predefined values. */
|
||||
|
||||
//FIXME: Temporal, till I rename addWgt() to addEmptyWgt()
|
||||
Widget *addEmptyWgt (const int TOKEN, const int MIN_WIDTH,
|
||||
const int MIN_HEIGHT) {return addWgt(TOKEN,MIN_WIDTH,MIN_HEIGHT);}
|
||||
|
||||
//Widget that adds visible rect & text, rounded corners with 20% radius,
|
||||
//sets the text, and large font
|
||||
Widget *addTitleWgt (const int TOKEN, const int MIN_WIDTH,
|
||||
const int MIN_HEIGHT, const std::string TEXT);
|
||||
|
||||
//Widget that adds visible rect & text, rounded corners with 20% radius,
|
||||
//and sets the text
|
||||
Widget *addTextWgt (const int TOKEN, const int MIN_WIDTH,
|
||||
const int MIN_HEIGHT, const std::string TEXT);
|
||||
|
||||
//Widget that adds visible rect & text, rounded corners with 20% radius,
|
||||
//sets the text and is selectable
|
||||
Widget *addTextButtonWgt(const int TOKEN, const int MIN_WIDTH,
|
||||
const int MIN_HEIGHT, const std::string TEXT);
|
||||
|
||||
//Widget that adds visible rect & image, white rect, 5% black
|
||||
//border, and sets the texture
|
||||
Widget *addImgWgt (const int TOKEN, const int MIN_WIDTH,
|
||||
const int MIN_HEIGHT, const int IMG);
|
||||
Widget *addImgWgt (const int TOKEN, const int MIN_WIDTH,
|
||||
const int MIN_HEIGHT, const char* FILENAME);
|
||||
|
||||
//Selectable widget with visible rect & image, rounded corners with 20% radius,
|
||||
//gray rect and texture
|
||||
Widget *addImgButtonWgt (const int TOKEN, const int MIN_WIDTH,
|
||||
const int MIN_HEIGHT, const int IMG);
|
||||
Widget *addImgButtonWgt (const int TOKEN, const int MIN_WIDTH,
|
||||
const int MIN_HEIGHT,const std::string& FILENAME);
|
||||
|
||||
/* On/off widget switch features. They are all disabled/hidden initially. */
|
||||
void setInitialActivationState( const bool ACTIVE);
|
||||
|
||||
void setInitialRectState(const bool SHOW,const WidgetArea ROUND_CORNERS,
|
||||
const int RADIUS,const GLfloat* const COLOR);
|
||||
|
||||
void setInitialTextureState(const bool SHOW, const int TEXTURE );
|
||||
|
||||
void setInitialBorderState
|
||||
(
|
||||
const bool SHOW,
|
||||
const int PERCENTAGE,
|
||||
const GLfloat* const COLOR
|
||||
);
|
||||
|
||||
void setInitialTextState
|
||||
(
|
||||
const bool SHOW,
|
||||
const std::string TEXT,
|
||||
const WidgetFontSize SIZE,
|
||||
const WidgetFont FONT,
|
||||
const GLfloat* const COLOR,
|
||||
const bool RESIZE_WGT
|
||||
);
|
||||
|
||||
void setInitialScrollState
|
||||
(
|
||||
const bool ENABLE,
|
||||
const WidgetScrollPos X_POS,
|
||||
const WidgetScrollPos Y_POS,
|
||||
const int X_SPEED,
|
||||
const int Y_SPEED
|
||||
);
|
||||
|
||||
void setInitialRotationState
|
||||
(
|
||||
const bool ENABLE,
|
||||
const float ANGLE,
|
||||
const int SPEED
|
||||
);
|
||||
|
||||
|
||||
void setInitialTrackState
|
||||
(
|
||||
const bool SHOW,
|
||||
const int TRACK
|
||||
);
|
||||
|
||||
void restoreDefaultStates();
|
||||
|
||||
void activateWgt(const int TOKEN);
|
||||
void deactivateWgt(const int TOKEN);
|
||||
|
||||
//FIXME: maybe this should be setWgtRectColor ? and put after the other rect funcs?
|
||||
void setWgtColor(const int TOKEN, const GLfloat* const COLOR);
|
||||
void setWgtRoundCorners(const int TOKEN, const WidgetArea CORNERS);
|
||||
//The radius given is the percentage of the height or the width of the
|
||||
//widget, whatever is smaller; however, the maximum is 50% (the corner's
|
||||
//size).
|
||||
void setWgtCornerRadius(const int TOKEN, const int RADIUS);
|
||||
void showWgtRect(const int TOKEN);
|
||||
// Completely hide and show a widget
|
||||
void hideWgt(const int t) {hideWgtRect(t); hideWgtText(t);}
|
||||
void hideWgt(int t0, int t2) {for(int i=t0; i<=t2; hideWgt(i++));}
|
||||
void showWgt(const int t) {showWgtRect(t); showWgtText(t);}
|
||||
void showWgt(int t0, int t2) {for(int i=t0; i<=t2; showWgt(i++));}
|
||||
void hideWgtRect(const int TOKEN);
|
||||
|
||||
void setWgtBorderColor(const int TOKEN, const GLfloat* const COLOR);
|
||||
void setWgtBorderPercentage(const int TOKEN, const int PERCENTAGE);
|
||||
void showWgtBorder(const int TOKEN);
|
||||
void hideWgtBorder(const int TOKEN);
|
||||
//TODO: add initial border colors, if I don't erase those functions.
|
||||
|
||||
void setWgtTexture(const int TOKEN, const int TEXTURE);
|
||||
void setWgtTexture(const int TOKEN, const std::string& FILENAME, const bool is_full_path=true);
|
||||
void setWgtLockTexture(const int token) {setWgtTexture(token, "gui_lock.rgb", false);}
|
||||
void showWgtTexture(const int TOKEN);
|
||||
void hideWgtTexture(const int TOKEN);
|
||||
|
||||
void setWgtText( const int TOKEN, const char* TEXT );
|
||||
void setWgtText( const int TOKEN, const std::string TEXT );
|
||||
void setWgtTextSize( const int TOKEN, const WidgetFontSize SIZE );
|
||||
void setWgtFont( const int TOKEN, const WidgetFont FONT );
|
||||
void setWgtTextColor( const int TOKEN, const GLfloat* const COLOR );
|
||||
void setWgtResizeToText( const int TOKEN, const bool RESIZE );
|
||||
void showWgtText( const int TOKEN );
|
||||
void hideWgtText( const int TOKEN );
|
||||
void resizeWgtToText( const int TOKEN );
|
||||
void reloadFonts();
|
||||
|
||||
//FIXME: change to enableWgtScrolling, since it enables or disables
|
||||
//FIXME: maybe all that enabling the scrolling should do, is to allow
|
||||
//players to lower/raise it?
|
||||
//only the scrolling movement, not setting the scrolling position.
|
||||
void enableWgtScroll( const int TOKEN );
|
||||
void disableWgtScroll( const int TOKEN );
|
||||
void setWgtXScrollPos( const int TOKEN, const WidgetScrollPos POS );
|
||||
void setWgtYScrollPos( const int TOKEN, const WidgetScrollPos POS );
|
||||
void setWgtXScrollSpeed( const int TOKEN, const int SPEED );
|
||||
void setWgtYScrollSpeed( const int TOKEN, const int SPEED );
|
||||
|
||||
void enableWgtRotation( const int TOKEN );
|
||||
void disableWgtRotation( const int TOKEN );
|
||||
void setWgtRotationAngle( const int TOKEN, const float ANGLE );
|
||||
void setWgtRotationSpeed( const int TOKEN, const int SPEED );
|
||||
|
||||
void showWgtTrack( const int TOKEN );
|
||||
void hideWgtTrack( const int TOKEN );
|
||||
void setWgtTrackNum( const int TOKEN, const int TRACK );
|
||||
|
||||
/* Activated widget features. */
|
||||
void pulseWgt( const int TOKEN ) const;
|
||||
|
||||
/* Convenience widget functions. */
|
||||
void lightenWgtColor(const int TOKEN);
|
||||
void darkenWgtColor(const int TOKEN);
|
||||
|
||||
/* Input device handling. */
|
||||
int handlePointer( const int X, const int Y );
|
||||
int handleLeft();
|
||||
int handleRight();
|
||||
int handleUp();
|
||||
int handleDown();
|
||||
|
||||
/* Scrolling modification. */
|
||||
void increaseScrollSpeed(bool = false);
|
||||
void decreaseScrollSpeed(bool = false);
|
||||
void setPosition(const int token,
|
||||
WidgetDirection hori, float percentage_x,
|
||||
WidgetDirection verti, float percentage_y);
|
||||
void sameWidth(int widget_min, int widget_max);
|
||||
};
|
||||
|
||||
extern WidgetManager *widget_manager;
|
||||
|
||||
#endif
|
||||
|
||||
/* EOF */
|
@ -12,9 +12,17 @@
|
||||
950557580F6968860056E88C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 950557570F6968860056E88C /* Carbon.framework */; };
|
||||
950557600F6968A50056E88C /* QuickTime.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9505575F0F6968A50056E88C /* QuickTime.framework */; };
|
||||
950557650F6968BE0056E88C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 950557640F6968BE0056E88C /* IOKit.framework */; };
|
||||
950557860F696A900056E88C /* engine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9505577A0F696A900056E88C /* engine.cpp */; };
|
||||
950557870F696A900056E88C /* my_button.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9505577C0F696A900056E88C /* my_button.cpp */; };
|
||||
950557880F696A900056E88C /* screen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9505577F0F696A900056E88C /* screen.cpp */; };
|
||||
950557890F696A900056E88C /* screen_loader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 950557810F696A900056E88C /* screen_loader.cpp */; };
|
||||
9505578A0F696A900056E88C /* skin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 950557820F696A900056E88C /* skin.cpp */; };
|
||||
9505578B0F696A900056E88C /* widget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 950557840F696A900056E88C /* widget.cpp */; };
|
||||
953EAAAF0F30A4220000D57D /* terrain_info.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 953EAAAE0F30A4220000D57D /* terrain_info.cpp */; };
|
||||
953EAAB20F30A4410000D57D /* triangle_mesh.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 953EAAB10F30A4410000D57D /* triangle_mesh.cpp */; };
|
||||
953EAAB60F30A4650000D57D /* translation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 953EAAB50F30A4650000D57D /* translation.cpp */; };
|
||||
95C1E3F20F699079005D33E6 /* race_gui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C1E3F10F699079005D33E6 /* race_gui.cpp */; };
|
||||
95C1E4000F699427005D33E6 /* font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C1E3FF0F699427005D33E6 /* font.cpp */; };
|
||||
95C2B1F70F296546000D3E5D /* actionmap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AC210F296540000D3E5D /* actionmap.cpp */; };
|
||||
95C2B1FB0F296546000D3E5D /* music_information.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AC280F296540000D3E5D /* music_information.cpp */; };
|
||||
95C2B1FC0F296546000D3E5D /* music_ogg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AC2A0F296540000D3E5D /* music_ogg.cpp */; };
|
||||
@ -136,36 +144,6 @@
|
||||
95C2B2FA0F296546000D3E5D /* explosion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AE740F296542000D3E5D /* explosion.cpp */; };
|
||||
95C2B3030F296546000D3E5D /* grand_prix_data.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AE7F0F296542000D3E5D /* grand_prix_data.cpp */; };
|
||||
95C2B3060F296546000D3E5D /* grand_prix_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AE830F296542000D3E5D /* grand_prix_manager.cpp */; };
|
||||
95C2B3100F296546000D3E5D /* base_gui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AE970F296542000D3E5D /* base_gui.cpp */; };
|
||||
95C2B3110F296546000D3E5D /* challenges_menu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AE990F296542000D3E5D /* challenges_menu.cpp */; };
|
||||
95C2B3120F296546000D3E5D /* char_sel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AE9B0F296542000D3E5D /* char_sel.cpp */; };
|
||||
95C2B3130F296546000D3E5D /* config_controls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AE9D0F296542000D3E5D /* config_controls.cpp */; };
|
||||
95C2B3140F296546000D3E5D /* config_display.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AE9F0F296542000D3E5D /* config_display.cpp */; };
|
||||
95C2B3150F296546000D3E5D /* config_sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEA10F296542000D3E5D /* config_sound.cpp */; };
|
||||
95C2B3160F296546000D3E5D /* credits_menu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEA30F296542000D3E5D /* credits_menu.cpp */; };
|
||||
95C2B3170F296546000D3E5D /* display_res_confirm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEA50F296542000D3E5D /* display_res_confirm.cpp */; };
|
||||
95C2B3180F296546000D3E5D /* feature_unlocked.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEA70F296542000D3E5D /* feature_unlocked.cpp */; };
|
||||
95C2B3190F296546000D3E5D /* font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEA90F296542000D3E5D /* font.cpp */; };
|
||||
95C2B31A0F296546000D3E5D /* game_mode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEAB0F296542000D3E5D /* game_mode.cpp */; };
|
||||
95C2B31B0F296546000D3E5D /* grand_prix_ending.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEAD0F296542000D3E5D /* grand_prix_ending.cpp */; };
|
||||
95C2B31C0F296546000D3E5D /* grand_prix_select.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEAF0F296542000D3E5D /* grand_prix_select.cpp */; };
|
||||
95C2B31D0F296546000D3E5D /* help_page_one.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEB10F296542000D3E5D /* help_page_one.cpp */; };
|
||||
95C2B31E0F296546000D3E5D /* help_page_three.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEB30F296542000D3E5D /* help_page_three.cpp */; };
|
||||
95C2B31F0F296546000D3E5D /* help_page_two.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEB50F296542000D3E5D /* help_page_two.cpp */; };
|
||||
95C2B3200F296546000D3E5D /* main_menu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEB70F296542000D3E5D /* main_menu.cpp */; };
|
||||
95C2B3210F296546000D3E5D /* menu_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEB90F296542000D3E5D /* menu_manager.cpp */; };
|
||||
95C2B3220F296546000D3E5D /* network_gui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEBB0F296542000D3E5D /* network_gui.cpp */; };
|
||||
95C2B3230F296546000D3E5D /* num_players.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEBD0F296542000D3E5D /* num_players.cpp */; };
|
||||
95C2B3240F296546000D3E5D /* options.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEBF0F296542000D3E5D /* options.cpp */; };
|
||||
95C2B3250F296546000D3E5D /* player_controls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEC10F296542000D3E5D /* player_controls.cpp */; };
|
||||
95C2B3260F296546000D3E5D /* race_gui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEC30F296542000D3E5D /* race_gui.cpp */; };
|
||||
95C2B3270F296546000D3E5D /* race_menu.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEC50F296542000D3E5D /* race_menu.cpp */; };
|
||||
95C2B3280F296546000D3E5D /* race_options.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEC70F296542000D3E5D /* race_options.cpp */; };
|
||||
95C2B3290F296546000D3E5D /* race_results_gui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEC90F296542000D3E5D /* race_results_gui.cpp */; };
|
||||
95C2B32A0F296546000D3E5D /* start_race_feedback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AECB0F296542000D3E5D /* start_race_feedback.cpp */; };
|
||||
95C2B32B0F296546000D3E5D /* track_sel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AECD0F296542000D3E5D /* track_sel.cpp */; };
|
||||
95C2B32C0F296546000D3E5D /* widget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AECF0F296542000D3E5D /* widget.cpp */; };
|
||||
95C2B32D0F296546000D3E5D /* widget_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AED10F296542000D3E5D /* widget_manager.cpp */; };
|
||||
95C2B3310F296546000D3E5D /* highscore_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AED60F296542000D3E5D /* highscore_manager.cpp */; };
|
||||
95C2B3330F296546000D3E5D /* highscores.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AED90F296542000D3E5D /* highscores.cpp */; };
|
||||
95C2B3350F296546000D3E5D /* history.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95C2AEDC0F296542000D3E5D /* history.cpp */; };
|
||||
@ -270,6 +248,18 @@
|
||||
950557570F6968860056E88C /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
|
||||
9505575F0F6968A50056E88C /* QuickTime.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickTime.framework; path = /System/Library/Frameworks/QuickTime.framework; sourceTree = "<absolute>"; };
|
||||
950557640F6968BE0056E88C /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; };
|
||||
9505577A0F696A900056E88C /* engine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = engine.cpp; path = games/supertuxkart/src/gui/engine.cpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
9505577B0F696A900056E88C /* engine.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = engine.hpp; path = games/supertuxkart/src/gui/engine.hpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
9505577C0F696A900056E88C /* my_button.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = my_button.cpp; path = games/supertuxkart/src/gui/my_button.cpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
9505577D0F696A900056E88C /* my_button.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = my_button.hpp; path = games/supertuxkart/src/gui/my_button.hpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
9505577E0F696A900056E88C /* ptr_vector.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = ptr_vector.hpp; path = games/supertuxkart/src/gui/ptr_vector.hpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
9505577F0F696A900056E88C /* screen.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = screen.cpp; path = games/supertuxkart/src/gui/screen.cpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
950557800F696A900056E88C /* screen.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = screen.hpp; path = games/supertuxkart/src/gui/screen.hpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
950557810F696A900056E88C /* screen_loader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = screen_loader.cpp; path = games/supertuxkart/src/gui/screen_loader.cpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
950557820F696A900056E88C /* skin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = skin.cpp; path = games/supertuxkart/src/gui/skin.cpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
950557830F696A900056E88C /* skin.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = skin.hpp; path = games/supertuxkart/src/gui/skin.hpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
950557840F696A900056E88C /* widget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = widget.cpp; path = games/supertuxkart/src/gui/widget.cpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
950557850F696A900056E88C /* widget.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = widget.hpp; path = games/supertuxkart/src/gui/widget.hpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
951F96810F29670C00E1AC66 /* SuperTuxKart */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = SuperTuxKart; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
953EAAAD0F30A4220000D57D /* terrain_info.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = terrain_info.hpp; path = ../../tracks/terrain_info.hpp; sourceTree = SOURCE_ROOT; };
|
||||
953EAAAE0F30A4220000D57D /* terrain_info.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = terrain_info.cpp; path = ../../tracks/terrain_info.cpp; sourceTree = SOURCE_ROOT; };
|
||||
@ -277,6 +267,10 @@
|
||||
953EAAB10F30A4410000D57D /* triangle_mesh.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = triangle_mesh.cpp; path = ../../physics/triangle_mesh.cpp; sourceTree = SOURCE_ROOT; };
|
||||
953EAAB40F30A4650000D57D /* translation.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = translation.hpp; path = ../../utils/translation.hpp; sourceTree = SOURCE_ROOT; };
|
||||
953EAAB50F30A4650000D57D /* translation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = translation.cpp; path = ../../utils/translation.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C1E3EB0F698F23005D33E6 /* race_gui.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = race_gui.hpp; path = games/supertuxkart/src/gui/race_gui.hpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
95C1E3F10F699079005D33E6 /* race_gui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = race_gui.cpp; path = games/supertuxkart/src/gui/race_gui.cpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
95C1E3FF0F699427005D33E6 /* font.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = font.cpp; path = games/supertuxkart/src/gui/font.cpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
95C1E4020F69943D005D33E6 /* font.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = font.hpp; path = games/supertuxkart/src/gui/font.hpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
95C2AC210F296540000D3E5D /* actionmap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = actionmap.cpp; path = ../../actionmap.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AC220F296540000D3E5D /* actionmap.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = actionmap.hpp; path = ../../actionmap.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AC270F296540000D3E5D /* music.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = music.hpp; path = ../../audio/music.hpp; sourceTree = SOURCE_ROOT; };
|
||||
@ -567,66 +561,6 @@
|
||||
95C2AE800F296542000D3E5D /* grand_prix_data.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = grand_prix_data.hpp; path = ../../grand_prix_data.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AE830F296542000D3E5D /* grand_prix_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = grand_prix_manager.cpp; path = ../../grand_prix_manager.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AE840F296542000D3E5D /* grand_prix_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = grand_prix_manager.hpp; path = ../../grand_prix_manager.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AE970F296542000D3E5D /* base_gui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = base_gui.cpp; path = ../../gui/base_gui.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AE980F296542000D3E5D /* base_gui.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = base_gui.hpp; path = ../../gui/base_gui.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AE990F296542000D3E5D /* challenges_menu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = challenges_menu.cpp; path = ../../gui/challenges_menu.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AE9A0F296542000D3E5D /* challenges_menu.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = challenges_menu.hpp; path = ../../gui/challenges_menu.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AE9B0F296542000D3E5D /* char_sel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = char_sel.cpp; path = ../../gui/char_sel.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AE9C0F296542000D3E5D /* char_sel.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = char_sel.hpp; path = ../../gui/char_sel.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AE9D0F296542000D3E5D /* config_controls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = config_controls.cpp; path = ../../gui/config_controls.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AE9E0F296542000D3E5D /* config_controls.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = config_controls.hpp; path = ../../gui/config_controls.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AE9F0F296542000D3E5D /* config_display.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = config_display.cpp; path = ../../gui/config_display.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEA00F296542000D3E5D /* config_display.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = config_display.hpp; path = ../../gui/config_display.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEA10F296542000D3E5D /* config_sound.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = config_sound.cpp; path = ../../gui/config_sound.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEA20F296542000D3E5D /* config_sound.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = config_sound.hpp; path = ../../gui/config_sound.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEA30F296542000D3E5D /* credits_menu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = credits_menu.cpp; path = ../../gui/credits_menu.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEA40F296542000D3E5D /* credits_menu.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = credits_menu.hpp; path = ../../gui/credits_menu.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEA50F296542000D3E5D /* display_res_confirm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = display_res_confirm.cpp; path = ../../gui/display_res_confirm.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEA60F296542000D3E5D /* display_res_confirm.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = display_res_confirm.hpp; path = ../../gui/display_res_confirm.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEA70F296542000D3E5D /* feature_unlocked.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = feature_unlocked.cpp; path = ../../gui/feature_unlocked.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEA80F296542000D3E5D /* feature_unlocked.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = feature_unlocked.hpp; path = ../../gui/feature_unlocked.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEA90F296542000D3E5D /* font.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = font.cpp; path = ../../gui/font.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEAA0F296542000D3E5D /* font.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = font.hpp; path = ../../gui/font.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEAB0F296542000D3E5D /* game_mode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = game_mode.cpp; path = ../../gui/game_mode.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEAC0F296542000D3E5D /* game_mode.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = game_mode.hpp; path = ../../gui/game_mode.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEAD0F296542000D3E5D /* grand_prix_ending.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = grand_prix_ending.cpp; path = ../../gui/grand_prix_ending.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEAE0F296542000D3E5D /* grand_prix_ending.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = grand_prix_ending.hpp; path = ../../gui/grand_prix_ending.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEAF0F296542000D3E5D /* grand_prix_select.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = grand_prix_select.cpp; path = ../../gui/grand_prix_select.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEB00F296542000D3E5D /* grand_prix_select.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = grand_prix_select.hpp; path = ../../gui/grand_prix_select.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEB10F296542000D3E5D /* help_page_one.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = help_page_one.cpp; path = ../../gui/help_page_one.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEB20F296542000D3E5D /* help_page_one.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = help_page_one.hpp; path = ../../gui/help_page_one.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEB30F296542000D3E5D /* help_page_three.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = help_page_three.cpp; path = ../../gui/help_page_three.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEB40F296542000D3E5D /* help_page_three.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = help_page_three.hpp; path = ../../gui/help_page_three.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEB50F296542000D3E5D /* help_page_two.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = help_page_two.cpp; path = ../../gui/help_page_two.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEB60F296542000D3E5D /* help_page_two.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = help_page_two.hpp; path = ../../gui/help_page_two.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEB70F296542000D3E5D /* main_menu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main_menu.cpp; path = ../../gui/main_menu.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEB80F296542000D3E5D /* main_menu.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = main_menu.hpp; path = ../../gui/main_menu.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEB90F296542000D3E5D /* menu_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = menu_manager.cpp; path = ../../gui/menu_manager.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEBA0F296542000D3E5D /* menu_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = menu_manager.hpp; path = ../../gui/menu_manager.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEBB0F296542000D3E5D /* network_gui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = network_gui.cpp; path = ../../gui/network_gui.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEBC0F296542000D3E5D /* network_gui.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = network_gui.hpp; path = ../../gui/network_gui.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEBD0F296542000D3E5D /* num_players.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = num_players.cpp; path = ../../gui/num_players.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEBE0F296542000D3E5D /* num_players.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = num_players.hpp; path = ../../gui/num_players.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEBF0F296542000D3E5D /* options.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = options.cpp; path = ../../gui/options.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEC00F296542000D3E5D /* options.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = options.hpp; path = ../../gui/options.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEC10F296542000D3E5D /* player_controls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = player_controls.cpp; path = ../../gui/player_controls.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEC20F296542000D3E5D /* player_controls.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = player_controls.hpp; path = ../../gui/player_controls.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEC30F296542000D3E5D /* race_gui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = race_gui.cpp; path = ../../gui/race_gui.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEC40F296542000D3E5D /* race_gui.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = race_gui.hpp; path = ../../gui/race_gui.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEC50F296542000D3E5D /* race_menu.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = race_menu.cpp; path = ../../gui/race_menu.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEC60F296542000D3E5D /* race_menu.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = race_menu.hpp; path = ../../gui/race_menu.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEC70F296542000D3E5D /* race_options.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = race_options.cpp; path = ../../gui/race_options.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEC80F296542000D3E5D /* race_options.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = race_options.hpp; path = ../../gui/race_options.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AEC90F296542000D3E5D /* race_results_gui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = race_results_gui.cpp; path = ../../gui/race_results_gui.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AECA0F296542000D3E5D /* race_results_gui.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = race_results_gui.hpp; path = ../../gui/race_results_gui.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AECB0F296542000D3E5D /* start_race_feedback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = start_race_feedback.cpp; path = ../../gui/start_race_feedback.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AECC0F296542000D3E5D /* start_race_feedback.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = start_race_feedback.hpp; path = ../../gui/start_race_feedback.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AECD0F296542000D3E5D /* track_sel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = track_sel.cpp; path = ../../gui/track_sel.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AECE0F296542000D3E5D /* track_sel.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = track_sel.hpp; path = ../../gui/track_sel.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AECF0F296542000D3E5D /* widget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = widget.cpp; path = ../../gui/widget.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AED00F296542000D3E5D /* widget.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = widget.hpp; path = ../../gui/widget.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AED10F296542000D3E5D /* widget_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = widget_manager.cpp; path = ../../gui/widget_manager.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AED20F296542000D3E5D /* widget_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = widget_manager.hpp; path = ../../gui/widget_manager.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AED60F296542000D3E5D /* highscore_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = highscore_manager.cpp; path = ../../highscore_manager.cpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AED70F296542000D3E5D /* highscore_manager.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = highscore_manager.hpp; path = ../../highscore_manager.hpp; sourceTree = SOURCE_ROOT; };
|
||||
95C2AED90F296542000D3E5D /* highscores.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = highscores.cpp; path = ../../highscores.cpp; sourceTree = SOURCE_ROOT; };
|
||||
@ -806,6 +740,171 @@
|
||||
95C65D9F0F532FD400BE7BA7 /* scene.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = scene.cpp; path = games/supertuxkart/src/graphics/scene.cpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
95C65DA00F532FD400BE7BA7 /* shadow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = shadow.cpp; path = games/supertuxkart/src/graphics/shadow.cpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
95C65DA10F532FD400BE7BA7 /* nitro.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = nitro.cpp; path = games/supertuxkart/src/graphics/nitro.cpp; sourceTree = SYSTEM_DEVELOPER_DIR; };
|
||||
95D538840F69D61C00B4062E /* aabbox3d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = aabbox3d.h; path = /usr/local/include/irrlicht/aabbox3d.h; sourceTree = "<absolute>"; };
|
||||
95D538850F69D61C00B4062E /* CDynamicMeshBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDynamicMeshBuffer.h; path = /usr/local/include/irrlicht/CDynamicMeshBuffer.h; sourceTree = "<absolute>"; };
|
||||
95D538860F69D61C00B4062E /* CIndexBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CIndexBuffer.h; path = /usr/local/include/irrlicht/CIndexBuffer.h; sourceTree = "<absolute>"; };
|
||||
95D538870F69D61C00B4062E /* CMeshBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CMeshBuffer.h; path = /usr/local/include/irrlicht/CMeshBuffer.h; sourceTree = "<absolute>"; };
|
||||
95D538880F69D61C00B4062E /* coreutil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = coreutil.h; path = /usr/local/include/irrlicht/coreutil.h; sourceTree = "<absolute>"; };
|
||||
95D538890F69D61C00B4062E /* CVertexBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CVertexBuffer.h; path = /usr/local/include/irrlicht/CVertexBuffer.h; sourceTree = "<absolute>"; };
|
||||
95D5388A0F69D61C00B4062E /* dimension2d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dimension2d.h; path = /usr/local/include/irrlicht/dimension2d.h; sourceTree = "<absolute>"; };
|
||||
95D5388B0F69D61C00B4062E /* ECullingTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ECullingTypes.h; path = /usr/local/include/irrlicht/ECullingTypes.h; sourceTree = "<absolute>"; };
|
||||
95D5388C0F69D61C00B4062E /* EDebugSceneTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EDebugSceneTypes.h; path = /usr/local/include/irrlicht/EDebugSceneTypes.h; sourceTree = "<absolute>"; };
|
||||
95D5388D0F69D61C00B4062E /* EDriverFeatures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EDriverFeatures.h; path = /usr/local/include/irrlicht/EDriverFeatures.h; sourceTree = "<absolute>"; };
|
||||
95D5388E0F69D61C00B4062E /* EDriverTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EDriverTypes.h; path = /usr/local/include/irrlicht/EDriverTypes.h; sourceTree = "<absolute>"; };
|
||||
95D5388F0F69D61C00B4062E /* EGUIAlignment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EGUIAlignment.h; path = /usr/local/include/irrlicht/EGUIAlignment.h; sourceTree = "<absolute>"; };
|
||||
95D538900F69D61C00B4062E /* EGUIElementTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EGUIElementTypes.h; path = /usr/local/include/irrlicht/EGUIElementTypes.h; sourceTree = "<absolute>"; };
|
||||
95D538910F69D61C00B4062E /* EHardwareBufferFlags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EHardwareBufferFlags.h; path = /usr/local/include/irrlicht/EHardwareBufferFlags.h; sourceTree = "<absolute>"; };
|
||||
95D538920F69D61C00B4062E /* EMaterialFlags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EMaterialFlags.h; path = /usr/local/include/irrlicht/EMaterialFlags.h; sourceTree = "<absolute>"; };
|
||||
95D538930F69D61C00B4062E /* EMaterialTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EMaterialTypes.h; path = /usr/local/include/irrlicht/EMaterialTypes.h; sourceTree = "<absolute>"; };
|
||||
95D538940F69D61C00B4062E /* EMeshWriterEnums.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EMeshWriterEnums.h; path = /usr/local/include/irrlicht/EMeshWriterEnums.h; sourceTree = "<absolute>"; };
|
||||
95D538950F69D61C00B4062E /* EMessageBoxFlags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EMessageBoxFlags.h; path = /usr/local/include/irrlicht/EMessageBoxFlags.h; sourceTree = "<absolute>"; };
|
||||
95D538960F69D61C00B4062E /* ESceneNodeAnimatorTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ESceneNodeAnimatorTypes.h; path = /usr/local/include/irrlicht/ESceneNodeAnimatorTypes.h; sourceTree = "<absolute>"; };
|
||||
95D538970F69D61C00B4062E /* ESceneNodeTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ESceneNodeTypes.h; path = /usr/local/include/irrlicht/ESceneNodeTypes.h; sourceTree = "<absolute>"; };
|
||||
95D538980F69D61C00B4062E /* ETerrainElements.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ETerrainElements.h; path = /usr/local/include/irrlicht/ETerrainElements.h; sourceTree = "<absolute>"; };
|
||||
95D538990F69D61C00B4062E /* fast_atof.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fast_atof.h; path = /usr/local/include/irrlicht/fast_atof.h; sourceTree = "<absolute>"; };
|
||||
95D5389A0F69D61C00B4062E /* heapsort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = heapsort.h; path = /usr/local/include/irrlicht/heapsort.h; sourceTree = "<absolute>"; };
|
||||
95D5389B0F69D61C00B4062E /* IAnimatedMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IAnimatedMesh.h; path = /usr/local/include/irrlicht/IAnimatedMesh.h; sourceTree = "<absolute>"; };
|
||||
95D5389C0F69D61C00B4062E /* IAnimatedMeshMD2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IAnimatedMeshMD2.h; path = /usr/local/include/irrlicht/IAnimatedMeshMD2.h; sourceTree = "<absolute>"; };
|
||||
95D5389D0F69D61C00B4062E /* IAnimatedMeshMD3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IAnimatedMeshMD3.h; path = /usr/local/include/irrlicht/IAnimatedMeshMD3.h; sourceTree = "<absolute>"; };
|
||||
95D5389E0F69D61C00B4062E /* IAnimatedMeshSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IAnimatedMeshSceneNode.h; path = /usr/local/include/irrlicht/IAnimatedMeshSceneNode.h; sourceTree = "<absolute>"; };
|
||||
95D5389F0F69D61C00B4062E /* IAttributeExchangingObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IAttributeExchangingObject.h; path = /usr/local/include/irrlicht/IAttributeExchangingObject.h; sourceTree = "<absolute>"; };
|
||||
95D538A00F69D61C00B4062E /* IAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IAttributes.h; path = /usr/local/include/irrlicht/IAttributes.h; sourceTree = "<absolute>"; };
|
||||
95D538A10F69D61C00B4062E /* IBillboardSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IBillboardSceneNode.h; path = /usr/local/include/irrlicht/IBillboardSceneNode.h; sourceTree = "<absolute>"; };
|
||||
95D538A20F69D61C00B4062E /* IBillboardTextSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IBillboardTextSceneNode.h; path = /usr/local/include/irrlicht/IBillboardTextSceneNode.h; sourceTree = "<absolute>"; };
|
||||
95D538A30F69D61C00B4062E /* IBoneSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IBoneSceneNode.h; path = /usr/local/include/irrlicht/IBoneSceneNode.h; sourceTree = "<absolute>"; };
|
||||
95D538A40F69D61C00B4062E /* ICameraSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ICameraSceneNode.h; path = /usr/local/include/irrlicht/ICameraSceneNode.h; sourceTree = "<absolute>"; };
|
||||
95D538A50F69D61C00B4062E /* ICursorControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ICursorControl.h; path = /usr/local/include/irrlicht/ICursorControl.h; sourceTree = "<absolute>"; };
|
||||
95D538A60F69D61C00B4062E /* IDummyTransformationSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IDummyTransformationSceneNode.h; path = /usr/local/include/irrlicht/IDummyTransformationSceneNode.h; sourceTree = "<absolute>"; };
|
||||
95D538A70F69D61C00B4062E /* IDynamicMeshBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IDynamicMeshBuffer.h; path = /usr/local/include/irrlicht/IDynamicMeshBuffer.h; sourceTree = "<absolute>"; };
|
||||
95D538A80F69D61C00B4062E /* IEventReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IEventReceiver.h; path = /usr/local/include/irrlicht/IEventReceiver.h; sourceTree = "<absolute>"; };
|
||||
95D538A90F69D61C00B4062E /* IFileList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IFileList.h; path = /usr/local/include/irrlicht/IFileList.h; sourceTree = "<absolute>"; };
|
||||
95D538AA0F69D61C00B4062E /* IFileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IFileSystem.h; path = /usr/local/include/irrlicht/IFileSystem.h; sourceTree = "<absolute>"; };
|
||||
95D538AB0F69D61C00B4062E /* IGPUProgrammingServices.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGPUProgrammingServices.h; path = /usr/local/include/irrlicht/IGPUProgrammingServices.h; sourceTree = "<absolute>"; };
|
||||
95D538AC0F69D61C00B4062E /* IGUIButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUIButton.h; path = /usr/local/include/irrlicht/IGUIButton.h; sourceTree = "<absolute>"; };
|
||||
95D538AD0F69D61C00B4062E /* IGUICheckBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUICheckBox.h; path = /usr/local/include/irrlicht/IGUICheckBox.h; sourceTree = "<absolute>"; };
|
||||
95D538AE0F69D61C00B4062E /* IGUIColorSelectDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUIColorSelectDialog.h; path = /usr/local/include/irrlicht/IGUIColorSelectDialog.h; sourceTree = "<absolute>"; };
|
||||
95D538AF0F69D61C00B4062E /* IGUIComboBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUIComboBox.h; path = /usr/local/include/irrlicht/IGUIComboBox.h; sourceTree = "<absolute>"; };
|
||||
95D538B00F69D61C00B4062E /* IGUIContextMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUIContextMenu.h; path = /usr/local/include/irrlicht/IGUIContextMenu.h; sourceTree = "<absolute>"; };
|
||||
95D538B10F69D61C00B4062E /* IGUIEditBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUIEditBox.h; path = /usr/local/include/irrlicht/IGUIEditBox.h; sourceTree = "<absolute>"; };
|
||||
95D538B20F69D61C00B4062E /* IGUIElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUIElement.h; path = /usr/local/include/irrlicht/IGUIElement.h; sourceTree = "<absolute>"; };
|
||||
95D538B30F69D61C00B4062E /* IGUIElementFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUIElementFactory.h; path = /usr/local/include/irrlicht/IGUIElementFactory.h; sourceTree = "<absolute>"; };
|
||||
95D538B40F69D61C00B4062E /* IGUIEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUIEnvironment.h; path = /usr/local/include/irrlicht/IGUIEnvironment.h; sourceTree = "<absolute>"; };
|
||||
95D538B50F69D61C00B4062E /* IGUIFileOpenDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUIFileOpenDialog.h; path = /usr/local/include/irrlicht/IGUIFileOpenDialog.h; sourceTree = "<absolute>"; };
|
||||
95D538B60F69D61C00B4062E /* IGUIFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUIFont.h; path = /usr/local/include/irrlicht/IGUIFont.h; sourceTree = "<absolute>"; };
|
||||
95D538B70F69D61C00B4062E /* IGUIFontBitmap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUIFontBitmap.h; path = /usr/local/include/irrlicht/IGUIFontBitmap.h; sourceTree = "<absolute>"; };
|
||||
95D538B80F69D61C00B4062E /* IGUIImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUIImage.h; path = /usr/local/include/irrlicht/IGUIImage.h; sourceTree = "<absolute>"; };
|
||||
95D538B90F69D61C00B4062E /* IGUIInOutFader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUIInOutFader.h; path = /usr/local/include/irrlicht/IGUIInOutFader.h; sourceTree = "<absolute>"; };
|
||||
95D538BA0F69D61C00B4062E /* IGUIListBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUIListBox.h; path = /usr/local/include/irrlicht/IGUIListBox.h; sourceTree = "<absolute>"; };
|
||||
95D538BB0F69D61C00B4062E /* IGUIMeshViewer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUIMeshViewer.h; path = /usr/local/include/irrlicht/IGUIMeshViewer.h; sourceTree = "<absolute>"; };
|
||||
95D538BC0F69D61C00B4062E /* IGUIScrollBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUIScrollBar.h; path = /usr/local/include/irrlicht/IGUIScrollBar.h; sourceTree = "<absolute>"; };
|
||||
95D538BD0F69D61C00B4062E /* IGUISkin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUISkin.h; path = /usr/local/include/irrlicht/IGUISkin.h; sourceTree = "<absolute>"; };
|
||||
95D538BE0F69D61C00B4062E /* IGUISpinBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUISpinBox.h; path = /usr/local/include/irrlicht/IGUISpinBox.h; sourceTree = "<absolute>"; };
|
||||
95D538BF0F69D61C00B4062E /* IGUISpriteBank.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUISpriteBank.h; path = /usr/local/include/irrlicht/IGUISpriteBank.h; sourceTree = "<absolute>"; };
|
||||
95D538C00F69D61C00B4062E /* IGUIStaticText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUIStaticText.h; path = /usr/local/include/irrlicht/IGUIStaticText.h; sourceTree = "<absolute>"; };
|
||||
95D538C10F69D61C00B4062E /* IGUITabControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUITabControl.h; path = /usr/local/include/irrlicht/IGUITabControl.h; sourceTree = "<absolute>"; };
|
||||
95D538C20F69D61C00B4062E /* IGUITable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUITable.h; path = /usr/local/include/irrlicht/IGUITable.h; sourceTree = "<absolute>"; };
|
||||
95D538C30F69D61C00B4062E /* IGUIToolbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUIToolbar.h; path = /usr/local/include/irrlicht/IGUIToolbar.h; sourceTree = "<absolute>"; };
|
||||
95D538C40F69D61C00B4062E /* IGUIWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IGUIWindow.h; path = /usr/local/include/irrlicht/IGUIWindow.h; sourceTree = "<absolute>"; };
|
||||
95D538C50F69D61C00B4062E /* IImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IImage.h; path = /usr/local/include/irrlicht/IImage.h; sourceTree = "<absolute>"; };
|
||||
95D538C60F69D61C00B4062E /* IImageLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IImageLoader.h; path = /usr/local/include/irrlicht/IImageLoader.h; sourceTree = "<absolute>"; };
|
||||
95D538C70F69D61C00B4062E /* IImageWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IImageWriter.h; path = /usr/local/include/irrlicht/IImageWriter.h; sourceTree = "<absolute>"; };
|
||||
95D538C80F69D61C00B4062E /* IIndexBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IIndexBuffer.h; path = /usr/local/include/irrlicht/IIndexBuffer.h; sourceTree = "<absolute>"; };
|
||||
95D538C90F69D61C00B4062E /* ILightSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ILightSceneNode.h; path = /usr/local/include/irrlicht/ILightSceneNode.h; sourceTree = "<absolute>"; };
|
||||
95D538CA0F69D61C00B4062E /* ILogger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ILogger.h; path = /usr/local/include/irrlicht/ILogger.h; sourceTree = "<absolute>"; };
|
||||
95D538CB0F69D61C00B4062E /* IMaterialRenderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IMaterialRenderer.h; path = /usr/local/include/irrlicht/IMaterialRenderer.h; sourceTree = "<absolute>"; };
|
||||
95D538CC0F69D61C00B4062E /* IMaterialRendererServices.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IMaterialRendererServices.h; path = /usr/local/include/irrlicht/IMaterialRendererServices.h; sourceTree = "<absolute>"; };
|
||||
95D538CD0F69D61C00B4062E /* IMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IMesh.h; path = /usr/local/include/irrlicht/IMesh.h; sourceTree = "<absolute>"; };
|
||||
95D538CE0F69D61C00B4062E /* IMeshBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IMeshBuffer.h; path = /usr/local/include/irrlicht/IMeshBuffer.h; sourceTree = "<absolute>"; };
|
||||
95D538CF0F69D61C00B4062E /* IMeshCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IMeshCache.h; path = /usr/local/include/irrlicht/IMeshCache.h; sourceTree = "<absolute>"; };
|
||||
95D538D00F69D61C00B4062E /* IMeshLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IMeshLoader.h; path = /usr/local/include/irrlicht/IMeshLoader.h; sourceTree = "<absolute>"; };
|
||||
95D538D10F69D61C00B4062E /* IMeshManipulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IMeshManipulator.h; path = /usr/local/include/irrlicht/IMeshManipulator.h; sourceTree = "<absolute>"; };
|
||||
95D538D20F69D61C00B4062E /* IMeshSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IMeshSceneNode.h; path = /usr/local/include/irrlicht/IMeshSceneNode.h; sourceTree = "<absolute>"; };
|
||||
95D538D30F69D61C00B4062E /* IMeshWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IMeshWriter.h; path = /usr/local/include/irrlicht/IMeshWriter.h; sourceTree = "<absolute>"; };
|
||||
95D538D40F69D61C00B4062E /* IMetaTriangleSelector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IMetaTriangleSelector.h; path = /usr/local/include/irrlicht/IMetaTriangleSelector.h; sourceTree = "<absolute>"; };
|
||||
95D538D50F69D61C00B4062E /* IOSOperator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IOSOperator.h; path = /usr/local/include/irrlicht/IOSOperator.h; sourceTree = "<absolute>"; };
|
||||
95D538D60F69D61C00B4062E /* IParticleAffector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IParticleAffector.h; path = /usr/local/include/irrlicht/IParticleAffector.h; sourceTree = "<absolute>"; };
|
||||
95D538D70F69D61C00B4062E /* IParticleAnimatedMeshSceneNodeEmitter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IParticleAnimatedMeshSceneNodeEmitter.h; path = /usr/local/include/irrlicht/IParticleAnimatedMeshSceneNodeEmitter.h; sourceTree = "<absolute>"; };
|
||||
95D538D80F69D61C00B4062E /* IParticleAttractionAffector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IParticleAttractionAffector.h; path = /usr/local/include/irrlicht/IParticleAttractionAffector.h; sourceTree = "<absolute>"; };
|
||||
95D538D90F69D61C00B4062E /* IParticleBoxEmitter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IParticleBoxEmitter.h; path = /usr/local/include/irrlicht/IParticleBoxEmitter.h; sourceTree = "<absolute>"; };
|
||||
95D538DA0F69D61C00B4062E /* IParticleCylinderEmitter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IParticleCylinderEmitter.h; path = /usr/local/include/irrlicht/IParticleCylinderEmitter.h; sourceTree = "<absolute>"; };
|
||||
95D538DB0F69D61C00B4062E /* IParticleEmitter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IParticleEmitter.h; path = /usr/local/include/irrlicht/IParticleEmitter.h; sourceTree = "<absolute>"; };
|
||||
95D538DC0F69D61C00B4062E /* IParticleFadeOutAffector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IParticleFadeOutAffector.h; path = /usr/local/include/irrlicht/IParticleFadeOutAffector.h; sourceTree = "<absolute>"; };
|
||||
95D538DD0F69D61C00B4062E /* IParticleGravityAffector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IParticleGravityAffector.h; path = /usr/local/include/irrlicht/IParticleGravityAffector.h; sourceTree = "<absolute>"; };
|
||||
95D538DE0F69D61C00B4062E /* IParticleMeshEmitter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IParticleMeshEmitter.h; path = /usr/local/include/irrlicht/IParticleMeshEmitter.h; sourceTree = "<absolute>"; };
|
||||
95D538DF0F69D61C00B4062E /* IParticleRingEmitter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IParticleRingEmitter.h; path = /usr/local/include/irrlicht/IParticleRingEmitter.h; sourceTree = "<absolute>"; };
|
||||
95D538E00F69D61C00B4062E /* IParticleRotationAffector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IParticleRotationAffector.h; path = /usr/local/include/irrlicht/IParticleRotationAffector.h; sourceTree = "<absolute>"; };
|
||||
95D538E10F69D61C00B4062E /* IParticleSphereEmitter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IParticleSphereEmitter.h; path = /usr/local/include/irrlicht/IParticleSphereEmitter.h; sourceTree = "<absolute>"; };
|
||||
95D538E20F69D61C00B4062E /* IParticleSystemSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IParticleSystemSceneNode.h; path = /usr/local/include/irrlicht/IParticleSystemSceneNode.h; sourceTree = "<absolute>"; };
|
||||
95D538E30F69D61C00B4062E /* IQ3LevelMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IQ3LevelMesh.h; path = /usr/local/include/irrlicht/IQ3LevelMesh.h; sourceTree = "<absolute>"; };
|
||||
95D538E40F69D61C00B4062E /* IQ3Shader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IQ3Shader.h; path = /usr/local/include/irrlicht/IQ3Shader.h; sourceTree = "<absolute>"; };
|
||||
95D538E50F69D61C00B4062E /* IReadFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IReadFile.h; path = /usr/local/include/irrlicht/IReadFile.h; sourceTree = "<absolute>"; };
|
||||
95D538E60F69D61C00B4062E /* IReferenceCounted.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IReferenceCounted.h; path = /usr/local/include/irrlicht/IReferenceCounted.h; sourceTree = "<absolute>"; };
|
||||
95D538E70F69D61C00B4062E /* irrAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = irrAllocator.h; path = /usr/local/include/irrlicht/irrAllocator.h; sourceTree = "<absolute>"; };
|
||||
95D538E80F69D61C00B4062E /* irrArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = irrArray.h; path = /usr/local/include/irrlicht/irrArray.h; sourceTree = "<absolute>"; };
|
||||
95D538E90F69D61C00B4062E /* IrrCompileConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IrrCompileConfig.h; path = /usr/local/include/irrlicht/IrrCompileConfig.h; sourceTree = "<absolute>"; };
|
||||
95D538EA0F69D61C00B4062E /* irrlicht.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = irrlicht.h; path = /usr/local/include/irrlicht/irrlicht.h; sourceTree = "<absolute>"; };
|
||||
95D538EB0F69D61C00B4062E /* IrrlichtDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IrrlichtDevice.h; path = /usr/local/include/irrlicht/IrrlichtDevice.h; sourceTree = "<absolute>"; };
|
||||
95D538EC0F69D61C00B4062E /* irrList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = irrList.h; path = /usr/local/include/irrlicht/irrList.h; sourceTree = "<absolute>"; };
|
||||
95D538ED0F69D61C00B4062E /* irrMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = irrMap.h; path = /usr/local/include/irrlicht/irrMap.h; sourceTree = "<absolute>"; };
|
||||
95D538EE0F69D61C00B4062E /* irrMath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = irrMath.h; path = /usr/local/include/irrlicht/irrMath.h; sourceTree = "<absolute>"; };
|
||||
95D538EF0F69D61C00B4062E /* irrString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = irrString.h; path = /usr/local/include/irrlicht/irrString.h; sourceTree = "<absolute>"; };
|
||||
95D538F00F69D61C00B4062E /* irrTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = irrTypes.h; path = /usr/local/include/irrlicht/irrTypes.h; sourceTree = "<absolute>"; };
|
||||
95D538F10F69D61C00B4062E /* irrXML.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = irrXML.h; path = /usr/local/include/irrlicht/irrXML.h; sourceTree = "<absolute>"; };
|
||||
95D538F20F69D61C00B4062E /* ISceneCollisionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISceneCollisionManager.h; path = /usr/local/include/irrlicht/ISceneCollisionManager.h; sourceTree = "<absolute>"; };
|
||||
95D538F30F69D61C00B4062E /* ISceneManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISceneManager.h; path = /usr/local/include/irrlicht/ISceneManager.h; sourceTree = "<absolute>"; };
|
||||
95D538F40F69D61C00B4062E /* ISceneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISceneNode.h; path = /usr/local/include/irrlicht/ISceneNode.h; sourceTree = "<absolute>"; };
|
||||
95D538F50F69D61C00B4062E /* ISceneNodeAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISceneNodeAnimator.h; path = /usr/local/include/irrlicht/ISceneNodeAnimator.h; sourceTree = "<absolute>"; };
|
||||
95D538F60F69D61C00B4062E /* ISceneNodeAnimatorCameraFPS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISceneNodeAnimatorCameraFPS.h; path = /usr/local/include/irrlicht/ISceneNodeAnimatorCameraFPS.h; sourceTree = "<absolute>"; };
|
||||
95D538F70F69D61C00B4062E /* ISceneNodeAnimatorCameraMaya.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISceneNodeAnimatorCameraMaya.h; path = /usr/local/include/irrlicht/ISceneNodeAnimatorCameraMaya.h; sourceTree = "<absolute>"; };
|
||||
95D538F80F69D61C00B4062E /* ISceneNodeAnimatorCollisionResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISceneNodeAnimatorCollisionResponse.h; path = /usr/local/include/irrlicht/ISceneNodeAnimatorCollisionResponse.h; sourceTree = "<absolute>"; };
|
||||
95D538F90F69D61C00B4062E /* ISceneNodeAnimatorFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISceneNodeAnimatorFactory.h; path = /usr/local/include/irrlicht/ISceneNodeAnimatorFactory.h; sourceTree = "<absolute>"; };
|
||||
95D538FA0F69D61C00B4062E /* ISceneNodeFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISceneNodeFactory.h; path = /usr/local/include/irrlicht/ISceneNodeFactory.h; sourceTree = "<absolute>"; };
|
||||
95D538FB0F69D61C00B4062E /* ISceneUserDataSerializer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISceneUserDataSerializer.h; path = /usr/local/include/irrlicht/ISceneUserDataSerializer.h; sourceTree = "<absolute>"; };
|
||||
95D538FC0F69D61C00B4062E /* IShaderConstantSetCallBack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IShaderConstantSetCallBack.h; path = /usr/local/include/irrlicht/IShaderConstantSetCallBack.h; sourceTree = "<absolute>"; };
|
||||
95D538FD0F69D61C00B4062E /* IShadowVolumeSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IShadowVolumeSceneNode.h; path = /usr/local/include/irrlicht/IShadowVolumeSceneNode.h; sourceTree = "<absolute>"; };
|
||||
95D538FE0F69D61C00B4062E /* ISkinnedMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ISkinnedMesh.h; path = /usr/local/include/irrlicht/ISkinnedMesh.h; sourceTree = "<absolute>"; };
|
||||
95D538FF0F69D61C00B4062E /* ITerrainSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ITerrainSceneNode.h; path = /usr/local/include/irrlicht/ITerrainSceneNode.h; sourceTree = "<absolute>"; };
|
||||
95D539000F69D61C00B4062E /* ITextSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ITextSceneNode.h; path = /usr/local/include/irrlicht/ITextSceneNode.h; sourceTree = "<absolute>"; };
|
||||
95D539010F69D61C00B4062E /* ITexture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ITexture.h; path = /usr/local/include/irrlicht/ITexture.h; sourceTree = "<absolute>"; };
|
||||
95D539020F69D61C00B4062E /* ITimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ITimer.h; path = /usr/local/include/irrlicht/ITimer.h; sourceTree = "<absolute>"; };
|
||||
95D539030F69D61C00B4062E /* ITriangleSelector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ITriangleSelector.h; path = /usr/local/include/irrlicht/ITriangleSelector.h; sourceTree = "<absolute>"; };
|
||||
95D539040F69D61C00B4062E /* IVertexBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IVertexBuffer.h; path = /usr/local/include/irrlicht/IVertexBuffer.h; sourceTree = "<absolute>"; };
|
||||
95D539050F69D61C00B4062E /* IVideoDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IVideoDriver.h; path = /usr/local/include/irrlicht/IVideoDriver.h; sourceTree = "<absolute>"; };
|
||||
95D539060F69D61C00B4062E /* IVideoModeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IVideoModeList.h; path = /usr/local/include/irrlicht/IVideoModeList.h; sourceTree = "<absolute>"; };
|
||||
95D539070F69D61C00B4062E /* IVolumeLightSceneNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IVolumeLightSceneNode.h; path = /usr/local/include/irrlicht/IVolumeLightSceneNode.h; sourceTree = "<absolute>"; };
|
||||
95D539080F69D61C00B4062E /* IWriteFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IWriteFile.h; path = /usr/local/include/irrlicht/IWriteFile.h; sourceTree = "<absolute>"; };
|
||||
95D539090F69D61C00B4062E /* IXMLReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IXMLReader.h; path = /usr/local/include/irrlicht/IXMLReader.h; sourceTree = "<absolute>"; };
|
||||
95D5390A0F69D61C00B4062E /* IXMLWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IXMLWriter.h; path = /usr/local/include/irrlicht/IXMLWriter.h; sourceTree = "<absolute>"; };
|
||||
95D5390B0F69D61C00B4062E /* Keycodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Keycodes.h; path = /usr/local/include/irrlicht/Keycodes.h; sourceTree = "<absolute>"; };
|
||||
95D5390C0F69D61C00B4062E /* line2d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = line2d.h; path = /usr/local/include/irrlicht/line2d.h; sourceTree = "<absolute>"; };
|
||||
95D5390D0F69D61C00B4062E /* line3d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = line3d.h; path = /usr/local/include/irrlicht/line3d.h; sourceTree = "<absolute>"; };
|
||||
95D5390E0F69D61C00B4062E /* matrix4.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = matrix4.h; path = /usr/local/include/irrlicht/matrix4.h; sourceTree = "<absolute>"; };
|
||||
95D5390F0F69D61C00B4062E /* plane3d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = plane3d.h; path = /usr/local/include/irrlicht/plane3d.h; sourceTree = "<absolute>"; };
|
||||
95D539100F69D61C00B4062E /* position2d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = position2d.h; path = /usr/local/include/irrlicht/position2d.h; sourceTree = "<absolute>"; };
|
||||
95D539110F69D61C00B4062E /* quaternion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = quaternion.h; path = /usr/local/include/irrlicht/quaternion.h; sourceTree = "<absolute>"; };
|
||||
95D539120F69D61C00B4062E /* rect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = rect.h; path = /usr/local/include/irrlicht/rect.h; sourceTree = "<absolute>"; };
|
||||
95D539130F69D61C00B4062E /* S3DVertex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = S3DVertex.h; path = /usr/local/include/irrlicht/S3DVertex.h; sourceTree = "<absolute>"; };
|
||||
95D539140F69D61C00B4062E /* SAnimatedMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SAnimatedMesh.h; path = /usr/local/include/irrlicht/SAnimatedMesh.h; sourceTree = "<absolute>"; };
|
||||
95D539150F69D61C00B4062E /* SceneParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SceneParameters.h; path = /usr/local/include/irrlicht/SceneParameters.h; sourceTree = "<absolute>"; };
|
||||
95D539160F69D61C00B4062E /* SColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SColor.h; path = /usr/local/include/irrlicht/SColor.h; sourceTree = "<absolute>"; };
|
||||
95D539170F69D61C00B4062E /* SExposedVideoData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SExposedVideoData.h; path = /usr/local/include/irrlicht/SExposedVideoData.h; sourceTree = "<absolute>"; };
|
||||
95D539180F69D61C00B4062E /* SIrrCreationParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SIrrCreationParameters.h; path = /usr/local/include/irrlicht/SIrrCreationParameters.h; sourceTree = "<absolute>"; };
|
||||
95D539190F69D61C00B4062E /* SKeyMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SKeyMap.h; path = /usr/local/include/irrlicht/SKeyMap.h; sourceTree = "<absolute>"; };
|
||||
95D5391A0F69D61C00B4062E /* SLight.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SLight.h; path = /usr/local/include/irrlicht/SLight.h; sourceTree = "<absolute>"; };
|
||||
95D5391B0F69D61C00B4062E /* SMaterial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SMaterial.h; path = /usr/local/include/irrlicht/SMaterial.h; sourceTree = "<absolute>"; };
|
||||
95D5391C0F69D61C00B4062E /* SMaterialLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SMaterialLayer.h; path = /usr/local/include/irrlicht/SMaterialLayer.h; sourceTree = "<absolute>"; };
|
||||
95D5391D0F69D61C00B4062E /* SMesh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SMesh.h; path = /usr/local/include/irrlicht/SMesh.h; sourceTree = "<absolute>"; };
|
||||
95D5391E0F69D61C00B4062E /* SMeshBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SMeshBuffer.h; path = /usr/local/include/irrlicht/SMeshBuffer.h; sourceTree = "<absolute>"; };
|
||||
95D5391F0F69D61C00B4062E /* SMeshBufferLightMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SMeshBufferLightMap.h; path = /usr/local/include/irrlicht/SMeshBufferLightMap.h; sourceTree = "<absolute>"; };
|
||||
95D539200F69D61C00B4062E /* SMeshBufferTangents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SMeshBufferTangents.h; path = /usr/local/include/irrlicht/SMeshBufferTangents.h; sourceTree = "<absolute>"; };
|
||||
95D539210F69D61C00B4062E /* SParticle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SParticle.h; path = /usr/local/include/irrlicht/SParticle.h; sourceTree = "<absolute>"; };
|
||||
95D539220F69D61C00B4062E /* SSharedMeshBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SSharedMeshBuffer.h; path = /usr/local/include/irrlicht/SSharedMeshBuffer.h; sourceTree = "<absolute>"; };
|
||||
95D539230F69D61C00B4062E /* SSkinMeshBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SSkinMeshBuffer.h; path = /usr/local/include/irrlicht/SSkinMeshBuffer.h; sourceTree = "<absolute>"; };
|
||||
95D539240F69D61C00B4062E /* SVertexIndex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SVertexIndex.h; path = /usr/local/include/irrlicht/SVertexIndex.h; sourceTree = "<absolute>"; };
|
||||
95D539250F69D61C00B4062E /* SViewFrustum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SViewFrustum.h; path = /usr/local/include/irrlicht/SViewFrustum.h; sourceTree = "<absolute>"; };
|
||||
95D539260F69D61C00B4062E /* triangle3d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = triangle3d.h; path = /usr/local/include/irrlicht/triangle3d.h; sourceTree = "<absolute>"; };
|
||||
95D539270F69D61C00B4062E /* vector2d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = vector2d.h; path = /usr/local/include/irrlicht/vector2d.h; sourceTree = "<absolute>"; };
|
||||
95D539280F69D61C00B4062E /* vector3d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = vector3d.h; path = /usr/local/include/irrlicht/vector3d.h; sourceTree = "<absolute>"; };
|
||||
95E1059A0E28F65F00503124 /* btBulletCollisionCommon.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = btBulletCollisionCommon.h; path = ../../bullet/src/btBulletCollisionCommon.h; sourceTree = SOURCE_ROOT; };
|
||||
95E1059B0E28F65F00503124 /* btBulletDynamicsCommon.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = btBulletDynamicsCommon.h; path = ../../bullet/src/btBulletDynamicsCommon.h; sourceTree = SOURCE_ROOT; };
|
||||
95E105F00E28F66000503124 /* Bullet-C-Api.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = "Bullet-C-Api.h"; path = "../../bullet/src/Bullet-C-Api.h"; sourceTree = SOURCE_ROOT; };
|
||||
@ -1056,6 +1155,7 @@
|
||||
08FB7794FE84155DC02AAC07 /* STK_XCode */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
95D538830F69D61C00B4062E /* irrlicht */,
|
||||
95C2ABA60F29653F000D3E5D /* src */,
|
||||
9513B40E0F0EDE80005D29F6 /* Frameworks */,
|
||||
1AB674ADFE9D54B511CA2CBB /* Products */,
|
||||
@ -1072,6 +1172,30 @@
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
950557790F696A900056E88C /* gui */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9505577A0F696A900056E88C /* engine.cpp */,
|
||||
9505577B0F696A900056E88C /* engine.hpp */,
|
||||
9505577C0F696A900056E88C /* my_button.cpp */,
|
||||
9505577D0F696A900056E88C /* my_button.hpp */,
|
||||
95C1E3FF0F699427005D33E6 /* font.cpp */,
|
||||
95C1E4020F69943D005D33E6 /* font.hpp */,
|
||||
9505577E0F696A900056E88C /* ptr_vector.hpp */,
|
||||
9505577F0F696A900056E88C /* screen.cpp */,
|
||||
950557800F696A900056E88C /* screen.hpp */,
|
||||
950557810F696A900056E88C /* screen_loader.cpp */,
|
||||
950557820F696A900056E88C /* skin.cpp */,
|
||||
950557830F696A900056E88C /* skin.hpp */,
|
||||
950557840F696A900056E88C /* widget.cpp */,
|
||||
950557850F696A900056E88C /* widget.hpp */,
|
||||
95C1E3F10F699079005D33E6 /* race_gui.cpp */,
|
||||
95C1E3EB0F698F23005D33E6 /* race_gui.hpp */,
|
||||
);
|
||||
name = gui;
|
||||
path = games/supertuxkart/src/gui;
|
||||
sourceTree = SYSTEM_DEVELOPER_DIR;
|
||||
};
|
||||
9513B40E0F0EDE80005D29F6 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -1093,8 +1217,8 @@
|
||||
95C2AC360F296540000D3E5D /* bullet */,
|
||||
95C2AE250F296541000D3E5D /* challenges */,
|
||||
95C2AE370F296541000D3E5D /* enet */,
|
||||
950557790F696A900056E88C /* gui */,
|
||||
95C2AE870F296542000D3E5D /* graphics */,
|
||||
95C2AE960F296542000D3E5D /* gui */,
|
||||
95C65D750F532F7D00BE7BA7 /* io */,
|
||||
95C2B0F50F296545000D3E5D /* items */,
|
||||
95C2B1160F296545000D3E5D /* karts */,
|
||||
@ -1645,74 +1769,6 @@
|
||||
path = ../../graphics;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
95C2AE960F296542000D3E5D /* gui */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
95C2AE970F296542000D3E5D /* base_gui.cpp */,
|
||||
95C2AE980F296542000D3E5D /* base_gui.hpp */,
|
||||
95C2AE990F296542000D3E5D /* challenges_menu.cpp */,
|
||||
95C2AE9A0F296542000D3E5D /* challenges_menu.hpp */,
|
||||
95C2AE9B0F296542000D3E5D /* char_sel.cpp */,
|
||||
95C2AE9C0F296542000D3E5D /* char_sel.hpp */,
|
||||
95C2AE9D0F296542000D3E5D /* config_controls.cpp */,
|
||||
95C2AE9E0F296542000D3E5D /* config_controls.hpp */,
|
||||
95C2AE9F0F296542000D3E5D /* config_display.cpp */,
|
||||
95C2AEA00F296542000D3E5D /* config_display.hpp */,
|
||||
95C2AEA10F296542000D3E5D /* config_sound.cpp */,
|
||||
95C2AEA20F296542000D3E5D /* config_sound.hpp */,
|
||||
95C2AEA30F296542000D3E5D /* credits_menu.cpp */,
|
||||
95C2AEA40F296542000D3E5D /* credits_menu.hpp */,
|
||||
95C2AEA50F296542000D3E5D /* display_res_confirm.cpp */,
|
||||
95C2AEA60F296542000D3E5D /* display_res_confirm.hpp */,
|
||||
95C2AEA70F296542000D3E5D /* feature_unlocked.cpp */,
|
||||
95C2AEA80F296542000D3E5D /* feature_unlocked.hpp */,
|
||||
95C2AEA90F296542000D3E5D /* font.cpp */,
|
||||
95C2AEAA0F296542000D3E5D /* font.hpp */,
|
||||
95C2AEAB0F296542000D3E5D /* game_mode.cpp */,
|
||||
95C2AEAC0F296542000D3E5D /* game_mode.hpp */,
|
||||
95C2AEAD0F296542000D3E5D /* grand_prix_ending.cpp */,
|
||||
95C2AEAE0F296542000D3E5D /* grand_prix_ending.hpp */,
|
||||
95C2AEAF0F296542000D3E5D /* grand_prix_select.cpp */,
|
||||
95C2AEB00F296542000D3E5D /* grand_prix_select.hpp */,
|
||||
95C2AEB10F296542000D3E5D /* help_page_one.cpp */,
|
||||
95C2AEB20F296542000D3E5D /* help_page_one.hpp */,
|
||||
95C2AEB30F296542000D3E5D /* help_page_three.cpp */,
|
||||
95C2AEB40F296542000D3E5D /* help_page_three.hpp */,
|
||||
95C2AEB50F296542000D3E5D /* help_page_two.cpp */,
|
||||
95C2AEB60F296542000D3E5D /* help_page_two.hpp */,
|
||||
95C2AEB70F296542000D3E5D /* main_menu.cpp */,
|
||||
95C2AEB80F296542000D3E5D /* main_menu.hpp */,
|
||||
95C2AEB90F296542000D3E5D /* menu_manager.cpp */,
|
||||
95C2AEBA0F296542000D3E5D /* menu_manager.hpp */,
|
||||
95C2AEBB0F296542000D3E5D /* network_gui.cpp */,
|
||||
95C2AEBC0F296542000D3E5D /* network_gui.hpp */,
|
||||
95C2AEBD0F296542000D3E5D /* num_players.cpp */,
|
||||
95C2AEBE0F296542000D3E5D /* num_players.hpp */,
|
||||
95C2AEBF0F296542000D3E5D /* options.cpp */,
|
||||
95C2AEC00F296542000D3E5D /* options.hpp */,
|
||||
95C2AEC10F296542000D3E5D /* player_controls.cpp */,
|
||||
95C2AEC20F296542000D3E5D /* player_controls.hpp */,
|
||||
95C2AEC30F296542000D3E5D /* race_gui.cpp */,
|
||||
95C2AEC40F296542000D3E5D /* race_gui.hpp */,
|
||||
95C2AEC50F296542000D3E5D /* race_menu.cpp */,
|
||||
95C2AEC60F296542000D3E5D /* race_menu.hpp */,
|
||||
95C2AEC70F296542000D3E5D /* race_options.cpp */,
|
||||
95C2AEC80F296542000D3E5D /* race_options.hpp */,
|
||||
95C2AEC90F296542000D3E5D /* race_results_gui.cpp */,
|
||||
95C2AECA0F296542000D3E5D /* race_results_gui.hpp */,
|
||||
95C2AECB0F296542000D3E5D /* start_race_feedback.cpp */,
|
||||
95C2AECC0F296542000D3E5D /* start_race_feedback.hpp */,
|
||||
95C2AECD0F296542000D3E5D /* track_sel.cpp */,
|
||||
95C2AECE0F296542000D3E5D /* track_sel.hpp */,
|
||||
95C2AECF0F296542000D3E5D /* widget.cpp */,
|
||||
95C2AED00F296542000D3E5D /* widget.hpp */,
|
||||
95C2AED10F296542000D3E5D /* widget_manager.cpp */,
|
||||
95C2AED20F296542000D3E5D /* widget_manager.hpp */,
|
||||
);
|
||||
name = gui;
|
||||
path = ../../gui;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
95C2B0F50F296545000D3E5D /* items */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -1937,6 +1993,179 @@
|
||||
path = games/supertuxkart/src/io;
|
||||
sourceTree = SYSTEM_DEVELOPER_DIR;
|
||||
};
|
||||
95D538830F69D61C00B4062E /* irrlicht */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
95D538840F69D61C00B4062E /* aabbox3d.h */,
|
||||
95D538850F69D61C00B4062E /* CDynamicMeshBuffer.h */,
|
||||
95D538860F69D61C00B4062E /* CIndexBuffer.h */,
|
||||
95D538870F69D61C00B4062E /* CMeshBuffer.h */,
|
||||
95D538880F69D61C00B4062E /* coreutil.h */,
|
||||
95D538890F69D61C00B4062E /* CVertexBuffer.h */,
|
||||
95D5388A0F69D61C00B4062E /* dimension2d.h */,
|
||||
95D5388B0F69D61C00B4062E /* ECullingTypes.h */,
|
||||
95D5388C0F69D61C00B4062E /* EDebugSceneTypes.h */,
|
||||
95D5388D0F69D61C00B4062E /* EDriverFeatures.h */,
|
||||
95D5388E0F69D61C00B4062E /* EDriverTypes.h */,
|
||||
95D5388F0F69D61C00B4062E /* EGUIAlignment.h */,
|
||||
95D538900F69D61C00B4062E /* EGUIElementTypes.h */,
|
||||
95D538910F69D61C00B4062E /* EHardwareBufferFlags.h */,
|
||||
95D538920F69D61C00B4062E /* EMaterialFlags.h */,
|
||||
95D538930F69D61C00B4062E /* EMaterialTypes.h */,
|
||||
95D538940F69D61C00B4062E /* EMeshWriterEnums.h */,
|
||||
95D538950F69D61C00B4062E /* EMessageBoxFlags.h */,
|
||||
95D538960F69D61C00B4062E /* ESceneNodeAnimatorTypes.h */,
|
||||
95D538970F69D61C00B4062E /* ESceneNodeTypes.h */,
|
||||
95D538980F69D61C00B4062E /* ETerrainElements.h */,
|
||||
95D538990F69D61C00B4062E /* fast_atof.h */,
|
||||
95D5389A0F69D61C00B4062E /* heapsort.h */,
|
||||
95D5389B0F69D61C00B4062E /* IAnimatedMesh.h */,
|
||||
95D5389C0F69D61C00B4062E /* IAnimatedMeshMD2.h */,
|
||||
95D5389D0F69D61C00B4062E /* IAnimatedMeshMD3.h */,
|
||||
95D5389E0F69D61C00B4062E /* IAnimatedMeshSceneNode.h */,
|
||||
95D5389F0F69D61C00B4062E /* IAttributeExchangingObject.h */,
|
||||
95D538A00F69D61C00B4062E /* IAttributes.h */,
|
||||
95D538A10F69D61C00B4062E /* IBillboardSceneNode.h */,
|
||||
95D538A20F69D61C00B4062E /* IBillboardTextSceneNode.h */,
|
||||
95D538A30F69D61C00B4062E /* IBoneSceneNode.h */,
|
||||
95D538A40F69D61C00B4062E /* ICameraSceneNode.h */,
|
||||
95D538A50F69D61C00B4062E /* ICursorControl.h */,
|
||||
95D538A60F69D61C00B4062E /* IDummyTransformationSceneNode.h */,
|
||||
95D538A70F69D61C00B4062E /* IDynamicMeshBuffer.h */,
|
||||
95D538A80F69D61C00B4062E /* IEventReceiver.h */,
|
||||
95D538A90F69D61C00B4062E /* IFileList.h */,
|
||||
95D538AA0F69D61C00B4062E /* IFileSystem.h */,
|
||||
95D538AB0F69D61C00B4062E /* IGPUProgrammingServices.h */,
|
||||
95D538AC0F69D61C00B4062E /* IGUIButton.h */,
|
||||
95D538AD0F69D61C00B4062E /* IGUICheckBox.h */,
|
||||
95D538AE0F69D61C00B4062E /* IGUIColorSelectDialog.h */,
|
||||
95D538AF0F69D61C00B4062E /* IGUIComboBox.h */,
|
||||
95D538B00F69D61C00B4062E /* IGUIContextMenu.h */,
|
||||
95D538B10F69D61C00B4062E /* IGUIEditBox.h */,
|
||||
95D538B20F69D61C00B4062E /* IGUIElement.h */,
|
||||
95D538B30F69D61C00B4062E /* IGUIElementFactory.h */,
|
||||
95D538B40F69D61C00B4062E /* IGUIEnvironment.h */,
|
||||
95D538B50F69D61C00B4062E /* IGUIFileOpenDialog.h */,
|
||||
95D538B60F69D61C00B4062E /* IGUIFont.h */,
|
||||
95D538B70F69D61C00B4062E /* IGUIFontBitmap.h */,
|
||||
95D538B80F69D61C00B4062E /* IGUIImage.h */,
|
||||
95D538B90F69D61C00B4062E /* IGUIInOutFader.h */,
|
||||
95D538BA0F69D61C00B4062E /* IGUIListBox.h */,
|
||||
95D538BB0F69D61C00B4062E /* IGUIMeshViewer.h */,
|
||||
95D538BC0F69D61C00B4062E /* IGUIScrollBar.h */,
|
||||
95D538BD0F69D61C00B4062E /* IGUISkin.h */,
|
||||
95D538BE0F69D61C00B4062E /* IGUISpinBox.h */,
|
||||
95D538BF0F69D61C00B4062E /* IGUISpriteBank.h */,
|
||||
95D538C00F69D61C00B4062E /* IGUIStaticText.h */,
|
||||
95D538C10F69D61C00B4062E /* IGUITabControl.h */,
|
||||
95D538C20F69D61C00B4062E /* IGUITable.h */,
|
||||
95D538C30F69D61C00B4062E /* IGUIToolbar.h */,
|
||||
95D538C40F69D61C00B4062E /* IGUIWindow.h */,
|
||||
95D538C50F69D61C00B4062E /* IImage.h */,
|
||||
95D538C60F69D61C00B4062E /* IImageLoader.h */,
|
||||
95D538C70F69D61C00B4062E /* IImageWriter.h */,
|
||||
95D538C80F69D61C00B4062E /* IIndexBuffer.h */,
|
||||
95D538C90F69D61C00B4062E /* ILightSceneNode.h */,
|
||||
95D538CA0F69D61C00B4062E /* ILogger.h */,
|
||||
95D538CB0F69D61C00B4062E /* IMaterialRenderer.h */,
|
||||
95D538CC0F69D61C00B4062E /* IMaterialRendererServices.h */,
|
||||
95D538CD0F69D61C00B4062E /* IMesh.h */,
|
||||
95D538CE0F69D61C00B4062E /* IMeshBuffer.h */,
|
||||
95D538CF0F69D61C00B4062E /* IMeshCache.h */,
|
||||
95D538D00F69D61C00B4062E /* IMeshLoader.h */,
|
||||
95D538D10F69D61C00B4062E /* IMeshManipulator.h */,
|
||||
95D538D20F69D61C00B4062E /* IMeshSceneNode.h */,
|
||||
95D538D30F69D61C00B4062E /* IMeshWriter.h */,
|
||||
95D538D40F69D61C00B4062E /* IMetaTriangleSelector.h */,
|
||||
95D538D50F69D61C00B4062E /* IOSOperator.h */,
|
||||
95D538D60F69D61C00B4062E /* IParticleAffector.h */,
|
||||
95D538D70F69D61C00B4062E /* IParticleAnimatedMeshSceneNodeEmitter.h */,
|
||||
95D538D80F69D61C00B4062E /* IParticleAttractionAffector.h */,
|
||||
95D538D90F69D61C00B4062E /* IParticleBoxEmitter.h */,
|
||||
95D538DA0F69D61C00B4062E /* IParticleCylinderEmitter.h */,
|
||||
95D538DB0F69D61C00B4062E /* IParticleEmitter.h */,
|
||||
95D538DC0F69D61C00B4062E /* IParticleFadeOutAffector.h */,
|
||||
95D538DD0F69D61C00B4062E /* IParticleGravityAffector.h */,
|
||||
95D538DE0F69D61C00B4062E /* IParticleMeshEmitter.h */,
|
||||
95D538DF0F69D61C00B4062E /* IParticleRingEmitter.h */,
|
||||
95D538E00F69D61C00B4062E /* IParticleRotationAffector.h */,
|
||||
95D538E10F69D61C00B4062E /* IParticleSphereEmitter.h */,
|
||||
95D538E20F69D61C00B4062E /* IParticleSystemSceneNode.h */,
|
||||
95D538E30F69D61C00B4062E /* IQ3LevelMesh.h */,
|
||||
95D538E40F69D61C00B4062E /* IQ3Shader.h */,
|
||||
95D538E50F69D61C00B4062E /* IReadFile.h */,
|
||||
95D538E60F69D61C00B4062E /* IReferenceCounted.h */,
|
||||
95D538E70F69D61C00B4062E /* irrAllocator.h */,
|
||||
95D538E80F69D61C00B4062E /* irrArray.h */,
|
||||
95D538E90F69D61C00B4062E /* IrrCompileConfig.h */,
|
||||
95D538EA0F69D61C00B4062E /* irrlicht.h */,
|
||||
95D538EB0F69D61C00B4062E /* IrrlichtDevice.h */,
|
||||
95D538EC0F69D61C00B4062E /* irrList.h */,
|
||||
95D538ED0F69D61C00B4062E /* irrMap.h */,
|
||||
95D538EE0F69D61C00B4062E /* irrMath.h */,
|
||||
95D538EF0F69D61C00B4062E /* irrString.h */,
|
||||
95D538F00F69D61C00B4062E /* irrTypes.h */,
|
||||
95D538F10F69D61C00B4062E /* irrXML.h */,
|
||||
95D538F20F69D61C00B4062E /* ISceneCollisionManager.h */,
|
||||
95D538F30F69D61C00B4062E /* ISceneManager.h */,
|
||||
95D538F40F69D61C00B4062E /* ISceneNode.h */,
|
||||
95D538F50F69D61C00B4062E /* ISceneNodeAnimator.h */,
|
||||
95D538F60F69D61C00B4062E /* ISceneNodeAnimatorCameraFPS.h */,
|
||||
95D538F70F69D61C00B4062E /* ISceneNodeAnimatorCameraMaya.h */,
|
||||
95D538F80F69D61C00B4062E /* ISceneNodeAnimatorCollisionResponse.h */,
|
||||
95D538F90F69D61C00B4062E /* ISceneNodeAnimatorFactory.h */,
|
||||
95D538FA0F69D61C00B4062E /* ISceneNodeFactory.h */,
|
||||
95D538FB0F69D61C00B4062E /* ISceneUserDataSerializer.h */,
|
||||
95D538FC0F69D61C00B4062E /* IShaderConstantSetCallBack.h */,
|
||||
95D538FD0F69D61C00B4062E /* IShadowVolumeSceneNode.h */,
|
||||
95D538FE0F69D61C00B4062E /* ISkinnedMesh.h */,
|
||||
95D538FF0F69D61C00B4062E /* ITerrainSceneNode.h */,
|
||||
95D539000F69D61C00B4062E /* ITextSceneNode.h */,
|
||||
95D539010F69D61C00B4062E /* ITexture.h */,
|
||||
95D539020F69D61C00B4062E /* ITimer.h */,
|
||||
95D539030F69D61C00B4062E /* ITriangleSelector.h */,
|
||||
95D539040F69D61C00B4062E /* IVertexBuffer.h */,
|
||||
95D539050F69D61C00B4062E /* IVideoDriver.h */,
|
||||
95D539060F69D61C00B4062E /* IVideoModeList.h */,
|
||||
95D539070F69D61C00B4062E /* IVolumeLightSceneNode.h */,
|
||||
95D539080F69D61C00B4062E /* IWriteFile.h */,
|
||||
95D539090F69D61C00B4062E /* IXMLReader.h */,
|
||||
95D5390A0F69D61C00B4062E /* IXMLWriter.h */,
|
||||
95D5390B0F69D61C00B4062E /* Keycodes.h */,
|
||||
95D5390C0F69D61C00B4062E /* line2d.h */,
|
||||
95D5390D0F69D61C00B4062E /* line3d.h */,
|
||||
95D5390E0F69D61C00B4062E /* matrix4.h */,
|
||||
95D5390F0F69D61C00B4062E /* plane3d.h */,
|
||||
95D539100F69D61C00B4062E /* position2d.h */,
|
||||
95D539110F69D61C00B4062E /* quaternion.h */,
|
||||
95D539120F69D61C00B4062E /* rect.h */,
|
||||
95D539130F69D61C00B4062E /* S3DVertex.h */,
|
||||
95D539140F69D61C00B4062E /* SAnimatedMesh.h */,
|
||||
95D539150F69D61C00B4062E /* SceneParameters.h */,
|
||||
95D539160F69D61C00B4062E /* SColor.h */,
|
||||
95D539170F69D61C00B4062E /* SExposedVideoData.h */,
|
||||
95D539180F69D61C00B4062E /* SIrrCreationParameters.h */,
|
||||
95D539190F69D61C00B4062E /* SKeyMap.h */,
|
||||
95D5391A0F69D61C00B4062E /* SLight.h */,
|
||||
95D5391B0F69D61C00B4062E /* SMaterial.h */,
|
||||
95D5391C0F69D61C00B4062E /* SMaterialLayer.h */,
|
||||
95D5391D0F69D61C00B4062E /* SMesh.h */,
|
||||
95D5391E0F69D61C00B4062E /* SMeshBuffer.h */,
|
||||
95D5391F0F69D61C00B4062E /* SMeshBufferLightMap.h */,
|
||||
95D539200F69D61C00B4062E /* SMeshBufferTangents.h */,
|
||||
95D539210F69D61C00B4062E /* SParticle.h */,
|
||||
95D539220F69D61C00B4062E /* SSharedMeshBuffer.h */,
|
||||
95D539230F69D61C00B4062E /* SSkinMeshBuffer.h */,
|
||||
95D539240F69D61C00B4062E /* SVertexIndex.h */,
|
||||
95D539250F69D61C00B4062E /* SViewFrustum.h */,
|
||||
95D539260F69D61C00B4062E /* triangle3d.h */,
|
||||
95D539270F69D61C00B4062E /* vector2d.h */,
|
||||
95D539280F69D61C00B4062E /* vector3d.h */,
|
||||
);
|
||||
name = irrlicht;
|
||||
path = /usr/local/include/irrlicht;
|
||||
sourceTree = "<absolute>";
|
||||
};
|
||||
95E104FE0E28F65D00503124 /* bullet */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -2429,36 +2658,6 @@
|
||||
95C2B2FA0F296546000D3E5D /* explosion.cpp in Sources */,
|
||||
95C2B3030F296546000D3E5D /* grand_prix_data.cpp in Sources */,
|
||||
95C2B3060F296546000D3E5D /* grand_prix_manager.cpp in Sources */,
|
||||
95C2B3100F296546000D3E5D /* base_gui.cpp in Sources */,
|
||||
95C2B3110F296546000D3E5D /* challenges_menu.cpp in Sources */,
|
||||
95C2B3120F296546000D3E5D /* char_sel.cpp in Sources */,
|
||||
95C2B3130F296546000D3E5D /* config_controls.cpp in Sources */,
|
||||
95C2B3140F296546000D3E5D /* config_display.cpp in Sources */,
|
||||
95C2B3150F296546000D3E5D /* config_sound.cpp in Sources */,
|
||||
95C2B3160F296546000D3E5D /* credits_menu.cpp in Sources */,
|
||||
95C2B3170F296546000D3E5D /* display_res_confirm.cpp in Sources */,
|
||||
95C2B3180F296546000D3E5D /* feature_unlocked.cpp in Sources */,
|
||||
95C2B3190F296546000D3E5D /* font.cpp in Sources */,
|
||||
95C2B31A0F296546000D3E5D /* game_mode.cpp in Sources */,
|
||||
95C2B31B0F296546000D3E5D /* grand_prix_ending.cpp in Sources */,
|
||||
95C2B31C0F296546000D3E5D /* grand_prix_select.cpp in Sources */,
|
||||
95C2B31D0F296546000D3E5D /* help_page_one.cpp in Sources */,
|
||||
95C2B31E0F296546000D3E5D /* help_page_three.cpp in Sources */,
|
||||
95C2B31F0F296546000D3E5D /* help_page_two.cpp in Sources */,
|
||||
95C2B3200F296546000D3E5D /* main_menu.cpp in Sources */,
|
||||
95C2B3210F296546000D3E5D /* menu_manager.cpp in Sources */,
|
||||
95C2B3220F296546000D3E5D /* network_gui.cpp in Sources */,
|
||||
95C2B3230F296546000D3E5D /* num_players.cpp in Sources */,
|
||||
95C2B3240F296546000D3E5D /* options.cpp in Sources */,
|
||||
95C2B3250F296546000D3E5D /* player_controls.cpp in Sources */,
|
||||
95C2B3260F296546000D3E5D /* race_gui.cpp in Sources */,
|
||||
95C2B3270F296546000D3E5D /* race_menu.cpp in Sources */,
|
||||
95C2B3280F296546000D3E5D /* race_options.cpp in Sources */,
|
||||
95C2B3290F296546000D3E5D /* race_results_gui.cpp in Sources */,
|
||||
95C2B32A0F296546000D3E5D /* start_race_feedback.cpp in Sources */,
|
||||
95C2B32B0F296546000D3E5D /* track_sel.cpp in Sources */,
|
||||
95C2B32C0F296546000D3E5D /* widget.cpp in Sources */,
|
||||
95C2B32D0F296546000D3E5D /* widget_manager.cpp in Sources */,
|
||||
95C2B3310F296546000D3E5D /* highscore_manager.cpp in Sources */,
|
||||
95C2B3330F296546000D3E5D /* highscores.cpp in Sources */,
|
||||
95C2B3350F296546000D3E5D /* history.cpp in Sources */,
|
||||
@ -2543,6 +2742,14 @@
|
||||
95C65DAA0F532FD400BE7BA7 /* shadow.cpp in Sources */,
|
||||
95C65DAB0F532FD400BE7BA7 /* nitro.cpp in Sources */,
|
||||
950557140F6963790056E88C /* file_manager.cpp in Sources */,
|
||||
950557860F696A900056E88C /* engine.cpp in Sources */,
|
||||
950557870F696A900056E88C /* my_button.cpp in Sources */,
|
||||
950557880F696A900056E88C /* screen.cpp in Sources */,
|
||||
950557890F696A900056E88C /* screen_loader.cpp in Sources */,
|
||||
9505578A0F696A900056E88C /* skin.cpp in Sources */,
|
||||
9505578B0F696A900056E88C /* widget.cpp in Sources */,
|
||||
95C1E3F20F699079005D33E6 /* race_gui.cpp in Sources */,
|
||||
95C1E4000F699427005D33E6 /* font.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -2631,8 +2838,6 @@
|
||||
"-lplibssgaux",
|
||||
"-lirrlicht",
|
||||
"-L/usr/local/lib",
|
||||
"-lSDL",
|
||||
"-lSDLmain",
|
||||
"-lopenal",
|
||||
"-lvorbisfile",
|
||||
"-lvorbis",
|
||||
|
@ -19,6 +19,7 @@
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "io/file_manager.hpp"
|
||||
#include <unistd.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
@ -91,16 +92,31 @@ FileManager* file_manager = 0;
|
||||
*/
|
||||
FileManager::FileManager()
|
||||
{
|
||||
m_device = createDevice(video::EDT_NULL);
|
||||
#ifdef __APPLE__
|
||||
// irrLicht's createDevice method has a nasty habit of messing the CWD.
|
||||
// since the code above may rely on it, save it to be able to restore it after.
|
||||
char buffer[256];
|
||||
getcwd(buffer, 256);
|
||||
#endif
|
||||
|
||||
m_device = createDevice(video::EDT_NULL);
|
||||
|
||||
#ifdef __APPLE__
|
||||
chdir( buffer );
|
||||
#endif
|
||||
|
||||
m_file_system = m_device->getFileSystem();
|
||||
m_is_full_path = false;
|
||||
|
||||
|
||||
if ( getenv ( "SUPERTUXKART_DATADIR" ) != NULL )
|
||||
m_root_dir= getenv ( "SUPERTUXKART_DATADIR" ) ;
|
||||
#ifdef __APPLE__
|
||||
else if( macSetBundlePathIfRelevant( m_root_dir ) ) { /* nothing to do */ }
|
||||
#endif
|
||||
else if(m_file_system->existFile("data/stk_config.data"))
|
||||
// else if(m_file_system->existFile("/Developer/games/supertuxkart/data/stk_config.data"))
|
||||
// m_root_dir = "/Developer/games/supertuxkart" ;
|
||||
// FIXME - existFile() fails to detect the file, even though it exists, on my computer
|
||||
else if(m_file_system->existFile("/data/stk_config.data"))
|
||||
m_root_dir = "." ;
|
||||
else if(m_file_system->existFile("../data/stk_config.data"))
|
||||
m_root_dir = ".." ;
|
||||
|
@ -38,8 +38,7 @@
|
||||
#include "graphics/shadow.hpp"
|
||||
#include "graphics/skid_marks.hpp"
|
||||
#include "graphics/smoke.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/race_gui.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "items/item_manager.hpp"
|
||||
#include "karts/kart_model.hpp"
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "audio/sfx_base.hpp"
|
||||
#include "graphics/camera.hpp"
|
||||
#include "graphics/scene.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/race_gui.hpp"
|
||||
#include "items/item.hpp"
|
||||
#include "modes/world.hpp"
|
||||
@ -314,12 +313,15 @@ void PlayerKart::raceFinished(float time)
|
||||
// will most likely not be at the starting line at the end of the race
|
||||
if(race_manager->getMinorMode()!=RaceManager::MINOR_MODE_FOLLOW_LEADER)
|
||||
m_camera->setMode(Camera::CM_FINAL);
|
||||
// TODO : race ending menu
|
||||
/*
|
||||
RaceGUI* m=(RaceGUI*)menu_manager->getRaceMenu();
|
||||
if(m)
|
||||
{
|
||||
m->addMessage(getPosition()==1 ? _("You won the race!") : _("You finished the race!") ,
|
||||
this, 2.0f, 60);
|
||||
}
|
||||
*/
|
||||
} // raceFinished
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -376,7 +378,7 @@ void PlayerKart::collectedItem(const Item &item, int add_info)
|
||||
*/
|
||||
void PlayerKart::doingShortcut()
|
||||
{
|
||||
RaceGUI* m=(RaceGUI*)menu_manager->getRaceMenu();
|
||||
RaceGUI* m=(RaceGUI*)getRaceGUI();
|
||||
// Can happen if the option menu is called
|
||||
if(m)
|
||||
m->addMessage(_("Invalid short-cut!!"), this, 2.0f, 60);
|
||||
|
18
src/main.cpp
18
src/main.cpp
@ -60,9 +60,7 @@
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/scene.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "gui/font.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "items/attachment_manager.hpp"
|
||||
#include "items/item_manager.hpp"
|
||||
@ -472,7 +470,7 @@ void InitTuxkart()
|
||||
race_manager->setMinorMode (RaceManager::MINOR_MODE_QUICK_RACE);
|
||||
race_manager->setDifficulty(RaceManager::RD_HARD);
|
||||
|
||||
menu_manager= new MenuManager();
|
||||
//menu_manager= new MenuManager();
|
||||
|
||||
// Consistency check for challenges, and enable all challenges
|
||||
// that have all prerequisites fulfilled
|
||||
@ -484,7 +482,7 @@ void CleanTuxKart()
|
||||
{
|
||||
//delete in reverse order of what they were created in.
|
||||
//see InitTuxkart()
|
||||
if(menu_manager) delete menu_manager;
|
||||
//if(menu_manager) delete menu_manager;
|
||||
if(race_manager) delete race_manager;
|
||||
if(network_manager) delete network_manager;
|
||||
if(grand_prix_manager) delete grand_prix_manager;
|
||||
@ -561,11 +559,12 @@ int main(int argc, char *argv[] )
|
||||
|
||||
//For some reason, calling this before the material loading screws
|
||||
//the background picture.
|
||||
fntInit();
|
||||
//fntInit();
|
||||
init_fonts();
|
||||
|
||||
widget_manager = new WidgetManager;
|
||||
menu_manager->switchToMainMenu();
|
||||
// TODO - show main menu here
|
||||
//widget_manager = new WidgetManager;
|
||||
//menu_manager->switchToMainMenu();
|
||||
|
||||
// Replay a race
|
||||
// =============
|
||||
@ -593,7 +592,8 @@ int main(int argc, char *argv[] )
|
||||
// On the server start with the network information page for now
|
||||
if(network_manager->getMode()==NetworkManager::NW_SERVER)
|
||||
{
|
||||
menu_manager->pushMenu(MENUID_NETWORK_GUI);
|
||||
// TODO - network menu
|
||||
//menu_manager->pushMenu(MENUID_NETWORK_GUI);
|
||||
}
|
||||
// Not replaying
|
||||
// =============
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "audio/sound_manager.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/scene.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/engine.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "user_config.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
@ -191,12 +191,12 @@ void MainLoop::run()
|
||||
|
||||
|
||||
//Draw the splash screen
|
||||
|
||||
/*
|
||||
if(menu_manager->isMainMenuActive())
|
||||
glBindTexture(GL_TEXTURE_2D, m_title_screen_texture);
|
||||
else
|
||||
glBindTexture(GL_TEXTURE_2D, m_bg_texture);
|
||||
|
||||
*/
|
||||
glBegin ( GL_QUADS ) ;
|
||||
glColor3f (1, 1, 1 ) ;
|
||||
glTexCoord2f(0, 0); glVertex2i(-1, -1);
|
||||
@ -206,7 +206,9 @@ void MainLoop::run()
|
||||
glEnd () ;
|
||||
}
|
||||
|
||||
menu_manager->update();
|
||||
// TODO - render menus if necessary
|
||||
//GUIEngine::render();
|
||||
//menu_manager->update();
|
||||
sound_manager->update(dt);
|
||||
|
||||
#ifdef HAVE_IRRLICHT
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "user_config.hpp"
|
||||
#include "audio/sound_manager.hpp"
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/race_gui.hpp"
|
||||
#include "items/powerup_manager.hpp"
|
||||
#include "modes/follow_the_leader.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
|
@ -16,12 +16,11 @@
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "modes/linear_world.hpp"
|
||||
|
||||
#include "gui/race_gui.hpp"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "audio/sound_manager.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/race_gui.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
#include "utils/constants.hpp"
|
||||
@ -281,13 +280,13 @@ void LinearWorld::doLapCounting ( KartInfo& kart_info, Kart* kart )
|
||||
if(time_per_lap < getFastestLapTime() && raceHasLaps())
|
||||
{
|
||||
setFastestLap(kart, time_per_lap);
|
||||
RaceGUI* m=(RaceGUI*)menu_manager->getRaceMenu();
|
||||
RaceGUI* m=(RaceGUI*)getRaceGUI();
|
||||
if(m)
|
||||
{
|
||||
m->addMessage(_("New fastest lap"), NULL,
|
||||
2.0f, 40, 100, 210, 100);
|
||||
char s[20];
|
||||
m->TimeToString(time_per_lap, s);
|
||||
timeToString(time_per_lap, s);
|
||||
|
||||
std::ostringstream m_fastest_lap_message;
|
||||
m_fastest_lap_message << s << ": " << kart->getName();
|
||||
@ -413,7 +412,7 @@ KartIconDisplayInfo* LinearWorld::getKartsDisplayInfo(const RaceGUI* caller)
|
||||
if(position==1)
|
||||
{
|
||||
str[0]=' '; str[1]=0;
|
||||
caller->TimeToString(getTimeAtLapForKart(kart->getWorldKartId()), str+1);
|
||||
timeToString(getTimeAtLapForKart(kart->getWorldKartId()), str+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -423,7 +422,7 @@ KartIconDisplayInfo* LinearWorld::getKartsDisplayInfo(const RaceGUI* caller)
|
||||
: getTime())
|
||||
- time_of_leader;
|
||||
str[0]='+'; str[1]=0;
|
||||
caller->TimeToString(timeBehind, str+1);
|
||||
timeToString(timeBehind, str+1);
|
||||
}
|
||||
rank_info.time = str;
|
||||
}
|
||||
@ -633,7 +632,7 @@ void LinearWorld::checkForWrongDirection(unsigned int i)
|
||||
if(!m_kart[i]->isPlayerKart()) return;
|
||||
if(!m_kart_info[i].m_on_road) return;
|
||||
|
||||
RaceGUI* m=menu_manager->getRaceMenu();
|
||||
RaceGUI* m = getRaceGUI();
|
||||
// This can happen if the option menu is called, since the
|
||||
// racegui gets deleted
|
||||
if(!m) return;
|
||||
@ -653,7 +652,6 @@ void LinearWorld::checkForWrongDirection(unsigned int i)
|
||||
{
|
||||
m->addMessage(_("WRONG WAY!"), kart, -1.0f, 60);
|
||||
} // if angle is too big
|
||||
|
||||
} // checkForWrongDirection
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
#include "user_config.hpp"
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
StandardRace::StandardRace() : LinearWorld()
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "graphics/camera.hpp"
|
||||
#include "graphics/scene.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/race_gui.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "items/item_manager.hpp"
|
||||
#include "items/projectile_manager.hpp"
|
||||
@ -158,7 +158,8 @@ void World::init()
|
||||
#endif
|
||||
|
||||
callback_manager->initAll();
|
||||
menu_manager->switchToRace();
|
||||
// TODO - race GUI
|
||||
//menu_manager->switchToRace();
|
||||
|
||||
m_track->startMusic();
|
||||
|
||||
@ -205,7 +206,8 @@ void World::terminateRace()
|
||||
{
|
||||
updateHighscores();
|
||||
TimedRace::pause();
|
||||
menu_manager->pushMenu(MENUID_RACERESULT);
|
||||
// TODO - race results GUI
|
||||
//menu_manager->pushMenu(MENUID_RACERESULT);
|
||||
unlock_manager->raceFinished();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -401,7 +403,7 @@ void World::removeKart(int kart_number)
|
||||
{
|
||||
Kart *kart = m_kart[kart_number];
|
||||
// Display a message about the eliminated kart in the race gui
|
||||
RaceGUI* m=(RaceGUI*)menu_manager->getRaceMenu();
|
||||
RaceGUI* m=getRaceGUI();
|
||||
if(m)
|
||||
{
|
||||
for (std::vector<PlayerKart*>::iterator i = m_player_karts.begin();
|
||||
|
@ -34,9 +34,9 @@
|
||||
|
||||
class SFXBase;
|
||||
struct KartIconDisplayInfo;
|
||||
class RaceGUI;
|
||||
class btRigidBody;
|
||||
class Track;
|
||||
class RaceGUI;
|
||||
|
||||
/** This class is responsible for running the actual race. A world is created
|
||||
* by the race manager on the start of each race (so a new world is created
|
||||
|
@ -22,9 +22,6 @@
|
||||
#include "stk_config.hpp"
|
||||
#include "user_config.hpp"
|
||||
#include "race_manager.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/char_sel.hpp"
|
||||
#include "gui/race_results_gui.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "network/connect_message.hpp"
|
||||
@ -251,9 +248,12 @@ void NetworkManager::handleMessageAtServer(ENetEvent *event)
|
||||
|
||||
int kart_id = kart_properties_manager->getKartId(ki.getKartName());
|
||||
kart_properties_manager->testAndSetKart(kart_id);
|
||||
// TODO - character selection screen in networking
|
||||
/*
|
||||
CharSel *menu = dynamic_cast<CharSel*>(menu_manager->getCurrentMenu());
|
||||
if(menu)
|
||||
menu->updateAvailableCharacters();
|
||||
*/
|
||||
|
||||
// Broadcast the information about a selected kart to all clients
|
||||
CharacterConfirmMessage ccm(ki.getKartName(), hostid);
|
||||
@ -318,9 +318,12 @@ void NetworkManager::handleMessageAtClient(ENetEvent *event)
|
||||
{
|
||||
CharacterConfirmMessage m(event->packet);
|
||||
kart_properties_manager->selectKartName(m.getKartName());
|
||||
// TODO - karts selection screen in networking
|
||||
/*
|
||||
CharSel *menu = dynamic_cast<CharSel*>(menu_manager->getCurrentMenu());
|
||||
if(menu)
|
||||
menu->updateAvailableCharacters();
|
||||
*/
|
||||
break;
|
||||
}
|
||||
case NS_WAIT_FOR_KART_CONFIRMATION:
|
||||
@ -330,9 +333,11 @@ void NetworkManager::handleMessageAtClient(ENetEvent *event)
|
||||
|
||||
// If the current menu is the character selection menu,
|
||||
// update the menu so that the newly taken character is removed.
|
||||
// TODO - kart selection screen and networking
|
||||
/*
|
||||
CharSel *menu = dynamic_cast<CharSel*>(menu_manager->getCurrentMenu());
|
||||
if(menu)
|
||||
menu->updateAvailableCharacters();
|
||||
menu->updateAvailableCharacters();*/
|
||||
// Check if we received a message about the kart we just selected.
|
||||
// If so, the menu needs to progress, otherwise a different kart
|
||||
// must be selected by the current player.
|
||||
@ -376,9 +381,11 @@ void NetworkManager::handleMessageAtClient(ENetEvent *event)
|
||||
case NS_RACE_RESULT_BARRIER:
|
||||
{
|
||||
RaceResultAckMessage message(event->packet);
|
||||
// TODO - race results menu in networking
|
||||
/*
|
||||
RaceResultsGUI *menu = dynamic_cast<RaceResultsGUI*>(menu_manager->getCurrentMenu());
|
||||
if(menu)
|
||||
menu->setSelectedWidget(message.getSelectedMenu());
|
||||
menu->setSelectedWidget(message.getSelectedMenu());*/
|
||||
m_state = NS_RACE_RESULT_BARRIER_OVER;
|
||||
break;
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "stk_config.hpp"
|
||||
#include "challenges/unlock_manager.hpp"
|
||||
#include "graphics/scene.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "network/network_manager.hpp"
|
||||
#include "modes/standard_race.hpp"
|
||||
@ -364,11 +363,13 @@ void RaceManager::exit_race()
|
||||
delete []race_time;
|
||||
|
||||
unlock_manager->grandPrixFinished();
|
||||
menu_manager->switchToGrandPrixEnding();
|
||||
// TODO - Grand Prix ending
|
||||
// menu_manager->switchToGrandPrixEnding();
|
||||
}
|
||||
else
|
||||
{
|
||||
menu_manager->switchToMainMenu();
|
||||
// FIXME - back to main menu
|
||||
// menu_manager->switchToMainMenu();
|
||||
}
|
||||
stk_scene->clear();
|
||||
delete world;
|
||||
|
@ -36,14 +36,12 @@
|
||||
#include "loader.hpp"
|
||||
#include "player.hpp"
|
||||
#include "user_config.hpp"
|
||||
#include "gui/menu_manager.hpp"
|
||||
#include "gui/widget_manager.hpp"
|
||||
#include "gui/font.hpp"
|
||||
#include "items/item_manager.hpp"
|
||||
#include "items/powerup_manager.hpp"
|
||||
#include "items/attachment_manager.hpp"
|
||||
#include "items/projectile_manager.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "gui/font.hpp"
|
||||
|
||||
#define DEADZONE_MOUSE 150
|
||||
#define DEADZONE_MOUSE_SENSE 200
|
||||
@ -229,16 +227,20 @@ void SDLDriver::toggleFullscreen(bool resetTextures)
|
||||
{
|
||||
m_flags |= SDL_FULLSCREEN;
|
||||
|
||||
// TODO - GUI and screen setup
|
||||
/*
|
||||
if(menu_manager->isSomewhereOnStack(MENUID_RACE))
|
||||
showPointer();
|
||||
showPointer();*/
|
||||
|
||||
// Store settings in user config file in case new video mode
|
||||
// causes a crash
|
||||
user_config->m_crashed = true; //set flag.
|
||||
user_config->saveConfig();
|
||||
}
|
||||
// TODO - GUI and screen setup
|
||||
/*
|
||||
else if(menu_manager->isSomewhereOnStack(MENUID_RACE))
|
||||
hidePointer();
|
||||
hidePointer();*/
|
||||
|
||||
setVideoMode(resetTextures);
|
||||
} // toggleFullscreen
|
||||
@ -289,7 +291,7 @@ void SDLDriver::setVideoMode(bool resetTextures)
|
||||
|
||||
//TODO: this function probably will get deleted in the future; if
|
||||
//so, the widget_manager.hpp include has no other reason to be here.
|
||||
widget_manager->reloadFonts();
|
||||
//widget_manager->reloadFonts();
|
||||
}
|
||||
#endif
|
||||
} // setVideoMode
|
||||
@ -326,6 +328,8 @@ SDLDriver::~SDLDriver()
|
||||
void SDLDriver::input(Input::InputType type, int id0, int id1, int id2,
|
||||
int value)
|
||||
{
|
||||
// TODO - menus handle SDL input
|
||||
/*
|
||||
BaseGUI* menu = menu_manager->getCurrentMenu();
|
||||
|
||||
GameAction ga = m_action_map->getEntry(type, id0, id1, id2);
|
||||
@ -391,6 +395,7 @@ void SDLDriver::input(Input::InputType type, int id0, int id1, int id2,
|
||||
menu->handle(ga, value);
|
||||
}
|
||||
} // menu!=NULL
|
||||
*/
|
||||
} // input
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -433,12 +438,14 @@ void SDLDriver::input()
|
||||
case SDL_KEYDOWN:
|
||||
if (m_mode == LOWLEVEL)
|
||||
{
|
||||
// TODO - keyboard handling and GUI
|
||||
/*
|
||||
// Unicode translation in SDL is only done for keydown events.
|
||||
// Therefore for lowlevel keyboard handling we provide no notion
|
||||
// of whether a key was pressed or released.
|
||||
menu_manager->getCurrentMenu()
|
||||
->inputKeyboard(ev.key.keysym.sym,
|
||||
ev.key.keysym.unicode);
|
||||
ev.key.keysym.unicode);*/
|
||||
}
|
||||
input(Input::IT_KEYBOARD, ev.key.keysym.sym,
|
||||
#ifdef HAVE_IRRLICHT
|
||||
@ -465,11 +472,14 @@ void SDLDriver::input()
|
||||
// axis value) while the pointer has two.
|
||||
if (!m_mode)
|
||||
{
|
||||
// TODO - mouse motion handling and GUI
|
||||
/*
|
||||
BaseGUI* menu = menu_manager->getCurrentMenu();
|
||||
#ifndef HAVE_IRRLICHT
|
||||
if (menu != NULL)
|
||||
menu->inputPointer(ev.motion.x, m_main_surface->h - ev.motion.y);
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
// If sensing input mouse movements are made less sensitive in order
|
||||
// to avoid it being detected unwantedly.
|
||||
@ -582,8 +592,10 @@ void SDLDriver::input()
|
||||
ev.jbutton.button, 0, 32768);
|
||||
break;
|
||||
case SDL_USEREVENT:
|
||||
// TODO - GUI countdown
|
||||
break;
|
||||
// used in display_res_confirm for the countdown timer
|
||||
(menu_manager->getCurrentMenu())->countdown();
|
||||
// (menu_manager->getCurrentMenu())->countdown();
|
||||
|
||||
} // switch
|
||||
} // while (SDL_PollEvent())
|
||||
|
Loading…
x
Reference in New Issue
Block a user