mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-10-26 13:56:05 +03:00
feat(ui): add CSimpleMessageFrame skeleton
This commit is contained in:
parent
568afa1c1b
commit
b76a9fed82
@ -52,7 +52,6 @@ static int32_t Script_UnitIsUnit(lua_State* L) {
|
||||
|
||||
static int32_t Script_UnitIsPlayer(lua_State* L) {
|
||||
// TODO
|
||||
__debugbreak();
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
39
src/ui/CSimpleMessageFrame.cpp
Normal file
39
src/ui/CSimpleMessageFrame.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
#include "ui/CSimpleMessageFrame.hpp"
|
||||
#include "ui/CSimpleMessageFrameScript.hpp"
|
||||
|
||||
int32_t CSimpleMessageFrame::s_metatable = 0;
|
||||
int32_t CSimpleMessageFrame::s_objectType = 0;
|
||||
|
||||
void CSimpleMessageFrame::CreateScriptMetaTable() {
|
||||
lua_State* L = FrameScript_GetContext();
|
||||
int32_t ref = FrameScript_Object::CreateScriptMetaTable(L, &CSimpleMessageFrame::RegisterScriptMethods);
|
||||
CSimpleMessageFrame::s_metatable = ref;
|
||||
}
|
||||
|
||||
int32_t CSimpleMessageFrame::GetObjectType() {
|
||||
if (!CSimpleMessageFrame::s_objectType) {
|
||||
CSimpleMessageFrame::s_objectType = ++FrameScript_Object::s_objectTypes;
|
||||
}
|
||||
|
||||
return CSimpleMessageFrame::s_objectType;
|
||||
}
|
||||
|
||||
void CSimpleMessageFrame::RegisterScriptMethods(lua_State* L) {
|
||||
CSimpleFrame::RegisterScriptMethods(L);
|
||||
FrameScript_Object::FillScriptMethodTable(L, SimpleMessageFrameMethods, NUM_SIMPLE_MESSAGE_FRAME_SCRIPT_METHODS);
|
||||
}
|
||||
|
||||
CSimpleMessageFrame::CSimpleMessageFrame(CSimpleFrame* parent)
|
||||
: CSimpleFrame(parent) {
|
||||
}
|
||||
|
||||
bool CSimpleMessageFrame::IsA(int32_t type) {
|
||||
return type == CSimpleMessageFrame::s_objectType
|
||||
|| type == CSimpleFrame::s_objectType
|
||||
|| type == CScriptRegion::s_objectType
|
||||
|| type == CScriptObject::s_objectType;
|
||||
}
|
||||
|
||||
int32_t CSimpleMessageFrame::GetScriptMetaTable() {
|
||||
return CSimpleMessageFrame::s_metatable;
|
||||
}
|
||||
25
src/ui/CSimpleMessageFrame.hpp
Normal file
25
src/ui/CSimpleMessageFrame.hpp
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef UI_C_SIMPLE_MESSAGE_FRAME_HPP
|
||||
#define UI_C_SIMPLE_MESSAGE_FRAME_HPP
|
||||
|
||||
#include "ui/CSimpleFrame.hpp"
|
||||
|
||||
class CSimpleMessageFrame : public CSimpleFrame {
|
||||
public:
|
||||
// Static variables
|
||||
static int32_t s_metatable;
|
||||
static int32_t s_objectType;
|
||||
|
||||
// Static functions
|
||||
static void CreateScriptMetaTable();
|
||||
static int32_t GetObjectType();
|
||||
static void RegisterScriptMethods(lua_State* L);
|
||||
|
||||
// Member functions
|
||||
CSimpleMessageFrame(CSimpleFrame* parent);
|
||||
|
||||
// Virtual member functions
|
||||
virtual bool IsA(int32_t type);
|
||||
virtual int32_t GetScriptMetaTable();
|
||||
};
|
||||
|
||||
#endif
|
||||
68
src/ui/CSimpleMessageFrameScript.cpp
Normal file
68
src/ui/CSimpleMessageFrameScript.cpp
Normal file
@ -0,0 +1,68 @@
|
||||
#include "ui/CSimpleMessageFrameScript.hpp"
|
||||
#include "ui/CSimpleMessageFrame.hpp"
|
||||
#include "util/Lua.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
static int32_t Script_GetOrientation(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
static int32_t Script_SetOrientation(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
static int32_t Script_GetMinMaxValues(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
static int32_t Script_SetMinMaxValues(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
static int32_t Script_GetValue(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
static int32_t Script_SetValue(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
static int32_t Script_GetStatusBarTexture(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
static int32_t Script_SetStatusBarTexture(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
static int32_t Script_GetStatusBarColor(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
static int32_t Script_SetStatusBarColor(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
static int32_t Script_GetRotatesTexture(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
static int32_t Script_SetRotatesTexture(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
}
|
||||
|
||||
|
||||
FrameScript_Method SimpleMessageFrameMethods[NUM_SIMPLE_MESSAGE_FRAME_SCRIPT_METHODS] = {
|
||||
{ "GetOrientation", &Script_GetOrientation },
|
||||
{ "SetOrientation", &Script_SetOrientation },
|
||||
{ "GetMinMaxValues", &Script_GetMinMaxValues },
|
||||
{ "SetMinMaxValues", &Script_SetMinMaxValues },
|
||||
{ "GetValue", &Script_GetValue },
|
||||
{ "SetValue", &Script_SetValue },
|
||||
{ "GetStatusBarTexture", &Script_GetStatusBarTexture },
|
||||
{ "SetStatusBarTexture", &Script_SetStatusBarTexture },
|
||||
{ "GetStatusBarColor", &Script_GetStatusBarColor },
|
||||
{ "SetStatusBarColor", &Script_SetStatusBarColor },
|
||||
{ "GetRotatesTexture", &Script_GetRotatesTexture },
|
||||
{ "SetRotatesTexture", &Script_SetRotatesTexture }
|
||||
};
|
||||
10
src/ui/CSimpleMessageFrameScript.hpp
Normal file
10
src/ui/CSimpleMessageFrameScript.hpp
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef UI_C_SIMPLE_MESSAGE_FRAME_SCRIPT_HPP
|
||||
#define UI_C_SIMPLE_MESSAGE_FRAME_SCRIPT_HPP
|
||||
|
||||
#include "ui/FrameScript.hpp"
|
||||
|
||||
#define NUM_SIMPLE_MESSAGE_FRAME_SCRIPT_METHODS 12
|
||||
|
||||
extern FrameScript_Method SimpleMessageFrameMethods[NUM_SIMPLE_MESSAGE_FRAME_SCRIPT_METHODS];
|
||||
|
||||
#endif
|
||||
@ -8,6 +8,7 @@
|
||||
#include "ui/CSimpleModel.hpp"
|
||||
#include "ui/CSimpleMovieFrame.hpp"
|
||||
#include "ui/CSimpleScrollFrame.hpp"
|
||||
#include "ui/CSimpleMessageFrame.hpp"
|
||||
#include "ui/CSimpleMessageScrollFrame.hpp"
|
||||
#include "ui/CSimpleSlider.hpp"
|
||||
#include "ui/CSimpleStatusBar.hpp"
|
||||
@ -57,7 +58,8 @@ CSimpleFrame* Create_SimpleFrame(CSimpleFrame* parent) {
|
||||
CSimpleFrame* Create_SimpleMessageFrame(CSimpleFrame* parent) {
|
||||
// TODO
|
||||
|
||||
return nullptr;
|
||||
auto m = SMemAlloc(sizeof(CSimpleMessageFrame), __FILE__, __LINE__, 0x0);
|
||||
return new (m) CSimpleMessageFrame(parent);
|
||||
}
|
||||
|
||||
CSimpleFrame* Create_SimpleModel(CSimpleFrame* parent) {
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#include "ui/CSimpleScrollFrame.hpp"
|
||||
#include "ui/CSimpleSlider.hpp"
|
||||
#include "ui/CSimpleTexture.hpp"
|
||||
#include "ui/CSimpleMessageFrame.hpp"
|
||||
#include "ui/CSimpleMessageScrollFrame.hpp"
|
||||
#include "ui/CSimpleStatusBar.hpp"
|
||||
#include "ui/FrameScript.hpp"
|
||||
@ -79,8 +80,7 @@ void RegisterSimpleFrameScriptMethods() {
|
||||
CSimpleEditBox::CreateScriptMetaTable();
|
||||
CSimpleHTML::CreateScriptMetaTable();
|
||||
|
||||
// TODO
|
||||
// CSimpleMessageFrame::CreateScriptMetaTable();
|
||||
CSimpleMessageFrame::CreateScriptMetaTable();
|
||||
CSimpleMessageScrollFrame::CreateScriptMetaTable();
|
||||
|
||||
CSimpleModel::CreateScriptMetaTable();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user