mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-08 11:38:08 +03:00
Move GameScriptSettings over to Scripting.
This commit is contained in:
parent
2889a62704
commit
fe978daa9d
6 changed files with 24 additions and 16 deletions
|
@ -32,8 +32,10 @@
|
|||
<ClInclude Include="include\GameScriptNamedBase.h" />
|
||||
<ClInclude Include="include\GameScriptPosition.h" />
|
||||
<ClInclude Include="include\GameScriptRotation.h" />
|
||||
<ClInclude Include="include\GameScriptSettings.h" />
|
||||
<ClInclude Include="include\GameScriptSinkInfo.h" />
|
||||
<ClInclude Include="include\GameScriptSkyLayer.h" />
|
||||
<ClInclude Include="include\GameScriptSoundSourceInfo.h" />
|
||||
<ClInclude Include="include\ItemEnumPair.h" />
|
||||
<ClInclude Include="include\ReservedScriptNames.h" />
|
||||
<ClInclude Include="include\ScriptAssert.h" />
|
||||
|
@ -55,8 +57,10 @@
|
|||
<ClCompile Include="src\GameScriptMirror.cpp" />
|
||||
<ClCompile Include="src\GameScriptPosition.cpp" />
|
||||
<ClCompile Include="src\GameScriptRotation.cpp" />
|
||||
<ClCompile Include="src\GameScriptSettings.cpp" />
|
||||
<ClCompile Include="src\GameScriptSinkInfo.cpp" />
|
||||
<ClCompile Include="src\GameScriptSkyLayer.cpp" />
|
||||
<ClCompile Include="src\GameScriptSoundSourceInfo.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
@ -135,7 +139,7 @@
|
|||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NOMINMAX;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;NOMINMAX;SPDLOG_COMPILED_LIB;</PreprocessorDefinitions>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>frameworkandsol.h</PrecompiledHeaderFile>
|
||||
|
@ -147,6 +151,9 @@
|
|||
</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
|
@ -154,7 +161,7 @@
|
|||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NOMINMAX;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;NOMINMAX;SPDLOG_COMPILED_LIB;</PreprocessorDefinitions>
|
||||
<ConformanceMode>false</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>frameworkandsol.h</PrecompiledHeaderFile>
|
||||
|
@ -168,6 +175,9 @@
|
|||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
|
|
|
@ -72,6 +72,12 @@
|
|||
<ClInclude Include="include\ReservedScriptNames.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\GameScriptSettings.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\GameScriptSoundSourceInfo.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="frameworkandsol.cpp">
|
||||
|
@ -113,6 +119,12 @@
|
|||
<ClCompile Include="src\GameScriptDisplayString.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\GameScriptSettings.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\GameScriptSoundSourceInfo.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
|
31
Scripting/include/GameScriptSettings.h
Normal file
31
Scripting/include/GameScriptSettings.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
#pragma once
|
||||
|
||||
#include "ScriptAssert.h"
|
||||
#include <string>
|
||||
|
||||
static const std::unordered_map<std::string, ERROR_MODE> kErrorModes {
|
||||
{"SILENT", ERROR_MODE::SILENT},
|
||||
{"WARN", ERROR_MODE::WARN},
|
||||
{"TERMINATE", ERROR_MODE::TERMINATE}
|
||||
};
|
||||
|
||||
namespace sol {
|
||||
class state;
|
||||
}
|
||||
|
||||
struct GameScriptSettings
|
||||
{
|
||||
int ScreenWidth;
|
||||
int ScreenHeight;
|
||||
bool EnableLoadSave;
|
||||
bool EnableDynamicShadows;
|
||||
bool EnableWaterCaustics;
|
||||
bool Windowed;
|
||||
int DrawingDistance;
|
||||
bool ShowRendererSteps;
|
||||
bool ShowDebugInfo;
|
||||
ERROR_MODE ErrorMode;
|
||||
|
||||
static void Register(sol::state* lua);
|
||||
};
|
||||
|
41
Scripting/src/GameScriptSettings.cpp
Normal file
41
Scripting/src/GameScriptSettings.cpp
Normal file
|
@ -0,0 +1,41 @@
|
|||
#include "frameworkandsol.h"
|
||||
#include "GameScriptSettings.h"
|
||||
|
||||
/***
|
||||
Settings that will be run on game startup.
|
||||
@pregameclass Settings
|
||||
@pragma nostrip
|
||||
*/
|
||||
|
||||
void GameScriptSettings::Register(sol::state* lua)
|
||||
{
|
||||
lua->new_usertype<GameScriptSettings>("Settings",
|
||||
"screenWidth", &GameScriptSettings::ScreenWidth,
|
||||
"screenHeight", &GameScriptSettings::ScreenHeight,
|
||||
"enableDynamicShadows", &GameScriptSettings::EnableDynamicShadows,
|
||||
"windowed", &GameScriptSettings::Windowed,
|
||||
"enableWaterCaustics", &GameScriptSettings::EnableWaterCaustics,
|
||||
"drawingDistance", &GameScriptSettings::DrawingDistance,
|
||||
"showRendererSteps", &GameScriptSettings::ShowRendererSteps,
|
||||
"showDebugInfo", &GameScriptSettings::ShowDebugInfo,
|
||||
|
||||
/*** How should the application respond to script errors?
|
||||
Must be one of the following:
|
||||
`ErrorMode.TERMINATE` - print to the log file and terminate the application when any script error is hit.
|
||||
This is the one you will want to go for if you want to know IMMEDIATELY if something has gone wrong.
|
||||
|
||||
`ErrorMode.WARN` - print to the log file and continue running the application when a recoverable script error is hit.
|
||||
Choose this one if terminating the application is too much for you. Note that unrecoverable errors will still terminate
|
||||
the application.
|
||||
|
||||
`ErrorMode.SILENT` - do nothing when a recoverable script error is hit.
|
||||
Think __very__ carefully before using this setting. These error modes are here to help you to keep your scripts
|
||||
working properly, but if you opt to ignore errors, you won't be alerted if you've misused a function or passed
|
||||
an invalid argument.
|
||||
|
||||
As with `ErrorMode.WARN`, unrecoverable errors will still terminate the application.
|
||||
@mem errorMode
|
||||
*/
|
||||
"errorMode", &GameScriptSettings::ErrorMode
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue