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
virtual void beforeAddingWidget() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: soccer_setup_screen.cpp:107
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:31
virtual bool onEscapePressed() OVERRIDE
Called when escape is pressed.
Definition: soccer_setup_screen.cpp:474
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:262
PlayerAction
types of input events / what actions the players can do
Definition: input.hpp:116
virtual void onUpdate(float delta) OVERRIDE
optional callback you can override to be notified at every frame.
Definition: soccer_setup_screen.cpp:375
Definition: input.hpp:34
Definition: soccer_setup_screen.hpp:37
A model view widget.
Definition: model_view_widget.hpp:38
virtual void loadedFromFile() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: soccer_setup_screen.cpp:52
virtual void tearDown() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: soccer_setup_screen.cpp:211
Screen with soccer setup options.
Definition: soccer_setup_screen.hpp:30
Represents a single GUI screen.
Definition: screen.hpp:94
Declares a class to be a singleton.
Definition: screen.hpp:57
virtual void init() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: soccer_setup_screen.cpp:191
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:57