You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.5 KiB
C++
57 lines
1.5 KiB
C++
/******************************************************************************
|
|
* File - luaConsole.h
|
|
* Author - Joey Pollack
|
|
* Date - 2021/09/17 (y/m/d)
|
|
* Mod Date - 2021/09/17 (y/m/d)
|
|
* Description - GUI window for the LUA console
|
|
******************************************************************************/
|
|
|
|
#ifndef LUA_CONSOLE_H_
|
|
#define LUA_CONSOLE_H_
|
|
|
|
#include <utils/opRes.h>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
struct ImGuiInputTextCallbackData;
|
|
|
|
namespace lunarium
|
|
{
|
|
const int LUA_CON_BUFFER_SIZE = 64;
|
|
class LuaConsole
|
|
{
|
|
public:
|
|
static LuaConsole& GetInstance();
|
|
static void FreeInstance();
|
|
|
|
OpRes Initialize();
|
|
void Show();
|
|
|
|
void SetShow(bool show);
|
|
bool IsShown() const;
|
|
bool IsStuckToWindow() const;
|
|
void SetStickToWindow(bool stick);
|
|
|
|
const std::vector<std::string>* GetCommandHistory() const;
|
|
std::string GetLastCommand();
|
|
bool GetNewCommand(std::string& command); // returns true if there is a new and false if not
|
|
|
|
static int MyCallback(ImGuiInputTextCallbackData* data);
|
|
|
|
private:
|
|
static LuaConsole* mpInstance;
|
|
bool mbShow;
|
|
bool mbStickToWindow;
|
|
char mBuffer[LUA_CON_BUFFER_SIZE];
|
|
std::vector<std::string> mCommandHistory;
|
|
bool mbNewCommand;
|
|
int mRecalledCommand;
|
|
|
|
private:
|
|
LuaConsole();
|
|
LuaConsole(const LuaConsole&) = delete;
|
|
const LuaConsole& operator=(const LuaConsole&) = delete;
|
|
};
|
|
}
|
|
|
|
#endif // LUA_CONSOLE_H_
|