mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 21:51:06 +03:00
Compare commits
5 Commits
91a4afd976
...
22eb04e495
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22eb04e495 | ||
|
|
2c181e436c | ||
|
|
3d7d000190 | ||
|
|
bdef61479d | ||
|
|
85b7537faa |
@ -98,6 +98,21 @@ enum TextureImageMode {
|
||||
ImageMode_Desaturate = 1
|
||||
};
|
||||
|
||||
enum TOOLTIP_ANCHORPOINT {
|
||||
TOOLTIP_ANCHOR_LEFT = 0,
|
||||
TOOLTIP_ANCHOR_RIGHT = 1,
|
||||
TOOLTIP_ANCHOR_BOTTOMLEFT = 2,
|
||||
TOOLTIP_ANCHOR_BOTTOM = 3,
|
||||
TOOLTIP_ANCHOR_BOTTOMRIGHT = 4,
|
||||
TOOLTIP_ANCHOR_TOPLEFT = 5,
|
||||
TOOLTIP_ANCHOR_TOP = 6,
|
||||
TOOLTIP_ANCHOR_TOPRIGHT = 7,
|
||||
TOOLTIP_ANCHOR_CURSOR = 8,
|
||||
TOOLTIP_ANCHOR_NONE = 9,
|
||||
TOOLTIP_ANCHOR_PRESERVE = 10,
|
||||
TOOLTIP_ANCHOR_CURSOR_RIGHT = 11,
|
||||
};
|
||||
|
||||
struct FRAMEPRIORITY {
|
||||
CSimpleFrame* frame;
|
||||
uint32_t priority;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#include "ui/game/BattlefieldInfoScript.hpp"
|
||||
#include "ui/game/CGBattlefieldInfo.hpp"
|
||||
#include "ui/FrameScript.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
@ -105,7 +106,9 @@ int32_t Script_GetBattlefieldStatData(lua_State* L) {
|
||||
}
|
||||
|
||||
int32_t Script_RequestBattlefieldPositions(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
CGBattlefieldInfo::RequestPlayerPositions();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t Script_GetNumBattlefieldPositions(lua_State* L) {
|
||||
|
||||
5
src/ui/game/CGBattlefieldInfo.cpp
Normal file
5
src/ui/game/CGBattlefieldInfo.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#include "ui/game/CGBattlefieldInfo.hpp"
|
||||
|
||||
void CGBattlefieldInfo::RequestPlayerPositions() {
|
||||
// TODO
|
||||
}
|
||||
10
src/ui/game/CGBattlefieldInfo.hpp
Normal file
10
src/ui/game/CGBattlefieldInfo.hpp
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef UI_GAME_C_G_BATTLEFIELD_INFO_HPP
|
||||
#define UI_GAME_C_G_BATTLEFIELD_INFO_HPP
|
||||
|
||||
class CGBattlefieldInfo {
|
||||
public:
|
||||
// Static functions
|
||||
static void RequestPlayerPositions();
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -35,3 +35,10 @@ CGTooltip::CGTooltip(CSimpleFrame* parent) : CSimpleFrame(parent) {
|
||||
int32_t CGTooltip::GetScriptMetaTable() {
|
||||
return CGTooltip::s_metatable;
|
||||
}
|
||||
|
||||
bool CGTooltip::IsA(int32_t type) {
|
||||
return type == CGTooltip::s_objectType
|
||||
|| type == CSimpleFrame::s_objectType
|
||||
|| type == CScriptRegion::s_objectType
|
||||
|| type == CScriptObject::s_objectType;
|
||||
}
|
||||
|
||||
@ -16,9 +16,14 @@ class CGTooltip : public CSimpleFrame {
|
||||
static void RegisterScriptMethods(lua_State* L);
|
||||
|
||||
// Member variables
|
||||
CSimpleFrame* m_owner = nullptr;
|
||||
TOOLTIP_ANCHORPOINT m_anchorPoint;
|
||||
// TODO
|
||||
C2Vector m_offset;
|
||||
// TODO
|
||||
|
||||
// Virtual member functions
|
||||
virtual bool IsA(int32_t type);
|
||||
virtual int32_t GetScriptMetaTable();
|
||||
|
||||
// Member functions
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
#include "ui/game/CGTooltipScript.hpp"
|
||||
#include "ui/game/CGTooltip.hpp"
|
||||
#include "ui/FrameScript.hpp"
|
||||
#include "util/Lua.hpp"
|
||||
#include "util/Unimplemented.hpp"
|
||||
|
||||
namespace {
|
||||
@ -25,7 +27,35 @@ int32_t CGTooltip_GetPadding(lua_State* L) {
|
||||
}
|
||||
|
||||
int32_t CGTooltip_IsOwned(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
auto type = CGTooltip::GetObjectType();
|
||||
auto tooltip = static_cast<CGTooltip*>(FrameScript_GetObjectThis(L, type));
|
||||
|
||||
if (lua_type(L, 2) != LUA_TTABLE) {
|
||||
luaL_error(L, "Usage: %s:IsOwned(frame)", tooltip->GetDisplayName());
|
||||
return 0;
|
||||
}
|
||||
|
||||
lua_rawgeti(L, 2, 0);
|
||||
auto frame = static_cast<CSimpleFrame*>(lua_touserdata(L, -1));
|
||||
lua_settop(L, -2);
|
||||
|
||||
if (!frame) {
|
||||
luaL_error(L, "%s:IsOwned(): Couldn't find 'this' in frame object", tooltip->GetDisplayName());
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!frame->IsA(CSimpleFrame::GetObjectType())) {
|
||||
luaL_error(L, "%s:IsOwned(): Wrong object type, expected frame", tooltip->GetDisplayName());
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (tooltip->m_owner == frame) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t CGTooltip_GetOwner(lua_State* L) {
|
||||
|
||||
@ -218,7 +218,22 @@ int32_t CSimpleButton_SetFontString(lua_State* L) {
|
||||
}
|
||||
|
||||
int32_t CSimpleButton_GetFontString(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
auto type = CSimpleButton::GetObjectType();
|
||||
auto button = static_cast<CSimpleButton*>(FrameScript_GetObjectThis(L, type));
|
||||
auto text = button->m_text;
|
||||
|
||||
if (!text) {
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!text->lua_registered) {
|
||||
text->RegisterScriptObject(nullptr);
|
||||
}
|
||||
|
||||
lua_rawgeti(L, LUA_REGISTRYINDEX, text->lua_objectRef);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t CSimpleButton_SetText(lua_State* L) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user