LUS Cleanup: Console class is now in the Ship namespace
This commit is contained in:
parent
1bf7771981
commit
352b46c1f5
|
@ -10,6 +10,7 @@
|
|||
#include "Utils/StringHelper.h"
|
||||
#include "Lib/ImGui/imgui_internal.h"
|
||||
|
||||
namespace Ship {
|
||||
std::map<ImGuiKey, std::string> Bindings;
|
||||
std::map<ImGuiKey, std::string> BindingToggle;
|
||||
|
||||
|
@ -329,3 +330,4 @@ void Console::Append(const std::string& channel, Priority priority, const char*
|
|||
va_end(args);
|
||||
this->Log[channel].push_back({ std::string(buf), priority });
|
||||
}
|
||||
}
|
|
@ -7,10 +7,11 @@
|
|||
|
||||
#include "Lib/ImGui/imgui.h"
|
||||
|
||||
#define LOG(msg, ...) SohImGui::console->Append("Main", Priority::LOG_LVL, msg, ##__VA_ARGS__)
|
||||
#define INFO(msg, ...) SohImGui::console->Append("Main", Priority::INFO_LVL, msg, ##__VA_ARGS__)
|
||||
#define WARNING(msg, ...) SohImGui::console->Append("Main", Priority::WARNING_LVL, msg, ##__VA_ARGS__)
|
||||
#define ERROR(msg, ...) SohImGui::console->Append("Main", Priority::ERROR_LVL, msg, ##__VA_ARGS__)
|
||||
namespace Ship {
|
||||
#define LOG(msg, ...) SohImGui::console->Append("Main", Ship::Priority::LOG_LVL, msg, ##__VA_ARGS__)
|
||||
#define INFO(msg, ...) SohImGui::console->Append("Main", Ship::Priority::INFO_LVL, msg, ##__VA_ARGS__)
|
||||
#define WARNING(msg, ...) SohImGui::console->Append("Main", Ship::Priority::WARNING_LVL, msg, ##__VA_ARGS__)
|
||||
#define ERROR(msg, ...) SohImGui::console->Append("Main", Ship::Priority::ERROR_LVL, msg, ##__VA_ARGS__)
|
||||
#define CMD_SUCCESS true
|
||||
#define CMD_FAILED false
|
||||
#define MAX_BUFFER_SIZE 255
|
||||
|
@ -79,3 +80,4 @@ public:
|
|||
void Dispatch(const std::string& line);
|
||||
static int CallbackStub(ImGuiInputTextCallbackData* data);
|
||||
};
|
||||
}
|
|
@ -69,7 +69,7 @@ namespace SohImGui {
|
|||
WindowDrawFunc drawFunc;
|
||||
} CustomWindow;
|
||||
|
||||
extern Console* console;
|
||||
extern Ship::Console* console;
|
||||
extern Ship::InputEditor* controller;
|
||||
extern Ship::GameOverlay* overlay;
|
||||
extern bool needs_save;
|
||||
|
@ -92,7 +92,7 @@ namespace SohImGui {
|
|||
void Render(void);
|
||||
void CancelFrame(void);
|
||||
void ShowCursor(bool hide, Dialogues w);
|
||||
void BindCmd(const std::string& cmd, CommandEntry entry);
|
||||
void BindCmd(const std::string& cmd, Ship::CommandEntry entry);
|
||||
void AddWindow(const std::string& category, const std::string& name, WindowDrawFunc drawFunc, bool isEnabled=false, bool isHidden=false);
|
||||
void LoadResource(const std::string& name, const std::string& path, const ImVec4& tint = ImVec4(1, 1, 1, 1));
|
||||
void LoadPickersColors(ImVec4& ColorArray, const char* cvarname, const ImVec4& default_colors, bool has_alpha=false);
|
||||
|
|
|
@ -358,7 +358,6 @@ static void gfx_dxgi_show_cursor(bool hide) {
|
|||
* @bug When menubar is open in windowed mode and you toggle fullscreen
|
||||
* ShowCursor no longer responds. Debugging shows the bool to be correct.
|
||||
**/
|
||||
INFO("renderer: %s", hide ? "true" : "false");
|
||||
ShowCursor(hide);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
protected:
|
||||
void sink_it_(const details::log_msg &msg) override
|
||||
{
|
||||
const Priority priority = convert_to_soh(msg.level);
|
||||
const Ship::Priority priority = convert_to_soh(msg.level);
|
||||
memory_buf_t formatted;
|
||||
if (use_raw_msg_)
|
||||
{
|
||||
|
@ -53,24 +53,25 @@ protected:
|
|||
void flush_() override {}
|
||||
|
||||
private:
|
||||
static Priority convert_to_soh(spdlog::level::level_enum level) {
|
||||
static Ship::Priority convert_to_soh(spdlog::level::level_enum level)
|
||||
{
|
||||
switch (level) {
|
||||
case spdlog::level::trace:
|
||||
return Priority::INFO_LVL;
|
||||
return Ship::Priority::INFO_LVL;
|
||||
case spdlog::level::debug:
|
||||
return Priority::LOG_LVL;
|
||||
return Ship::Priority::LOG_LVL;
|
||||
case spdlog::level::info:
|
||||
return Priority::LOG_LVL;
|
||||
return Ship::Priority::LOG_LVL;
|
||||
case spdlog::level::warn:
|
||||
return Priority::WARNING_LVL;
|
||||
return Ship::Priority::WARNING_LVL;
|
||||
case spdlog::level::err:
|
||||
return Priority::ERROR_LVL;
|
||||
return Ship::Priority::ERROR_LVL;
|
||||
case spdlog::level::critical:
|
||||
return Priority::ERROR_LVL;
|
||||
return Ship::Priority::ERROR_LVL;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return Priority::LOG_LVL;
|
||||
return Ship::Priority::LOG_LVL;
|
||||
}
|
||||
|
||||
std::string tag_;
|
||||
|
|
|
@ -463,50 +463,49 @@ void DebugConsole_Init(void) {
|
|||
CMD_REGISTER("kill", { KillPlayerHandler, "Commit suicide." });
|
||||
CMD_REGISTER("map", { LoadSceneHandler, "Load up kak?" });
|
||||
CMD_REGISTER("rupee", { RuppeHandler, "Set your rupee counter.", {
|
||||
{"amount", ArgumentType::NUMBER }
|
||||
{"amount", Ship::ArgumentType::NUMBER }
|
||||
}});
|
||||
CMD_REGISTER("bItem", { BHandler, "Set an item to the B button.", { { "Item ID", ArgumentType::NUMBER } } });
|
||||
CMD_REGISTER("health", { SetPlayerHealthHandler, "Set the health of the player.", {
|
||||
{"health", ArgumentType::NUMBER }
|
||||
CMD_REGISTER("bItem", { BHandler, "Set an item to the B button.", { { "Item ID", Ship::ArgumentType::NUMBER } } });
|
||||
CMD_REGISTER("health", { SetPlayerHealthHandler, "Set the health of the player.", { { "health", Ship::ArgumentType::NUMBER }
|
||||
}});
|
||||
CMD_REGISTER("spawn", { ActorSpawnHandler, "Spawn an actor.", {
|
||||
{ "actor_id", ArgumentType::NUMBER },
|
||||
{ "data", ArgumentType::NUMBER },
|
||||
{ "x", ArgumentType::PLAYER_POS, true },
|
||||
{ "y", ArgumentType::PLAYER_POS, true },
|
||||
{ "z", ArgumentType::PLAYER_POS, true },
|
||||
{ "rx", ArgumentType::PLAYER_ROT, true },
|
||||
{ "ry", ArgumentType::PLAYER_ROT, true },
|
||||
{ "rz", ArgumentType::PLAYER_ROT, true }
|
||||
CMD_REGISTER("spawn", { ActorSpawnHandler, "Spawn an actor.", { { "actor_id", Ship::ArgumentType::NUMBER },
|
||||
{ "data", Ship::ArgumentType::NUMBER },
|
||||
{ "x", Ship::ArgumentType::PLAYER_POS, true },
|
||||
{ "y", Ship::ArgumentType::PLAYER_POS, true },
|
||||
{ "z", Ship::ArgumentType::PLAYER_POS, true },
|
||||
{ "rx", Ship::ArgumentType::PLAYER_ROT, true },
|
||||
{ "ry", Ship::ArgumentType::PLAYER_ROT, true },
|
||||
{ "rz", Ship::ArgumentType::PLAYER_ROT, true }
|
||||
}});
|
||||
CMD_REGISTER("pos", { SetPosHandler, "Sets the position of the player.", {
|
||||
{ "x", ArgumentType::PLAYER_POS, true },
|
||||
{ "y", ArgumentType::PLAYER_POS, true },
|
||||
{ "z", ArgumentType::PLAYER_POS, true }
|
||||
CMD_REGISTER("pos", { SetPosHandler, "Sets the position of the player.", { { "x", Ship::ArgumentType::PLAYER_POS, true },
|
||||
{ "y", Ship::ArgumentType::PLAYER_POS, true },
|
||||
{ "z", Ship::ArgumentType::PLAYER_POS, true }
|
||||
}});
|
||||
CMD_REGISTER("set", { SetCVarHandler,
|
||||
"Sets a console variable.",
|
||||
{ { "varName", ArgumentType::TEXT }, { "varValue", ArgumentType::TEXT } } });
|
||||
CMD_REGISTER("get", { GetCVarHandler, "Gets a console variable.", { { "varName", ArgumentType::TEXT } } });
|
||||
{ { "varName", Ship::ArgumentType::TEXT }, { "varValue", Ship::ArgumentType::TEXT } } });
|
||||
CMD_REGISTER("get", { GetCVarHandler, "Gets a console variable.", { { "varName", Ship::ArgumentType::TEXT } } });
|
||||
CMD_REGISTER("reset", { ResetHandler, "Resets the game." });
|
||||
CMD_REGISTER("ammo", { AmmoHandler, "Changes ammo of an item.",
|
||||
{ { "item", ArgumentType::TEXT },
|
||||
{ "count", ArgumentType::NUMBER } } });
|
||||
{ { "item", Ship::ArgumentType::TEXT }, { "count", Ship::ArgumentType::NUMBER } } });
|
||||
|
||||
CMD_REGISTER("bottle", { BottleHandler,
|
||||
"Changes item in a bottle slot.",
|
||||
{ { "item", ArgumentType::TEXT }, { "slot", ArgumentType::NUMBER } } });
|
||||
{ { "item", Ship::ArgumentType::TEXT }, { "slot", Ship::ArgumentType::NUMBER } } });
|
||||
|
||||
CMD_REGISTER("item", { ItemHandler,
|
||||
"Sets item ID in arg 1 into slot arg 2. No boundary checks. Use with caution.",
|
||||
{ { "slot", ArgumentType::NUMBER }, { "item id", ArgumentType::NUMBER } } });
|
||||
CMD_REGISTER("entrance",
|
||||
{ EntranceHandler, "Sends player to the entered entrance (hex)", { { "entrance", ArgumentType::NUMBER } } });
|
||||
{ { "slot", Ship::ArgumentType::NUMBER }, { "item id", Ship::ArgumentType::NUMBER } } });
|
||||
CMD_REGISTER("entrance", { EntranceHandler,
|
||||
"Sends player to the entered entrance (hex)",
|
||||
{ { "entrance", Ship::ArgumentType::NUMBER } } });
|
||||
|
||||
CMD_REGISTER("save_state", { SaveStateHandler, "Save a state." });
|
||||
CMD_REGISTER("load_state", { LoadStateHandler, "Load a state." });
|
||||
CMD_REGISTER("set_slot", { StateSlotSelectHandler, "Selects a SaveState slot", {
|
||||
{ "Slot number", ArgumentType::NUMBER, }
|
||||
CMD_REGISTER("set_slot", { StateSlotSelectHandler, "Selects a SaveState slot", { {
|
||||
"Slot number",
|
||||
Ship::ArgumentType::NUMBER,
|
||||
}
|
||||
} });
|
||||
DebugConsole_LoadCVars();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue