10 Commits

Author SHA1 Message Date
a3d80256f5 Patch - Increments build version number - V14.1.1
Updates the build version number in the header file.

This change reflects an iteration in the development process.
2025-09-18 01:59:31 +02:00
29db39910c Minor - Adds build versioning to the engine - V14.1.0
Implements a build versioning system to track and display the engine's build information.

- Adds a version header file defining version constants.
- Increments the build number automatically from a configuration file on each build in the binary folder.
- Displays the build version in the ImGui menu bar for easy identification.
- Persists version information by reading/writing to the config file

This provides better tracking and identification of specific engine builds.
2025-09-18 01:58:18 +02:00
2346625afb Patch - Adds .idea/ to .gitignore - V14.0.3
Excludes the IntelliJ IDEA project directory from version control.

This prevents project-specific settings and configurations from being accidentally committed, ensuring a cleaner repository.
2025-09-17 23:23:42 +02:00
e9d906ce72 Patch - Removes IDE-specific configuration files - V14.0.2
Deletes various .idea/ configuration files.
These files are specific to the JetBrains Rider IDE
and should not be tracked in the repository.
2025-09-17 23:23:12 +02:00
aee0704fe7 Patch - Configures Git LFS for binary assets - V14.0.1
Configures Git LFS to properly track and manage binary files such as Lua libraries and DLLs.

This ensures that large binary files are stored efficiently and do not bloat the Git repository.
2025-09-17 23:21:32 +02:00
f3039f22ed Major - Adds Lua scripting component support - V14.0.0
Adds a Lua scripting component to the engine, allowing users to attach Lua scripts to entities.

Includes necessary Lua headers and library files.

Also integrates the Lua scripting component into the editor, allowing it to be added via ImGui.
2025-09-17 23:20:50 +02:00
76fdd3c76e Patch - Adds component shutdown functionality - V13.6.1
Implements a shutdown mechanism for components and entities,
ensuring proper resource release and preventing memory leaks.

This change introduces a virtual `Shutdown` method to the
`Component` class, allowing derived components to release
specific resources when they are removed from an entity or
when the entity is destroyed. The `Entity` class now calls
the `Shutdown` method on all its components during its own
release process. The `EntityManager` now calls the
`release()` method when destroying an entity.

This enhancement ensures that resources, such as FMOD sound
objects and channels in the `AudioComponent`, are properly
released, preventing potential resource leaks and improving
the stability of the engine.
2025-09-17 16:47:01 +02:00
7fc4b08808 Minor - Improves scene loading and audio component - V13.6.0
Refactors scene loading to properly initialize models and textures from the scene file.

Adds audio component deserialization and file path handling.

Fixes model loading and texture application in scene manager.
Addresses potential issues with missing components during scene loading.
2025-09-17 00:01:13 +02:00
de05631608 Minor - Enhances ECS component functionality - V13.5.0
Adds serialization/deserialization to components,
allowing saving and loading of entity states.
Provides ImGui widgets for editing component properties,
improving editor usability.
Passes the D3D device and context to entities and
components enabling resource creation within components.
2025-09-16 18:26:33 +02:00
f875580197 Minor - Adds FMOD integration for audio support - V13.4.0
Initializes FMOD sound system within the application class and propagates it to the entity manager and entities. This allows for audio components to access and use the FMOD system for playing sounds.

Removes redundant FMOD system initialization from the audio component.
2025-09-16 16:34:08 +02:00
47 changed files with 2577 additions and 681 deletions

7
.gitattributes vendored
View File

@@ -1,3 +1,10 @@
enginecustom/assets/Model/OBJ/*.obj filter=lfs diff=lfs merge=lfs -text
enginecustom/assets/Model/OBJ/*.mtl filter=lfs diff=lfs merge=lfs -text
doxygen_docs/** filter=lfs diff=lfs merge=lfs -text
enginecustom/include/Lua/Lib/lua54.lib filter=lfs diff=lfs merge=lfs -text
enginecustom/x64/Debug/lua54.dll filter=lfs diff=lfs merge=lfs -text
enginecustom/x64/Release/lua54.dll filter=lfs diff=lfs merge=lfs -text
x64/Debug/lua54.dll filter=lfs diff=lfs merge=lfs -text
x64/Release/lua54.dll filter=lfs diff=lfs merge=lfs -text
x64/Debug/config.txt filter=lfs diff=lfs merge=lfs -text
x64/Release/config.txt filter=lfs diff=lfs merge=lfs -text

2
.gitignore vendored
View File

@@ -434,3 +434,5 @@ FodyWeavers.xsd
# Additional files built by Visual Studio
# End of https://www.toptal.com/developers/gitignore/api/visualstudio,c++
.idea/

View File

@@ -1 +0,0 @@
KhaoticEngineReborn

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidProjectSystem">
<option name="providerId" value="RiderAndroidProjectSystem" />
</component>
</project>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AgentMigrationStateService">
<option name="migrationStatus" value="COMPLETED" />
</component>
</project>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EditMigrationStateService">
<option name="migrationStatus" value="COMPLETED" />
</component>
</project>

View File

@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT_FILES" />
<option name="description" value="" />
<option name="applicationTheme" value="default" />
<option name="iconsTheme" value="default" />
<option name="button1Title" value="" />
<option name="button1Url" value="" />
<option name="button2Title" value="" />
<option name="button2Url" value="" />
<option name="customApplicationId" value="" />
</component>
</project>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/enginecustom/src/src/system/application_class.cpp" charset="windows-1252" />
<file url="file://$PROJECT_DIR$/enginecustom/src/src/system/imguiManager.cpp" charset="windows-1252" />
<file url="PROJECT" charset="windows-1252" />
</component>
</project>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitToolBoxBlameSettings">
<option name="version" value="2" />
</component>
</project>

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitToolBoxProjectSettings">
<option name="commitMessageIssueKeyValidationOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
</BoolValueOverride>
</option>
<option name="commitMessageValidationEnabledOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
</BoolValueOverride>
</option>
</component>
</project>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@@ -1,7 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="LanguageDetectionInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="ReassignedToPlainText" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MaterialThemeProjectNewConfig">
<option name="metadata">
<MTProjectMetadataState>
<option name="migrated" value="true" />
<option name="pristineConfig" value="false" />
<option name="userId" value="4025287c:194ad69ad19:-7ff7" />
</MTProjectMetadataState>
</option>
</component>
</project>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RiderProjectSettingsUpdater">
<option name="singleClickDiffPreview" value="1" />
<option name="unhandledExceptionsIgnoreList" value="1" />
<option name="vcsConfiguration" value="3" />
</component>
</project>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@@ -1,332 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="e81d6e08-efc7-40a0-909d-ec4943d948e9" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/camera_class.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/camera_class.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/component.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/component.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/audio_component.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/audio_component.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/transform_component.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/transform_component.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/entity.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/entity.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/entity_manager.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/ecs/entity_manager.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/application_class.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/application_class.cpp" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="DpaMonitoringSettings">
<option name="firstShow" value="false" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="HighlightingSettingsPerFile">
<setting file="file://C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um/d3d11.h" root0="SKIP_HIGHLIGHTING" />
<setting file="file://C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um/dinput.h" root0="SKIP_HIGHLIGHTING" />
<setting file="file://C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/include/memory" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/include/Inc/VertexTypes.h" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/include/Vulkan/Include/vulkan/vulkan_core.h" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/src/inc/system/ecs/ComponentFactory.h" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/src/inc/system/ecs/component.h" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/identity_component.h" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/model_path_component.h" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/physics_component.h" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/render_component.h" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/shader_component.h" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/src/inc/system/ecs/components/transform_component.h" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/src/inc/system/ecs/entity.h" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/src/inc/system/ecs/entity_manager.h" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/src/inc/system/ecs/systems/render_system.h" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/src/inc/system/ecs/systems/types.h" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/../../IDE_VS/VC/Tools/MSVC/14.38.33130/include/type_traits" root0="SKIP_HIGHLIGHTING" />
</component>
<component name="KubernetesApiPersistence">{}</component>
<component name="KubernetesApiProvider">{
&quot;isMigrated&quot;: true
}</component>
<component name="MetaFilesCheckinStateConfiguration" checkMetaFiles="true" />
<component name="ProblemsViewState">
<option name="selectedTabId" value="CurrentFile" />
</component>
<component name="ProjectColorInfo">{
&quot;associatedIndex&quot;: 6
}</component>
<component name="ProjectId" id="2sGIWDeT5ixyzDQ0he4A3RFpG9W" />
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;ASKED_SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;C++ Project.enginecustom.executor&quot;: &quot;Run&quot;,
&quot;C/C++ Project.KhaoticDemo.executor&quot;: &quot;Run&quot;,
&quot;C/C++ Project.enginecustom.executor&quot;: &quot;Run&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
&quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;main&quot;,
&quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.pluginManager&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
}
}</component>
<component name="RunManager" selected="C/C++ Project.enginecustom">
<configuration name="KhaoticDemo" type="CppProject" factoryName="C++ Project">
<configuration_1 setup="1">
<option name="CONFIGURATION" value="Debug" />
<option name="PLATFORM" value="x64" />
<option name="CURRENT_LAUNCH_PROFILE" value="Local" />
<option name="EXE_PATH" value="$(LocalDebuggerCommand)" />
<option name="PROGRAM_PARAMETERS" value="$(LocalDebuggerCommandArguments)" />
<option name="WORKING_DIRECTORY" value="$(LocalDebuggerWorkingDirectory)" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="TERMINAL_INTERACTION_BEHAVIOR" value="AUTO_DETECT" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj" />
</configuration_1>
<option name="DEFAULT_PROJECT_PATH" value="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj" />
<option name="AUTO_SELECT_PRIORITY" value="0" />
<method v="2">
<option name="Build" />
</method>
</configuration>
<configuration name="enginecustom" type="CppProject" factoryName="C++ Project">
<configuration_1 setup="1">
<option name="CONFIGURATION" value="Debug" />
<option name="PLATFORM" value="x64" />
<option name="CURRENT_LAUNCH_PROFILE" value="Local" />
<option name="EXE_PATH" value="$(LocalDebuggerCommand)" />
<option name="PROGRAM_PARAMETERS" value="$(LocalDebuggerCommandArguments)" />
<option name="WORKING_DIRECTORY" value="$(LocalDebuggerWorkingDirectory)" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="TERMINAL_INTERACTION_BEHAVIOR" value="AUTO_DETECT" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
</configuration_1>
<configuration_2 setup="1">
<option name="CONFIGURATION" value="Release" />
<option name="PLATFORM" value="x64" />
<option name="CURRENT_LAUNCH_PROFILE" value="Local" />
<option name="EXE_PATH" value="$(TargetPath)" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$(ProjectDir)" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="TERMINAL_INTERACTION_BEHAVIOR" value="AUTO_DETECT" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
</configuration_2>
<option name="DEFAULT_PROJECT_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
<option name="AUTO_SELECT_PRIORITY" value="0" />
<method v="2">
<option name="Build" />
</method>
</configuration>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="e81d6e08-efc7-40a0-909d-ec4943d948e9" name="Changes" comment="" />
<created>1738075515913</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1738075515913</updated>
<workItem from="1738075517746" duration="553000" />
<workItem from="1738076088229" duration="80000" />
<workItem from="1738076192788" duration="19000" />
<workItem from="1738076222547" duration="6131000" />
<workItem from="1738171504772" duration="876000" />
<workItem from="1738172392786" duration="67000" />
<workItem from="1738173151768" duration="2361000" />
<workItem from="1738175535254" duration="279000" />
<workItem from="1738178991872" duration="2736000" />
<workItem from="1738244577624" duration="3000" />
<workItem from="1738321399968" duration="689000" />
<workItem from="1738358054789" duration="9000" />
<workItem from="1738358091089" duration="6675000" />
<workItem from="1738364887298" duration="2275000" />
<workItem from="1738515031789" duration="14018000" />
<workItem from="1741705445392" duration="138000" />
<workItem from="1741706018301" duration="5499000" />
<workItem from="1742198713923" duration="31000" />
<workItem from="1742198792655" duration="4618000" />
<workItem from="1742203643675" duration="600000" />
<workItem from="1742206836574" duration="258000" />
<workItem from="1742207107802" duration="5340000" />
<workItem from="1742228751298" duration="38000" />
<workItem from="1742228870107" duration="1198000" />
<workItem from="1742314944369" duration="79000" />
<workItem from="1742318452773" duration="2258000" />
<workItem from="1742331065936" duration="3030000" />
<workItem from="1742371397157" duration="13355000" />
<workItem from="1742425863119" duration="231000" />
<workItem from="1742474596806" duration="67000" />
<workItem from="1742474683111" duration="689000" />
<workItem from="1742574318953" duration="552000" />
<workItem from="1742581210996" duration="681000" />
<workItem from="1742651501885" duration="47000" />
<workItem from="1742664377329" duration="746000" />
<workItem from="1742665243312" duration="310000" />
<workItem from="1742667326806" duration="95000" />
<workItem from="1743185728805" duration="15000" />
<workItem from="1743185754182" duration="815000" />
<workItem from="1743355100472" duration="708000" />
<workItem from="1743355837694" duration="1514000" />
<workItem from="1743370106270" duration="901000" />
<workItem from="1743505399891" duration="2361000" />
<workItem from="1746106963725" duration="5888000" />
<workItem from="1746112904421" duration="75000" />
<workItem from="1746113092234" duration="1477000" />
<workItem from="1746117455914" duration="5976000" />
<workItem from="1746126812110" duration="180000" />
<workItem from="1746188920194" duration="1870000" />
<workItem from="1746274246641" duration="89000" />
<workItem from="1746274352144" duration="8039000" />
<workItem from="1746444660572" duration="7742000" />
<workItem from="1746456965664" duration="13000" />
<workItem from="1746469494034" duration="799000" />
<workItem from="1746526901276" duration="2023000" />
<workItem from="1746536290167" duration="1908000" />
<workItem from="1746538260893" duration="5781000" />
<workItem from="1746546014271" duration="1814000" />
<workItem from="1746619988287" duration="12282000" />
<workItem from="1746711806997" duration="6736000" />
<workItem from="1746719840054" duration="991000" />
<workItem from="1746795732153" duration="33000" />
<workItem from="1746795828588" duration="592000" />
<workItem from="1747049871967" duration="9350000" />
<workItem from="1747136509645" duration="3939000" />
<workItem from="1747258663152" duration="835000" />
<workItem from="1747826758888" duration="3587000" />
<workItem from="1747830379222" duration="7954000" />
<workItem from="1748254142068" duration="10499000" />
<workItem from="1748267553700" duration="654000" />
<workItem from="1748429087202" duration="7421000" />
<workItem from="1748521606678" duration="5300000" />
<workItem from="1748859894056" duration="1431000" />
<workItem from="1748861785837" duration="357000" />
<workItem from="1748865625274" duration="797000" />
<workItem from="1748869642637" duration="3049000" />
<workItem from="1748954607174" duration="14202000" />
<workItem from="1748969487337" duration="402000" />
<workItem from="1750187491423" duration="4397000" />
<workItem from="1750191969842" duration="162000" />
<workItem from="1750248915365" duration="442000" />
<workItem from="1750335650897" duration="2051000" />
<workItem from="1750344288223" duration="1751000" />
<workItem from="1750351735497" duration="9648000" />
<workItem from="1750417484899" duration="2384000" />
<workItem from="1750420267631" duration="148000" />
<workItem from="1750592598277" duration="332000" />
<workItem from="1750699146323" duration="10385000" />
<workItem from="1750763086646" duration="4874000" />
<workItem from="1750770680795" duration="13425000" />
<workItem from="1750964683511" duration="27000" />
<workItem from="1750964770914" duration="2126000" />
<workItem from="1753700140931" duration="918000" />
<workItem from="1753701507863" duration="7153000" />
<workItem from="1753713925469" duration="1739000" />
<workItem from="1754572996727" duration="224000" />
<workItem from="1755617169013" duration="222000" />
<workItem from="1757101936080" duration="185000" />
<workItem from="1757158576637" duration="2501000" />
<workItem from="1757167799006" duration="45000" />
<workItem from="1757167889796" duration="7081000" />
<workItem from="1757175031271" duration="2289000" />
<workItem from="1757177353935" duration="676000" />
<workItem from="1757182479393" duration="1386000" />
<workItem from="1757427950015" duration="2864000" />
<workItem from="1757431548883" duration="986000" />
<workItem from="1757449929378" duration="1107000" />
<workItem from="1757456559331" duration="2094000" />
<workItem from="1757458683204" duration="3628000" />
<workItem from="1757938327874" duration="2045000" />
<workItem from="1757952605657" duration="117000" />
<workItem from="1757952791669" duration="4499000" />
<workItem from="1757959923169" duration="1930000" />
<workItem from="1757961888820" duration="8937000" />
</task>
<task id="LOCAL-00001" summary="Minor update - viewport window tweak">
<option name="closed" value="true" />
<created>1738175474520</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1738175474520</updated>
</task>
<task id="LOCAL-00002" summary="Patch update - add menu button">
<option name="closed" value="true" />
<created>1738181617050</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1738181617050</updated>
</task>
<option name="localTasksCounter" value="3" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="UnityCheckinConfiguration" checkUnsavedScenes="true" />
<component name="UnityProjectConfiguration" hasMinimizedUI="false" />
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
<MESSAGE value="Minor update - viewport window tweak" />
<MESSAGE value="Patch update - add menu button" />
<option name="LAST_COMMIT_MESSAGE" value="Patch update - add menu button" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<breakpoint enabled="true" type="DotNet_Exception_Breakpoints">
<properties exception="System.OperationCanceledException" breakIfHandledByOtherCode="false" displayValue="System.OperationCanceledException" />
<option name="timeStamp" value="1" />
</breakpoint>
<breakpoint enabled="true" type="DotNet_Exception_Breakpoints">
<properties exception="System.Threading.Tasks.TaskCanceledException" breakIfHandledByOtherCode="false" displayValue="System.Threading.Tasks.TaskCanceledException" />
<option name="timeStamp" value="2" />
</breakpoint>
<breakpoint enabled="true" type="DotNet_Exception_Breakpoints">
<properties exception="System.Threading.ThreadAbortException" breakIfHandledByOtherCode="false" displayValue="System.Threading.ThreadAbortException" />
<option name="timeStamp" value="3" />
</breakpoint>
</breakpoints>
</breakpoint-manager>
<watches-manager>
<configuration name="CppProject">
<watch expression="((class ModelClass &amp;) (*(*(*this).m_Application).m_object[0]))" />
</configuration>
</watches-manager>
</component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />
<select />
</component>
</project>

View File

@@ -0,0 +1,8 @@
Entity:0:86
IdentityComponent:0:86:Unknown
TransformComponent:0:50:0:0:-0:0:1:1:1
RenderComponent:HasModel:1:assets/Texture/Bricks2K.png:1:assets/Texture/BricksNRM2K.png:1:assets/Texture/BricksGLOSS2K.png:0:
ShaderComponent:LIGHTING
ModelPathComponent:Content/Assets/Kobject/86.obj
AudioComponent:F:\Github_Repo\khaotic-engine-Reborn\x64\Release\assets\sounds\default.mp3;1:0:1:1:0:0:128:1:0
EndEntity

View File

@@ -123,6 +123,7 @@
<ClInclude Include="src\inc\system\ecs\ComponentFactory.h" />
<ClInclude Include="src\inc\system\ecs\components\audio_component.h" />
<ClInclude Include="src\inc\system\ecs\components\identity_component.h" />
<ClInclude Include="src\inc\system\ecs\components\lua_script_component.h" />
<ClInclude Include="src\inc\system\ecs\components\model_path_component.h" />
<ClInclude Include="src\inc\system\ecs\components\physics_component.h" />
<ClInclude Include="src\inc\system\ecs\components\render_component.h" />
@@ -155,6 +156,7 @@
<ClInclude Include="src\inc\system\text_class.h" />
<ClInclude Include="src\inc\system\texture_class.h" />
<ClInclude Include="src\inc\system\timer_class.h" />
<ClInclude Include="src\inc\system\version.h" />
<ClInclude Include="src\inc\system\vulkan.h" />
</ItemGroup>
<ItemGroup>
@@ -682,14 +684,14 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)enginecustom\include\backends;$(SolutionDir)enginecustom\include\Inc;$(SolutionDir)enginecustom\include;$(SolutionDir)enginecustom\src\inc\shader;$(SolutionDir)enginecustom\src\inc\system;$(SolutionDir)enginecustom\include\Vulkan\Include;$(SolutionDir)enginecustom\include\Fmod;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)enginecustom\include\backends;$(SolutionDir)enginecustom\include\Inc;$(SolutionDir)enginecustom\include;$(SolutionDir)enginecustom\src\inc\shader;$(SolutionDir)enginecustom\src\inc\system;$(SolutionDir)enginecustom\include\Vulkan\Include;$(SolutionDir)enginecustom\include\Lua;$(SolutionDir)enginecustom\include\Fmod;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)enginecustom\include\Vulkan\Lib;$(SolutionDir)enginecustom\include\GLFW\lib-vc2022;$(SolutionDir)enginecustom\include\Fmod\core\lib\x64\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>fmodL_vc.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)enginecustom\include\Vulkan\Lib;$(SolutionDir)enginecustom\include\GLFW\lib-vc2022;$(SolutionDir)enginecustom\include\Lua\Lib;$(SolutionDir)enginecustom\include\Fmod\core\lib\x64\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>fmodL_vc.lib;lua54.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -701,15 +703,15 @@
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>$(SolutionDir)enginecustom\include\backends;$(SolutionDir)enginecustom\include\Inc;$(SolutionDir)enginecustom\include;$(SolutionDir)enginecustom\src\inc\shader;$(SolutionDir)enginecustom\src\inc\system;$(SolutionDir)enginecustom\include\Vulkan\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)enginecustom\include\backends;$(SolutionDir)enginecustom\include\Inc;$(SolutionDir)enginecustom\include;$(SolutionDir)enginecustom\src\inc\shader;$(SolutionDir)enginecustom\src\inc\system;$(SolutionDir)enginecustom\include\Vulkan\Include;$(SolutionDir)enginecustom\include\Lua;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)enginecustom\include\Vulkan\Lib;$(SolutionDir)enginecustom\include\GLFW\lib-vc2022;$(SolutionDir)enginecustom\include\Fmod\core\lib\x64\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>fmod_vc.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)enginecustom\include\Vulkan\Lib;$(SolutionDir)enginecustom\include\GLFW\lib-vc2022;$(SolutionDir)enginecustom\include\Lua\Lib;$(SolutionDir)enginecustom\include\Fmod\core\lib\x64\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>fmod_vc.lib;lua54.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@@ -12,7 +12,7 @@ Collapsed=0
Pos=1267,19
Size=317,842
Collapsed=0
DockId=0x00000005,0
DockId=0x00000006,0
[Window][render Stats]
Pos=0,630
@@ -48,20 +48,20 @@ DockId=0x0000000B,0
Pos=1267,462
Size=317,166
Collapsed=0
DockId=0x00000006,0
DockId=0x00000002,0
[Docking][Data]
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=0,19 Size=1584,842 Split=Y
DockNode ID=0x00000003 Parent=0xCCBD8CF7 SizeRef=1584,609 Split=X
DockNode ID=0x0000000B Parent=0x00000003 SizeRef=234,842 Selected=0x031DC75C
DockNode ID=0x0000000C Parent=0x00000003 SizeRef=1348,842 Split=X
DockNode ID=0x00000007 Parent=0x0000000C SizeRef=266,842 Selected=0x393905AB
DockNode ID=0x00000008 Parent=0x0000000C SizeRef=1316,842 Split=X
DockNode ID=0x00000001 Parent=0x00000008 SizeRef=1265,842 CentralNode=1
DockNode ID=0x00000002 Parent=0x00000008 SizeRef=317,842 Split=Y Selected=0x9F035453
DockNode ID=0x00000005 Parent=0x00000002 SizeRef=317,441 Selected=0x9F035453
DockNode ID=0x00000006 Parent=0x00000002 SizeRef=317,166 Selected=0x0B098C4B
DockNode ID=0x00000004 Parent=0xCCBD8CF7 SizeRef=1584,231 Split=X Selected=0xF5D1BB37
DockNode ID=0x00000009 Parent=0x00000004 SizeRef=792,231 Selected=0xF5D1BB37
DockNode ID=0x0000000A Parent=0x00000004 SizeRef=790,231 Selected=0xAB74BEE9
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=0,19 Size=1584,842 Split=X
DockNode ID=0x00000005 Parent=0xCCBD8CF7 SizeRef=1265,842 Split=Y
DockNode ID=0x00000003 Parent=0x00000005 SizeRef=1584,609 Split=X
DockNode ID=0x0000000B Parent=0x00000003 SizeRef=234,842 Selected=0x031DC75C
DockNode ID=0x0000000C Parent=0x00000003 SizeRef=1348,842 Split=X
DockNode ID=0x00000007 Parent=0x0000000C SizeRef=266,842 Selected=0x393905AB
DockNode ID=0x00000008 Parent=0x0000000C SizeRef=1316,842 Split=X
DockNode ID=0x00000001 Parent=0x00000008 SizeRef=1265,842 CentralNode=1
DockNode ID=0x00000002 Parent=0x00000008 SizeRef=317,842 Selected=0x9F035453
DockNode ID=0x00000004 Parent=0x00000005 SizeRef=1584,231 Split=X Selected=0xF5D1BB37
DockNode ID=0x00000009 Parent=0x00000004 SizeRef=792,231 Selected=0xF5D1BB37
DockNode ID=0x0000000A Parent=0x00000004 SizeRef=790,231 Selected=0xAB74BEE9
DockNode ID=0x00000006 Parent=0xCCBD8CF7 SizeRef=317,842 Selected=0x9F035453

BIN
enginecustom/include/Lua/Lib/lua54.lib (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -0,0 +1,276 @@
/*
** $Id: lauxlib.h $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
#ifndef lauxlib_h
#define lauxlib_h
#include <stddef.h>
#include <stdio.h>
#include "lua.h"
/* global table */
#define LUA_GNAME "_G"
typedef struct luaL_Buffer luaL_Buffer;
/* extra error code for 'luaL_loadfilex' */
#define LUA_ERRFILE (LUA_ERRERR+1)
/* key, in the registry, for table of loaded modules */
#define LUA_LOADED_TABLE "_LOADED"
/* key, in the registry, for table of preloaded loaders */
#define LUA_PRELOAD_TABLE "_PRELOAD"
typedef struct luaL_Reg {
const char *name;
lua_CFunction func;
} luaL_Reg;
#define LUAL_NUMSIZES (sizeof(lua_Integer)*16 + sizeof(lua_Number))
LUALIB_API void (luaL_checkversion_) (lua_State *L, lua_Number ver, size_t sz);
#define luaL_checkversion(L) \
luaL_checkversion_(L, LUA_VERSION_NUM, LUAL_NUMSIZES)
LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);
LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);
LUALIB_API const char *(luaL_tolstring) (lua_State *L, int idx, size_t *len);
LUALIB_API int (luaL_argerror) (lua_State *L, int arg, const char *extramsg);
LUALIB_API int (luaL_typeerror) (lua_State *L, int arg, const char *tname);
LUALIB_API const char *(luaL_checklstring) (lua_State *L, int arg,
size_t *l);
LUALIB_API const char *(luaL_optlstring) (lua_State *L, int arg,
const char *def, size_t *l);
LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int arg);
LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int arg, lua_Number def);
LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int arg);
LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int arg,
lua_Integer def);
LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);
LUALIB_API void (luaL_checktype) (lua_State *L, int arg, int t);
LUALIB_API void (luaL_checkany) (lua_State *L, int arg);
LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname);
LUALIB_API void (luaL_setmetatable) (lua_State *L, const char *tname);
LUALIB_API void *(luaL_testudata) (lua_State *L, int ud, const char *tname);
LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);
LUALIB_API void (luaL_where) (lua_State *L, int lvl);
LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);
LUALIB_API int (luaL_checkoption) (lua_State *L, int arg, const char *def,
const char *const lst[]);
LUALIB_API int (luaL_fileresult) (lua_State *L, int stat, const char *fname);
LUALIB_API int (luaL_execresult) (lua_State *L, int stat);
/* predefined references */
#define LUA_NOREF (-2)
#define LUA_REFNIL (-1)
LUALIB_API int (luaL_ref) (lua_State *L, int t);
LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
LUALIB_API int (luaL_loadfilex) (lua_State *L, const char *filename,
const char *mode);
#define luaL_loadfile(L,f) luaL_loadfilex(L,f,NULL)
LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz,
const char *name, const char *mode);
LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);
LUALIB_API lua_State *(luaL_newstate) (void);
LUALIB_API lua_Integer (luaL_len) (lua_State *L, int idx);
LUALIB_API void luaL_addgsub (luaL_Buffer *b, const char *s,
const char *p, const char *r);
LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s,
const char *p, const char *r);
LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup);
LUALIB_API int (luaL_getsubtable) (lua_State *L, int idx, const char *fname);
LUALIB_API void (luaL_traceback) (lua_State *L, lua_State *L1,
const char *msg, int level);
LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname,
lua_CFunction openf, int glb);
/*
** ===============================================================
** some useful macros
** ===============================================================
*/
#define luaL_newlibtable(L,l) \
lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1)
#define luaL_newlib(L,l) \
(luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))
#define luaL_argcheck(L, cond,arg,extramsg) \
((void)((cond) || luaL_argerror(L, (arg), (extramsg))))
#define luaL_argexpected(L,cond,arg,tname) \
((void)((cond) || luaL_typeerror(L, (arg), (tname))))
#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))
#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i)))
#define luaL_dofile(L, fn) \
(luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
#define luaL_dostring(L, s) \
(luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n)))
#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
#define luaL_loadbuffer(L,s,sz,n) luaL_loadbufferx(L,s,sz,n,NULL)
/* push the value used to represent failure/error */
#define luaL_pushfail(L) lua_pushnil(L)
/*
** {======================================================
** Generic Buffer manipulation
** =======================================================
*/
struct luaL_Buffer {
char *b; /* buffer address */
size_t size; /* buffer size */
size_t n; /* number of characters in buffer */
lua_State *L;
union {
LUAI_MAXALIGN; /* ensure maximum alignment for buffer */
char b[LUAL_BUFFERSIZE]; /* initial buffer */
} init;
};
#define luaL_bufflen(bf) ((bf)->n)
#define luaL_buffaddr(bf) ((bf)->b)
#define luaL_addchar(B,c) \
((void)((B)->n < (B)->size || luaL_prepbuffsize((B), 1)), \
((B)->b[(B)->n++] = (c)))
#define luaL_addsize(B,s) ((B)->n += (s))
#define luaL_buffsub(B,s) ((B)->n -= (s))
LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);
LUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz);
LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s);
LUALIB_API void (luaL_addvalue) (luaL_Buffer *B);
LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
LUALIB_API void (luaL_pushresultsize) (luaL_Buffer *B, size_t sz);
LUALIB_API char *(luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz);
#define luaL_prepbuffer(B) luaL_prepbuffsize(B, LUAL_BUFFERSIZE)
/* }====================================================== */
/*
** {======================================================
** File handles for IO library
** =======================================================
*/
/*
** A file handle is a userdata with metatable 'LUA_FILEHANDLE' and
** initial structure 'luaL_Stream' (it may contain other fields
** after that initial structure).
*/
#define LUA_FILEHANDLE "FILE*"
typedef struct luaL_Stream {
FILE *f; /* stream (NULL for incompletely created streams) */
lua_CFunction closef; /* to close stream (NULL for closed streams) */
} luaL_Stream;
/* }====================================================== */
/*
** {==================================================================
** "Abstraction Layer" for basic report of messages and errors
** ===================================================================
*/
/* print a string */
#if !defined(lua_writestring)
#define lua_writestring(s,l) fwrite((s), sizeof(char), (l), stdout)
#endif
/* print a newline and flush the output */
#if !defined(lua_writeline)
#define lua_writeline() (lua_writestring("\n", 1), fflush(stdout))
#endif
/* print an error message */
#if !defined(lua_writestringerror)
#define lua_writestringerror(s,p) \
(fprintf(stderr, (s), (p)), fflush(stderr))
#endif
/* }================================================================== */
/*
** {============================================================
** Compatibility with deprecated conversions
** =============================================================
*/
#if defined(LUA_COMPAT_APIINTCASTS)
#define luaL_checkunsigned(L,a) ((lua_Unsigned)luaL_checkinteger(L,a))
#define luaL_optunsigned(L,a,d) \
((lua_Unsigned)luaL_optinteger(L,a,(lua_Integer)(d)))
#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n)))
#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d)))
#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n)))
#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d)))
#endif
/* }============================================================ */
#endif

View File

@@ -0,0 +1,517 @@
/*
** $Id: lua.h $
** Lua - A Scripting Language
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
** See Copyright Notice at the end of this file
*/
#ifndef lua_h
#define lua_h
#include <stdarg.h>
#include <stddef.h>
#include "luaconf.h"
#define LUA_VERSION_MAJOR "5"
#define LUA_VERSION_MINOR "4"
#define LUA_VERSION_RELEASE "2"
#define LUA_VERSION_NUM 504
#define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 0)
#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2020 Lua.org, PUC-Rio"
#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes"
/* mark for precompiled code ('<esc>Lua') */
#define LUA_SIGNATURE "\x1bLua"
/* option for multiple returns in 'lua_pcall' and 'lua_call' */
#define LUA_MULTRET (-1)
/*
** Pseudo-indices
** (-LUAI_MAXSTACK is the minimum valid index; we keep some free empty
** space after that to help overflow detection)
*/
#define LUA_REGISTRYINDEX (-LUAI_MAXSTACK - 1000)
#define lua_upvalueindex(i) (LUA_REGISTRYINDEX - (i))
/* thread status */
#define LUA_OK 0
#define LUA_YIELD 1
#define LUA_ERRRUN 2
#define LUA_ERRSYNTAX 3
#define LUA_ERRMEM 4
#define LUA_ERRERR 5
typedef struct lua_State lua_State;
/*
** basic types
*/
#define LUA_TNONE (-1)
#define LUA_TNIL 0
#define LUA_TBOOLEAN 1
#define LUA_TLIGHTUSERDATA 2
#define LUA_TNUMBER 3
#define LUA_TSTRING 4
#define LUA_TTABLE 5
#define LUA_TFUNCTION 6
#define LUA_TUSERDATA 7
#define LUA_TTHREAD 8
#define LUA_NUMTYPES 9
/* minimum Lua stack available to a C function */
#define LUA_MINSTACK 20
/* predefined values in the registry */
#define LUA_RIDX_MAINTHREAD 1
#define LUA_RIDX_GLOBALS 2
#define LUA_RIDX_LAST LUA_RIDX_GLOBALS
/* type of numbers in Lua */
typedef LUA_NUMBER lua_Number;
/* type for integer functions */
typedef LUA_INTEGER lua_Integer;
/* unsigned integer type */
typedef LUA_UNSIGNED lua_Unsigned;
/* type for continuation-function contexts */
typedef LUA_KCONTEXT lua_KContext;
/*
** Type for C functions registered with Lua
*/
typedef int (*lua_CFunction) (lua_State *L);
/*
** Type for continuation functions
*/
typedef int (*lua_KFunction) (lua_State *L, int status, lua_KContext ctx);
/*
** Type for functions that read/write blocks when loading/dumping Lua chunks
*/
typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);
typedef int (*lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud);
/*
** Type for memory-allocation functions
*/
typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
/*
** Type for warning functions
*/
typedef void (*lua_WarnFunction) (void *ud, const char *msg, int tocont);
/*
** generic extra include file
*/
#if defined(LUA_USER_H)
#include LUA_USER_H
#endif
/*
** RCS ident string
*/
extern const char lua_ident[];
/*
** state manipulation
*/
LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);
LUA_API void (lua_close) (lua_State *L);
LUA_API lua_State *(lua_newthread) (lua_State *L);
LUA_API int (lua_resetthread) (lua_State *L);
LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);
LUA_API lua_Number (lua_version) (lua_State *L);
/*
** basic stack manipulation
*/
LUA_API int (lua_absindex) (lua_State *L, int idx);
LUA_API int (lua_gettop) (lua_State *L);
LUA_API void (lua_settop) (lua_State *L, int idx);
LUA_API void (lua_pushvalue) (lua_State *L, int idx);
LUA_API void (lua_rotate) (lua_State *L, int idx, int n);
LUA_API void (lua_copy) (lua_State *L, int fromidx, int toidx);
LUA_API int (lua_checkstack) (lua_State *L, int n);
LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n);
/*
** access functions (stack -> C)
*/
LUA_API int (lua_isnumber) (lua_State *L, int idx);
LUA_API int (lua_isstring) (lua_State *L, int idx);
LUA_API int (lua_iscfunction) (lua_State *L, int idx);
LUA_API int (lua_isinteger) (lua_State *L, int idx);
LUA_API int (lua_isuserdata) (lua_State *L, int idx);
LUA_API int (lua_type) (lua_State *L, int idx);
LUA_API const char *(lua_typename) (lua_State *L, int tp);
LUA_API lua_Number (lua_tonumberx) (lua_State *L, int idx, int *isnum);
LUA_API lua_Integer (lua_tointegerx) (lua_State *L, int idx, int *isnum);
LUA_API int (lua_toboolean) (lua_State *L, int idx);
LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len);
LUA_API lua_Unsigned (lua_rawlen) (lua_State *L, int idx);
LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx);
LUA_API void *(lua_touserdata) (lua_State *L, int idx);
LUA_API lua_State *(lua_tothread) (lua_State *L, int idx);
LUA_API const void *(lua_topointer) (lua_State *L, int idx);
/*
** Comparison and arithmetic functions
*/
#define LUA_OPADD 0 /* ORDER TM, ORDER OP */
#define LUA_OPSUB 1
#define LUA_OPMUL 2
#define LUA_OPMOD 3
#define LUA_OPPOW 4
#define LUA_OPDIV 5
#define LUA_OPIDIV 6
#define LUA_OPBAND 7
#define LUA_OPBOR 8
#define LUA_OPBXOR 9
#define LUA_OPSHL 10
#define LUA_OPSHR 11
#define LUA_OPUNM 12
#define LUA_OPBNOT 13
LUA_API void (lua_arith) (lua_State *L, int op);
#define LUA_OPEQ 0
#define LUA_OPLT 1
#define LUA_OPLE 2
LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2);
LUA_API int (lua_compare) (lua_State *L, int idx1, int idx2, int op);
/*
** push functions (C -> stack)
*/
LUA_API void (lua_pushnil) (lua_State *L);
LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n);
LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n);
LUA_API const char *(lua_pushlstring) (lua_State *L, const char *s, size_t len);
LUA_API const char *(lua_pushstring) (lua_State *L, const char *s);
LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt,
va_list argp);
LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...);
LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
LUA_API void (lua_pushboolean) (lua_State *L, int b);
LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p);
LUA_API int (lua_pushthread) (lua_State *L);
/*
** get functions (Lua -> stack)
*/
LUA_API int (lua_getglobal) (lua_State *L, const char *name);
LUA_API int (lua_gettable) (lua_State *L, int idx);
LUA_API int (lua_getfield) (lua_State *L, int idx, const char *k);
LUA_API int (lua_geti) (lua_State *L, int idx, lua_Integer n);
LUA_API int (lua_rawget) (lua_State *L, int idx);
LUA_API int (lua_rawgeti) (lua_State *L, int idx, lua_Integer n);
LUA_API int (lua_rawgetp) (lua_State *L, int idx, const void *p);
LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec);
LUA_API void *(lua_newuserdatauv) (lua_State *L, size_t sz, int nuvalue);
LUA_API int (lua_getmetatable) (lua_State *L, int objindex);
LUA_API int (lua_getiuservalue) (lua_State *L, int idx, int n);
/*
** set functions (stack -> Lua)
*/
LUA_API void (lua_setglobal) (lua_State *L, const char *name);
LUA_API void (lua_settable) (lua_State *L, int idx);
LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k);
LUA_API void (lua_seti) (lua_State *L, int idx, lua_Integer n);
LUA_API void (lua_rawset) (lua_State *L, int idx);
LUA_API void (lua_rawseti) (lua_State *L, int idx, lua_Integer n);
LUA_API void (lua_rawsetp) (lua_State *L, int idx, const void *p);
LUA_API int (lua_setmetatable) (lua_State *L, int objindex);
LUA_API int (lua_setiuservalue) (lua_State *L, int idx, int n);
/*
** 'load' and 'call' functions (load and run Lua code)
*/
LUA_API void (lua_callk) (lua_State *L, int nargs, int nresults,
lua_KContext ctx, lua_KFunction k);
#define lua_call(L,n,r) lua_callk(L, (n), (r), 0, NULL)
LUA_API int (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc,
lua_KContext ctx, lua_KFunction k);
#define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL)
LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt,
const char *chunkname, const char *mode);
LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data, int strip);
/*
** coroutine functions
*/
LUA_API int (lua_yieldk) (lua_State *L, int nresults, lua_KContext ctx,
lua_KFunction k);
LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg,
int *nres);
LUA_API int (lua_status) (lua_State *L);
LUA_API int (lua_isyieldable) (lua_State *L);
#define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL)
/*
** Warning-related functions
*/
LUA_API void (lua_setwarnf) (lua_State *L, lua_WarnFunction f, void *ud);
LUA_API void (lua_warning) (lua_State *L, const char *msg, int tocont);
/*
** garbage-collection function and options
*/
#define LUA_GCSTOP 0
#define LUA_GCRESTART 1
#define LUA_GCCOLLECT 2
#define LUA_GCCOUNT 3
#define LUA_GCCOUNTB 4
#define LUA_GCSTEP 5
#define LUA_GCSETPAUSE 6
#define LUA_GCSETSTEPMUL 7
#define LUA_GCISRUNNING 9
#define LUA_GCGEN 10
#define LUA_GCINC 11
LUA_API int (lua_gc) (lua_State *L, int what, ...);
/*
** miscellaneous functions
*/
LUA_API int (lua_error) (lua_State *L);
LUA_API int (lua_next) (lua_State *L, int idx);
LUA_API void (lua_concat) (lua_State *L, int n);
LUA_API void (lua_len) (lua_State *L, int idx);
LUA_API size_t (lua_stringtonumber) (lua_State *L, const char *s);
LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);
LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);
LUA_API void (lua_toclose) (lua_State *L, int idx);
/*
** {==============================================================
** some useful macros
** ===============================================================
*/
#define lua_getextraspace(L) ((void *)((char *)(L) - LUA_EXTRASPACE))
#define lua_tonumber(L,i) lua_tonumberx(L,(i),NULL)
#define lua_tointeger(L,i) lua_tointegerx(L,(i),NULL)
#define lua_pop(L,n) lua_settop(L, -(n)-1)
#define lua_newtable(L) lua_createtable(L, 0, 0)
#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))
#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)
#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION)
#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE)
#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA)
#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL)
#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN)
#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD)
#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE)
#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0)
#define lua_pushliteral(L, s) lua_pushstring(L, "" s)
#define lua_pushglobaltable(L) \
((void)lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS))
#define lua_tostring(L,i) lua_tolstring(L, (i), NULL)
#define lua_insert(L,idx) lua_rotate(L, (idx), 1)
#define lua_remove(L,idx) (lua_rotate(L, (idx), -1), lua_pop(L, 1))
#define lua_replace(L,idx) (lua_copy(L, -1, (idx)), lua_pop(L, 1))
/* }============================================================== */
/*
** {==============================================================
** compatibility macros
** ===============================================================
*/
#if defined(LUA_COMPAT_APIINTCASTS)
#define lua_pushunsigned(L,n) lua_pushinteger(L, (lua_Integer)(n))
#define lua_tounsignedx(L,i,is) ((lua_Unsigned)lua_tointegerx(L,i,is))
#define lua_tounsigned(L,i) lua_tounsignedx(L,(i),NULL)
#endif
#define lua_newuserdata(L,s) lua_newuserdatauv(L,s,1)
#define lua_getuservalue(L,idx) lua_getiuservalue(L,idx,1)
#define lua_setuservalue(L,idx) lua_setiuservalue(L,idx,1)
#define LUA_NUMTAGS LUA_NUMTYPES
/* }============================================================== */
/*
** {======================================================================
** Debug API
** =======================================================================
*/
/*
** Event codes
*/
#define LUA_HOOKCALL 0
#define LUA_HOOKRET 1
#define LUA_HOOKLINE 2
#define LUA_HOOKCOUNT 3
#define LUA_HOOKTAILCALL 4
/*
** Event masks
*/
#define LUA_MASKCALL (1 << LUA_HOOKCALL)
#define LUA_MASKRET (1 << LUA_HOOKRET)
#define LUA_MASKLINE (1 << LUA_HOOKLINE)
#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT)
typedef struct lua_Debug lua_Debug; /* activation record */
/* Functions to be called by the debugger in specific events */
typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
LUA_API int (lua_getstack) (lua_State *L, int level, lua_Debug *ar);
LUA_API int (lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar);
LUA_API const char *(lua_getlocal) (lua_State *L, const lua_Debug *ar, int n);
LUA_API const char *(lua_setlocal) (lua_State *L, const lua_Debug *ar, int n);
LUA_API const char *(lua_getupvalue) (lua_State *L, int funcindex, int n);
LUA_API const char *(lua_setupvalue) (lua_State *L, int funcindex, int n);
LUA_API void *(lua_upvalueid) (lua_State *L, int fidx, int n);
LUA_API void (lua_upvaluejoin) (lua_State *L, int fidx1, int n1,
int fidx2, int n2);
LUA_API void (lua_sethook) (lua_State *L, lua_Hook func, int mask, int count);
LUA_API lua_Hook (lua_gethook) (lua_State *L);
LUA_API int (lua_gethookmask) (lua_State *L);
LUA_API int (lua_gethookcount) (lua_State *L);
LUA_API int (lua_setcstacklimit) (lua_State *L, unsigned int limit);
struct lua_Debug {
int event;
const char *name; /* (n) */
const char *namewhat; /* (n) 'global', 'local', 'field', 'method' */
const char *what; /* (S) 'Lua', 'C', 'main', 'tail' */
const char *source; /* (S) */
size_t srclen; /* (S) */
int currentline; /* (l) */
int linedefined; /* (S) */
int lastlinedefined; /* (S) */
unsigned char nups; /* (u) number of upvalues */
unsigned char nparams;/* (u) number of parameters */
char isvararg; /* (u) */
char istailcall; /* (t) */
unsigned short ftransfer; /* (r) index of first value transferred */
unsigned short ntransfer; /* (r) number of transferred values */
char short_src[LUA_IDSIZE]; /* (S) */
/* private part */
struct CallInfo *i_ci; /* active function */
};
/* }====================================================================== */
/******************************************************************************
* Copyright (C) 1994-2020 Lua.org, PUC-Rio.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************************/
#endif

View File

@@ -0,0 +1,9 @@
// lua.hpp
// Lua header files for C++
// <<extern "C">> not supplied automatically because Lua also compiles as C++
extern "C" {
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
}

View File

@@ -0,0 +1,763 @@
/*
** $Id: luaconf.h $
** Configuration file for Lua
** See Copyright Notice in lua.h
*/
#ifndef luaconf_h
#define luaconf_h
#include <limits.h>
#include <stddef.h>
/*
** ===================================================================
** General Configuration File for Lua
**
** Some definitions here can be changed externally, through the
** compiler (e.g., with '-D' options). Those are protected by
** '#if !defined' guards. However, several other definitions should
** be changed directly here, either because they affect the Lua
** ABI (by making the changes here, you ensure that all software
** connected to Lua, such as C libraries, will be compiled with the
** same configuration); or because they are seldom changed.
**
** Search for "@@" to find all configurable definitions.
** ===================================================================
*/
/*
** {====================================================================
** System Configuration: macros to adapt (if needed) Lua to some
** particular platform, for instance restricting it to C89.
** =====================================================================
*/
/*
@@ LUA_USE_C89 controls the use of non-ISO-C89 features.
** Define it if you want Lua to avoid the use of a few C99 features
** or Windows-specific features on Windows.
*/
/* #define LUA_USE_C89 */
/*
** By default, Lua on Windows use (some) specific Windows features
*/
#if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE)
#define LUA_USE_WINDOWS /* enable goodies for regular Windows */
#endif
#if defined(LUA_USE_WINDOWS)
#define LUA_DL_DLL /* enable support for DLL */
#define LUA_USE_C89 /* broadly, Windows is C89 */
#endif
#if defined(LUA_USE_LINUX)
#define LUA_USE_POSIX
#define LUA_USE_DLOPEN /* needs an extra library: -ldl */
#endif
#if defined(LUA_USE_MACOSX)
#define LUA_USE_POSIX
#define LUA_USE_DLOPEN /* MacOS does not need -ldl */
#endif
/*
@@ LUAI_IS32INT is true iff 'int' has (at least) 32 bits.
*/
#define LUAI_IS32INT ((UINT_MAX >> 30) >= 3)
/* }================================================================== */
/*
** {==================================================================
** Configuration for Number types.
** ===================================================================
*/
/*
@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats.
*/
/* #define LUA_32BITS */
/*
@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for
** C89 ('long' and 'double'); Windows always has '__int64', so it does
** not need to use this case.
*/
#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS)
#define LUA_C89_NUMBERS
#endif
/*
@@ LUA_INT_TYPE defines the type for Lua integers.
@@ LUA_FLOAT_TYPE defines the type for Lua floats.
** Lua should work fine with any mix of these options supported
** by your C compiler. The usual configurations are 64-bit integers
** and 'double' (the default), 32-bit integers and 'float' (for
** restricted platforms), and 'long'/'double' (for C compilers not
** compliant with C99, which may not have support for 'long long').
*/
/* predefined options for LUA_INT_TYPE */
#define LUA_INT_INT 1
#define LUA_INT_LONG 2
#define LUA_INT_LONGLONG 3
/* predefined options for LUA_FLOAT_TYPE */
#define LUA_FLOAT_FLOAT 1
#define LUA_FLOAT_DOUBLE 2
#define LUA_FLOAT_LONGDOUBLE 3
#if defined(LUA_32BITS) /* { */
/*
** 32-bit integers and 'float'
*/
#if LUAI_IS32INT /* use 'int' if big enough */
#define LUA_INT_TYPE LUA_INT_INT
#else /* otherwise use 'long' */
#define LUA_INT_TYPE LUA_INT_LONG
#endif
#define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT
#elif defined(LUA_C89_NUMBERS) /* }{ */
/*
** largest types available for C89 ('long' and 'double')
*/
#define LUA_INT_TYPE LUA_INT_LONG
#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE
#endif /* } */
/*
** default configuration for 64-bit Lua ('long long' and 'double')
*/
#if !defined(LUA_INT_TYPE)
#define LUA_INT_TYPE LUA_INT_LONGLONG
#endif
#if !defined(LUA_FLOAT_TYPE)
#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE
#endif
/* }================================================================== */
/*
** {==================================================================
** Configuration for Paths.
** ===================================================================
*/
/*
** LUA_PATH_SEP is the character that separates templates in a path.
** LUA_PATH_MARK is the string that marks the substitution points in a
** template.
** LUA_EXEC_DIR in a Windows path is replaced by the executable's
** directory.
*/
#define LUA_PATH_SEP ";"
#define LUA_PATH_MARK "?"
#define LUA_EXEC_DIR "!"
/*
@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
** Lua libraries.
@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for
** C libraries.
** CHANGE them if your machine has a non-conventional directory
** hierarchy or if you want to install your libraries in
** non-conventional directories.
*/
#define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
#if defined(_WIN32) /* { */
/*
** In Windows, any exclamation mark ('!') in the path is replaced by the
** path of the directory of the executable file of the current process.
*/
#define LUA_LDIR "!\\lua\\"
#define LUA_CDIR "!\\"
#define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\"
#if !defined(LUA_PATH_DEFAULT)
#define LUA_PATH_DEFAULT \
LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \
LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \
".\\?.lua;" ".\\?\\init.lua"
#endif
#if !defined(LUA_CPATH_DEFAULT)
#define LUA_CPATH_DEFAULT \
LUA_CDIR"?.dll;" \
LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \
LUA_CDIR"loadall.dll;" ".\\?.dll;" \
LUA_CDIR"?54.dll;" ".\\?54.dll"
#endif
#else /* }{ */
#define LUA_ROOT "/usr/local/"
#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"
#if !defined(LUA_PATH_DEFAULT)
#define LUA_PATH_DEFAULT \
LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \
"./?.lua;" "./?/init.lua"
#endif
#if !defined(LUA_CPATH_DEFAULT)
#define LUA_CPATH_DEFAULT \
LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so;" \
LUA_CDIR"lib?54.so;" "./lib?54.so"
#endif
#endif /* } */
/*
@@ LUA_DIRSEP is the directory separator (for submodules).
** CHANGE it if your machine does not use "/" as the directory separator
** and is not Windows. (On Windows Lua automatically uses "\".)
*/
#if !defined(LUA_DIRSEP)
#if defined(_WIN32)
#define LUA_DIRSEP "\\"
#else
#define LUA_DIRSEP "/"
#endif
#endif
/* }================================================================== */
/*
** {==================================================================
** Marks for exported symbols in the C code
** ===================================================================
*/
/*
@@ LUA_API is a mark for all core API functions.
@@ LUALIB_API is a mark for all auxiliary library functions.
@@ LUAMOD_API is a mark for all standard library opening functions.
** CHANGE them if you need to define those functions in some special way.
** For instance, if you want to create one Windows DLL with the core and
** the libraries, you may want to use the following definition (define
** LUA_BUILD_AS_DLL to get it).
*/
#if defined(LUA_BUILD_AS_DLL) /* { */
#if defined(LUA_CORE) || defined(LUA_LIB) /* { */
#define LUA_API __declspec(dllexport)
#else /* }{ */
#define LUA_API __declspec(dllimport)
#endif /* } */
#else /* }{ */
#define LUA_API extern
#endif /* } */
/*
** More often than not the libs go together with the core.
*/
#define LUALIB_API LUA_API
#define LUAMOD_API LUA_API
/*
@@ LUAI_FUNC is a mark for all extern functions that are not to be
** exported to outside modules.
@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables,
** none of which to be exported to outside modules (LUAI_DDEF for
** definitions and LUAI_DDEC for declarations).
** CHANGE them if you need to mark them in some special way. Elf/gcc
** (versions 3.2 and later) mark them as "hidden" to optimize access
** when Lua is compiled as a shared library. Not all elf targets support
** this attribute. Unfortunately, gcc does not offer a way to check
** whether the target offers that support, and those without support
** give a warning about it. To avoid these warnings, change to the
** default definition.
*/
#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
defined(__ELF__) /* { */
#define LUAI_FUNC __attribute__((visibility("internal"))) extern
#else /* }{ */
#define LUAI_FUNC extern
#endif /* } */
#define LUAI_DDEC(dec) LUAI_FUNC dec
#define LUAI_DDEF /* empty */
/* }================================================================== */
/*
** {==================================================================
** Compatibility with previous versions
** ===================================================================
*/
/*
@@ LUA_COMPAT_5_3 controls other macros for compatibility with Lua 5.3.
** You can define it to get all options, or change specific options
** to fit your specific needs.
*/
#if defined(LUA_COMPAT_5_3) /* { */
/*
@@ LUA_COMPAT_MATHLIB controls the presence of several deprecated
** functions in the mathematical library.
** (These functions were already officially removed in 5.3;
** nevertheless they are still available here.)
*/
#define LUA_COMPAT_MATHLIB
/*
@@ LUA_COMPAT_APIINTCASTS controls the presence of macros for
** manipulating other integer types (lua_pushunsigned, lua_tounsigned,
** luaL_checkint, luaL_checklong, etc.)
** (These macros were also officially removed in 5.3, but they are still
** available here.)
*/
#define LUA_COMPAT_APIINTCASTS
/*
@@ LUA_COMPAT_LT_LE controls the emulation of the '__le' metamethod
** using '__lt'.
*/
#define LUA_COMPAT_LT_LE
/*
@@ The following macros supply trivial compatibility for some
** changes in the API. The macros themselves document how to
** change your code to avoid using them.
** (Once more, these macros were officially removed in 5.3, but they are
** still available here.)
*/
#define lua_strlen(L,i) lua_rawlen(L, (i))
#define lua_objlen(L,i) lua_rawlen(L, (i))
#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ)
#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT)
#endif /* } */
/* }================================================================== */
/*
** {==================================================================
** Configuration for Numbers.
** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_*
** satisfy your needs.
** ===================================================================
*/
/*
@@ LUA_NUMBER is the floating-point type used by Lua.
@@ LUAI_UACNUMBER is the result of a 'default argument promotion'
@@ over a floating number.
@@ l_floatatt(x) corrects float attribute 'x' to the proper float type
** by prefixing it with one of FLT/DBL/LDBL.
@@ LUA_NUMBER_FRMLEN is the length modifier for writing floats.
@@ LUA_NUMBER_FMT is the format for writing floats.
@@ lua_number2str converts a float to a string.
@@ l_mathop allows the addition of an 'l' or 'f' to all math operations.
@@ l_floor takes the floor of a float.
@@ lua_str2number converts a decimal numeral to a number.
*/
/* The following definitions are good for most cases here */
#define l_floor(x) (l_mathop(floor)(x))
#define lua_number2str(s,sz,n) \
l_sprintf((s), sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)(n))
/*
@@ lua_numbertointeger converts a float number with an integral value
** to an integer, or returns 0 if float is not within the range of
** a lua_Integer. (The range comparisons are tricky because of
** rounding. The tests here assume a two-complement representation,
** where MININTEGER always has an exact representation as a float;
** MAXINTEGER may not have one, and therefore its conversion to float
** may have an ill-defined value.)
*/
#define lua_numbertointeger(n,p) \
((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \
(n) < -(LUA_NUMBER)(LUA_MININTEGER) && \
(*(p) = (LUA_INTEGER)(n), 1))
/* now the variable definitions */
#if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT /* { single float */
#define LUA_NUMBER float
#define l_floatatt(n) (FLT_##n)
#define LUAI_UACNUMBER double
#define LUA_NUMBER_FRMLEN ""
#define LUA_NUMBER_FMT "%.7g"
#define l_mathop(op) op##f
#define lua_str2number(s,p) strtof((s), (p))
#elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE /* }{ long double */
#define LUA_NUMBER long double
#define l_floatatt(n) (LDBL_##n)
#define LUAI_UACNUMBER long double
#define LUA_NUMBER_FRMLEN "L"
#define LUA_NUMBER_FMT "%.19Lg"
#define l_mathop(op) op##l
#define lua_str2number(s,p) strtold((s), (p))
#elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE /* }{ double */
#define LUA_NUMBER double
#define l_floatatt(n) (DBL_##n)
#define LUAI_UACNUMBER double
#define LUA_NUMBER_FRMLEN ""
#define LUA_NUMBER_FMT "%.14g"
#define l_mathop(op) op
#define lua_str2number(s,p) strtod((s), (p))
#else /* }{ */
#error "numeric float type not defined"
#endif /* } */
/*
@@ LUA_INTEGER is the integer type used by Lua.
**
@@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER.
**
@@ LUAI_UACINT is the result of a 'default argument promotion'
@@ over a LUA_INTEGER.
@@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers.
@@ LUA_INTEGER_FMT is the format for writing integers.
@@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER.
@@ LUA_MININTEGER is the minimum value for a LUA_INTEGER.
@@ LUA_MAXUNSIGNED is the maximum value for a LUA_UNSIGNED.
@@ LUA_UNSIGNEDBITS is the number of bits in a LUA_UNSIGNED.
@@ lua_integer2str converts an integer to a string.
*/
/* The following definitions are good for most cases here */
#define LUA_INTEGER_FMT "%" LUA_INTEGER_FRMLEN "d"
#define LUAI_UACINT LUA_INTEGER
#define lua_integer2str(s,sz,n) \
l_sprintf((s), sz, LUA_INTEGER_FMT, (LUAI_UACINT)(n))
/*
** use LUAI_UACINT here to avoid problems with promotions (which
** can turn a comparison between unsigneds into a signed comparison)
*/
#define LUA_UNSIGNED unsigned LUAI_UACINT
#define LUA_UNSIGNEDBITS (sizeof(LUA_UNSIGNED) * CHAR_BIT)
/* now the variable definitions */
#if LUA_INT_TYPE == LUA_INT_INT /* { int */
#define LUA_INTEGER int
#define LUA_INTEGER_FRMLEN ""
#define LUA_MAXINTEGER INT_MAX
#define LUA_MININTEGER INT_MIN
#define LUA_MAXUNSIGNED UINT_MAX
#elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */
#define LUA_INTEGER long
#define LUA_INTEGER_FRMLEN "l"
#define LUA_MAXINTEGER LONG_MAX
#define LUA_MININTEGER LONG_MIN
#define LUA_MAXUNSIGNED ULONG_MAX
#elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */
/* use presence of macro LLONG_MAX as proxy for C99 compliance */
#if defined(LLONG_MAX) /* { */
/* use ISO C99 stuff */
#define LUA_INTEGER long long
#define LUA_INTEGER_FRMLEN "ll"
#define LUA_MAXINTEGER LLONG_MAX
#define LUA_MININTEGER LLONG_MIN
#define LUA_MAXUNSIGNED ULLONG_MAX
#elif defined(LUA_USE_WINDOWS) /* }{ */
/* in Windows, can use specific Windows types */
#define LUA_INTEGER __int64
#define LUA_INTEGER_FRMLEN "I64"
#define LUA_MAXINTEGER _I64_MAX
#define LUA_MININTEGER _I64_MIN
#define LUA_MAXUNSIGNED _UI64_MAX
#else /* }{ */
#error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \
or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)"
#endif /* } */
#else /* }{ */
#error "numeric integer type not defined"
#endif /* } */
/* }================================================================== */
/*
** {==================================================================
** Dependencies with C99 and other C details
** ===================================================================
*/
/*
@@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89.
** (All uses in Lua have only one format item.)
*/
#if !defined(LUA_USE_C89)
#define l_sprintf(s,sz,f,i) snprintf(s,sz,f,i)
#else
#define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i))
#endif
/*
@@ lua_strx2number converts a hexadecimal numeral to a number.
** In C99, 'strtod' does that conversion. Otherwise, you can
** leave 'lua_strx2number' undefined and Lua will provide its own
** implementation.
*/
#if !defined(LUA_USE_C89)
#define lua_strx2number(s,p) lua_str2number(s,p)
#endif
/*
@@ lua_pointer2str converts a pointer to a readable string in a
** non-specified way.
*/
#define lua_pointer2str(buff,sz,p) l_sprintf(buff,sz,"%p",p)
/*
@@ lua_number2strx converts a float to a hexadecimal numeral.
** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that.
** Otherwise, you can leave 'lua_number2strx' undefined and Lua will
** provide its own implementation.
*/
#if !defined(LUA_USE_C89)
#define lua_number2strx(L,b,sz,f,n) \
((void)L, l_sprintf(b,sz,f,(LUAI_UACNUMBER)(n)))
#endif
/*
** 'strtof' and 'opf' variants for math functions are not valid in
** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the
** availability of these variants. ('math.h' is already included in
** all files that use these macros.)
*/
#if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF))
#undef l_mathop /* variants not available */
#undef lua_str2number
#define l_mathop(op) (lua_Number)op /* no variant */
#define lua_str2number(s,p) ((lua_Number)strtod((s), (p)))
#endif
/*
@@ LUA_KCONTEXT is the type of the context ('ctx') for continuation
** functions. It must be a numerical type; Lua will use 'intptr_t' if
** available, otherwise it will use 'ptrdiff_t' (the nearest thing to
** 'intptr_t' in C89)
*/
#define LUA_KCONTEXT ptrdiff_t
#if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \
__STDC_VERSION__ >= 199901L
#include <stdint.h>
#if defined(INTPTR_MAX) /* even in C99 this type is optional */
#undef LUA_KCONTEXT
#define LUA_KCONTEXT intptr_t
#endif
#endif
/*
@@ lua_getlocaledecpoint gets the locale "radix character" (decimal point).
** Change that if you do not want to use C locales. (Code using this
** macro must include the header 'locale.h'.)
*/
#if !defined(lua_getlocaledecpoint)
#define lua_getlocaledecpoint() (localeconv()->decimal_point[0])
#endif
/* }================================================================== */
/*
** {==================================================================
** Language Variations
** =====================================================================
*/
/*
@@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some
** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from
** numbers to strings. Define LUA_NOCVTS2N to turn off automatic
** coercion from strings to numbers.
*/
/* #define LUA_NOCVTN2S */
/* #define LUA_NOCVTS2N */
/*
@@ LUA_USE_APICHECK turns on several consistency checks on the C API.
** Define it as a help when debugging C code.
*/
#if defined(LUA_USE_APICHECK)
#include <assert.h>
#define luai_apicheck(l,e) assert(e)
#endif
/* }================================================================== */
/*
** {==================================================================
** Macros that affect the API and must be stable (that is, must be the
** same when you compile Lua and when you compile code that links to
** Lua).
** =====================================================================
*/
/*
@@ LUAI_MAXSTACK limits the size of the Lua stack.
** CHANGE it if you need a different limit. This limit is arbitrary;
** its only purpose is to stop Lua from consuming unlimited stack
** space (and to reserve some numbers for pseudo-indices).
** (It must fit into max(size_t)/32.)
*/
#if LUAI_IS32INT
#define LUAI_MAXSTACK 1000000
#else
#define LUAI_MAXSTACK 15000
#endif
/*
@@ LUA_EXTRASPACE defines the size of a raw memory area associated with
** a Lua state with very fast access.
** CHANGE it if you need a different size.
*/
#define LUA_EXTRASPACE (sizeof(void *))
/*
@@ LUA_IDSIZE gives the maximum size for the description of the source
@@ of a function in debug information.
** CHANGE it if you want a different size.
*/
#define LUA_IDSIZE 60
/*
@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
*/
#define LUAL_BUFFERSIZE ((int)(16 * sizeof(void*) * sizeof(lua_Number)))
/*
@@ LUAI_MAXALIGN defines fields that, when used in a union, ensure
** maximum alignment for the other items in that union.
*/
#define LUAI_MAXALIGN lua_Number n; double u; void *s; lua_Integer i; long l
/* }================================================================== */
/* =================================================================== */
/*
** Local configuration. You can use this space to add your redefinitions
** without modifying the main part of the file.
*/
#endif

View File

@@ -0,0 +1,58 @@
/*
** $Id: lualib.h $
** Lua standard libraries
** See Copyright Notice in lua.h
*/
#ifndef lualib_h
#define lualib_h
#include "lua.h"
/* version suffix for environment variable names */
#define LUA_VERSUFFIX "_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR
LUAMOD_API int (luaopen_base) (lua_State *L);
#define LUA_COLIBNAME "coroutine"
LUAMOD_API int (luaopen_coroutine) (lua_State *L);
#define LUA_TABLIBNAME "table"
LUAMOD_API int (luaopen_table) (lua_State *L);
#define LUA_IOLIBNAME "io"
LUAMOD_API int (luaopen_io) (lua_State *L);
#define LUA_OSLIBNAME "os"
LUAMOD_API int (luaopen_os) (lua_State *L);
#define LUA_STRLIBNAME "string"
LUAMOD_API int (luaopen_string) (lua_State *L);
#define LUA_UTF8LIBNAME "utf8"
LUAMOD_API int (luaopen_utf8) (lua_State *L);
#define LUA_MATHLIBNAME "math"
LUAMOD_API int (luaopen_math) (lua_State *L);
#define LUA_DBLIBNAME "debug"
LUAMOD_API int (luaopen_debug) (lua_State *L);
#define LUA_LOADLIBNAME "package"
LUAMOD_API int (luaopen_package) (lua_State *L);
/* open all previous libraries */
LUALIB_API void (luaL_openlibs) (lua_State *L);
#if !defined(lua_assert)
#define lua_assert(x) ((void)0)
#endif
#endif

View File

@@ -662,6 +662,13 @@ private :
input inputs_;
bool tab_was_pressed_;
// ------------------------------------------------- //
// ------------------- SOUND ----------------------- //
// ------------------------------------------------- //
// shared pointer to the FMOD system
FMOD::System* sound_system_;
};
#endif

View File

@@ -82,6 +82,12 @@ public:
*/
void get_reflection_view_matrix(XMMATRIX&) const;
/**
* @brief Calculates and returns the forward direction vector of the camera based on its rotation.
* This vector points in the direction the camera is facing.
* @return A normalized 3D vector representing the camera's forward direction.
*/
XMFLOAT3 get_forward() const {
float pitch = XMConvertToRadians(rotation_x_);
float yaw = XMConvertToRadians(rotation_y_);
@@ -93,7 +99,11 @@ public:
return forwardVec;
}
/**
* @brief Calculates and returns the right direction vector of the camera based on its rotation.
* This vector points to the right side of the camera.
* @return A normalized 3D vector representing the camera's right direction.
*/
XMFLOAT3 get_up() const {
// Construire matrice rotation <20> partir des angles
XMMATRIX rot = XMMatrixRotationRollPitchYaw(

View File

@@ -9,6 +9,7 @@
#include "component.h"
#include "components/audio_component.h"
#include "components/identity_component.h"
#include "components/lua_script_component.h"
#include "components/render_component.h"
#include "components/transform_component.h"
#include "components/physics_component.h"
@@ -52,5 +53,6 @@ inline void EnregistrerTousLesComposants() {
factory.EnregistrerComposant<ecs::IdentityComponent>("IdentityComponent");
factory.EnregistrerComposant<ecs::RenderComponent>("RenderComponent");
factory.EnregistrerComposant<ecs::AudioComponent>("AudioComponent");
factory.EnregistrerComposant<ecs::LuaScriptComponent>("LuaScriptComponent");
// Ajouter d'autres composants ici
}

View File

@@ -5,6 +5,8 @@
#include <imgui.h>
#include "entity.h"
#include "Logger.h"
/**
* namespace for the Entity-Component-System (ECS)
*/
@@ -30,6 +32,11 @@ public:
*/
virtual void Initialize() {}
/**
*Virtual function to shutdown the component.
*/
virtual void Shutdown() {}
/**
* Virtual function to update the component.
* @param deltaTime Time since the last update.

View File

@@ -16,49 +16,77 @@
namespace ecs {
class AudioComponent : public Component {
public:
AudioComponent() : m_system(nullptr), m_sound(nullptr), m_channel(nullptr) {}
AudioComponent() : m_sound(nullptr), m_channel(nullptr) {}
~AudioComponent() override {
// stop the sound if it's playing
if (m_channel) {
bool isPlaying = false;
m_channel->isPlaying(&isPlaying);
if (isPlaying) {
m_channel->stop();
}
}
if (m_sound) m_sound->release();
// Ne pas lib<69>rer m_system ici car il peut <20>tre partag<61>
}
/**
* Shutdown the audio component by releasing the sound and channel.
* This method is called when the component is removed from an entity or when the entity is destroyed.
*/
void Shutdown() override {
if (m_channel) {
bool isPlaying = false;
m_channel->isPlaying(&isPlaying);
if (isPlaying) {
m_channel->stop();
}
m_channel = nullptr;
}
if (m_sound) {
m_sound->release();
m_sound = nullptr;
}
m_system = nullptr; // Ne pas lib<69>rer m_system ici car il peut <20>tre partag<61>
m_camera = nullptr;
}
/**
* Initialize the audio component by setting up the FMOD system and camera from the parent entity.
* This method is called when the component is added to an entity.
*/
void Initialize() override
{
// create FMOD system if not already created
if (!m_system)
{
FMOD_RESULT result = FMOD::System_Create(&m_system);
if (result != FMOD_OK) {
m_lastError = "<EFBFBD>chec de la cr<63>ation du syst<73>me FMOD: " + std::to_string(result);
return;
}
result = m_system->init(512, FMOD_INIT_NORMAL | FMOD_INIT_3D_RIGHTHANDED, nullptr);
if (result != FMOD_OK) {
m_lastError = "<EFBFBD>chec de l'initialisation du syst<73>me FMOD: " + std::to_string(result);
m_system->release();
m_system = nullptr;
}
}
auto parent = GetParent();
if (parent && parent->GetCamera())
{
SetCamera(parent->GetCamera());
SetSoundSystem(parent->GetSoundSystem());
}
}
/**
* Load an audio file from the specified path.
* If the FMOD system is not initialized, it will be initialized first.
* Creates a sound object with appropriate settings based on the component's properties.
* @param path The file path to load the audio from.
* @return True if the audio file was loaded successfully, otherwise false.
*/
bool Load(const std::string& path) {
if (!m_system) {
Initialize();
if (!m_system) return false;
}
Logger::Get().Log("Loading audio file: " + path, __FILE__, __LINE__, Logger::LogLevel::Info);
m_soundPath = path;
if (!std::filesystem::exists(path)) {
m_lastError = "Fichier non trouv<75>: " + path;
Logger::Get().Log(m_lastError, __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
@@ -87,6 +115,11 @@ public:
return true;
}
/**
* Play the loaded audio sound.
* If the sound is already playing, it will be stopped and restarted.
* The channel properties such as volume, pan, pitch, mute, priority, and paused state are applied.
*/
void Play() {
if (m_system && m_sound) {
bool isPlaying = false;
@@ -111,6 +144,10 @@ public:
}
}
/**
* Pause the currently playing audio sound.
* If the sound is not playing, this method has no effect.
*/
void Pause() {
if (m_channel) {
m_paused = true;
@@ -118,6 +155,10 @@ public:
}
}
/**
* Resume the paused audio sound.
* If the sound is not paused, this method has no effect.
*/
void Resume() {
if (m_channel) {
m_paused = false;
@@ -125,13 +166,26 @@ public:
}
}
/**
* Stop the currently playing audio sound.
* If the sound is not playing, this method has no effect.
*/
void Stop() {
if (m_channel)
m_channel->stop();
}
/**
* Set the camera to be used for 3D audio spatialization.
* This camera is used to update the listener attributes in FMOD.
* @param camera Pointer to the camera_class instance.
*/
void SetCamera(camera_class* camera) {m_camera = camera; }
/**
* Update the audio component.
* @param deltaTime Time since the last update.
*/
void Update(float deltaTime) override {
if (!m_spatialized) return;
@@ -186,7 +240,12 @@ public:
m_system->update();
}
/**
* ImGui Widget to control the audio component properties.
* Allows loading/changing/removing audio files, and adjusting properties like volume, pan, pitch, looping, spatialization, etc.
* Displays error messages if loading fails.
* This method is called during the ImGui rendering phase.
*/
void OnImGuiRender() override {
if (!m_sound) {
ImGui::Text("No audio file loaded");
@@ -392,7 +451,82 @@ public:
}
}
/**
* Set the FMOD system to be used by this audio component.
* This method allows sharing the FMOD system instance across multiple audio components.
* @param system Pointer to the FMOD::System instance.
*/
void SetSoundSystem(FMOD::System* system) {
m_system = system;
}
/**
* Serialize the audio component's state to a string.
* This includes properties like sound path, volume, pan, pitch, looping, muted, paused, priority, spatialization, and use of velocity.
* This method is useful for saving the component's state or debugging.
* @return A string representation of the audio component's state.
*/
std::string Serialize() const override {
std::stringstream ss;
ss << "AudioComponent:"
<< m_soundPath << ";"
<< m_volume << ":"
<< m_pan << ":"
<< m_pitch << ":"
<< m_looping << ":"
<< m_muted << ":"
<< m_paused << ":"
<< m_priority << ":"
<< m_spatialized << ":"
<< m_use_velocity;
return ss.str();
}
/**
* Deserialize the audio component's state from a string.
* This method parses the string and sets the component's properties accordingly.
* If the sound path is valid, it attempts to load the audio file.
* @param data The string representation of the audio component's state.
* @return True if deserialization was successful, otherwise false.
*/
bool Deserialize(const std::string& data) override {
std::stringstream ss(data);
std::string type;
std::getline(ss, type, ':');
if (type != "AudioComponent") return false;
std::string s_volume, s_pan, s_pitch, s_looping, s_muted, s_paused, s_priority, s_spatialized, s_use_velocity;
std::getline(ss, m_soundPath, ';');
std::getline(ss, s_volume, ':');
std::getline(ss, s_pan, ':');
std::getline(ss, s_pitch, ':');
std::getline(ss, s_looping, ':');
std::getline(ss, s_muted, ':');
std::getline(ss, s_paused, ':');
std::getline(ss, s_priority, ':');
std::getline(ss, s_spatialized, ':');
std::getline(ss, s_use_velocity, ':');
Logger::Get().Log("Deserializing AudioComponent: path=" + m_soundPath, __FILE__, __LINE__, Logger::LogLevel::Warning);
m_volume = std::stof(s_volume);
m_pan = std::stof(s_pan);
m_pitch = std::stof(s_pitch);
m_looping = (s_looping == "1");
m_muted = (s_muted == "1");
m_paused = (s_paused == "1");
m_priority = std::stoi(s_priority);
m_spatialized = (s_spatialized == "1");
m_use_velocity = (s_use_velocity == "1");
// Recharger le son si le chemin existe (optional: ou laisser le chargement manuel)
if (!m_soundPath.empty() && m_system) {
Load(m_soundPath);
}
return true;
}
private:
FMOD::System* m_system;

View File

@@ -0,0 +1,100 @@
#pragma once
#include "../component.h"
#include "Lua/lua.hpp"
#include <string>
#include <fstream>
#include <sstream>
#include <imgui.h>
#include <filesystem>
namespace ecs {
class LuaScriptComponent : public Component {
public:
LuaScriptComponent() : scriptCreated(false), popupOpen(true) {
L = luaL_newstate();
luaL_openlibs(L);
}
~LuaScriptComponent() override {
if (L) {
lua_close(L);
L = nullptr;
}
}
void OnImGuiRender() override {
if (popupOpen) {
ImGui::OpenPopup("Nouveau Script Lua");
if (ImGui::BeginPopupModal("Nouveau Script Lua", NULL, ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::InputText("Nom du Script", scriptNameBuffer, sizeof(scriptNameBuffer));
if (ImGui::Button("Annuler")) {
scriptCreated = false;
popupOpen = false;
// Signal pour retirer ce component (<28> g<>rer par l'entity)
}
ImGui::SameLine();
if (ImGui::Button("Valider")) {
if (CreateScriptFile()) {
scriptCreated = true;
popupOpen = false;
} else {
// Gestion d'erreur possible (imprimer popup message)
}
}
ImGui::EndPopup();
}
}
if (scriptCreated) {
ImGui::TextWrapped("Script associe: %s", scriptName.c_str());
}
}
bool HasScript() const { return scriptCreated; }
const std::string& GetScriptName() const { return scriptName; }
private:
lua_State* L = nullptr;
char scriptNameBuffer[128] = {0};
std::string scriptName;
bool scriptCreated = false;
bool popupOpen = false;
bool CreateScriptFile() {
if (strlen(scriptNameBuffer) == 0)
return false;
scriptName = scriptNameBuffer;
if (scriptName.length() < 4 || scriptName.substr(scriptName.length() - 4) != ".lua") {
scriptName += ".lua";
}
// Dossier standard des scripts
std::string execFolder = std::filesystem::current_path().string();
std::string scriptFolder = execFolder + "/assets/Script/";
// Cr<43>er dossiers s'ils manquent
std::error_code ec;
std::filesystem::create_directories(scriptFolder, ec);
if (ec) {
// Log erreur
return false;
}
std::string fullPath = scriptFolder + scriptName;
// Cr<43>er un fichier script vide ou template simple
std::ofstream ofs(fullPath);
if (!ofs) return false;
ofs << "-- Script Lua vide pour ECS\n\nfunction on_update(dt)\n -- Code ici\nend\n";
ofs.close();
return true;
}
};
} // namespace ecs

View File

@@ -14,17 +14,7 @@
extern std::map<std::string, std::shared_ptr<model_class>> g_model_cache;
namespace ecs {
/**
* Enum for different types of textures used in rendering.
*/
enum class TextureType
{
Diffuse,
Normal,
Specular,
Alpha,
Reflection
};
class RenderComponent : public Component {
public:
@@ -34,7 +24,21 @@ public:
RenderComponent() : m_model(nullptr), m_isVisible(true) {}
~RenderComponent() = default;
void Initialize() override {}
/**
* Initialize the component by setting up the Direct3D device and context from the parent entity.
* This method is called when the component is added to an entity.
*/
void Initialize() override
{
if (auto parent = GetParent()) {
SetDevice(parent->GetDevice());
SetContext(parent->GetContext());
}
texture_container_buffer = TextureContainer();
}
void Update(float deltaTime) override {}
/**
@@ -186,28 +190,142 @@ public:
}
}
/**
* Serialize the RenderComponent's state to a string.
* This method is useful for saving the component's state or debugging.
* @return A string representation of the RenderComponent's state.
*/
std::string Serialize() const override {
if (!m_model) return "RenderComponent:NoModel";
TextureContainer texture_container_buffer = m_model->GetTextureContainer();
auto serializePaths = [](const std::vector<std::wstring> &paths) -> std::string {
std::string result;
for (size_t i = 0; i < paths.size(); ++i) {
std::string p = std::string(paths[i].begin(), paths[i].end());
result += p;
if (i + 1 < paths.size()) {
result += ","; // virgule entre chemins mais pas apr<70>s dernier
}
}
return result;
};
int diffuse_count = (int)texture_container_buffer.diffuse.size();
int normal_count = (int)texture_container_buffer.normal.size();
int specular_count = (int)texture_container_buffer.specular.size();
int alpha_count = (int)texture_container_buffer.alpha.size();
std::string diffuse_paths_ = serializePaths(texture_container_buffer.diffusePaths);
std::string normal_paths_ = serializePaths(texture_container_buffer.normalPaths);
std::string specular_paths_ = serializePaths(texture_container_buffer.specularPaths);
std::string alpha_paths_ = serializePaths(texture_container_buffer.alphaPaths);
std::stringstream ss;
ss << "RenderComponent:HasModel";
ss << "RenderComponent:HasModel:"
<< diffuse_count << ":" << diffuse_paths_ << ":"
<< normal_count << ":" << normal_paths_ << ":"
<< specular_count << ":" << specular_paths_ << ":"
<< alpha_count << ":" << alpha_paths_;
return ss.str();
}
/**
* Deserialize the RenderComponent's state from a string.
* This method parses the string and sets the component's properties accordingly.
* Note: The model will be loaded separately based on the model file path.
* @param data The string representation of the RenderComponent's state.
* @return True if deserialization was successful, otherwise false.
*/
bool Deserialize(const std::string& data) override {
std::stringstream ss(data);
std::string type;
std::getline(ss, type, ':');
if (type != "RenderComponent") return false;
std::string hasModel;
std::getline(ss, hasModel);
// Le mod<6F>le sera charg<72> s<>par<61>ment
if (!std::getline(ss, type, ':') || type != "RenderComponent")
return false;
std::string token;
if (!std::getline(ss, token, ':') || token != "HasModel")
return false;
int diffuse_count = 0, normal_count = 0, specular_count = 0, alpha_count = 0;
std::vector<std::wstring> paths_diffuse, paths_normal, paths_specular, paths_alpha;
auto read_count = [&](int& count) -> bool {
if (!std::getline(ss, token, ':'))
return false;
try {
count = std::stoi(token);
}
catch (...) {
return false;
}
return true;
};
auto clean_token = [](std::string& str) {
// Retirer virgules et espaces
str.erase(std::remove(str.begin(), str.end(), ','), str.end());
str.erase(0, str.find_first_not_of(" \t\n\r"));
str.erase(str.find_last_not_of(" \t\n\r") + 1);
};
auto read_paths = [&](int count, std::vector<std::wstring>& paths) -> bool {
for (int i = 0; i < count; ++i) {
if (!std::getline(ss, token, ':'))
return false;
clean_token(token);
if (!token.empty()) {
paths.emplace_back(token.begin(), token.end());
Logger::Get().Log("Loaded path: " + std::string(token.begin(), token.end()), __FILE__, __LINE__, Logger::LogLevel::Info);
}
}
return true;
};
if (!read_count(diffuse_count)) return false;
if (!read_paths(diffuse_count, paths_diffuse)) return false;
if (!read_count(normal_count)) return false;
if (!read_paths(normal_count, paths_normal)) return false;
if (!read_count(specular_count)) return false;
if (!read_paths(specular_count, paths_specular)) return false;
if (!read_count(alpha_count)) return false;
if (!read_paths(alpha_count, paths_alpha)) return false;
// Lib<69>rer textures existantes
for (auto& tex : texture_container_buffer.diffuse) if (tex) { tex->Release(); tex = nullptr; }
for (auto& tex : texture_container_buffer.normal) if (tex) { tex->Release(); tex = nullptr; }
for (auto& tex : texture_container_buffer.specular) if (tex) { tex->Release(); tex = nullptr; }
for (auto& tex : texture_container_buffer.alpha) if (tex) { tex->Release(); tex = nullptr; }
texture_container_buffer.diffuse.clear();
texture_container_buffer.normal.clear();
texture_container_buffer.specular.clear();
texture_container_buffer.alpha.clear();
texture_container_buffer.diffusePaths = std::move(paths_diffuse);
texture_container_buffer.normalPaths = std::move(paths_normal);
texture_container_buffer.specularPaths = std::move(paths_specular);
texture_container_buffer.alphaPaths = std::move(paths_alpha);
return true;
}
/**
* Render the ImGui interface for the RenderComponent.
* This method provides a user interface for inspecting and modifying the component's properties.
* It includes options to toggle visibility, display model information, and manage textures.
*/
void OnImGuiRender() override {
ImGui::Checkbox("Visible", &m_isVisible);
ImGui::Text("Model File Path: %s", m_modelFilePath.c_str());
@@ -216,12 +334,132 @@ public:
} else {
ImGui::Text("No model loaded.");
}
ImGui::Separator();
// D<>finir les types de textures_
std::vector<std::string> textureCategories = {
"Diffuse", "Normal", "Specular", "Alpha"
};
std::vector<TextureType> textureTypes = {
TextureType::Diffuse, TextureType::Normal,
TextureType::Specular, TextureType::Alpha
};
// Cr<43>er un espace pour afficher les textures_ avec d<>filement
ImGui::BeginChild("TextureChild", ImVec2(0, 200), true, ImGuiWindowFlags_HorizontalScrollbar);
// Pour chaque type de texture
for (int typeIndex = 0; typeIndex < textureCategories.size(); typeIndex++)
{
TextureType type = textureTypes[typeIndex];
std::string typeName = textureCategories[typeIndex];
// Afficher le titre de la cat<61>gorie
ImGui::Text("%s:", typeName.c_str());
ImGui::SameLine();
// Compter combien de textures_ de ce type existent
int textureCount = 0;
while (GetTexture(type, textureCount) != nullptr)
{
textureCount++;
}
// Afficher toutes les textures_ existantes
ImGui::BeginGroup();
for (int texIndex = 0; texIndex < textureCount; texIndex++)
{
ID3D11ShaderResourceView* texture = GetTexture(type, texIndex);
if (texture)
{
// ID unique pour chaque bouton de texture
std::string buttonId = "tex##" +
std::to_string(typeIndex) + "_" +
std::to_string(texIndex);
if (ImGui::ImageButton(buttonId.c_str(), (ImTextureID)texture, ImVec2(48, 48)))
{
// Ouvrir une bo<62>te de dialogue pour changer la texture
OPENFILENAME ofn;
WCHAR szFile[260];
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = NULL;
ofn.lpstrFile = szFile;
szFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = L"Texture\0*.png;*.jpg;*.dds\0";
ofn.nFilterIndex = 1;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn))
{
// Changer la texture existante
m_model->ChangeTexture(device, context, ofn.lpstrFile, type, texIndex);
}
}
// Afficher l'indice de texture et pr<70>visualisation au survol
if (ImGui::IsItemHovered())
{
ImGui::BeginTooltip();
ImGui::Text("%s %d", typeName.c_str(), texIndex);
ImGui::Image((ImTextureID)texture, ImVec2(192, 192));
ImGui::EndTooltip();
}
ImGui::SameLine();
}
}
// Bouton pour ajouter une nouvelle texture
std::string addButtonLabel = "+##" + std::to_string(typeIndex);
if (ImGui::Button(addButtonLabel.c_str(), ImVec2(48, 48)))
{
// Ouvrir une bo<62>te de dialogue pour ajouter une texture
OPENFILENAME ofn;
WCHAR szFile[260];
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = NULL;
ofn.lpstrFile = szFile;
szFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = L"Texture\0*.png;*.jpg;*.dds\0";
ofn.nFilterIndex = 1;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn))
{
// Ajouter une nouvelle texture
m_model->AddTexture(device, context, ofn.lpstrFile, type);
}
}
ImGui::EndGroup();
ImGui::Separator();
}
ImGui::EndChild();
}
void SetDevice (ID3D11Device* dev) { device = dev; }
void SetContext(ID3D11DeviceContext* ctx) { context = ctx; }
void SetTextureContainer(const TextureContainer& texContainer) { texture_container_buffer = texContainer; }
const TextureContainer& GetTextureContainerBuffer() const { return texture_container_buffer; }
private:
std::shared_ptr<model_class> m_model;
std::string m_modelFilePath;
bool m_isVisible;
ID3D11Device* device;
ID3D11DeviceContext* context;
TextureContainer texture_container_buffer;
};
} // namespace ecs

