Blamite Game Engine - blam!  00296.01.12.21.0102.blamite
The core library for the Blamite Game Engine.
discord_rpc_tester.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../../debug_ui.h"
4 
5 #include <time.h>
6 
9 #include "version_data.h"
10 
11 namespace Blam::DebugUI::Windows
12 {
23  {
24  public:
29 
34 
35  void Draw()
36  {
37  //discord rich presence ui
38  if (show)
39  {
40  //ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
41 
42  //ImGui::PopStyleVar();
43 
44  ImGui::Begin("Discord Rich Presence Tester", &show, ImGuiWindowFlags_AlwaysAutoResize);
45 
46  static char state[127] = "Forge World";
47  static char details[127] = "Using the Forge";
48  static char large_img_key[31] = "infinity_icon_for_discord_rpc";
49  static char small_img_key[31] = "blam_icon3";
50  static char large_img_tooltip[127] = "sample tooltip for infinity icon";
51  static char small_img_tooltip[127] = ENGINE_VERSION;
52  static char party_id[127] = "derp";
53  static char join_secret[127] = "4b2fdce12f639de8bfa7e3591b71a0d679d7c93f";
54  static char spectate_secret[127] = "e7eb30d2ee025ed05c71ea495f770b76454ee4e0";
55  static int player_count = 1;
56  static int max_players = 8;
57  static int instance = 1;
58  static int64_t time_start = time(0);
59  static int time_end = 60;
60  static bool use_start_time = true;
61  static bool use_end_time = false;
62 
63 
64  ImGui::Text("This tool is used to manually update Discord Rich Presence for testing purposes.\n");
65 
66  ImGui::InputText("State", state, IM_ARRAYSIZE(state));
67  ImGui::InputText("Details", details, IM_ARRAYSIZE(details));
68  ImGui::InputText("Large Image Key", large_img_key, IM_ARRAYSIZE(large_img_key));
69  ImGui::InputText("Small Image Key", small_img_key, IM_ARRAYSIZE(small_img_key));
70  ImGui::InputText("Large Image Tooltip", large_img_key, IM_ARRAYSIZE(large_img_tooltip));
71  ImGui::InputText("Small Image Tooltip", small_img_key, IM_ARRAYSIZE(small_img_tooltip));
72  ImGui::InputText("Party ID", party_id, IM_ARRAYSIZE(party_id));
73  ImGui::InputText("Join Secret", join_secret, IM_ARRAYSIZE(join_secret));
74  ImGui::InputText("Spectate Secret", spectate_secret, IM_ARRAYSIZE(spectate_secret));
75  ImGui::InputInt("Player Count", &player_count);
76  ImGui::InputInt("Max Players", &max_players);
77  ImGui::Checkbox("Use Start Time", &use_start_time);
78  ImGui::Checkbox("Use End Time", &use_end_time);
79  ImGui::InputInt("End Time (seconds)", &time_end);
80  ImGui::InputInt("Instance", &instance);
81  //ImGui::SameLine(); ShowHelpMarker("Input the IP address to test in this box.\nYou may use a DNS host (dns.domain.com) or a direct IP (1.2.3.4)");
82 
83  ImGui::Separator();
84  if (ImGui::Button("Update", ImVec2(120, 0)))
85  {
86  DiscordRichPresence presence;
87  memset(&presence, 0, sizeof(presence));
88 
89  presence.state = state;
90  presence.details = details;
91  if (use_start_time)
92  {
93  presence.startTimestamp = time(0);
94  }
95  if (use_end_time)
96  {
97  presence.endTimestamp = time(0) + time_end;
98  }
99  presence.largeImageKey = large_img_key;
100  presence.smallImageKey = small_img_key;
101  presence.largeImageText = large_img_tooltip;
102  presence.smallImageText = small_img_tooltip;
103  presence.partyId = party_id;
104  presence.partySize = player_count;
105  presence.partyMax = max_players;
106  presence.joinSecret = join_secret;
107  presence.spectateSecret = spectate_secret;
108  presence.instance = instance;
110  }
111  ImGui::Separator();
112 
113  if (ImGui::Button("DiscordReady", ImVec2(120, 0)))
114  {
116  }
117  ImGui::SameLine();
118  if (ImGui::Button("DiscordError", ImVec2(120, 0)))
119  {
121  }
122  ImGui::SameLine();
123  if (ImGui::Button("DiscordDisconnected", ImVec2(120, 0)))
124  {
126  }
127 
128  if (ImGui::Button("DiscordJoinGame", ImVec2(120, 0)))
129  {
131  }
132  ImGui::SameLine();
133  if (ImGui::Button("DiscordSpectateGame", ImVec2(120, 0)))
134  {
136  }
137  ImGui::SameLine();
138  if (ImGui::Button("DiscordJoinRequest", ImVec2(120, 0)))
139  {
141  }
142 
143  ImGui::End();
144 
145  }
146  }
147  };
148 }
Blam::DebugUI::Windows::DiscordRPCTester::Draw
void Draw()
Draws the contents of the group.
Definition: discord_rpc_tester.hpp:35
details
LPSTR details
Definition: error_notice.cpp:17
version_data.h
Blam::DiscordRPC::DummyEvent
BLAM void DummyEvent(int id)
Triggers a dummy event.
Definition: discord_rpc.cpp:130
ENGINE_VERSION
#define ENGINE_VERSION
Definition: version_data.h:31
discord_rpc.h
Blam::DebugUI::Windows::DiscordRPCTester::~DiscordRPCTester
~DiscordRPCTester()
Empty destructor.
Definition: discord_rpc_tester.hpp:33
Blam::DebugUI::ImGUIDrawingGroup::show
bool show
Controls whether or not the group should be shown. May not be used in all groups.
Definition: debug_ui.h:362
Blam::DebugUI::ImGUIDrawingGroup
Class representing an ImGUI drawing group/draw list item.
Definition: debug_ui.h:359
Blam::DebugUI::Windows::DiscordRPCTester
Class for the Discord Rich Presence test dialog.
Definition: discord_rpc_tester.hpp:22
Blam::DebugUI::Windows::DiscordRPCTester::DiscordRPCTester
DiscordRPCTester()
Empty constructor.
Definition: discord_rpc_tester.hpp:28
engine_definitions.h
Blam::DebugUI::Windows
Legacy namespace to contain data for the legacy ImGUI console.
Definition: debug_ui.h:434
Text
@ Text
Master text object that wraps around both BitmapText and DWText.
Definition: render_stack.h:73
Blam::DiscordRPC::UpdatePresence
BLAM void UpdatePresence(DiscordRichPresence discordPresence)
Update the current Discord presence.
Definition: discord_rpc.cpp:103