SuperTuxKart
online_screen.hpp
1 // SuperTuxKart - a fun racing game with go-kart
2 // Copyright (C) 2009-2015 Marianne Gagnon
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_ONLINE_SCREEN_HPP
19 #define HEADER_ONLINE_SCREEN_HPP
20 
21 #include "guiengine/screen.hpp"
22 #include "network/transport_address.hpp"
23 
24 #include <memory>
25 
26 class Server;
27 
28 namespace GUIEngine { class CheckBoxWidget; class ListWidget;
29  class ButtonWidget; class IconButtonWidget; }
30 
35 class OnlineScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<OnlineScreen>
36 {
37 private:
39 
40  core::stringw m_online_string;
41 
42  core::stringw m_login_string;
43 
46 
49 
50  GUIEngine::CheckBoxWidget* m_enable_splitscreen;
51 
52  std::shared_ptr<Server> m_entered_server;
53 
54  TransportAddress m_entered_server_address;
55 
56  OnlineScreen();
57 
58 public:
59 
60  virtual void onUpdate(float delta) OVERRIDE;
61 
63  virtual void loadedFromFile() OVERRIDE;
64 
66  virtual void beforeAddingWidget() OVERRIDE;
67 
69  virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name,
70  const int playerID) OVERRIDE;
71 
73  virtual void init() OVERRIDE;
74 
76  virtual bool onEscapePressed() OVERRIDE;
77 
78 };
79 
80 #endif
virtual void loadedFromFile() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: online_screen.cpp:67
virtual void init() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: online_screen.cpp:82
Definition: server.hpp:43
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:31
A checkbox widget.
Definition: check_box_widget.hpp:33
virtual bool onEscapePressed() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: online_screen.cpp:307
A button widget with an icon and optionnaly a label beneath.
Definition: icon_button_widget.hpp:43
Handles the networking main menu.
Definition: online_screen.hpp:35
virtual void onUpdate(float delta) OVERRIDE
optional callback you can override to be notified at every frame.
Definition: online_screen.cpp:108
Describes a transport-layer address. For IP networks, a transport address is the couple ip:port.
Definition: transport_address.hpp:36
GUIEngine::IconButtonWidget * m_online
Keep the widget to avoid looking it up every frame.
Definition: online_screen.hpp:48
GUIEngine::ButtonWidget * m_user_id
Keep the widget to to the user name.
Definition: online_screen.hpp:45
A text button widget.
Definition: button_widget.hpp:40
Represents a single GUI screen.
Definition: screen.hpp:94
Declares a class to be a singleton.
Definition: screen.hpp:57
virtual void beforeAddingWidget() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: online_screen.cpp:76
virtual void eventCallback(GUIEngine::Widget *widget, const std::string &name, const int playerID) OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: online_screen.cpp:149