View File

@@ -154,6 +154,11 @@ public:
*/
void SetTranslateMatrix(XMMATRIX matrix) { m_TranslateMatrix = matrix; UpdateWorldMatrix(); }
/**
* Serialize the transform component's state to a string.
* The format is: "TransformComponent:posX:posY:posZ:rotX:rotY:rotZ:scaleX:scaleY:scaleZ"
* @return A string representation of the transform component's state.
*/
std::string Serialize() const override
{
XMFLOAT3 position, rotation, scale;
@@ -169,6 +174,12 @@ public:
return ss.str();
}
/**
* Deserialize the transform component's state from a string.
* The expected format is: "TransformComponent:posX:posY:posZ:rotX:rotY:rotZ:scaleX:scaleY:scaleZ"
* @param data The string representation of the transform component's state.
* @return True if deserialization was successful, otherwise false.
*/
bool Deserialize(const std::string& data) override
{
std::stringstream ss(data);
@@ -198,6 +209,10 @@ public:
return true;
}
/**
* Render the ImGui interface for editing the transform component.
* This method provides draggable controls for position, rotation, and scale.
*/
void OnImGuiRender() override {
XMFLOAT3 position, rotation, scale;
XMStoreFloat3(&position, GetPosition());

View File

@@ -5,8 +5,11 @@
#include <memory>
#include <algorithm>
#include <cassert>
#include <WICTextureLoader.h>
#include <d3d11.h>
#include "camera_class.h"
#include <Fmod/core/inc/fmod.hpp>
namespace ecs {
/**
@@ -137,9 +140,50 @@ public:
return m_Components;
}
/**
* Set the main camera of the scene to be used by components like AudioComponent.
* @param camera
*/
void SetCamera(camera_class* camera) {m_camera = camera; }
/**
* Get the main camera of the scene.
* @return A pointer to the main camera.
*/
camera_class* GetCamera() const { return m_camera; }
/**
* Set the FMOD sound system to be used by components like AudioComponent.
* @param soundSystem
*/
void SetSoundSystem(FMOD::System* soundSystem) {m_soundSystem = soundSystem; }
/**
* Get the FMOD sound system.
* @return A pointer to the FMOD sound system.
*/
FMOD::System* GetSoundSystem() const { return m_soundSystem; }
/**
* Release all data associated with the entity.
* This includes clearing all components and resetting the camera and sound system pointers.
*/
void release()
{
// call shutdown on all components if needed
for (auto& [typeID, component] : m_Components) {
// If components had a shutdown method, we would call it here
component->Shutdown();
}
m_Components.clear();
m_camera = nullptr;
m_soundSystem = nullptr;
}
void SetDevice (ID3D11Device* dev) { device = dev; }
void SetContext(ID3D11DeviceContext* ctx) { context = ctx; }
ID3D11Device* GetDevice() const { return device; }
ID3D11DeviceContext* GetContext() const { return context; }
private:
/**
@@ -154,6 +198,12 @@ private:
// camera
camera_class* m_camera = nullptr;
// FMOD sound system
FMOD::System* m_soundSystem = nullptr;
ID3D11Device* device;
ID3D11DeviceContext* context;
};
} // namespace ecs

View File

@@ -3,6 +3,7 @@
#include <vector>
#include <unordered_map>
#include <queue>
#include <d3d11.h>
namespace ecs {
@@ -32,6 +33,9 @@ public:
auto entity = std::make_shared<Entity>(id);
entity->SetCamera(camera_);
entity->SetSoundSystem(sound_system_);
entity->SetDevice(device);
entity->SetContext(context);
m_Entities[id] = entity;
return entity;
@@ -44,6 +48,7 @@ public:
void DestroyEntity(EntityID id) {
auto it = m_Entities.find(id);
if (it != m_Entities.end()) {
it->second->release();
m_Entities.erase(it);
m_FreeIDs.push(id); // Recycler l'ID
}
@@ -145,14 +150,42 @@ public:
}
/**
* Set the main camera that will be propagate to the entity when creating a new entity.
* @param camera Pointer to the camera_class instance.
*/
void SetCamera(camera_class* camera) { camera_ = camera; }
/**
* Get the main camera used by entities.
* @return Pointer to the camera_class instance.
*/
camera_class* GetCamera() const { return camera_; }
/**
* Set the FMOD sound system that will be propagate to the entity when creating a new entity.
* @param sound_system Pointer to the FMOD::System instance.
*/
void SetSoundSystem(FMOD::System* sound_system) { sound_system_ = sound_system; }
/**
* Get the FMOD sound system used by entities.
* @return Pointer to the FMOD::System instance.
*/
FMOD::System* GetSoundSystem() const { return sound_system_; }
void SetDevice (ID3D11Device* dev) { device = dev; }
void SetContext(ID3D11DeviceContext* ctx) { context = ctx; }
ID3D11Device* GetDevice() const { return device; }
ID3D11DeviceContext* GetContext() const { return context; }
private:
EntityID m_NextEntityID;
std::unordered_map<EntityID, std::shared_ptr<Entity>> m_Entities;
std::queue<EntityID> m_FreeIDs; // IDs <20> r<>utiliser
camera_class* camera_ = nullptr;
FMOD::System* sound_system_ = nullptr;
ID3D11Device* device;
ID3D11DeviceContext* context;
};
} // namespace ecs

View File

