-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGameFinderUI.cpp
More file actions
52 lines (39 loc) · 1.29 KB
/
GameFinderUI.cpp
File metadata and controls
52 lines (39 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "GameFinderUI.h"
#include "imgui.h"
#include "imgui_stdlib.h"
#include "ViewModel.h"
#include "stormancer/IClientFactory.h"
#include "gamefinder/GameFinder.hpp"
std::string to_string(Stormancer::GameFinder::GameFinderStatus status)
{
using namespace Stormancer::GameFinder;
switch (status)
{
case GameFinderStatus::Idle: return "idle";
case GameFinderStatus::Searching: return "searching";
case GameFinderStatus::CandidateFound: return "candidateFound";
case GameFinderStatus::WaitingPlayersReady: return "waitingPlayerReady";
case GameFinderStatus::Success: return "success";
case GameFinderStatus::Failed: return "failed";
case GameFinderStatus::Canceled: return "canceled";
case GameFinderStatus::Loading: return "loading";
default: return "<unknown>";
}
}
void ShowUI(GameFinderViewModel& vm)
{
if (ImGui::BeginTable("gameFinderState", 2))
{
auto client = Stormancer::IClientFactory::GetClient(vm.parent->id);
auto gamefinder = client->dependencyResolver().resolve<Stormancer::GameFinder::GameFinderApi>();
for (auto kvp : gamefinder->getPendingFindGameStatus())
{
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Text(kvp.first.c_str());
ImGui::TableNextColumn();
ImGui::Text(to_string(kvp.second.status).c_str());
}
ImGui::EndTable();
}
}