HoverRace  2.0
PlayerStatusAnnouncement.h
Go to the documentation of this file.
1 
2 // PlayerStatusAnnouncement.h
3 //
4 // Copyright (c) 2016 Michael Imamura.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 
22 #pragma once
23 
24 #include "MessageAnnouncement.h"
25 
26 namespace HoverRace {
27 namespace Client {
28 
34 {
36 
37 public:
38  struct Status
39  {
40  enum status_t
41  {
44  };
45  };
46 
47 public:
49  std::shared_ptr<Player::Player> target,
50  std::shared_ptr<Player::Player> subject);
52 
53  Status::status_t GetStatus() const { return status; }
54 
55 protected:
56  static std::string RenderStatusText(Status::status_t status,
57  const Player::Player &player);
58 
59 public:
60  std::shared_ptr<Display::Box> CreateIcon(Display::Display &display,
61  Display::Container &parent) const override;
62 
63 private:
65  std::shared_ptr<Player::Player> subject;
66 };
67 
68 } // namespace Client
69 } // namespace HoverRace
Status::status_t status
Definition: PlayerStatusAnnouncement.h:64
MessageAnnouncement(const std::string &label, std::shared_ptr< Player::Player > player={})
Definition: MessageAnnouncement.h:38
Definition: PlayerStatusAnnouncement.h:38
Status::status_t GetStatus() const
Definition: PlayerStatusAnnouncement.h:53
static std::string RenderStatusText(Status::status_t status, const Player::Player &player)
Generate the announcement text for the status.
Definition: PlayerStatusAnnouncement.cpp:54
virtual ~PlayerStatusAnnouncement()
Definition: PlayerStatusAnnouncement.h:51
status_t
Definition: PlayerStatusAnnouncement.h:40
std::shared_ptr< Player::Player > subject
Definition: PlayerStatusAnnouncement.h:65
Base class for display managers.
Definition: Display.h:73
Basic message.
Definition: MessageAnnouncement.h:33
std::shared_ptr< Display::Box > CreateIcon(Display::Display &display, Display::Container &parent) const override
Create the optional icon to display next to the announcement.
Definition: PlayerStatusAnnouncement.cpp:75
An invisible container for other UI widgets.
Definition: Container.h:49
Player has just joined the game.
Definition: PlayerStatusAnnouncement.h:43
std::shared_ptr< Player::Player > player
Definition: Announcement.h:99
Player is currently logged in.
Definition: PlayerStatusAnnouncement.h:42
Definition: Announcement.h:24
PlayerStatusAnnouncement(Status::status_t status, std::shared_ptr< Player::Player > target, std::shared_ptr< Player::Player > subject)
Constructor.
Definition: PlayerStatusAnnouncement.cpp:41
Base class for connected players.
Definition: Player.h:49
Base class for announcements.
Definition: Announcement.h:43
Player status change (join / leave) announcement.
Definition: PlayerStatusAnnouncement.h:33