RigsofRods
Soft-body Physics Simulation
GUI_MultiplayerClientList.h
Go to the documentation of this file.
1 /*
2  This source file is part of Rigs of Rods
3  Copyright 2005-2012 Pierre-Michel Ricordel
4  Copyright 2007-2012 Thomas Fischer
5  Copyright 2013-2019 Petr Ohlidal
6 
7  For more information, see http://www.rigsofrods.org/
8 
9  Rigs of Rods is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License version 3, as
11  published by the Free Software Foundation.
12 
13  Rigs of Rods is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
25 
27 
28 #pragma once
29 
30 #include "RoRnet.h"
31 
32 #include <Ogre.h>
33 #include <imgui.h>
34 
35 namespace RoR {
36 namespace GUI {
37 
39 {
40 public:
41  void Draw();
42  void UpdateClients();
43 
44 private:
45  void DrawIcon(Ogre::TexturePtr tex, ImVec2 reference_box);
46  void CacheIcons();
47 
48  std::vector<RoRnet::UserInfo> m_users; // only updated on demand to reduce mutex locking and vector allocating overhead; see `MSG_GUI_MP_CLIENTS_REFRESH`.
49  std::vector <BitMask_t> m_users_peeropts; // updated along with `m_users`, see `MSG_GUI_MP_CLIENTS_REFRESH`.
50 
51  // Peer options menu - opened by [<] button, closes when mouse cursor leaves.
52  void DrawPeerOptionsMenu();
53  void DrawPeerOptCheckbox(const BitMask_t flag, const std::string& label);
54  void DrawServerCommandBtn(const std::string& cmdfmt, const std::string& label);
55  const int PEEROPTS_MENU_CONTENT_WIDTH = 150;
56  const int PEEROPTS_MENU_MARGIN = 10;
57  const int PEEROPTS_HOVER_MARGIN = 100;
59  ImVec2 m_peeropts_menu_corner_tl = ImVec2(0, 0);
60  ImVec2 m_peeropts_menu_corner_br = ImVec2(0, 0);
61 
62  // Icon cache
63  bool m_icons_cached = false;
64  Ogre::TexturePtr m_icon_arrow_down;
65  Ogre::TexturePtr m_icon_arrow_down_grey;
66  Ogre::TexturePtr m_icon_arrow_down_red;
67  Ogre::TexturePtr m_icon_arrow_up;
68  Ogre::TexturePtr m_icon_arrow_up_grey;
69  Ogre::TexturePtr m_icon_arrow_up_red;
70  Ogre::TexturePtr m_icon_flag_red;
71  Ogre::TexturePtr m_icon_flag_blue;
72  Ogre::TexturePtr m_icon_flag_green;
73  Ogre::TexturePtr m_icon_warn_triangle;
74 };
75 
76 } // namespace GUI
77 } // namespace RoR
RoR::GUI::MpClientList::m_icon_flag_red
Ogre::TexturePtr m_icon_flag_red
Definition: GUI_MultiplayerClientList.h:70
RoR::GUI::MpClientList::m_icons_cached
bool m_icons_cached
Definition: GUI_MultiplayerClientList.h:63
RoR::GUI::MpClientList::m_icon_arrow_down_red
Ogre::TexturePtr m_icon_arrow_down_red
Definition: GUI_MultiplayerClientList.h:66
RoR::GUI::MpClientList::m_icon_arrow_up
Ogre::TexturePtr m_icon_arrow_up
Definition: GUI_MultiplayerClientList.h:67
RoR::GUI::MpClientList::m_peeropts_menu_active_user_vectorpos
int m_peeropts_menu_active_user_vectorpos
Definition: GUI_MultiplayerClientList.h:58
RoR::GUI::MpClientList::PEEROPTS_MENU_MARGIN
const int PEEROPTS_MENU_MARGIN
Definition: GUI_MultiplayerClientList.h:56
RoR::GUI::MpClientList::DrawIcon
void DrawIcon(Ogre::TexturePtr tex, ImVec2 reference_box)
Definition: GUI_MultiplayerClientList.cpp:359
RoR::GUI::MpClientList::PEEROPTS_MENU_CONTENT_WIDTH
const int PEEROPTS_MENU_CONTENT_WIDTH
Definition: GUI_MultiplayerClientList.h:55
RoR::GUI::MpClientList::m_peeropts_menu_corner_br
ImVec2 m_peeropts_menu_corner_br
Definition: GUI_MultiplayerClientList.h:60
RoR::GUI::MpClientList::CacheIcons
void CacheIcons()
Definition: GUI_MultiplayerClientList.cpp:373
RoR::GUI::MpClientList::m_icon_arrow_up_red
Ogre::TexturePtr m_icon_arrow_up_red
Definition: GUI_MultiplayerClientList.h:69
RoR::GUI::MpClientList::m_peeropts_menu_corner_tl
ImVec2 m_peeropts_menu_corner_tl
Definition: GUI_MultiplayerClientList.h:59
RoR::GUI::MpClientList::m_icon_arrow_up_grey
Ogre::TexturePtr m_icon_arrow_up_grey
Definition: GUI_MultiplayerClientList.h:68
RoR::GUI::MpClientList::DrawPeerOptionsMenu
void DrawPeerOptionsMenu()
Definition: GUI_MultiplayerClientList.cpp:312
RoR::GUI::MpClientList::PEEROPTS_HOVER_MARGIN
const int PEEROPTS_HOVER_MARGIN
Definition: GUI_MultiplayerClientList.h:57
RoR::GUI::MpClientList::m_icon_arrow_down_grey
Ogre::TexturePtr m_icon_arrow_down_grey
Definition: GUI_MultiplayerClientList.h:65
RoR::GUI::MpClientList::m_users
std::vector< RoRnet::UserInfo > m_users
Definition: GUI_MultiplayerClientList.h:48
RoR::GUI::MpClientList::m_icon_flag_green
Ogre::TexturePtr m_icon_flag_green
Definition: GUI_MultiplayerClientList.h:72
RoR::GUI::MpClientList
Definition: GUI_MultiplayerClientList.h:38
RoR::GUI::MpClientList::m_icon_flag_blue
Ogre::TexturePtr m_icon_flag_blue
Definition: GUI_MultiplayerClientList.h:71
RoR::GUI::MpClientList::m_users_peeropts
std::vector< BitMask_t > m_users_peeropts
Definition: GUI_MultiplayerClientList.h:49
RoR::GUI::MpClientList::UpdateClients
void UpdateClients()
Definition: GUI_MultiplayerClientList.cpp:45
RoR::GUI::MpClientList::m_icon_warn_triangle
Ogre::TexturePtr m_icon_warn_triangle
Definition: GUI_MultiplayerClientList.h:73
BitMask_t
uint32_t BitMask_t
Definition: BitFlags.h:7
RoR::GUI::MpClientList::m_icon_arrow_down
Ogre::TexturePtr m_icon_arrow_down
Definition: GUI_MultiplayerClientList.h:64
RoR::GUI::MpClientList::DrawPeerOptCheckbox
void DrawPeerOptCheckbox(const BitMask_t flag, const std::string &label)
Definition: GUI_MultiplayerClientList.cpp:290
RoR
Definition: AppContext.h:36
RoR::GUI::MpClientList::Draw
void Draw()
Definition: GUI_MultiplayerClientList.cpp:74
RoR::GUI::MpClientList::DrawServerCommandBtn
void DrawServerCommandBtn(const std::string &cmdfmt, const std::string &label)
Definition: GUI_MultiplayerClientList.cpp:303