SuperTuxKart
soccer_setup_screen.hpp
1 // SuperTuxKart - a fun racing game with go-kart
2 // Copyright (C) 2013-2015 Lionel Fuentes
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 3
7 // of the License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 
18 #ifndef HEADER_SOCCER_SETUP_SCREEN_HPP
19 #define HEADER_SOCCER_SETUP_SCREEN_HPP
20 
21 #include "guiengine/screen.hpp"
23 
24 namespace GUIEngine { class Widget; class LabelWidget; class ModelViewWidget; }
25 
31  public GUIEngine::ScreenSingleton<SoccerSetupScreen>
32 {
34 
36 
37  struct KartViewInfo
38  {
40  bool confirmed;
41  bool support_colorization;
42  KartTeam team;
43 
44  KartViewInfo() : view(), confirmed(false), support_colorization(false),
45  team(KART_TEAM_NONE) {}
46  };
47 
48  AlignedArray<KartViewInfo> m_kart_view_info;
49 
50  bool m_schedule_continue;
51 
52 public:
53 
55  virtual void loadedFromFile() OVERRIDE;
56 
58  virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
59  const int playerID) OVERRIDE;
60 
62  virtual void beforeAddingWidget() OVERRIDE;
63 
65  virtual void init() OVERRIDE;
66 
68  virtual void tearDown() OVERRIDE;
69 
70  virtual void onUpdate(float delta) OVERRIDE;
71 
73  virtual GUIEngine::EventPropagation filterActions( PlayerAction action,
74  int deviceID,
75  const unsigned int value,
76  Input::InputType type,
77  int playerId) OVERRIDE;
78 
79  virtual bool onEscapePressed() OVERRIDE;
80 
81 private:
82  bool areAllKartsConfirmed() const;
83  int getNumConfirmedKarts();
84  void updateKartViewsLayout();
85  void changeTeam(int player_id, KartTeam team);
86  void prepareGame();
87 };
88 
89 #endif // HEADER_SOCCER_SETUP_SCREEN_HPP
GUIEngine::ModelViewWidget
A model view widget.
Definition: model_view_widget.hpp:39
SoccerSetupScreen::beforeAddingWidget
virtual void beforeAddingWidget() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: soccer_setup_screen.cpp:109
Input
Definition: input.hpp:35
GUIEngine
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:32
SoccerSetupScreen::filterActions
virtual GUIEngine::EventPropagation filterActions(PlayerAction action, int deviceID, const unsigned int value, Input::InputType type, int playerId) OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: soccer_setup_screen.cpp:273
SoccerSetupScreen::KartViewInfo
Definition: soccer_setup_screen.hpp:38
SoccerSetupScreen::tearDown
virtual void tearDown() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: soccer_setup_screen.cpp:222
SoccerSetupScreen::onUpdate
virtual void onUpdate(float delta) OVERRIDE
optional callback you can override to be notified at every frame.
Definition: soccer_setup_screen.cpp:386
GUIEngine::Screen
Represents a single GUI screen.
Definition: screen.hpp:97
SoccerSetupScreen::loadedFromFile
virtual void loadedFromFile() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: soccer_setup_screen.cpp:54
GUIEngine::ScreenSingleton
Declares a class to be a singleton.
Definition: screen.hpp:59
SoccerSetupScreen::init
virtual void init() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: soccer_setup_screen.cpp:202
SoccerSetupScreen
Screen with soccer setup options.
Definition: soccer_setup_screen.hpp:32
remote_kart_info.hpp
SoccerSetupScreen::eventCallback
virtual void eventCallback(GUIEngine::Widget *widget, const std::string &name, const int playerID) OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: soccer_setup_screen.cpp:59
SoccerSetupScreen::onEscapePressed
virtual bool onEscapePressed() OVERRIDE
Called when escape is pressed.
Definition: soccer_setup_screen.cpp:485
PlayerAction
PlayerAction
types of input events / what actions the players can do
Definition: input.hpp:117