@@ -17,6 +17,8 @@
#include "scene_manager.h"
#include "ecs/entity_manager.h"
#include "version.h"
class application_class;
class stats;
@@ -31,6 +33,11 @@ struct widget_entry
std::function<void()> func;
};
struct ComponentEntry {
const char* name;
std::function<void()> addFunc;
};
class imguiManager
{
public:
@@ -42,6 +49,16 @@ public:
imguiManager();
~imguiManager();
/**
* Load the build version from a configuration file.
* The configuration file should contain a line with the build version in the format "VER=XXX...".
* If the line is not found, it will be added with a version of 0.
* The build version will be incremented by 1 each time this function is called.
* @param filepath The path to the configuration file.
* @return True if the build version was loaded successfully, otherwise false.
*/
bool IncrementBuildVersionInConfig(const std::string& filepath);
/**
* Initializes the ImGui manager.
* @param hwnd Handle to the window where ImGui will be rendered.
@@ -212,6 +229,8 @@ private:
std::string version_driver_;
ecs::EntityID m_selected_entity_id = 0; // ID of the currently selected entity
int BUILD_VERSION_VER = -1;
};
#endif

View File

@@ -0,0 +1,24 @@
#pragma once
#include "imgui.h"
#define BUILD_VERSION_MAJOR 14
#define BUILD_VERSION_MINOR 1
#define BUILD_VERSION_PATCH 1
// BUILD_VERSION_VER est un int persist<73> dans un fichier, <20> charger au lancement et incr<63>menter <20> chaque build (voir point 3)
extern int BUILD_VERSION_VER;
#ifdef _DEBUG
#define BUILD_VERSION_TYPE "Debug"
#define BUILD_VERSION_INVERSE "Release"
// define a color for debug mode (dark yellow)
#define DEBUG_MODE_COLOR IM_COL32(204, 153, 0, 255)
#else
#define BUILD_VERSION_TYPE "Release"
#define BUILD_VERSION_INVERSE "Debug"
// define a color for release mode (rouge bordeau)
#define DEBUG_MODE_COLOR IM_COL32(128, 0, 32, 255)
#endif
// BUILD_VERSION_STATE est d<>fini manuellement (ex "Dev" ou "Stable")
#define BUILD_VERSION_STATE "Dev"
//#define BUILD_VERSION_STATE "Stable"

View File

@@ -46,6 +46,7 @@ application_class::application_class() : should_quit_(false)
light_model_ = nullptr;
render_count_ = 0;
tab_was_pressed_ = false;
sound_system_ = nullptr;
}
application_class::~application_class()
@@ -503,8 +504,25 @@ bool application_class::initialize(int screenWidth, int screenHeight, HWND hwnd,
culling_active_ = true;
culling_thread_ = std::thread(&application_class::culling_thread_function, this);
FMOD_RESULT FMOD_result = FMOD::System_Create(&sound_system_);
std::string m_lastError;
if (FMOD_result != FMOD_OK) {
m_lastError = "<EFBFBD>chec de la cr<63>ation du syst<73>me FMOD: " + std::to_string(FMOD_result);
return false;
}
FMOD_result = sound_system_->init(512, FMOD_INIT_NORMAL | FMOD_INIT_3D_RIGHTHANDED, nullptr);
if (FMOD_result != FMOD_OK) {
m_lastError = "<EFBFBD>chec de l'initialisation du syst<73>me FMOD: " + std::to_string(FMOD_result);
sound_system_->release();
sound_system_ = nullptr;
}
entity_manager_->SetCamera(camera_);
entity_manager_->SetSoundSystem(sound_system_);
entity_manager_->SetDevice(direct_3d_->get_device());
entity_manager_->SetContext(direct_3d_->get_device_context());
}

View File

@@ -49,6 +49,50 @@ imguiManager::~imguiManager()
{
}
bool imguiManager::IncrementBuildVersionInConfig(const std::string& filepath) {
std::ifstream file_in(filepath);
if (!file_in) return false; // fichier introuvable
std::vector<std::string> lines;
std::string line;
// Lire toutes les lignes pour les manipuler
while (std::getline(file_in, line)) {
if (line.find("VER=") == 0) {
// Extraire la version actuelle
std::string ver_str = line.substr(4);
try {
BUILD_VERSION_VER = std::stoi(ver_str);
if (BUILD_VERSION_STATE == "Dev")
{
BUILD_VERSION_VER += 1;
line = "VER=" + std::to_string(BUILD_VERSION_VER);
}
} catch (...) {
return false; // erreur conversion
}
}
lines.push_back(line);
}
file_in.close();
// Si pas trouvé VER=, on l'ajoute
if (BUILD_VERSION_VER == -1) {
BUILD_VERSION_VER = 0;
lines.push_back("VER=0");
}
// Réécrire tout le fichier
std::ofstream file_out(filepath, std::ios::trunc);
if (!file_out) return false;
for (const auto& l : lines) {
file_out << l << "\n";
}
file_out.close();
return true;
}
bool imguiManager::Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceContext* deviceContext)
{
Logger::Get().Log("Initializing imgui", __FILE__, __LINE__, Logger::LogLevel::Initialize);
@@ -186,6 +230,40 @@ bool imguiManager::Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceConte
total_vertex_count_ = stats_->get_vertex_count_ptr();
entity_manager_ = app_->get_entity_manager();
// Get the exe parent directory to find config.txt ../exefolder
char exePath[MAX_PATH];
GetModuleFileNameA(NULL, exePath, MAX_PATH);
std::string exeDir = std::string(exePath);
// Retirer la partie exe filename (tout après le dernier slash)
size_t lastSlash = exeDir.find_last_of("\\/");
if (lastSlash != std::string::npos) {
exeDir = exeDir.substr(0, lastSlash);
} else {
exeDir = "";
}
// Retirer encore le dernier dossier (rebrousser dans le parent) : aller dans le dossier parent
lastSlash = exeDir.find_last_of("\\/");
if (lastSlash != std::string::npos) {
exeDir = exeDir.substr(0, lastSlash + 1); // garder slash de fin pour concat
} else {
exeDir = "";
}
std::string configPath = "config.txt"; // ou chemin complet
configPath = exeDir + BUILD_VERSION_TYPE + "\\" + configPath;
if (!IncrementBuildVersionInConfig(configPath)) {
Logger::Get().Log("Failed to increment build version in config.txt", __FILE__, __LINE__, Logger::LogLevel::Warning);
}
// update the build version text in the inverse build type folder
configPath = "config.txt";
configPath = exeDir + BUILD_VERSION_INVERSE + "\\" + configPath;
Logger::Get().Log("Inverse build type config path: " + configPath, __FILE__, __LINE__, Logger::LogLevel::Info);
if (!IncrementBuildVersionInConfig(configPath)) {
Logger::Get().Log("Failed to increment build version in config.txt of inverse build type", __FILE__, __LINE__, Logger::LogLevel::Warning);
}
Logger::Get().Log("imgui initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
@@ -276,6 +354,44 @@ void imguiManager::SetupDockspace() {
ImGui::EndMenu();
}
const float PAD_X = 14.0f;
float menuBarHeight = ImGui::GetFrameHeight();
std::string versionText = std::string("Build-") + BUILD_VERSION_TYPE + "-" +
std::to_string(BUILD_VERSION_MAJOR) + "." +
std::to_string(BUILD_VERSION_MINOR) + "." +
std::to_string(BUILD_VERSION_PATCH) + "." +
std::to_string(BUILD_VERSION_VER) + "-" +
BUILD_VERSION_STATE;
ImVec2 textSize = ImGui::CalcTextSize(versionText.c_str());
float windowWidth = ImGui::GetWindowContentRegionMax().x;
// Rectangle ajusté parfaitement à la hauteur
float rectWidth = textSize.x + PAD_X * 2;
float rectX = ImGui::GetWindowPos().x + windowWidth - rectWidth - 10.0f; // marge droite
float rectY = ImGui::GetWindowPos().y;
float offsetX = textSize.x * 0.2f;
ImVec2 rectMin(rectX - offsetX, rectY);
ImVec2 rectMax(rectX + rectWidth - offsetX, rectY + menuBarHeight);
// Fond arrondi parfaitement aligné avec la barre
ImGui::GetForegroundDrawList()->AddRectFilled(
rectMin, rectMax, DEBUG_MODE_COLOR, menuBarHeight / 2.0f
);
// Texte centré verticalement dans le rectangle
ImVec2 textPos(
rectMin.x + PAD_X,
rectMin.y + (menuBarHeight - textSize.y) / 2.0f
);
ImGui::GetForegroundDrawList()->AddText(
ImGui::GetFont(), ImGui::GetFontSize(),
textPos, IM_COL32(255,255,255,255), versionText.c_str()
);
ImGui::EndMenuBar();
}
@@ -555,64 +671,33 @@ void imguiManager::WidgetInspectorWindow()
}
ImGui::SameLine();
if (ImGui::Button("Add Component"))
{
if (ImGui::Button("Add Component")) {
ImGui::OpenPopup("AddComponentPopup");
}
if (ImGui::BeginPopup("AddComponentPopup"))
{
if (ImGui::BeginPopup("AddComponentPopup")) {
ImGui::Text("Select Component to Add:");
ImGui::Separator();
if (ImGui::MenuItem("Transform Component"))
{
if (!entity->HasComponent<ecs::TransformComponent>())
{
entity->AddComponent<ecs::TransformComponent>();
ComponentEntry componentsEntry[] = {
{"Transform Component", [&]() { if (!entity->HasComponent<ecs::TransformComponent>()) entity->AddComponent<ecs::TransformComponent>(); }},
{"Model Path Component", [&]() { if (!entity->HasComponent<ecs::ModelPathComponent>()) entity->AddComponent<ecs::ModelPathComponent>(); }},
{"Audio Component", [&]() { if (!entity->HasComponent<ecs::AudioComponent>()) entity->AddComponent<ecs::AudioComponent>(); }},
{"Physics Component", [&]() { if (!entity->HasComponent<ecs::PhysicsComponent>()) entity->AddComponent<ecs::PhysicsComponent>(); }},
{"Render Component", [&]() { if (!entity->HasComponent<ecs::RenderComponent>()) entity->AddComponent<ecs::RenderComponent>(); }},
{"Shader Component", [&]() { if (!entity->HasComponent<ecs::ShaderComponent>()) entity->AddComponent<ecs::ShaderComponent>(); }},
{"Lua Script Component", [&]() { if (!entity->HasComponent<ecs::LuaScriptComponent>()) entity->AddComponent<ecs::LuaScriptComponent>(); }},
{"Identity Component", [&]() { if (!entity->HasComponent<ecs::IdentityComponent>()) entity->AddComponent<ecs::IdentityComponent>(); }}
// Ajouter d'autres composants ici
};
for (auto& comp : componentsEntry) {
if (ImGui::MenuItem(comp.name)) {
comp.addFunc();
ImGui::CloseCurrentPopup();
}
ImGui::CloseCurrentPopup();
}
if (ImGui::MenuItem("Model Path Component"))
{
if (!entity->HasComponent<ecs::ModelPathComponent>())
{
entity->AddComponent<ecs::ModelPathComponent>();
}
ImGui::CloseCurrentPopup();
}
if (ImGui::MenuItem("Audio Component"))
{
if (!entity->HasComponent<ecs::AudioComponent>())
{
entity->AddComponent<ecs::AudioComponent>();
}
ImGui::CloseCurrentPopup();
}
if (ImGui::MenuItem("Physics Component"))
{
if (!entity->HasComponent<ecs::PhysicsComponent>())
{
entity->AddComponent<ecs::PhysicsComponent>();
}
ImGui::CloseCurrentPopup();
}
if (ImGui::MenuItem("Render Component"))
{
if (!entity->HasComponent<ecs::RenderComponent>())
{
entity->AddComponent<ecs::RenderComponent>();
}
ImGui::CloseCurrentPopup();
}
if (ImGui::MenuItem("Shader Component"))
{
if (!entity->HasComponent<ecs::ShaderComponent>())
{
entity->AddComponent<ecs::ShaderComponent>();
}
ImGui::CloseCurrentPopup();
}
ImGui::EndPopup();
}

View File

@@ -279,6 +279,7 @@ bool model_class::LoadObjModel(char* filename)
{
XMFLOAT3 pos;
sscanf_s(line.c_str() + 2, "%f %f %f", &pos.x, &pos.y, &pos.z);
pos.z = -pos.z; // Inversion de l'axe Z pour DirectX
temp_positions.push_back(pos);
}
else if (line[1] == 't') // Coordonn<6E>es de texture
@@ -313,19 +314,19 @@ bool model_class::LoadObjModel(char* filename)
if (normIndex[i] < 0) normIndex[i] += temp_normals.size() + 1;
}
for (int i = 0; i < 3; i++)
{
ModelType vertex{};
vertex.x = temp_positions[posIndex[i] - 1].x;
vertex.y = temp_positions[posIndex[i] - 1].y;
vertex.z = temp_positions[posIndex[i] - 1].z;
vertex.tu = temp_texcoords[texIndex[i] - 1].x;
vertex.tv = temp_texcoords[texIndex[i] - 1].y;
vertex.nx = temp_normals[normIndex[i] - 1].x;
vertex.ny = temp_normals[normIndex[i] - 1].y;
vertex.nz = temp_normals[normIndex[i] - 1].z;
temp_model.push_back(vertex);
}
for (int i = 2; i >= 0; --i)
{
ModelType vertex{};
vertex.x = temp_positions[posIndex[i] - 1].x;
vertex.y = temp_positions[posIndex[i] - 1].y;
vertex.z = temp_positions[posIndex[i] - 1].z;
vertex.tu = temp_texcoords[texIndex[i] - 1].x;
vertex.tv = temp_texcoords[texIndex[i] - 1].y;
vertex.nx = temp_normals[normIndex[i] - 1].x;
vertex.ny = temp_normals[normIndex[i] - 1].y;
vertex.nz = temp_normals[normIndex[i] - 1].z;
temp_model.push_back(vertex);
}
}
}

View File

@@ -153,96 +153,60 @@ bool scene_manager::load_scene() {
// Finaliser l'entit<69> - chargement du mod<6F>le si n<>cessaire
if (currentEntity) {
auto modelPathComponent = currentEntity->GetComponent<ecs::ModelPathComponent>();
if (modelPathComponent && !modelPathComponent->GetPath().empty()) {
std::wstring modelPath = modelPathComponent->GetPath();
std::string modelKey = convert_w_string_to_string(modelPath);
if (!modelPathComponent) {
Logger::Get().Log("ModelPathComponent missing for entity ID: " + std::to_string(currentEntity->GetID()), __FILE__, __LINE__, Logger::LogLevel::Warning);
}
if (!modelPathComponent || modelPathComponent->GetPath().empty()) {
Logger::Get().Log("No model path specified for entity ID: " + std::to_string(currentEntity->GetID()), __FILE__, __LINE__, Logger::LogLevel::Warning);
}
auto renderComponent = currentEntity->GetComponent<ecs::RenderComponent>();
if (!renderComponent)
{
Logger::Get().Log("RenderComponent missing for entity ID: " + std::to_string(currentEntity->GetID()), __FILE__, __LINE__, Logger::LogLevel::Warning);
}
currentTextures = renderComponent->GetTextureContainerBuffer();
std::wstring modelPath = modelPathComponent->GetPath();
std::string modelKey = convert_w_string_to_string(modelPath);
// V<>rifier si le mod<6F>le existe dans le cache
std::shared_ptr<model_class> model;
auto it = modelCache.find(modelKey);
if (it != modelCache.end()) {
model = it->second;
} else {
// Cr<43>er et initialiser un nouveau mod<6F>le
model = std::make_shared<model_class>();
// V<>rifier si le mod<6F>le existe dans le cache
std::shared_ptr<model_class> model;
auto it = modelCache.find(modelKey);
if (it != modelCache.end()) {
model = it->second;
} else {
// Cr<43>er et initialiser un nouveau mod<6F>le
model = std::make_shared<model_class>();
// Pr<50>charger les textures
if (!model->PreloadTextures(direct_3d_->get_device(), direct_3d_->get_device_context(), currentTextures)) {
Logger::Get().Log("<EFBFBD>chec du pr<70>chargement des textures", __FILE__, __LINE__, Logger::LogLevel::Error);
}
char modelFilename[256];
size_t convertedChars = 0;
wcstombs_s(&convertedChars, modelFilename, sizeof(modelFilename), modelPath.c_str(), _TRUNCATE);
if (!model->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, currentTextures)) {
Logger::Get().Log("<EFBFBD>chec d'initialisation du mod<6F>le", __FILE__, __LINE__, Logger::LogLevel::Error);
} else {
// Ajouter au cache
modelCache[modelKey] = model;
}
// Pr<50>charger les textures
if (!model->PreloadTextures(direct_3d_->get_device(), direct_3d_->get_device_context(), currentTextures)) {
Logger::Get().Log("<EFBFBD>chec du pr<70>chargement des textures", __FILE__, __LINE__, Logger::LogLevel::Error);
}
// Ajouter le composant de rendu avec le mod<6F>le
if (model) {
auto renderComponent = currentEntity->GetComponent<ecs::RenderComponent>();
if (!renderComponent) {
renderComponent = currentEntity->AddComponent<ecs::RenderComponent>();
}
renderComponent->InitializeWithModel(model);
char modelFilename[256];
size_t convertedChars = 0;
wcstombs_s(&convertedChars, modelFilename, sizeof(modelFilename), modelPath.c_str(), _TRUNCATE);
if (!model->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, currentTextures)) {
Logger::Get().Log("<EFBFBD>chec d'initialisation du mod<6F>le", __FILE__, __LINE__, Logger::LogLevel::Error);
} else {
// Ajouter au cache
modelCache[modelKey] = model;
}
}
// Ajouter le composant de rendu avec le mod<6F>le
if (model) renderComponent->InitializeWithModel(model);
}
currentEntity = nullptr;
}
else if (!line.empty() && line.find("TextureData:") == 0) {
Logger::Get().Log(line.substr(11), __FILE__, __LINE__, Logger::LogLevel::Info);
if (currentEntity) {
std::stringstream ss(line.substr(11));
std::string token;
// log the token values for debugging
Logger::Get().Log( token, __FILE__, __LINE__, Logger::LogLevel::Info);
std::getline(ss, token, ':');
// Diffuse
int diffuseCount = 0;
if (std::getline(ss, token, ':') && !token.empty())
diffuseCount = std::stoi(token);
for (int i = 0; i < diffuseCount; i++) {
if (std::getline(ss, token, ':'))
currentTextures.diffusePaths.push_back(std::wstring(token.begin(), token.end()));
}
// Normal
int normalCount = 0;
if (std::getline(ss, token, ':') && !token.empty())
normalCount = std::stoi(token);
for (int i = 0; i < normalCount; i++) {
if (std::getline(ss, token, ':'))
currentTextures.normalPaths.push_back(std::wstring(token.begin(), token.end()));
}
// Textures sp<73>culaires
int specularCount = 0;
if (std::getline(ss, token, ':') && !token.empty())
specularCount = std::stoi(token);
for (int i = 0; i < specularCount; i++) {
if (std::getline(ss, token, ':'))
currentTextures.specularPaths.push_back(std::wstring(token.begin(), token.end()));
}
// Textures alpha
int alphaCount = 0;
if (std::getline(ss, token, ':') && !token.empty())
alphaCount = std::stoi(token);
for (int i = 0; i < alphaCount; i++) {
if (std::getline(ss, token, ':'))
currentTextures.alphaPaths.push_back(std::wstring(token.begin(), token.end()));
}
}
}
else if (currentEntity) {
// D<>terminer le type de composant
std::string componentType = line.substr(0, line.find(':'));
@@ -291,45 +255,6 @@ bool scene_manager::save_scene() {
}
}
// S<>rialiser les textures pour les composants de rendu
auto renderComponent = entity->GetComponent<ecs::RenderComponent>();
if (renderComponent && renderComponent->GetModel()) {
const auto& model = renderComponent->GetModel();
const auto& textureContainer = model->GetTextureContainer();
outFile << "TextureData:";
// Textures diffuses
const auto& diffusePaths = textureContainer.GetPaths(TextureType::Diffuse);
outFile << diffusePaths.size();
for (const auto& path : diffusePaths) {
outFile << ":" << convert_w_string_to_string(path);
}
// Textures normales
const auto& normalPaths = textureContainer.GetPaths(TextureType::Normal);
outFile << ":" << normalPaths.size();
for (const auto& path : normalPaths) {
outFile << ":" << convert_w_string_to_string(path);
}
// Textures sp<73>culaires
const auto& specularPaths = textureContainer.GetPaths(TextureType::Specular);
outFile << ":" << specularPaths.size();
for (const auto& path : specularPaths) {
outFile << ":" << convert_w_string_to_string(path);
}
// Textures alpha
const auto& alphaPaths = textureContainer.GetPaths(TextureType::Alpha);
outFile << ":" << alphaPaths.size();
for (const auto& path : alphaPaths) {
outFile << ":" << convert_w_string_to_string(path);
}
outFile << std::endl;
}
outFile << "EndEntity" << std::endl;
}

BIN
enginecustom/x64/Debug/lua54.dll (Stored with Git LFS) Normal file

Binary file not shown.

BIN
enginecustom/x64/Release/lua54.dll (Stored with Git LFS) Normal file

Binary file not shown.

BIN
x64/Debug/config.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
x64/Debug/lua54.dll (Stored with Git LFS) Normal file

Binary file not shown.

BIN
x64/Release/config.txt (Stored with Git LFS) Normal file

Binary file not shown.

BIN
x64/Release/lua54.dll (Stored with Git LFS) Normal file

Binary file not shown.