Update archipelago menu styling
This commit is contained in:
@@ -2,10 +2,12 @@
|
|||||||
|
|
||||||
#include "soh/SohGui/UIWidgets.hpp"
|
#include "soh/SohGui/UIWidgets.hpp"
|
||||||
#include "soh/SohGui/SohGui.hpp"
|
#include "soh/SohGui/SohGui.hpp"
|
||||||
|
#include "soh/OTRGlobals.h"
|
||||||
|
|
||||||
ImVector<char*> Items;
|
ImVector<char*> Items;
|
||||||
bool autoScroll = true;
|
bool autoScroll = true;
|
||||||
bool scrollToBottom = false;
|
|
||||||
|
using namespace UIWidgets;
|
||||||
|
|
||||||
void ArchipelagoConsole_SendMessage(const char* fmt, ...) IM_FMTARGS(2) {
|
void ArchipelagoConsole_SendMessage(const char* fmt, ...) IM_FMTARGS(2) {
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
@@ -18,22 +20,17 @@ void ArchipelagoConsole_SendMessage(const char* fmt, ...) IM_FMTARGS(2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ArchipelagoConsoleWindow::DrawElement() {
|
void ArchipelagoConsoleWindow::DrawElement() {
|
||||||
if (ImGui::Button("Add line to log")) {
|
ImGui::SeparatorText("Archipelago Log");
|
||||||
ArchipelagoConsole_SendMessage("[LOG] Hello World");
|
|
||||||
ArchipelagoConsole_SendMessage("[ERROR] Hello World");
|
|
||||||
ArchipelagoConsole_SendMessage("Hello World");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::BeginChild("ScrollingRegion", ImVec2(0, 400), false,
|
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.15f, 0.15f, 0.15f, 1.0f));
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 8.0f);
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(15.0f, 12.0f));
|
||||||
|
|
||||||
|
if (ImGui::BeginChild("ScrollingRegion", ImVec2(0, 400), ImGuiChildFlags_AlwaysUseWindowPadding,
|
||||||
ImGuiWindowFlags_HorizontalScrollbar)) {
|
ImGuiWindowFlags_HorizontalScrollbar)) {
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4, 1)); // Tighten spacing
|
|
||||||
|
|
||||||
for (int i = 0; i < Items.Size; i++) {
|
for (int i = 0; i < Items.Size; i++) {
|
||||||
const char* item = Items[i];
|
const char* item = Items[i];
|
||||||
|
|
||||||
// Normally you would store more information in your item than just a string.
|
|
||||||
// (e.g. make Items[] an array of structure, store color/type etc.)
|
|
||||||
ImVec4 color;
|
ImVec4 color;
|
||||||
bool hasColor = false;
|
bool hasColor = false;
|
||||||
if (strstr(item, "[ERROR]")) {
|
if (strstr(item, "[ERROR]")) {
|
||||||
@@ -42,25 +39,32 @@ void ArchipelagoConsoleWindow::DrawElement() {
|
|||||||
} else if (strstr(item, "[LOG]")) {
|
} else if (strstr(item, "[LOG]")) {
|
||||||
color = ImVec4(0.7f, 0.7f, 1.0f, 1.0f);
|
color = ImVec4(0.7f, 0.7f, 1.0f, 1.0f);
|
||||||
hasColor = true;
|
hasColor = true;
|
||||||
} else if (strncmp(item, "# ", 2) == 0) {
|
|
||||||
color = ImVec4(1.0f, 0.8f, 0.6f, 1.0f);
|
|
||||||
hasColor = true;
|
|
||||||
}
|
}
|
||||||
if (hasColor)
|
if (hasColor) {
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, color);
|
ImGui::PushStyleColor(ImGuiCol_Text, color);
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::TextUnformatted(item);
|
ImGui::TextUnformatted(item);
|
||||||
if (hasColor)
|
|
||||||
|
if (hasColor) {
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Keep up at the bottom of the scroll region if we were already at the bottom at the beginning of the frame.
|
// Keep up at the bottom of the scroll region if we were already at the bottom at the beginning of the frame.
|
||||||
// Using a scrollbar or mouse-wheel will take away from the bottom edge.
|
// Using a scrollbar or mouse-wheel will take away from the bottom edge.
|
||||||
if (scrollToBottom || (autoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY())) {
|
if (autoScroll && ImGui::GetScrollY() >= ImGui::GetScrollMaxY()) {
|
||||||
ImGui::SetScrollHereY(1.0f);
|
ImGui::SetScrollHereY(1.0f);
|
||||||
}
|
}
|
||||||
scrollToBottom = false;
|
|
||||||
|
|
||||||
ImGui::PopStyleVar();
|
|
||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
|
ImGui::PopStyleColor();
|
||||||
|
ImGui::PopStyleVar(2);
|
||||||
|
|
||||||
|
if (UIWidgets::Button("Add dummy lines to log",
|
||||||
|
UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(ImVec2(0.0, 0.0)))) {
|
||||||
|
ArchipelagoConsole_SendMessage("[LOG] Hello World");
|
||||||
|
ArchipelagoConsole_SendMessage("[ERROR] Hello World");
|
||||||
|
ArchipelagoConsole_SendMessage("Hello World");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,13 +7,24 @@
|
|||||||
|
|
||||||
void ArchipelagoSettingsWindow::DrawElement() {
|
void ArchipelagoSettingsWindow::DrawElement() {
|
||||||
ArchipelagoClient& AP_client = ArchipelagoClient::GetInstance();
|
ArchipelagoClient& AP_client = ArchipelagoClient::GetInstance();
|
||||||
|
|
||||||
ImGui::SeparatorText("Connection info");
|
ImGui::SeparatorText("Connection info");
|
||||||
ImGui::InputText("Server Address", AP_client.GetServerAddressBuffer(), AP_Client_consts::MAX_ADDRESS_LENGTH);
|
|
||||||
ImGui::InputText("Slot Name", AP_client.GetSlotNameBuffer(), AP_Client_consts::MAX_PLAYER_NAME_LENGHT);
|
UIWidgets::PushStyleCombobox(THEME_COLOR);
|
||||||
ImGui::InputText("Password (leave blank for no password)", AP_client.GetPasswordBuffer(),
|
ImGui::PushStyleColor(ImGuiCol_Border, UIWidgets::ColorValues.at(THEME_COLOR));
|
||||||
|
|
||||||
|
ImGui::Text("Server Address");
|
||||||
|
ImGui::InputText("##serveraddress", AP_client.GetServerAddressBuffer(), AP_Client_consts::MAX_ADDRESS_LENGTH);
|
||||||
|
ImGui::Text("Slot Name");
|
||||||
|
ImGui::InputText("##slotname", AP_client.GetSlotNameBuffer(), AP_Client_consts::MAX_PLAYER_NAME_LENGHT);
|
||||||
|
ImGui::Text("Password (leave blank for no password)");
|
||||||
|
ImGui::InputText("##password", AP_client.GetPasswordBuffer(),
|
||||||
AP_Client_consts::MAX_PASSWORD_LENGTH, ImGuiInputTextFlags_Password);
|
AP_Client_consts::MAX_PASSWORD_LENGTH, ImGuiInputTextFlags_Password);
|
||||||
|
|
||||||
if (ImGui::Button("Connect")) {
|
ImGui::PopStyleColor();
|
||||||
|
UIWidgets::PopStyleCombobox();
|
||||||
|
|
||||||
|
if (UIWidgets::Button("Connect", UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(ImVec2(0.0, 0.0)))) {
|
||||||
bool success = AP_client.StartClient();
|
bool success = AP_client.StartClient();
|
||||||
ArchipelagoConsole_SendMessage("[LOG] Trying to connect...");
|
ArchipelagoConsole_SendMessage("[LOG] Trying to connect...");
|
||||||
}
|
}
|
||||||
@@ -21,17 +32,18 @@ void ArchipelagoSettingsWindow::DrawElement() {
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text(ArchipelagoClient::GetInstance().GetConnectionStatus());
|
ImGui::Text(ArchipelagoClient::GetInstance().GetConnectionStatus());
|
||||||
|
|
||||||
if (ImGui::Button("Scout")) {
|
// Temporary developer helpers
|
||||||
|
ImGui::SeparatorText("Developer Tools");
|
||||||
|
if (UIWidgets::Button("Scout", UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(ImVec2(0.0, 0.0)))) {
|
||||||
AP_client.StartLocationScouts();
|
AP_client.StartLocationScouts();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Link up")) {
|
if (UIWidgets::Button("Link up", UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(ImVec2(0.0, 0.0)))) {
|
||||||
CVarSetInteger("ArchipelagoConnected", 1);
|
CVarSetInteger("ArchipelagoConnected", 1);
|
||||||
}
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
UIWidgets::PaddedSeparator();
|
if (UIWidgets::Button("Give Blue Rupee", UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(ImVec2(0.0, 0.0)))) {
|
||||||
|
|
||||||
if(ImGui::Button("Give Blue Rupee")) {
|
|
||||||
ArchipelagoClient::GetInstance().OnItemReceived(66077, true);
|
ArchipelagoClient::GetInstance().OnItemReceived(66077, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -199,10 +199,10 @@ void SetupGuiElements() {
|
|||||||
std::make_shared<PlandomizerWindow>(CVAR_WINDOW("PlandomizerEditor"), "Plandomizer Editor", ImVec2(850, 760));
|
std::make_shared<PlandomizerWindow>(CVAR_WINDOW("PlandomizerEditor"), "Plandomizer Editor", ImVec2(850, 760));
|
||||||
gui->AddGuiWindow(mPlandomizerWindow);
|
gui->AddGuiWindow(mPlandomizerWindow);
|
||||||
mArchipelagoSettingsWindow = std::make_shared<ArchipelagoSettingsWindow>(CVAR_WINDOW("ArchipelagoSettingsWindow"),
|
mArchipelagoSettingsWindow = std::make_shared<ArchipelagoSettingsWindow>(CVAR_WINDOW("ArchipelagoSettingsWindow"),
|
||||||
"Archipelago Settings", ImVec2(850, 760));
|
"Archipelago Settings", ImVec2(600, 450));
|
||||||
gui->AddGuiWindow(mArchipelagoSettingsWindow);
|
gui->AddGuiWindow(mArchipelagoSettingsWindow);
|
||||||
mArchipelagoConsoleWindow = std::make_shared<ArchipelagoConsoleWindow>(CVAR_WINDOW("ArchipelagoConsoleWindow"),
|
mArchipelagoConsoleWindow = std::make_shared<ArchipelagoConsoleWindow>(CVAR_WINDOW("ArchipelagoConsoleWindow"),
|
||||||
"Archipelago Console", ImVec2(850, 760));
|
"Archipelago Console", ImVec2(600, 550));
|
||||||
gui->AddGuiWindow(mArchipelagoConsoleWindow);
|
gui->AddGuiWindow(mArchipelagoConsoleWindow);
|
||||||
mModalWindow = std::make_shared<SohModalWindow>(CVAR_WINDOW("ModalWindow"), "Modal Window");
|
mModalWindow = std::make_shared<SohModalWindow>(CVAR_WINDOW("ModalWindow"), "Modal Window");
|
||||||
gui->AddGuiWindow(mModalWindow);
|
gui->AddGuiWindow(mModalWindow);
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ void SohMenu::AddMenuNetwork() {
|
|||||||
|
|
||||||
// Sail
|
// Sail
|
||||||
path.sidebarName = "Sail";
|
path.sidebarName = "Sail";
|
||||||
|
path.column = SECTION_COLUMN_1;
|
||||||
AddSidebarEntry("Network", path.sidebarName, 3);
|
AddSidebarEntry("Network", path.sidebarName, 3);
|
||||||
|
|
||||||
AddWidget(path,
|
AddWidget(path,
|
||||||
|
|||||||
Reference in New Issue
Block a user