SuperTuxKart
Loading...
Searching...
No Matches
network_kart_selection.hpp
1// SuperTuxKart - a fun racing game with go-kart
2// Copyright (C) 2014-2015 SuperTuxKart-Team
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 NETWORK_KART_SELECTION_HPP
19#define NETWORK_KART_SELECTION_HPP
20
21#include "states_screens/kart_selection.hpp"
22#include "guiengine/screen.hpp"
23
24namespace GUIEngine
25{
26 class ProgressBarWidget;
27}
28
29#include <set>
30
32 public GUIEngine::ScreenSingleton<NetworkKartSelectionScreen>
33{
34private:
38
40
41 bool m_live_join;
42
43 bool m_all_players_done;
44
45 uint64_t m_exit_timeout;
46protected:
47 // ------------------------------------------------------------------------
49 : KartSelectionScreen("online/network_karts.stkgui")
50 {
51 m_live_join = false;
52 m_all_players_done = false;
53 }
54 // ------------------------------------------------------------------------
56 // ------------------------------------------------------------------------
57 virtual void allPlayersDone() OVERRIDE;
58
59private:
60 std::set<std::string> m_available_karts;
61
62 // ------------------------------------------------------------------------
63 virtual bool isIgnored(const std::string& ident) const OVERRIDE;
64 // ------------------------------------------------------------------------
65 void updateProgressBarText();
66 // ------------------------------------------------------------------------
67 virtual void beforeAddingWidget() OVERRIDE;
68
69public:
71 virtual void onUpdate(float dt) OVERRIDE;
72
73 // ------------------------------------------------------------------------
74 void setAvailableKartsFromServer(const std::set<std::string>& k)
75 { m_available_karts = k; }
76 // ------------------------------------------------------------------------
77 virtual void init() OVERRIDE;
78 // ------------------------------------------------------------------------
79 virtual bool onEscapePressed() OVERRIDE;
80 // ------------------------------------------------------------------------
81 virtual bool playerQuit(StateManager::ActivePlayer* player) OVERRIDE
82 { return true; }
83 // ------------------------------------------------------------------------
84 void setLiveJoin(bool val) { m_live_join = val; }
85};
86
87#endif // NETWORK_KART_SELECTION_HPP
A progress bar widget.
Definition: progress_bar_widget.hpp:36
Declares a class to be a singleton.
Definition: screen.hpp:59
screen where players can choose their kart
Definition: kart_selection.hpp:51
Definition: network_kart_selection.hpp:33
virtual void init() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: network_kart_selection.cpp:46
virtual bool onEscapePressed() OVERRIDE
implement optional callback from parent class GUIEngine::Screen
Definition: network_kart_selection.cpp:173
GUIEngine::ProgressBarWidget * m_timer
Pointer to progress bar widget which is used as a timer (going backwards).
Definition: network_kart_selection.hpp:37
virtual void beforeAddingWidget() OVERRIDE
Optional callback invoked very early, before widgets have been added (contrast with init(),...
Definition: network_kart_selection.cpp:39
virtual void allPlayersDone() OVERRIDE
Called when all players selected their kart.
Definition: network_kart_selection.cpp:103
virtual void onUpdate(float dt) OVERRIDE
Implement per-frame callback.
Definition: network_kart_selection.cpp:86
virtual bool playerQuit(StateManager::ActivePlayer *player) OVERRIDE
Called when a player hits 'rescue'/'cancel' on his device to leave the game.
Definition: network_kart_selection.hpp:81
A concrete scene manager, derived from GUIEngine's AbastractSceneManager.
Definition: state_manager.hpp:60
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33