mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-01-19 03:57:14 +01:00
Implemented functions to create keybind entities and added constructor to create an entity reference from a base reference.
This commit is contained in:
parent
986fc5769e
commit
78c72399db
@ -1,9 +1,17 @@
|
|||||||
#include "Entity/Keybind.hpp"
|
#include "Entity/Keybind.hpp"
|
||||||
|
#include "Core.hpp"
|
||||||
#include "Register.hpp"
|
#include "Register.hpp"
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
namespace SqMod {
|
namespace SqMod {
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
CKeybind::CKeybind(const Reference< CKeybind > & o) noexcept
|
||||||
|
: Reference(o)
|
||||||
|
{
|
||||||
|
/* ... */
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
SQInt32 CKeybind::GetPrimary() const noexcept
|
SQInt32 CKeybind::GetPrimary() const noexcept
|
||||||
{
|
{
|
||||||
@ -64,6 +72,70 @@ bool CKeybind::IsRelease() const noexcept
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
Reference< CKeybind > CreateBaseKeybind_ES(bool release,
|
||||||
|
SQInt32 primary, SQInt32 secondary, SQInt32 alternative) noexcept
|
||||||
|
{
|
||||||
|
return _Core->NewKeybind(SQMOD_UNKNOWN, release, primary, secondary, alternative,
|
||||||
|
SQMOD_CREATE_DEFAULT, NullData());
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference< CKeybind > CreateBaseKeybind_ES(bool release,
|
||||||
|
SQInt32 primary, SQInt32 secondary, SQInt32 alternative,
|
||||||
|
SQInt32 header, SqObj & payload) noexcept
|
||||||
|
{
|
||||||
|
return _Core->NewKeybind(SQMOD_UNKNOWN, release, primary, secondary, alternative,
|
||||||
|
header, payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
Reference< CKeybind > CreateBaseKeybind_EF(SQInt32 slot, bool release,
|
||||||
|
SQInt32 primary, SQInt32 secondary, SQInt32 alternative) noexcept
|
||||||
|
{
|
||||||
|
return _Core->NewKeybind(slot, release, primary, secondary, alternative,
|
||||||
|
SQMOD_CREATE_DEFAULT, NullData());
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference< CKeybind > CreateBaseKeybind_EF(SQInt32 slot, bool release,
|
||||||
|
SQInt32 primary, SQInt32 secondary, SQInt32 alternative,
|
||||||
|
SQInt32 header, SqObj & payload) noexcept
|
||||||
|
{
|
||||||
|
return _Core->NewKeybind(slot, release, primary, secondary, alternative,
|
||||||
|
header, payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
CKeybind CreateKeybind_ES(bool release,
|
||||||
|
SQInt32 primary, SQInt32 secondary, SQInt32 alternative) noexcept
|
||||||
|
{
|
||||||
|
return _Core->NewKeybind(SQMOD_UNKNOWN, release, primary, secondary, alternative,
|
||||||
|
SQMOD_CREATE_DEFAULT, NullData());
|
||||||
|
}
|
||||||
|
|
||||||
|
CKeybind CreateKeybind_ES(bool release,
|
||||||
|
SQInt32 primary, SQInt32 secondary, SQInt32 alternative,
|
||||||
|
SQInt32 header, SqObj & payload) noexcept
|
||||||
|
{
|
||||||
|
return _Core->NewKeybind(SQMOD_UNKNOWN, release, primary, secondary, alternative,
|
||||||
|
header, payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
CKeybind CreateKeybind_EF(SQInt32 slot, bool release,
|
||||||
|
SQInt32 primary, SQInt32 secondary, SQInt32 alternative) noexcept
|
||||||
|
{
|
||||||
|
return _Core->NewKeybind(slot, release, primary, secondary, alternative,
|
||||||
|
SQMOD_CREATE_DEFAULT, NullData());
|
||||||
|
}
|
||||||
|
|
||||||
|
CKeybind CreateKeybind_EF(SQInt32 slot, bool release,
|
||||||
|
SQInt32 primary, SQInt32 secondary, SQInt32 alternative,
|
||||||
|
SQInt32 header, SqObj & payload) noexcept
|
||||||
|
{
|
||||||
|
return _Core->NewKeybind(slot, release, primary, secondary, alternative,
|
||||||
|
header, payload);
|
||||||
|
}
|
||||||
|
|
||||||
// ================================================================================================
|
// ================================================================================================
|
||||||
bool Register_CKeybind(HSQUIRRELVM vm)
|
bool Register_CKeybind(HSQUIRRELVM vm)
|
||||||
{
|
{
|
||||||
@ -74,10 +146,12 @@ bool Register_CKeybind(HSQUIRRELVM vm)
|
|||||||
// Registration failed
|
// Registration failed
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// Typedef the base reference type for simplicity
|
||||||
|
typedef Reference< CKeybind > RefType;
|
||||||
// Output debugging information
|
// Output debugging information
|
||||||
LogDbg("Beginning registration of <CKeybind> type");
|
LogDbg("Beginning registration of <CKeybind> type");
|
||||||
// Attempt to register the actual reference that implements all of the entity functionality
|
// Attempt to register the actual reference that implements all of the entity functionality
|
||||||
Sqrat::RootTable(vm).Bind(_SC("CKeybind"), Sqrat::DerivedClass< CKeybind, Reference< CKeybind > >(vm, _SC("CKeybind"))
|
Sqrat::RootTable(vm).Bind(_SC("CKeybind"), Sqrat::DerivedClass< CKeybind, RefType >(vm, _SC("CKeybind"))
|
||||||
/* Constructors */
|
/* Constructors */
|
||||||
.Ctor()
|
.Ctor()
|
||||||
.Ctor< SQInt32 >()
|
.Ctor< SQInt32 >()
|
||||||
@ -89,6 +163,32 @@ bool Register_CKeybind(HSQUIRRELVM vm)
|
|||||||
);
|
);
|
||||||
// Output debugging information
|
// Output debugging information
|
||||||
LogDbg("Registration of <CKeybind> type was successful");
|
LogDbg("Registration of <CKeybind> type was successful");
|
||||||
|
// Output debugging information
|
||||||
|
LogDbg("Beginning registration of <Keybind functions> type");
|
||||||
|
// Register global functions related to this entity type
|
||||||
|
Sqrat::RootTable(vm)
|
||||||
|
/* Create BaseKeybind [E]xtended [S]ubstitute */
|
||||||
|
.Overload< RefType (*)(bool, SQInt32, SQInt32, SQInt32) >
|
||||||
|
(_SC("CreateBaseKeybind_ES"), &CreateBaseKeybind_ES)
|
||||||
|
.Overload< RefType (*)(bool, SQInt32, SQInt32, SQInt32, SQInt32, SqObj &) >
|
||||||
|
(_SC("CreateBaseKeybind_ES"), &CreateBaseKeybind_ES)
|
||||||
|
/* Create BaseKeybind [E]xtended [F]Full */
|
||||||
|
.Overload< RefType (*)(SQInt32, bool, SQInt32, SQInt32, SQInt32) >
|
||||||
|
(_SC("CreateBaseKeybind_EF"), &CreateBaseKeybind_EF)
|
||||||
|
.Overload< RefType (*)(SQInt32, bool, SQInt32, SQInt32, SQInt32, SQInt32, SqObj &) >
|
||||||
|
(_SC("CreateBaseKeybind_EF"), &CreateBaseKeybind_EF)
|
||||||
|
/* Create CKeybind [E]xtended [S]ubstitute */
|
||||||
|
.Overload< CKeybind (*)(bool, SQInt32, SQInt32, SQInt32) >
|
||||||
|
(_SC("CreateKeybind_ES"), &CreateKeybind_ES)
|
||||||
|
.Overload< CKeybind (*)(bool, SQInt32, SQInt32, SQInt32, SQInt32, SqObj &) >
|
||||||
|
(_SC("CreateKeybind_ES"), &CreateKeybind_ES)
|
||||||
|
/* Create CKeybind [E]xtended [F]Full */
|
||||||
|
.Overload< CKeybind (*)(SQInt32, bool, SQInt32, SQInt32, SQInt32) >
|
||||||
|
(_SC("CreateKeybind_EF"), &CreateKeybind_EF)
|
||||||
|
.Overload< CKeybind (*)(SQInt32, bool, SQInt32, SQInt32, SQInt32, SQInt32, SqObj &) >
|
||||||
|
(_SC("CreateKeybind_EF"), &CreateKeybind_EF);
|
||||||
|
// Output debugging information
|
||||||
|
LogDbg("Registration of <Keybind functions> type was successful");
|
||||||
// Registration succeeded
|
// Registration succeeded
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
using RefType::Reference;
|
using RefType::Reference;
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Construct a reference from a base reference.
|
||||||
|
*/
|
||||||
|
CKeybind(const Reference< CKeybind > & o) noexcept;
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Retrieve the primary key code of the referenced keybind instance.
|
* Retrieve the primary key code of the referenced keybind instance.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user