SuperTuxKart
Loading...
Searching...
No Matches
online_profile_achievements.hpp
1// SuperTuxKart - a fun racing game with go-kart
2// Copyright (C) 2013-2015 Glenn De Jonghe
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
19#ifndef __HEADER_ONLINE_PROFILE_ACHIEVEMENTS_HPP__
20#define __HEADER_ONLINE_PROFILE_ACHIEVEMENTS_HPP__
21
22#include <string>
23#include <irrString.h>
24
25#include "achievements/achievement.hpp"
26#include "guiengine/screen.hpp"
27#include "guiengine/widgets.hpp"
28#include "states_screens/online/online_profile_base.hpp"
29#include "online/profile_manager.hpp"
30
31
32namespace GUIEngine { class Widget; }
33
34
41{
42private:
43
44 GUIEngine::ListWidget * m_achievements_list_widget;
45
46 int m_selected_achievement_index;
47 bool m_waiting_for_achievements;
48
51
52 bool m_sort_desc;
53
54 bool m_sort_default;
55
56 void displayResults();
57 // True if a < b
58 bool goalSort(Achievement *a, Achievement *b);
60
61protected:
62 BaseOnlineProfileAchievements(const std::string &filename);
63
64public:
66
68 virtual void loadedFromFile() OVERRIDE;
69
71 virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID) OVERRIDE;
72
74 virtual void init() OVERRIDE;
75
76 virtual void onUpdate(float delta) OVERRIDE;
77
78 virtual void beforeAddingWidget() OVERRIDE;
79 virtual void onColumnClicked(int column_id, bool sort_desc, bool sort_default) OVERRIDE;
80
81 // ------------------------------------------------------------------------
82 virtual void refreshAchievementsList()
83 {
84 m_waiting_for_achievements = true;
85 } // refreshAchievementsList
86};
87
88// ============================================================================
94 public GUIEngine::ScreenSingleton<TabOnlineProfileAchievements>
95{
96protected:
98
100 : BaseOnlineProfileAchievements("online/profile_achievements_tab.stkgui")
101 {}
102
103}; // TabOnlineProfileAchievements
104
105// ============================================================================
111 public GUIEngine::ScreenSingleton < OnlineProfileAchievements >
112{
113protected:
115
117 : BaseOnlineProfileAchievements("online/profile_achievements.stkgui")
118 {}
119
120}; // class
121
122
123#endif
Definition: achievement.hpp:42
Online profiel overview screen.
Definition: online_profile_achievements.hpp:41
virtual void beforeAddingWidget() OVERRIDE
Callback before widgets are added.
Definition: online_profile_achievements.cpp:72
virtual void eventCallback(GUIEngine::Widget *widget, const std::string &name, const int playerID) OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: online_profile_achievements.cpp:122
bool goalSort(Achievement *a, Achievement *b)
True if a's goal progression is <= to b's.
Definition: online_profile_achievements.cpp:275
virtual void init() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: online_profile_achievements.cpp:92
void displayResults()
Displays the achievements from a given profile.
Definition: online_profile_achievements.cpp:178
virtual void onUpdate(float delta) OVERRIDE
Called every frame.
Definition: online_profile_achievements.cpp:307
virtual void loadedFromFile() OVERRIDE
implement callback from parent class GUIEngine::Screen
Definition: online_profile_achievements.cpp:60
bool progressSort(Achievement *a, Achievement *b)
True if a's single-goal progress is <= to b's.
Definition: online_profile_achievements.cpp:288
int m_sort_column
Which column to use for sorting.
Definition: online_profile_achievements.hpp:50
Definition: list_widget.hpp:37
A vertical list widget with text entries.
Definition: list_widget.hpp:50
Declares a class to be a singleton.
Definition: screen.hpp:59
Online profiel overview screen.
Definition: online_profile_achievements.hpp:112
Online profile base screen.
Definition: online_profile_base.hpp:38
Online profiel overview screen.
Definition: online_profile_achievements.hpp:95
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33