Register constants simply for now

This commit is contained in:
Sezz 2023-10-06 21:00:31 +11:00
parent 95afcdca5c
commit f8583e7746
4 changed files with 8 additions and 17 deletions

View file

@ -57,6 +57,4 @@ void ScriptInterfaceState::Init(const std::string& assetsDir)
InventoryHandler::Register(&SolState, RootTable);
Misc::Register(&SolState, RootTable);
Effects::Register(&SolState, RootTable);
ScriptDisplaySprite::RegisterTables(&SolState, RootTable);
}

View file

@ -51,16 +51,6 @@ namespace TEN::Scripting::DisplaySprite
"Color", &ScriptDisplaySprite::Color);
}
void ScriptDisplaySprite::RegisterTables(sol::state* state, sol::table& parent)
{
auto table = sol::table(state->lua_state(), sol::create);
parent.set(ScriptReserved_DisplaySprite, table);
auto handler = LuaHandler(state);
handler.MakeReadOnlyTable(table, ScriptReserved_DisplaySpriteTableAlignMode, DISPLAY_SPRITE_ALIGN_MODES);
handler.MakeReadOnlyTable(table, ScriptReserved_DisplaySpriteTableScaleMode, DISPLAY_SPRITE_SCALE_MODES);
}
/***
@int objectID ID of the sprite sequence object.
@int spriteID ID of the sprite in the sprite sequence object.

View file

@ -4,17 +4,15 @@
#include "Scripting/Internal/TEN/Color/Color.h"
#include "Scripting/Internal/TEN/Vec2/Vec2.h"
enum BLEND_MODE;
using namespace TEN::Effects::DisplaySprite;
enum BLEND_MODE;
// TODO:
// Check if align modes are applied correctly.
// Check if ScriptDisplaySprite object has been registered correctly.
// Check if its methods have been registered correctly.
// Register DISPLAY_SPRITE_SCALE_MODES and DISPLAY_SPRITE_ORIGIN_TYPES under the correct sub-thing.
// Test nested sprites in various modes and how they behave when the aspect ratio changes.
// Check with everyone if the mySprite.Draw(blah, blah, blah) syntax is sensible.
namespace TEN::Scripting::DisplaySprite
{
@ -22,7 +20,6 @@ namespace TEN::Scripting::DisplaySprite
{
public:
static void Register(sol::table& parent);
static void RegisterTables(sol::state* state, sol::table& parent);
// Members
GAME_OBJECT_ID ObjectID = GAME_OBJECT_ID::ID_DEFAULT_SPRITES;

View file

@ -8,6 +8,8 @@
#include "Scripting/Include/Objects/ScriptInterfaceObjectsHandler.h"
#include "Scripting/Include/Strings/ScriptInterfaceStringsHandler.h"
#include "Scripting/Internal/ReservedScriptNames.h"
#include "Scripting/Internal/TEN/DisplaySprite/AlignModes.h"
#include "Scripting/Internal/TEN/DisplaySprite/ScaleModes.h"
#include "Scripting/Internal/TEN/DisplaySprite/ScriptDisplaySprite.h"
#include "Scripting/Internal/TEN/Flow/InventoryItem/InventoryItem.h"
#include "Scripting/Internal/TEN/Logic/LevelFunc.h"
@ -246,6 +248,10 @@ Specify which translations in the strings table correspond to which languages.
Settings::Register(tableFlow);
Fog::Register(tableFlow);
// TODO: Register inside ScriptDisplaySprite for syntax that looks like this: DisplaySprite.AlignMode.CENTER.
m_handler.MakeReadOnlyTable(tableFlow, "DisplayStringAlignMode"/*ScriptReserved_DisplaySpriteTableAlignMode*/, DISPLAY_SPRITE_ALIGN_MODES);
m_handler.MakeReadOnlyTable(tableFlow, "DisplayStringScaleMode"/*ScriptReserved_DisplaySpriteTableScaleMode*/, DISPLAY_SPRITE_SCALE_MODES);
m_handler.MakeReadOnlyTable(tableFlow, ScriptReserved_WeatherType, WEATHER_TYPES);
m_handler.MakeReadOnlyTable(tableFlow, ScriptReserved_LaraType, PLAYER_TYPES);
m_handler.MakeReadOnlyTable(tableFlow, ScriptReserved_RotationAxis, ROTATION_AXES);