2016-02-20 23:25:00 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2015-09-30 02:56:11 +02:00
|
|
|
#include "Entity/Textdraw.hpp"
|
2016-02-20 23:25:00 +01:00
|
|
|
#include "Entity/Player.hpp"
|
2015-10-29 21:55:36 +01:00
|
|
|
#include "Base/Vector2i.hpp"
|
2015-11-01 00:33:04 +01:00
|
|
|
#include "Core.hpp"
|
2015-09-30 02:56:11 +02:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
namespace SqMod {
|
|
|
|
|
2015-11-01 00:33:04 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-03-10 04:57:13 +01:00
|
|
|
const Int32 CTextdraw::Max = SQMOD_TEXTDRAW_POOL;
|
2016-02-20 23:25:00 +01:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-03-10 04:57:13 +01:00
|
|
|
SQInteger CTextdraw::Typename(HSQUIRRELVM vm)
|
|
|
|
{
|
|
|
|
static SQChar name[] = _SC("SqTextdraw");
|
|
|
|
sq_pushstring(vm, name, sizeof(name));
|
|
|
|
return 1;
|
|
|
|
}
|
2016-02-20 23:25:00 +01:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
CTextdraw::CTextdraw(Int32 id)
|
|
|
|
: m_ID(VALID_ENTITYGETEX(id, SQMOD_TEXTDRAW_POOL))
|
2016-03-10 04:57:13 +01:00
|
|
|
, m_Tag(ToStrF("%d", id))
|
2015-11-01 00:33:04 +01:00
|
|
|
{
|
|
|
|
/* ... */
|
|
|
|
}
|
|
|
|
|
2015-09-30 02:56:11 +02:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
CTextdraw::~CTextdraw()
|
2015-10-29 21:55:36 +01:00
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
/* ... */
|
2015-10-29 21:55:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 CTextdraw::Cmp(const CTextdraw & o) const
|
|
|
|
{
|
|
|
|
if (m_ID == o.m_ID)
|
|
|
|
return 0;
|
|
|
|
else if (m_ID > o.m_ID)
|
|
|
|
return 1;
|
2015-10-29 21:55:36 +01:00
|
|
|
else
|
2016-02-20 23:25:00 +01:00
|
|
|
return -1;
|
2015-10-29 21:55:36 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
const String & CTextdraw::ToString() const
|
2015-10-29 21:55:36 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return m_Tag;
|
2015-10-29 21:55:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-03-10 04:57:13 +01:00
|
|
|
const String & CTextdraw::GetTag() const
|
2015-10-29 21:55:36 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
return m_Tag;
|
2015-10-29 21:55:36 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CTextdraw::SetTag(CSStr tag)
|
|
|
|
{
|
|
|
|
m_Tag.assign(tag);
|
2015-10-29 21:55:36 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
Object & CTextdraw::GetData()
|
2015-10-29 21:55:36 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return m_Data;
|
2015-10-29 21:55:36 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CTextdraw::SetData(Object & data)
|
2015-10-29 21:55:36 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Apply the specified value
|
|
|
|
m_Data = data;
|
2015-10-29 21:55:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
bool CTextdraw::Destroy(Int32 header, Object & payload)
|
2015-10-29 21:55:36 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
2016-02-20 23:25:00 +01:00
|
|
|
return _Core->DelTextdraw(m_ID, header, payload);
|
2015-10-29 21:55:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-03-10 04:57:13 +01:00
|
|
|
void CTextdraw::BindEvent(Int32 evid, Object & env, Function & func) const
|
2016-02-20 23:25:00 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Obtain the function instance called for this event
|
2016-02-20 23:25:00 +01:00
|
|
|
Function & event = _Core->GetTextdrawEvent(m_ID, evid);
|
2016-03-10 04:57:13 +01:00
|
|
|
// Is the specified callback function null?
|
2016-02-20 23:25:00 +01:00
|
|
|
if (func.IsNull())
|
2016-03-10 04:57:13 +01:00
|
|
|
event.Release(); // Then release the current callback
|
|
|
|
// Assign the specified environment and function
|
2015-10-29 21:55:36 +01:00
|
|
|
else
|
2016-02-20 23:25:00 +01:00
|
|
|
event = Function(env.GetVM(), env, func.GetFunc());
|
2015-10-29 21:55:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CTextdraw::ShowAll() const
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->ShowTextdraw(m_ID, -1);
|
2015-10-29 21:55:36 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CTextdraw::ShowFor(CPlayer & player) const
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Is the specified player even valid?
|
2016-02-20 23:25:00 +01:00
|
|
|
if (!player.IsActive())
|
2016-03-10 04:57:13 +01:00
|
|
|
SqThrowF("Invalid player argument: null");
|
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->ShowTextdraw(m_ID, player.GetID());
|
2016-02-20 23:25:00 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CTextdraw::ShowRange(Int32 first, Int32 last) const
|
2015-10-29 21:55:36 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the specified range
|
2016-02-20 23:25:00 +01:00
|
|
|
if (first > last)
|
2016-03-10 04:57:13 +01:00
|
|
|
SqThrowF("Invalid player range: %d > %d", first, last);
|
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
for (; first <= last; ++first)
|
|
|
|
{
|
|
|
|
// Is the currently processed player even connected?
|
|
|
|
if (_Func->IsPlayerConnected(first))
|
|
|
|
// Then show this textdraw on his client
|
|
|
|
_Func->ShowTextdraw(m_ID, first);
|
|
|
|
}
|
2015-10-29 21:55:36 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CTextdraw::HideAll() const
|
2015-10-29 21:55:36 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->HideTextdraw(m_ID, -1);
|
2015-10-29 21:55:36 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CTextdraw::HideFor(CPlayer & player) const
|
2015-10-29 21:55:36 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Is the specified player even valid?
|
2016-02-20 23:25:00 +01:00
|
|
|
if (!player.IsActive())
|
2016-03-10 04:57:13 +01:00
|
|
|
SqThrowF("Invalid player argument: null");
|
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
2016-02-20 23:25:00 +01:00
|
|
|
_Func->HideTextdraw(m_ID, player.GetID());
|
2015-10-29 21:55:36 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CTextdraw::HideRange(Int32 first, Int32 last) const
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the specified range
|
2016-02-20 23:25:00 +01:00
|
|
|
if (first > last)
|
2016-03-10 04:57:13 +01:00
|
|
|
SqThrowF("Invalid player range: %d > %d", first, last);
|
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
for (; first <= last; ++first)
|
|
|
|
{
|
|
|
|
// Is the currently processed player even connected?
|
|
|
|
if (_Func->IsPlayerConnected(first))
|
|
|
|
// Then hide this textdraw on his client
|
|
|
|
_Func->HideTextdraw(m_ID, first);
|
|
|
|
}
|
2015-10-29 21:55:36 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CTextdraw::SetPositionAll(const Vector2i & pos) const
|
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->MoveTextdraw(m_ID, -1, pos.x, pos.y);
|
2015-10-29 21:55:36 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CTextdraw::SetPositionAllEx(Int32 x, Int32 y) const
|
2015-10-29 21:55:36 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->MoveTextdraw(m_ID, -1, x, y);
|
2015-10-29 21:55:36 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CTextdraw::SetPositionFor(CPlayer & player, const Vector2i & pos) const
|
2015-10-29 21:55:36 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Is the specified player even valid?
|
2016-02-20 23:25:00 +01:00
|
|
|
if (!player.IsActive())
|
2016-03-10 04:57:13 +01:00
|
|
|
SqThrowF("Invalid player argument: null");
|
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->MoveTextdraw(m_ID, player.GetID(), pos.x, pos.y);
|
2015-10-29 21:55:36 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CTextdraw::SetPositionForEx(CPlayer & player, Int32 x, Int32 y) const
|
2015-11-01 00:33:04 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Is the specified player even valid?
|
2016-02-20 23:25:00 +01:00
|
|
|
if (!player.IsActive())
|
2016-03-10 04:57:13 +01:00
|
|
|
SqThrowF("Invalid player argument: null");
|
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->MoveTextdraw(m_ID, player.GetID(), x, y);
|
2015-11-01 00:33:04 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CTextdraw::SetPositionRange(Int32 first, Int32 last, const Vector2i & pos) const
|
2015-11-01 00:33:04 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the specified range
|
2016-02-20 23:25:00 +01:00
|
|
|
if (first > last)
|
2016-03-10 04:57:13 +01:00
|
|
|
SqThrowF("Invalid player range: %d > %d", first, last);
|
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
for (; first <= last; ++first)
|
|
|
|
{
|
|
|
|
// Is the currently processed player even connected?
|
|
|
|
if (_Func->IsPlayerConnected(first))
|
|
|
|
// Then move this textdraw on his client
|
|
|
|
_Func->MoveTextdraw(m_ID, first, pos.x, pos.y);
|
|
|
|
}
|
2015-11-01 00:33:04 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CTextdraw::SetColorAll(const Color4 & col) const
|
2015-11-01 00:33:04 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetTextdrawColour(m_ID, -1, col.GetRGBA());
|
2015-11-01 00:33:04 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CTextdraw::SetColorAllEx(Uint8 r, Uint8 g, Uint8 b, Uint8 a) const
|
2015-11-01 00:33:04 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetTextdrawColour(m_ID, -1, SQMOD_PACK_RGBA(r, g, b, a));
|
2015-11-01 00:33:04 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CTextdraw::SetColorFor(CPlayer & player, const Color4 & col) const
|
2015-11-01 00:33:04 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Is the specified player even valid?
|
2016-02-20 23:25:00 +01:00
|
|
|
if (!player.IsActive())
|
2016-03-10 04:57:13 +01:00
|
|
|
SqThrowF("Invalid player argument: null");
|
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetTextdrawColour(m_ID, player.GetID(), col.GetRGBA());
|
2015-11-01 00:33:04 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CTextdraw::SetColorForEx(CPlayer & player, Uint8 r, Uint8 g, Uint8 b, Uint8 a) const
|
2015-11-01 00:33:04 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Is the specified player even valid?
|
2016-02-20 23:25:00 +01:00
|
|
|
if (!player.IsActive())
|
2016-03-10 04:57:13 +01:00
|
|
|
SqThrowF("Invalid player argument: null");
|
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
_Func->SetTextdrawColour(m_ID, player.GetID(), SQMOD_PACK_RGBA(r, g, b, a));
|
2015-11-01 00:33:04 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-02-20 23:25:00 +01:00
|
|
|
void CTextdraw::SetColorRange(Int32 first, Int32 last, const Color4 & col) const
|
2015-11-01 00:33:04 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the specified range
|
2016-02-20 23:25:00 +01:00
|
|
|
if (first > last)
|
2016-03-10 04:57:13 +01:00
|
|
|
SqThrowF("Invalid player range: %d > %d", first, last);
|
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Perform the requested operation
|
|
|
|
for (const Uint32 color = col.GetRGBA(); first <= last; ++first)
|
|
|
|
{
|
|
|
|
// Is the currently processed player even connected?
|
|
|
|
if (_Func->IsPlayerConnected(first))
|
|
|
|
// Then colorize this textdraw on his client
|
|
|
|
_Func->SetTextdrawColour(m_ID, first, color);
|
|
|
|
}
|
2015-11-01 00:33:04 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
const String & CTextdraw::GetText() const
|
2015-11-01 00:33:04 +01:00
|
|
|
{
|
2016-03-10 04:57:13 +01:00
|
|
|
// Validate the managed identifier
|
|
|
|
Validate();
|
|
|
|
// Return the requested information
|
|
|
|
return _Core->GetTextdraw(m_ID).mText;
|
2015-11-01 00:33:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-03-10 04:57:13 +01:00
|
|
|
static Object & Textdraw_CreateEx(CSStr text, Int32 xp, Int32 yp,
|
2016-02-20 23:25:00 +01:00
|
|
|
Uint8 r, Uint8 g, Uint8 b, Uint8 a, bool rel)
|
2015-11-01 00:33:04 +01:00
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
return _Core->NewTextdraw(SQMOD_UNKNOWN, text, xp, yp, SQMOD_PACK_ARGB(a, r, g, b), rel,
|
|
|
|
SQMOD_CREATE_DEFAULT, NullObject());
|
2015-11-01 00:33:04 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
static Object & Textdraw_CreateEx(CSStr text, Int32 xp, Int32 yp,
|
2016-02-20 23:25:00 +01:00
|
|
|
Uint8 r, Uint8 g, Uint8 b, Uint8 a, bool rel,
|
|
|
|
Int32 header, Object & payload)
|
2015-11-01 00:33:04 +01:00
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
return _Core->NewTextdraw(SQMOD_UNKNOWN, text, xp, yp, SQMOD_PACK_ARGB(a, r, g, b), rel,
|
2015-11-01 00:33:04 +01:00
|
|
|
header, payload);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-03-10 04:57:13 +01:00
|
|
|
static Object & Textdraw_CreateEx(Int32 index, CSStr text, Int32 xp, Int32 yp,
|
2016-02-20 23:25:00 +01:00
|
|
|
Uint8 r, Uint8 g, Uint8 b, Uint8 a, bool rel)
|
2015-11-01 00:33:04 +01:00
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
return _Core->NewTextdraw(index,text, xp, yp, SQMOD_PACK_ARGB(a, r, g, b), rel,
|
|
|
|
SQMOD_CREATE_DEFAULT, NullObject());
|
2015-11-01 00:33:04 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
static Object & Textdraw_CreateEx(Int32 index, CSStr text, Int32 xp, Int32 yp,
|
2016-02-20 23:25:00 +01:00
|
|
|
Uint8 r, Uint8 g, Uint8 b, Uint8 a, bool rel,
|
|
|
|
Int32 header, Object & payload)
|
2015-11-01 00:33:04 +01:00
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
return _Core->NewTextdraw(index, text, xp, yp, SQMOD_PACK_ARGB(a, r, g, b), rel,
|
2015-11-01 00:33:04 +01:00
|
|
|
header, payload);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-03-10 04:57:13 +01:00
|
|
|
static Object & Textdraw_Create(CSStr text, const Vector2i & pos, const Color4 & color, bool rel)
|
2015-11-01 00:33:04 +01:00
|
|
|
{
|
|
|
|
return _Core->NewTextdraw(SQMOD_UNKNOWN, text, pos.x, pos.y, color.GetARGB(), rel,
|
2016-02-20 23:25:00 +01:00
|
|
|
SQMOD_CREATE_DEFAULT, NullObject());
|
2015-11-01 00:33:04 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
static Object & Textdraw_Create(CSStr text, const Vector2i & pos, const Color4 & color, bool rel,
|
2016-02-20 23:25:00 +01:00
|
|
|
Int32 header, Object & payload)
|
2015-11-01 00:33:04 +01:00
|
|
|
{
|
|
|
|
return _Core->NewTextdraw(SQMOD_UNKNOWN, text, pos.x, pos.y, color.GetARGB(), rel,
|
|
|
|
header, payload);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2016-03-10 04:57:13 +01:00
|
|
|
static Object & Textdraw_Create(Int32 index, CSStr text, const Vector2i & pos, const Color4 & color,
|
2016-02-20 23:25:00 +01:00
|
|
|
bool rel)
|
2015-11-01 00:33:04 +01:00
|
|
|
{
|
|
|
|
return _Core->NewTextdraw(index, text, pos.x, pos.y, color.GetARGB(), rel,
|
2016-02-20 23:25:00 +01:00
|
|
|
SQMOD_CREATE_DEFAULT, NullObject());
|
2015-11-01 00:33:04 +01:00
|
|
|
}
|
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
static Object & Textdraw_Create(Int32 index, CSStr text, const Vector2i & pos, const Color4 & color,
|
2016-02-20 23:25:00 +01:00
|
|
|
bool rel, Int32 header, Object & payload)
|
2015-11-01 00:33:04 +01:00
|
|
|
{
|
2016-02-20 23:25:00 +01:00
|
|
|
return _Core->NewTextdraw(index, text, pos.x, pos.y, color.GetARGB(), rel, header, payload);
|
2015-11-01 00:33:04 +01:00
|
|
|
}
|
|
|
|
|
2015-10-29 21:55:36 +01:00
|
|
|
// ================================================================================================
|
2016-02-20 23:25:00 +01:00
|
|
|
void Register_CTextdraw(HSQUIRRELVM vm)
|
|
|
|
{
|
|
|
|
RootTable(vm).Bind(_SC("SqTextdraw"),
|
|
|
|
Class< CTextdraw, NoConstructor< CTextdraw > >(vm, _SC("SqTextdraw"))
|
2016-03-10 04:57:13 +01:00
|
|
|
// Metamethods
|
2016-02-20 23:25:00 +01:00
|
|
|
.Func(_SC("_cmp"), &CTextdraw::Cmp)
|
2016-03-10 04:57:13 +01:00
|
|
|
.SquirrelFunc(_SC("_typename"), &CTextdraw::Typename)
|
2016-02-20 23:25:00 +01:00
|
|
|
.Func(_SC("_tostring"), &CTextdraw::ToString)
|
2016-03-10 04:57:13 +01:00
|
|
|
// Static values
|
|
|
|
.SetStaticValue(_SC("MaxID"), CTextdraw::Max)
|
|
|
|
// Core Properties
|
2016-02-20 23:25:00 +01:00
|
|
|
.Prop(_SC("ID"), &CTextdraw::GetID)
|
|
|
|
.Prop(_SC("Tag"), &CTextdraw::GetTag, &CTextdraw::SetTag)
|
|
|
|
.Prop(_SC("Data"), &CTextdraw::GetData, &CTextdraw::SetData)
|
|
|
|
.Prop(_SC("Active"), &CTextdraw::IsActive)
|
2016-03-10 04:57:13 +01:00
|
|
|
// Core Functions
|
2016-02-20 23:25:00 +01:00
|
|
|
.Func(_SC("Bind"), &CTextdraw::BindEvent)
|
2016-03-10 04:57:13 +01:00
|
|
|
// Core Overloads
|
2016-02-20 23:25:00 +01:00
|
|
|
.Overload< bool (CTextdraw::*)(void) >(_SC("Destroy"), &CTextdraw::Destroy)
|
|
|
|
.Overload< bool (CTextdraw::*)(Int32) >(_SC("Destroy"), &CTextdraw::Destroy)
|
|
|
|
.Overload< bool (CTextdraw::*)(Int32, Object &) >(_SC("Destroy"), &CTextdraw::Destroy)
|
2016-03-10 04:57:13 +01:00
|
|
|
// Properties
|
2016-02-20 23:25:00 +01:00
|
|
|
.Prop(_SC("Text"), &CTextdraw::GetText)
|
2016-03-10 04:57:13 +01:00
|
|
|
// Functions
|
2016-02-20 23:25:00 +01:00
|
|
|
.Func(_SC("ShowAll"), &CTextdraw::ShowAll)
|
|
|
|
.Func(_SC("ShowTo"), &CTextdraw::ShowFor)
|
|
|
|
.Func(_SC("ShowFor"), &CTextdraw::ShowFor)
|
|
|
|
.Func(_SC("ShowRange"), &CTextdraw::ShowRange)
|
|
|
|
.Func(_SC("HideAll"), &CTextdraw::HideAll)
|
|
|
|
.Func(_SC("HideFor"), &CTextdraw::HideFor)
|
|
|
|
.Func(_SC("HideFrom"), &CTextdraw::HideFor)
|
|
|
|
.Func(_SC("HideRange"), &CTextdraw::HideRange)
|
|
|
|
.Func(_SC("SetPositionRange"), &CTextdraw::SetPositionRange)
|
|
|
|
.Func(_SC("SetColorRange"), &CTextdraw::SetColorRange)
|
2016-03-10 04:57:13 +01:00
|
|
|
// Overloads
|
2015-10-29 21:55:36 +01:00
|
|
|
.Overload< void (CTextdraw::*)(const Vector2i &) const >
|
2016-02-20 23:25:00 +01:00
|
|
|
(_SC("SetPositionAll"), &CTextdraw::SetPositionAll)
|
|
|
|
.Overload< void (CTextdraw::*)(Int32, Int32) const >
|
|
|
|
(_SC("SetPositionAll"), &CTextdraw::SetPositionAllEx)
|
|
|
|
.Overload< void (CTextdraw::*)(CPlayer &, const Vector2i &) const >
|
|
|
|
(_SC("SetPositionFor"), &CTextdraw::SetPositionFor)
|
|
|
|
.Overload< void (CTextdraw::*)(CPlayer &, Int32, Int32) const >
|
|
|
|
(_SC("SetPositionFor"), &CTextdraw::SetPositionForEx)
|
2015-10-29 21:55:36 +01:00
|
|
|
.Overload< void (CTextdraw::*)(const Color4 &) const >
|
2016-02-20 23:25:00 +01:00
|
|
|
(_SC("SetColorAll"), &CTextdraw::SetColorAll)
|
2015-10-29 21:55:36 +01:00
|
|
|
.Overload< void (CTextdraw::*)(Uint8, Uint8, Uint8, Uint8) const >
|
2016-02-20 23:25:00 +01:00
|
|
|
(_SC("SetColorAll"), &CTextdraw::SetColorAllEx)
|
|
|
|
.Overload< void (CTextdraw::*)(CPlayer &, const Color4 &) const >
|
|
|
|
(_SC("SetColorFor"), &CTextdraw::SetColorFor)
|
|
|
|
.Overload< void (CTextdraw::*)(CPlayer &, Uint8, Uint8, Uint8, Uint8) const >
|
|
|
|
(_SC("SetColorFor"), &CTextdraw::SetColorForEx)
|
2016-03-10 04:57:13 +01:00
|
|
|
// Static Overloads
|
|
|
|
.StaticOverload< Object & (*)(CSStr, Int32, Int32, Uint8, Uint8, Uint8, Uint8, bool) >
|
|
|
|
(_SC("CreateEx"), &Textdraw_CreateEx)
|
|
|
|
.StaticOverload< Object & (*)(CSStr, Int32, Int32, Uint8, Uint8, Uint8, Uint8, bool, Int32, Object &) >
|
|
|
|
(_SC("CreateEx"), &Textdraw_CreateEx)
|
|
|
|
.StaticOverload< Object & (*)(Int32, CSStr, Int32, Int32, Uint8, Uint8, Uint8, Uint8, bool) >
|
|
|
|
(_SC("CreateEx"), &Textdraw_CreateEx)
|
|
|
|
.StaticOverload< Object & (*)(Int32, CSStr, Int32, Int32, Uint8, Uint8, Uint8, Uint8, bool, Int32, Object &) >
|
|
|
|
(_SC("CreateEx"), &Textdraw_CreateEx)
|
|
|
|
.StaticOverload< Object & (*)(CSStr, const Vector2i &, const Color4 &, bool) >
|
|
|
|
(_SC("Create"), &Textdraw_Create)
|
|
|
|
.StaticOverload< Object & (*)(CSStr, const Vector2i &, const Color4 &, bool, Int32, Object &) >
|
|
|
|
(_SC("Create"), &Textdraw_Create)
|
|
|
|
.StaticOverload< Object & (*)(Int32, CSStr, const Vector2i &, const Color4 &, bool) >
|
|
|
|
(_SC("Create"), &Textdraw_Create)
|
|
|
|
.StaticOverload< Object & (*)(Int32, CSStr, const Vector2i &, const Color4 &, bool, Int32, Object &) >
|
|
|
|
(_SC("Create"), &Textdraw_Create)
|
2015-09-30 02:56:11 +02:00
|
|
|
);
|
2016-03-10 04:57:13 +01:00
|
|
|
}
|
2015-09-30 02:56:11 +02:00
|
|
|
|
2016-03-10 04:57:13 +01:00
|
|
|
} // Namespace:: SqMod
|