diff options
author | chai <chaifix@163.com> | 2019-03-25 23:46:59 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-03-25 23:46:59 +0800 |
commit | 03b3b8ae80559745f98ef94569b421adddeb441f (patch) | |
tree | 7bf46892fef7453d4c25172333bd4fbddb29ee16 | |
parent | 82956beb1fe17e1226327638c8ab22b5f5adfc1d (diff) |
*misc
109 files changed, 2922 insertions, 363 deletions
diff --git a/Build/Asura.Editor/Asura.Editor.vcxproj b/Build/Asura.Editor/Asura.Editor.vcxproj index cc38c61..3765ed4 100644 --- a/Build/Asura.Editor/Asura.Editor.vcxproj +++ b/Build/Asura.Editor/Asura.Editor.vcxproj @@ -122,6 +122,7 @@ <ClCompile Include="..\..\source\Asura.Editor\layout\horizontal_layout.cpp" /> <ClCompile Include="..\..\source\Asura.Editor\layout\vertical_layout.cpp" /> <ClCompile Include="..\..\source\Asura.Editor\main.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\widgets\binding\_button.cpp" /> <ClCompile Include="..\..\source\Asura.Editor\widgets\button.cpp" /> <ClCompile Include="..\..\source\Asura.Editor\widgets\checkbox.cpp" /> <ClCompile Include="..\..\source\Asura.Editor\widgets\hslider.cpp" /> @@ -134,6 +135,8 @@ <ClCompile Include="..\..\source\Asura.Editor\widgets\vslider.cpp" /> </ItemGroup> <ItemGroup> + <ClInclude Include="..\..\source\Asura.Editor\core\slot.h" /> + <ClInclude Include="..\..\source\Asura.Editor\core\signal.h" /> <ClInclude Include="..\..\source\Asura.Editor\dui_module.h" /> <ClInclude Include="..\..\source\Asura.Editor\editor.h" /> <ClInclude Include="..\..\source\Asura.Editor\layout\horizontal_layout.h" /> diff --git a/Build/Asura.Editor/Asura.Editor.vcxproj.filters b/Build/Asura.Editor/Asura.Editor.vcxproj.filters index 53931f0..8923f09 100644 --- a/Build/Asura.Editor/Asura.Editor.vcxproj.filters +++ b/Build/Asura.Editor/Asura.Editor.vcxproj.filters @@ -10,6 +10,12 @@ <Filter Include="core"> <UniqueIdentifier>{f67906bd-4f7c-4ac6-bca1-019617435a8b}</UniqueIdentifier> </Filter> + <Filter Include="widgets\binding"> + <UniqueIdentifier>{4be11763-e2f9-47a4-8947-5326a517e286}</UniqueIdentifier> + </Filter> + <Filter Include="script"> + <UniqueIdentifier>{48e88630-25b8-42f8-b76b-fa55bcce298d}</UniqueIdentifier> + </Filter> </ItemGroup> <ItemGroup> <ClCompile Include="..\..\source\Asura.Editor\widgets\button.cpp"> @@ -51,6 +57,9 @@ <ClCompile Include="..\..\source\Asura.Editor\editor.cpp" /> <ClCompile Include="..\..\source\Asura.Editor\main.cpp" /> <ClCompile Include="..\..\source\Asura.Editor\dui_module.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\widgets\binding\_button.cpp"> + <Filter>widgets\binding</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\source\Asura.Editor\widgets\button.h"> @@ -94,5 +103,11 @@ </ClInclude> <ClInclude Include="..\..\source\Asura.Editor\editor.h" /> <ClInclude Include="..\..\source\Asura.Editor\dui_module.h" /> + <ClInclude Include="..\..\source\Asura.Editor\core\signal.h"> + <Filter>core</Filter> + </ClInclude> + <ClInclude Include="..\..\source\Asura.Editor\core\slot.h"> + <Filter>core</Filter> + </ClInclude> </ItemGroup> </Project>
\ No newline at end of file diff --git a/Build/Asura.sln b/Build/Asura.sln index fa2e5ca..3bd9d61 100644 --- a/Build/Asura.sln +++ b/Build/Asura.sln @@ -77,10 +77,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asura-lib-json", "libs\asur EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asura-lib-xml", "libs\asura-lib-xml\asura-lib-xml.vcxproj", "{AB4F8F4A-73B5-4EFF-BD5D-448A3E39C60A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyxml2", "3rd-party\tinyxml2\tinyxml2.vcxproj", "{883BC26A-4C9E-44B3-B5C0-7F3E4EDC0226}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asura-lib-log", "libs\asura-lib-log\asura-lib-log.vcxproj", "{73B0F8AB-EF5A-412A-9E34-0FD2574766B7}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyxml", "3rd-party\tinyxml\tinyxml.vcxproj", "{9891C064-C897-424E-8EB6-CAD09812E032}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Preprocessor", "Preprocessor\Preprocessor.vcxproj", "{983F6496-7BB2-48E3-B8F4-68C2600EA315}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asura-lib-steam", "libs\asura-lib-steam\asura-lib-steam.vcxproj", "{129C3826-B418-4C80-A126-0319C7E2A857}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "05-physfs", "tests\05-physfs\05-physfs.vcxproj", "{5BECAAB3-9C80-4A62-99BB-E48F4667D9CD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -361,14 +367,6 @@ Global {AB4F8F4A-73B5-4EFF-BD5D-448A3E39C60A}.Release|x64.Build.0 = Release|x64 {AB4F8F4A-73B5-4EFF-BD5D-448A3E39C60A}.Release|x86.ActiveCfg = Release|Win32 {AB4F8F4A-73B5-4EFF-BD5D-448A3E39C60A}.Release|x86.Build.0 = Release|Win32 - {883BC26A-4C9E-44B3-B5C0-7F3E4EDC0226}.Debug|x64.ActiveCfg = Debug|x64 - {883BC26A-4C9E-44B3-B5C0-7F3E4EDC0226}.Debug|x64.Build.0 = Debug|x64 - {883BC26A-4C9E-44B3-B5C0-7F3E4EDC0226}.Debug|x86.ActiveCfg = Debug|Win32 - {883BC26A-4C9E-44B3-B5C0-7F3E4EDC0226}.Debug|x86.Build.0 = Debug|Win32 - {883BC26A-4C9E-44B3-B5C0-7F3E4EDC0226}.Release|x64.ActiveCfg = Release|x64 - {883BC26A-4C9E-44B3-B5C0-7F3E4EDC0226}.Release|x64.Build.0 = Release|x64 - {883BC26A-4C9E-44B3-B5C0-7F3E4EDC0226}.Release|x86.ActiveCfg = Release|Win32 - {883BC26A-4C9E-44B3-B5C0-7F3E4EDC0226}.Release|x86.Build.0 = Release|Win32 {73B0F8AB-EF5A-412A-9E34-0FD2574766B7}.Debug|x64.ActiveCfg = Debug|x64 {73B0F8AB-EF5A-412A-9E34-0FD2574766B7}.Debug|x64.Build.0 = Debug|x64 {73B0F8AB-EF5A-412A-9E34-0FD2574766B7}.Debug|x86.ActiveCfg = Debug|Win32 @@ -377,6 +375,38 @@ Global {73B0F8AB-EF5A-412A-9E34-0FD2574766B7}.Release|x64.Build.0 = Release|x64 {73B0F8AB-EF5A-412A-9E34-0FD2574766B7}.Release|x86.ActiveCfg = Release|Win32 {73B0F8AB-EF5A-412A-9E34-0FD2574766B7}.Release|x86.Build.0 = Release|Win32 + {9891C064-C897-424E-8EB6-CAD09812E032}.Debug|x64.ActiveCfg = Debug|x64 + {9891C064-C897-424E-8EB6-CAD09812E032}.Debug|x64.Build.0 = Debug|x64 + {9891C064-C897-424E-8EB6-CAD09812E032}.Debug|x86.ActiveCfg = Debug|Win32 + {9891C064-C897-424E-8EB6-CAD09812E032}.Debug|x86.Build.0 = Debug|Win32 + {9891C064-C897-424E-8EB6-CAD09812E032}.Release|x64.ActiveCfg = Release|x64 + {9891C064-C897-424E-8EB6-CAD09812E032}.Release|x64.Build.0 = Release|x64 + {9891C064-C897-424E-8EB6-CAD09812E032}.Release|x86.ActiveCfg = Release|Win32 + {9891C064-C897-424E-8EB6-CAD09812E032}.Release|x86.Build.0 = Release|Win32 + {983F6496-7BB2-48E3-B8F4-68C2600EA315}.Debug|x64.ActiveCfg = Debug|x64 + {983F6496-7BB2-48E3-B8F4-68C2600EA315}.Debug|x64.Build.0 = Debug|x64 + {983F6496-7BB2-48E3-B8F4-68C2600EA315}.Debug|x86.ActiveCfg = Debug|Win32 + {983F6496-7BB2-48E3-B8F4-68C2600EA315}.Debug|x86.Build.0 = Debug|Win32 + {983F6496-7BB2-48E3-B8F4-68C2600EA315}.Release|x64.ActiveCfg = Release|x64 + {983F6496-7BB2-48E3-B8F4-68C2600EA315}.Release|x64.Build.0 = Release|x64 + {983F6496-7BB2-48E3-B8F4-68C2600EA315}.Release|x86.ActiveCfg = Release|Win32 + {983F6496-7BB2-48E3-B8F4-68C2600EA315}.Release|x86.Build.0 = Release|Win32 + {129C3826-B418-4C80-A126-0319C7E2A857}.Debug|x64.ActiveCfg = Debug|x64 + {129C3826-B418-4C80-A126-0319C7E2A857}.Debug|x64.Build.0 = Debug|x64 + {129C3826-B418-4C80-A126-0319C7E2A857}.Debug|x86.ActiveCfg = Debug|Win32 + {129C3826-B418-4C80-A126-0319C7E2A857}.Debug|x86.Build.0 = Debug|Win32 + {129C3826-B418-4C80-A126-0319C7E2A857}.Release|x64.ActiveCfg = Release|x64 + {129C3826-B418-4C80-A126-0319C7E2A857}.Release|x64.Build.0 = Release|x64 + {129C3826-B418-4C80-A126-0319C7E2A857}.Release|x86.ActiveCfg = Release|Win32 + {129C3826-B418-4C80-A126-0319C7E2A857}.Release|x86.Build.0 = Release|Win32 + {5BECAAB3-9C80-4A62-99BB-E48F4667D9CD}.Debug|x64.ActiveCfg = Debug|x64 + {5BECAAB3-9C80-4A62-99BB-E48F4667D9CD}.Debug|x64.Build.0 = Debug|x64 + {5BECAAB3-9C80-4A62-99BB-E48F4667D9CD}.Debug|x86.ActiveCfg = Debug|Win32 + {5BECAAB3-9C80-4A62-99BB-E48F4667D9CD}.Debug|x86.Build.0 = Debug|Win32 + {5BECAAB3-9C80-4A62-99BB-E48F4667D9CD}.Release|x64.ActiveCfg = Release|x64 + {5BECAAB3-9C80-4A62-99BB-E48F4667D9CD}.Release|x64.Build.0 = Release|x64 + {5BECAAB3-9C80-4A62-99BB-E48F4667D9CD}.Release|x86.ActiveCfg = Release|Win32 + {5BECAAB3-9C80-4A62-99BB-E48F4667D9CD}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -411,8 +441,10 @@ Global {38090AEB-3AA9-489B-BBEC-0CEDF9EAC0DE} = {E068D138-C824-4365-B5A3-27C65E8FD0B5} {1B83A353-9694-42E0-997E-79E150E1C2E5} = {CD115016-E377-4AC1-8595-DB2836CEFE7E} {AB4F8F4A-73B5-4EFF-BD5D-448A3E39C60A} = {CD115016-E377-4AC1-8595-DB2836CEFE7E} - {883BC26A-4C9E-44B3-B5C0-7F3E4EDC0226} = {64D4E4B2-4A60-46F4-A500-370EFED4524F} {73B0F8AB-EF5A-412A-9E34-0FD2574766B7} = {CD115016-E377-4AC1-8595-DB2836CEFE7E} + {9891C064-C897-424E-8EB6-CAD09812E032} = {64D4E4B2-4A60-46F4-A500-370EFED4524F} + {129C3826-B418-4C80-A126-0319C7E2A857} = {CD115016-E377-4AC1-8595-DB2836CEFE7E} + {5BECAAB3-9C80-4A62-99BB-E48F4667D9CD} = {E068D138-C824-4365-B5A3-27C65E8FD0B5} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {331032D8-F7CC-43E3-A03B-67108767F96B} diff --git a/Source/Asura.Editor/Scripts/main.lua b/Source/Asura.Editor/Scripts/main.lua index a513f87..76fab7a 100644 --- a/Source/Asura.Editor/Scripts/main.lua +++ b/Source/Asura.Editor/Scripts/main.lua @@ -1,5 +1,4 @@ -local Editor = require("Asura.Editor") --༭ ---༭Asura.Editor/Scriptsʵ +--༭Asura.Editor/scriptsʵ diff --git a/Source/Asura.Editor/Scripts/scene_view.lua b/Source/Asura.Editor/Scripts/scene_view.lua index ff96b2c..db4790f 100644 --- a/Source/Asura.Editor/Scripts/scene_view.lua +++ b/Source/Asura.Editor/Scripts/scene_view.lua @@ -1,2 +1 @@ -- 场景窗口 - diff --git a/Source/Asura.Editor/scripts/main.lua b/Source/Asura.Editor/scripts/main.lua index a513f87..76fab7a 100644 --- a/Source/Asura.Editor/scripts/main.lua +++ b/Source/Asura.Editor/scripts/main.lua @@ -1,5 +1,4 @@ -local Editor = require("Asura.Editor") --༭ ---༭Asura.Editor/Scriptsʵ +--༭Asura.Editor/scriptsʵ diff --git a/Source/Asura.Editor/scripts/scene_view.lua b/Source/Asura.Editor/scripts/scene_view.lua index ff96b2c..db4790f 100644 --- a/Source/Asura.Editor/scripts/scene_view.lua +++ b/Source/Asura.Editor/scripts/scene_view.lua @@ -1,2 +1 @@ -- 场景窗口 - diff --git a/bin/win64/02-luax.exe b/bin/win64/02-luax.exe Binary files differindex 6a06082..f9d8dc4 100644 --- a/bin/win64/02-luax.exe +++ b/bin/win64/02-luax.exe diff --git a/build/3rd-party/tinyxml/tinyxml.vcxproj b/build/3rd-party/tinyxml/tinyxml.vcxproj new file mode 100644 index 0000000..ae84c61 --- /dev/null +++ b/build/3rd-party/tinyxml/tinyxml.vcxproj @@ -0,0 +1,122 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <VCProjectVersion>15.0</VCProjectVersion> + <ProjectGuid>{9891C064-C897-424E-8EB6-CAD09812E032}</ProjectGuid> + <RootNamespace>tinyxml</RootNamespace> + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="Shared"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup /> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + <Link> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + <Link> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/build/3rd-party/tinyxml/tinyxml.vcxproj.filters b/build/3rd-party/tinyxml/tinyxml.vcxproj.filters new file mode 100644 index 0000000..3c6f4fd --- /dev/null +++ b/build/3rd-party/tinyxml/tinyxml.vcxproj.filters @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="源文件"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="头文件"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions> + </Filter> + <Filter Include="资源文件"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> + </Filter> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/build/3rd-party/tinyxml/tinyxml.vcxproj.user b/build/3rd-party/tinyxml/tinyxml.vcxproj.user new file mode 100644 index 0000000..be25078 --- /dev/null +++ b/build/3rd-party/tinyxml/tinyxml.vcxproj.user @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup /> +</Project>
\ No newline at end of file diff --git a/build/Asura.Editor/Asura.Editor.vcxproj b/build/Asura.Editor/Asura.Editor.vcxproj index cc38c61..3765ed4 100644 --- a/build/Asura.Editor/Asura.Editor.vcxproj +++ b/build/Asura.Editor/Asura.Editor.vcxproj @@ -122,6 +122,7 @@ <ClCompile Include="..\..\source\Asura.Editor\layout\horizontal_layout.cpp" /> <ClCompile Include="..\..\source\Asura.Editor\layout\vertical_layout.cpp" /> <ClCompile Include="..\..\source\Asura.Editor\main.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\widgets\binding\_button.cpp" /> <ClCompile Include="..\..\source\Asura.Editor\widgets\button.cpp" /> <ClCompile Include="..\..\source\Asura.Editor\widgets\checkbox.cpp" /> <ClCompile Include="..\..\source\Asura.Editor\widgets\hslider.cpp" /> @@ -134,6 +135,8 @@ <ClCompile Include="..\..\source\Asura.Editor\widgets\vslider.cpp" /> </ItemGroup> <ItemGroup> + <ClInclude Include="..\..\source\Asura.Editor\core\slot.h" /> + <ClInclude Include="..\..\source\Asura.Editor\core\signal.h" /> <ClInclude Include="..\..\source\Asura.Editor\dui_module.h" /> <ClInclude Include="..\..\source\Asura.Editor\editor.h" /> <ClInclude Include="..\..\source\Asura.Editor\layout\horizontal_layout.h" /> diff --git a/build/Asura.Editor/Asura.Editor.vcxproj.filters b/build/Asura.Editor/Asura.Editor.vcxproj.filters index 53931f0..8923f09 100644 --- a/build/Asura.Editor/Asura.Editor.vcxproj.filters +++ b/build/Asura.Editor/Asura.Editor.vcxproj.filters @@ -10,6 +10,12 @@ <Filter Include="core"> <UniqueIdentifier>{f67906bd-4f7c-4ac6-bca1-019617435a8b}</UniqueIdentifier> </Filter> + <Filter Include="widgets\binding"> + <UniqueIdentifier>{4be11763-e2f9-47a4-8947-5326a517e286}</UniqueIdentifier> + </Filter> + <Filter Include="script"> + <UniqueIdentifier>{48e88630-25b8-42f8-b76b-fa55bcce298d}</UniqueIdentifier> + </Filter> </ItemGroup> <ItemGroup> <ClCompile Include="..\..\source\Asura.Editor\widgets\button.cpp"> @@ -51,6 +57,9 @@ <ClCompile Include="..\..\source\Asura.Editor\editor.cpp" /> <ClCompile Include="..\..\source\Asura.Editor\main.cpp" /> <ClCompile Include="..\..\source\Asura.Editor\dui_module.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\widgets\binding\_button.cpp"> + <Filter>widgets\binding</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\source\Asura.Editor\widgets\button.h"> @@ -94,5 +103,11 @@ </ClInclude> <ClInclude Include="..\..\source\Asura.Editor\editor.h" /> <ClInclude Include="..\..\source\Asura.Editor\dui_module.h" /> + <ClInclude Include="..\..\source\Asura.Editor\core\signal.h"> + <Filter>core</Filter> + </ClInclude> + <ClInclude Include="..\..\source\Asura.Editor\core\slot.h"> + <Filter>core</Filter> + </ClInclude> </ItemGroup> </Project>
\ No newline at end of file diff --git a/build/Asura.sln b/build/Asura.sln index fa2e5ca..3bd9d61 100644 --- a/build/Asura.sln +++ b/build/Asura.sln @@ -77,10 +77,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asura-lib-json", "libs\asur EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asura-lib-xml", "libs\asura-lib-xml\asura-lib-xml.vcxproj", "{AB4F8F4A-73B5-4EFF-BD5D-448A3E39C60A}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyxml2", "3rd-party\tinyxml2\tinyxml2.vcxproj", "{883BC26A-4C9E-44B3-B5C0-7F3E4EDC0226}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asura-lib-log", "libs\asura-lib-log\asura-lib-log.vcxproj", "{73B0F8AB-EF5A-412A-9E34-0FD2574766B7}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyxml", "3rd-party\tinyxml\tinyxml.vcxproj", "{9891C064-C897-424E-8EB6-CAD09812E032}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Preprocessor", "Preprocessor\Preprocessor.vcxproj", "{983F6496-7BB2-48E3-B8F4-68C2600EA315}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asura-lib-steam", "libs\asura-lib-steam\asura-lib-steam.vcxproj", "{129C3826-B418-4C80-A126-0319C7E2A857}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "05-physfs", "tests\05-physfs\05-physfs.vcxproj", "{5BECAAB3-9C80-4A62-99BB-E48F4667D9CD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -361,14 +367,6 @@ Global {AB4F8F4A-73B5-4EFF-BD5D-448A3E39C60A}.Release|x64.Build.0 = Release|x64 {AB4F8F4A-73B5-4EFF-BD5D-448A3E39C60A}.Release|x86.ActiveCfg = Release|Win32 {AB4F8F4A-73B5-4EFF-BD5D-448A3E39C60A}.Release|x86.Build.0 = Release|Win32 - {883BC26A-4C9E-44B3-B5C0-7F3E4EDC0226}.Debug|x64.ActiveCfg = Debug|x64 - {883BC26A-4C9E-44B3-B5C0-7F3E4EDC0226}.Debug|x64.Build.0 = Debug|x64 - {883BC26A-4C9E-44B3-B5C0-7F3E4EDC0226}.Debug|x86.ActiveCfg = Debug|Win32 - {883BC26A-4C9E-44B3-B5C0-7F3E4EDC0226}.Debug|x86.Build.0 = Debug|Win32 - {883BC26A-4C9E-44B3-B5C0-7F3E4EDC0226}.Release|x64.ActiveCfg = Release|x64 - {883BC26A-4C9E-44B3-B5C0-7F3E4EDC0226}.Release|x64.Build.0 = Release|x64 - {883BC26A-4C9E-44B3-B5C0-7F3E4EDC0226}.Release|x86.ActiveCfg = Release|Win32 - {883BC26A-4C9E-44B3-B5C0-7F3E4EDC0226}.Release|x86.Build.0 = Release|Win32 {73B0F8AB-EF5A-412A-9E34-0FD2574766B7}.Debug|x64.ActiveCfg = Debug|x64 {73B0F8AB-EF5A-412A-9E34-0FD2574766B7}.Debug|x64.Build.0 = Debug|x64 {73B0F8AB-EF5A-412A-9E34-0FD2574766B7}.Debug|x86.ActiveCfg = Debug|Win32 @@ -377,6 +375,38 @@ Global {73B0F8AB-EF5A-412A-9E34-0FD2574766B7}.Release|x64.Build.0 = Release|x64 {73B0F8AB-EF5A-412A-9E34-0FD2574766B7}.Release|x86.ActiveCfg = Release|Win32 {73B0F8AB-EF5A-412A-9E34-0FD2574766B7}.Release|x86.Build.0 = Release|Win32 + {9891C064-C897-424E-8EB6-CAD09812E032}.Debug|x64.ActiveCfg = Debug|x64 + {9891C064-C897-424E-8EB6-CAD09812E032}.Debug|x64.Build.0 = Debug|x64 + {9891C064-C897-424E-8EB6-CAD09812E032}.Debug|x86.ActiveCfg = Debug|Win32 + {9891C064-C897-424E-8EB6-CAD09812E032}.Debug|x86.Build.0 = Debug|Win32 + {9891C064-C897-424E-8EB6-CAD09812E032}.Release|x64.ActiveCfg = Release|x64 + {9891C064-C897-424E-8EB6-CAD09812E032}.Release|x64.Build.0 = Release|x64 + {9891C064-C897-424E-8EB6-CAD09812E032}.Release|x86.ActiveCfg = Release|Win32 + {9891C064-C897-424E-8EB6-CAD09812E032}.Release|x86.Build.0 = Release|Win32 + {983F6496-7BB2-48E3-B8F4-68C2600EA315}.Debug|x64.ActiveCfg = Debug|x64 + {983F6496-7BB2-48E3-B8F4-68C2600EA315}.Debug|x64.Build.0 = Debug|x64 + {983F6496-7BB2-48E3-B8F4-68C2600EA315}.Debug|x86.ActiveCfg = Debug|Win32 + {983F6496-7BB2-48E3-B8F4-68C2600EA315}.Debug|x86.Build.0 = Debug|Win32 + {983F6496-7BB2-48E3-B8F4-68C2600EA315}.Release|x64.ActiveCfg = Release|x64 + {983F6496-7BB2-48E3-B8F4-68C2600EA315}.Release|x64.Build.0 = Release|x64 + {983F6496-7BB2-48E3-B8F4-68C2600EA315}.Release|x86.ActiveCfg = Release|Win32 + {983F6496-7BB2-48E3-B8F4-68C2600EA315}.Release|x86.Build.0 = Release|Win32 + {129C3826-B418-4C80-A126-0319C7E2A857}.Debug|x64.ActiveCfg = Debug|x64 + {129C3826-B418-4C80-A126-0319C7E2A857}.Debug|x64.Build.0 = Debug|x64 + {129C3826-B418-4C80-A126-0319C7E2A857}.Debug|x86.ActiveCfg = Debug|Win32 + {129C3826-B418-4C80-A126-0319C7E2A857}.Debug|x86.Build.0 = Debug|Win32 + {129C3826-B418-4C80-A126-0319C7E2A857}.Release|x64.ActiveCfg = Release|x64 + {129C3826-B418-4C80-A126-0319C7E2A857}.Release|x64.Build.0 = Release|x64 + {129C3826-B418-4C80-A126-0319C7E2A857}.Release|x86.ActiveCfg = Release|Win32 + {129C3826-B418-4C80-A126-0319C7E2A857}.Release|x86.Build.0 = Release|Win32 + {5BECAAB3-9C80-4A62-99BB-E48F4667D9CD}.Debug|x64.ActiveCfg = Debug|x64 + {5BECAAB3-9C80-4A62-99BB-E48F4667D9CD}.Debug|x64.Build.0 = Debug|x64 + {5BECAAB3-9C80-4A62-99BB-E48F4667D9CD}.Debug|x86.ActiveCfg = Debug|Win32 + {5BECAAB3-9C80-4A62-99BB-E48F4667D9CD}.Debug|x86.Build.0 = Debug|Win32 + {5BECAAB3-9C80-4A62-99BB-E48F4667D9CD}.Release|x64.ActiveCfg = Release|x64 + {5BECAAB3-9C80-4A62-99BB-E48F4667D9CD}.Release|x64.Build.0 = Release|x64 + {5BECAAB3-9C80-4A62-99BB-E48F4667D9CD}.Release|x86.ActiveCfg = Release|Win32 + {5BECAAB3-9C80-4A62-99BB-E48F4667D9CD}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -411,8 +441,10 @@ Global {38090AEB-3AA9-489B-BBEC-0CEDF9EAC0DE} = {E068D138-C824-4365-B5A3-27C65E8FD0B5} {1B83A353-9694-42E0-997E-79E150E1C2E5} = {CD115016-E377-4AC1-8595-DB2836CEFE7E} {AB4F8F4A-73B5-4EFF-BD5D-448A3E39C60A} = {CD115016-E377-4AC1-8595-DB2836CEFE7E} - {883BC26A-4C9E-44B3-B5C0-7F3E4EDC0226} = {64D4E4B2-4A60-46F4-A500-370EFED4524F} {73B0F8AB-EF5A-412A-9E34-0FD2574766B7} = {CD115016-E377-4AC1-8595-DB2836CEFE7E} + {9891C064-C897-424E-8EB6-CAD09812E032} = {64D4E4B2-4A60-46F4-A500-370EFED4524F} + {129C3826-B418-4C80-A126-0319C7E2A857} = {CD115016-E377-4AC1-8595-DB2836CEFE7E} + {5BECAAB3-9C80-4A62-99BB-E48F4667D9CD} = {E068D138-C824-4365-B5A3-27C65E8FD0B5} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {331032D8-F7CC-43E3-A03B-67108767F96B} diff --git a/build/Preprocessor/Preprocessor.vcxproj b/build/Preprocessor/Preprocessor.vcxproj new file mode 100644 index 0000000..9fe75d2 --- /dev/null +++ b/build/Preprocessor/Preprocessor.vcxproj @@ -0,0 +1,122 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <VCProjectVersion>15.0</VCProjectVersion> + <ProjectGuid>{983F6496-7BB2-48E3-B8F4-68C2600EA315}</ProjectGuid> + <RootNamespace>Preprocessor</RootNamespace> + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="Shared"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup /> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + <Link> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + <Link> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/build/Preprocessor/Preprocessor.vcxproj.filters b/build/Preprocessor/Preprocessor.vcxproj.filters new file mode 100644 index 0000000..3c6f4fd --- /dev/null +++ b/build/Preprocessor/Preprocessor.vcxproj.filters @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="源文件"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="头文件"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions> + </Filter> + <Filter Include="资源文件"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> + </Filter> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/build/Preprocessor/Preprocessor.vcxproj.user b/build/Preprocessor/Preprocessor.vcxproj.user new file mode 100644 index 0000000..be25078 --- /dev/null +++ b/build/Preprocessor/Preprocessor.vcxproj.user @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup /> +</Project>
\ No newline at end of file diff --git a/build/libs/asura-lib-core/asura-lib-core.vcxproj b/build/libs/asura-lib-core/asura-lib-core.vcxproj index a5dd696..c19c581 100644 --- a/build/libs/asura-lib-core/asura-lib-core.vcxproj +++ b/build/libs/asura-lib-core/asura-lib-core.vcxproj @@ -126,16 +126,16 @@ <ClCompile Include="..\..\..\source\libs\asura-lib-core\font\glyph.cpp" /> <ClCompile Include="..\..\..\source\libs\asura-lib-core\font\string.cpp" /> <ClCompile Include="..\..\..\source\libs\asura-lib-core\font\ttf.cpp" /> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\canvas.binding.cpp" /> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\color.binding.cpp" /> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\gif.binding.cpp" /> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\image.binding.cpp" /> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\image_data.binding.cpp" /> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\mesh2d.binding.cpp" /> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\mesh2d_data.binding.cpp" /> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\shader.binding.cpp" /> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\sprite_batch.binding.cpp" /> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\window.binding.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\_canvas.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\_color.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\_gif.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\_image.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\_image_data.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\_mesh2d.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\_mesh2d_data.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\_shader.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\_sprite_batch.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\_window.cpp" /> <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\canvas.cpp" /> <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\color.cpp" /> <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\gif.cpp" /> @@ -158,7 +158,10 @@ <ClCompile Include="..\..\..\source\libs\asura-lib-core\input\keyboard.cpp" /> <ClCompile Include="..\..\..\source\libs\asura-lib-core\input\mouse.cpp" /> <ClCompile Include="..\..\..\source\libs\asura-lib-core\profiler\stats.cpp" /> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\stringmap.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\threading\binding\_coroutine.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\threading\binding\_thread.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\threading\coroutine.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\threading\thread.cpp" /> <ClCompile Include="..\..\..\source\libs\asura-lib-core\time\timer.cpp" /> </ItemGroup> <ItemGroup> @@ -198,13 +201,14 @@ <ClInclude Include="..\..\..\source\libs\asura-lib-core\graphics\window.h" /> <ClInclude Include="..\..\..\source\libs\asura-lib-core\input\clipboard.h" /> <ClInclude Include="..\..\..\source\libs\asura-lib-core\input\cursor.h" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-core\input\event.h" /> <ClInclude Include="..\..\..\source\libs\asura-lib-core\input\input_device.hpp" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-core\input\joypad.h" /> <ClInclude Include="..\..\..\source\libs\asura-lib-core\input\keyboard.h" /> <ClInclude Include="..\..\..\source\libs\asura-lib-core\input\mouse.h" /> - <ClInclude Include="..\..\..\source\libs\asura-lib-core\manager.hpp" /> <ClInclude Include="..\..\..\source\libs\asura-lib-core\profiler\stats.h" /> - <ClInclude Include="..\..\..\source\libs\asura-lib-core\singleton.hpp" /> - <ClInclude Include="..\..\..\source\libs\asura-lib-core\stringmap.hpp" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-core\threading\coroutine.h" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-core\threading\thread.h" /> <ClInclude Include="..\..\..\source\libs\asura-lib-core\time\timer.h" /> <ClInclude Include="..\..\..\source\libs\asura-lib-core\type.h" /> </ItemGroup> @@ -213,6 +217,7 @@ <None Include="..\..\..\source\libs\asura-lib-core\font\utf.inl" /> <None Include="..\..\..\source\libs\asura-lib-core\input\cursor.defs" /> <None Include="..\..\..\source\libs\asura-lib-core\input\keyboard.defs" /> + <None Include="..\..\..\source\libs\asura-lib-core\input\mouse.defs" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/build/libs/asura-lib-core/asura-lib-core.vcxproj.filters b/build/libs/asura-lib-core/asura-lib-core.vcxproj.filters index ae0aace..064cb2d 100644 --- a/build/libs/asura-lib-core/asura-lib-core.vcxproj.filters +++ b/build/libs/asura-lib-core/asura-lib-core.vcxproj.filters @@ -28,10 +28,15 @@ <Filter Include="client\glut"> <UniqueIdentifier>{c88e6733-13f6-4c25-9ffe-b162ad8b31cd}</UniqueIdentifier> </Filter> + <Filter Include="threading"> + <UniqueIdentifier>{d6f2001c-3947-4674-8793-f6d8c4aa8078}</UniqueIdentifier> + </Filter> + <Filter Include="threading\binding"> + <UniqueIdentifier>{ce11bd01-5b5c-4b5f-ad67-bd54db8b277c}</UniqueIdentifier> + </Filter> </ItemGroup> <ItemGroup> <ClCompile Include="..\..\..\source\libs\asura-lib-core\application.cpp" /> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\stringmap.cpp" /> <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\canvas.cpp"> <Filter>graphics</Filter> </ClCompile> @@ -83,36 +88,6 @@ <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\window.cpp"> <Filter>graphics</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\canvas.binding.cpp"> - <Filter>graphics\binding</Filter> - </ClCompile> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\color.binding.cpp"> - <Filter>graphics\binding</Filter> - </ClCompile> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\gif.binding.cpp"> - <Filter>graphics\binding</Filter> - </ClCompile> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\image.binding.cpp"> - <Filter>graphics\binding</Filter> - </ClCompile> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\image_data.binding.cpp"> - <Filter>graphics\binding</Filter> - </ClCompile> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\mesh2d.binding.cpp"> - <Filter>graphics\binding</Filter> - </ClCompile> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\mesh2d_data.binding.cpp"> - <Filter>graphics\binding</Filter> - </ClCompile> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\shader.binding.cpp"> - <Filter>graphics\binding</Filter> - </ClCompile> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\sprite_batch.binding.cpp"> - <Filter>graphics\binding</Filter> - </ClCompile> - <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\window.binding.cpp"> - <Filter>graphics\binding</Filter> - </ClCompile> <ClCompile Include="..\..\..\source\libs\asura-lib-core\input\clipboard.cpp"> <Filter>input</Filter> </ClCompile> @@ -153,12 +128,51 @@ <ClCompile Include="..\..\..\source\libs\asura-lib-core\client\sdl\sdl_thread.cpp"> <Filter>client\sdl</Filter> </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\_canvas.cpp"> + <Filter>graphics\binding</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\_color.cpp"> + <Filter>graphics\binding</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\_gif.cpp"> + <Filter>graphics\binding</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\_image.cpp"> + <Filter>graphics\binding</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\_image_data.cpp"> + <Filter>graphics\binding</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\_mesh2d.cpp"> + <Filter>graphics\binding</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\_mesh2d_data.cpp"> + <Filter>graphics\binding</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\_shader.cpp"> + <Filter>graphics\binding</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\_sprite_batch.cpp"> + <Filter>graphics\binding</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\graphics\binding\_window.cpp"> + <Filter>graphics\binding</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\threading\coroutine.cpp"> + <Filter>threading</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\threading\thread.cpp"> + <Filter>threading</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\threading\binding\_coroutine.cpp"> + <Filter>threading\binding</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-core\threading\binding\_thread.cpp"> + <Filter>threading\binding</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\..\source\libs\asura-lib-core\application.h" /> - <ClInclude Include="..\..\..\source\libs\asura-lib-core\manager.hpp" /> - <ClInclude Include="..\..\..\source\libs\asura-lib-core\singleton.hpp" /> - <ClInclude Include="..\..\..\source\libs\asura-lib-core\stringmap.hpp" /> <ClInclude Include="..\..\..\source\libs\asura-lib-core\graphics\blend_mode.h"> <Filter>graphics</Filter> </ClInclude> @@ -276,19 +290,34 @@ <Filter>client\sdl</Filter> </ClInclude> <ClInclude Include="..\..\..\source\libs\asura-lib-core\core_config.h" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-core\input\event.h"> + <Filter>input</Filter> + </ClInclude> + <ClInclude Include="..\..\..\source\libs\asura-lib-core\input\joypad.h"> + <Filter>input</Filter> + </ClInclude> + <ClInclude Include="..\..\..\source\libs\asura-lib-core\threading\coroutine.h"> + <Filter>threading</Filter> + </ClInclude> + <ClInclude Include="..\..\..\source\libs\asura-lib-core\threading\thread.h"> + <Filter>threading</Filter> + </ClInclude> </ItemGroup> <ItemGroup> + <None Include="..\..\..\source\libs\asura-lib-core\font\string.inl"> + <Filter>font</Filter> + </None> + <None Include="..\..\..\source\libs\asura-lib-core\font\utf.inl"> + <Filter>font</Filter> + </None> <None Include="..\..\..\source\libs\asura-lib-core\input\cursor.defs"> <Filter>input</Filter> </None> <None Include="..\..\..\source\libs\asura-lib-core\input\keyboard.defs"> <Filter>input</Filter> </None> - <None Include="..\..\..\source\libs\asura-lib-core\font\string.inl"> - <Filter>font</Filter> - </None> - <None Include="..\..\..\source\libs\asura-lib-core\font\utf.inl"> - <Filter>font</Filter> + <None Include="..\..\..\source\libs\asura-lib-core\input\mouse.defs"> + <Filter>input</Filter> </None> </ItemGroup> </Project>
\ No newline at end of file diff --git a/build/libs/asura-lib-steam/asura-lib-steam.vcxproj b/build/libs/asura-lib-steam/asura-lib-steam.vcxproj new file mode 100644 index 0000000..5863f77 --- /dev/null +++ b/build/libs/asura-lib-steam/asura-lib-steam.vcxproj @@ -0,0 +1,122 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <VCProjectVersion>15.0</VCProjectVersion> + <ProjectGuid>{129C3826-B418-4C80-A126-0319C7E2A857}</ProjectGuid> + <RootNamespace>asuralibsteam</RootNamespace> + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="Shared"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup /> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + <Link> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + <Link> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/build/libs/asura-lib-steam/asura-lib-steam.vcxproj.filters b/build/libs/asura-lib-steam/asura-lib-steam.vcxproj.filters new file mode 100644 index 0000000..3c6f4fd --- /dev/null +++ b/build/libs/asura-lib-steam/asura-lib-steam.vcxproj.filters @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="源文件"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="头文件"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions> + </Filter> + <Filter Include="资源文件"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> + </Filter> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/build/libs/asura-lib-steam/asura-lib-steam.vcxproj.user b/build/libs/asura-lib-steam/asura-lib-steam.vcxproj.user new file mode 100644 index 0000000..be25078 --- /dev/null +++ b/build/libs/asura-lib-steam/asura-lib-steam.vcxproj.user @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup /> +</Project>
\ No newline at end of file diff --git a/build/libs/asura-lib-utils/asura-lib-utils.vcxproj b/build/libs/asura-lib-utils/asura-lib-utils.vcxproj index 094fcb8..0138b00 100644 --- a/build/libs/asura-lib-utils/asura-lib-utils.vcxproj +++ b/build/libs/asura-lib-utils/asura-lib-utils.vcxproj @@ -118,23 +118,35 @@ </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="..\..\..\source\libs\asura-lib-utils\exceptions\exception.cpp" /> - <ClCompile Include="..\..\..\source\libs\asura-lib-utils\filesystem\binding\data_buffer.binding.cpp" /> - <ClCompile Include="..\..\..\source\libs\asura-lib-utils\filesystem\data_buffer.cpp" /> - <ClCompile Include="..\..\..\source\libs\asura-lib-utils\filesystem\decoded_data.cpp" /> - <ClCompile Include="..\..\..\source\libs\asura-lib-utils\filesystem\resource_manager.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\binding\_compressor.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\binding\_data_buffer.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\binding\_file.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\binding\_file_data.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\binding\_file_system.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\compressor.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\data_buffer.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\decoded_data.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\file.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\file_data.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\file_system.cpp" /> <ClCompile Include="..\..\..\source\libs\asura-lib-utils\math\curve.cpp" /> <ClCompile Include="..\..\..\source\libs\asura-lib-utils\math\functions.cpp" /> <ClCompile Include="..\..\..\source\libs\asura-lib-utils\math\matrix44.cpp" /> <ClCompile Include="..\..\..\source\libs\asura-lib-utils\math\ranged_value.cpp" /> <ClCompile Include="..\..\..\source\libs\asura-lib-utils\math\transform.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\stringmap.cpp" /> <ClCompile Include="..\..\..\source\libs\asura-lib-utils\utils_module.cpp" /> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\..\source\libs\asura-lib-utils\exceptions\exception.h" /> - <ClInclude Include="..\..\..\source\libs\asura-lib-utils\filesystem\data_buffer.h" /> - <ClInclude Include="..\..\..\source\libs\asura-lib-utils\filesystem\decoded_data.h" /> - <ClInclude Include="..\..\..\source\libs\asura-lib-utils\filesystem\reloadable.h" /> - <ClInclude Include="..\..\..\source\libs\asura-lib-utils\filesystem\resource_manager.h" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\io\compressor.h" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\io\data_buffer.h" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\io\decoded_data.h" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\io\file.h" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\io\file_data.h" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\io\file_system.h" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\io\reloadable.h" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\manager.hpp" /> <ClInclude Include="..\..\..\source\libs\asura-lib-utils\math\curve.h" /> <ClInclude Include="..\..\..\source\libs\asura-lib-utils\math\functions.h" /> <ClInclude Include="..\..\..\source\libs\asura-lib-utils\math\matrix44.h" /> @@ -146,8 +158,11 @@ <ClInclude Include="..\..\..\source\libs\asura-lib-utils\math\vector4.h" /> <ClInclude Include="..\..\..\source\libs\asura-lib-utils\module.h" /> <ClInclude Include="..\..\..\source\libs\asura-lib-utils\scripting\portable.hpp" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\singleton.hpp" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\stringmap.hpp" /> <ClInclude Include="..\..\..\source\libs\asura-lib-utils\type.h" /> <ClInclude Include="..\..\..\source\libs\asura-lib-utils\utils.h" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\utils_config.h" /> <ClInclude Include="..\..\..\source\libs\asura-lib-utils\utils_module.h" /> </ItemGroup> <ItemGroup> diff --git a/build/libs/asura-lib-utils/asura-lib-utils.vcxproj.filters b/build/libs/asura-lib-utils/asura-lib-utils.vcxproj.filters index 86bd1ff..f9b9007 100644 --- a/build/libs/asura-lib-utils/asura-lib-utils.vcxproj.filters +++ b/build/libs/asura-lib-utils/asura-lib-utils.vcxproj.filters @@ -4,16 +4,16 @@ <Filter Include="exceptions"> <UniqueIdentifier>{30702383-d458-4486-8d86-bd98db74d3c8}</UniqueIdentifier> </Filter> - <Filter Include="filesystem"> - <UniqueIdentifier>{6eb6ffb5-ecd9-408b-a2f4-c14837822850}</UniqueIdentifier> - </Filter> <Filter Include="math"> <UniqueIdentifier>{d46782e8-fa86-46be-8e3e-728d313acfed}</UniqueIdentifier> </Filter> <Filter Include="scripting"> <UniqueIdentifier>{3a94ee03-c8db-4d2e-b0b6-5f6ba157580d}</UniqueIdentifier> </Filter> - <Filter Include="filesystem\binding"> + <Filter Include="io"> + <UniqueIdentifier>{6eb6ffb5-ecd9-408b-a2f4-c14837822850}</UniqueIdentifier> + </Filter> + <Filter Include="io\binding"> <UniqueIdentifier>{b4b078e1-bb8d-4cb3-84b9-963e851be123}</UniqueIdentifier> </Filter> </ItemGroup> @@ -21,15 +21,6 @@ <ClCompile Include="..\..\..\source\libs\asura-lib-utils\exceptions\exception.cpp"> <Filter>exceptions</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\libs\asura-lib-utils\filesystem\data_buffer.cpp"> - <Filter>filesystem</Filter> - </ClCompile> - <ClCompile Include="..\..\..\source\libs\asura-lib-utils\filesystem\decoded_data.cpp"> - <Filter>filesystem</Filter> - </ClCompile> - <ClCompile Include="..\..\..\source\libs\asura-lib-utils\filesystem\resource_manager.cpp"> - <Filter>filesystem</Filter> - </ClCompile> <ClCompile Include="..\..\..\source\libs\asura-lib-utils\math\curve.cpp"> <Filter>math</Filter> </ClCompile> @@ -46,26 +37,45 @@ <Filter>math</Filter> </ClCompile> <ClCompile Include="..\..\..\source\libs\asura-lib-utils\utils_module.cpp" /> - <ClCompile Include="..\..\..\source\libs\asura-lib-utils\filesystem\binding\data_buffer.binding.cpp"> - <Filter>filesystem\binding</Filter> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\stringmap.cpp" /> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\binding\_data_buffer.cpp"> + <Filter>io\binding</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\binding\_file_system.cpp"> + <Filter>io\binding</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\data_buffer.cpp"> + <Filter>io</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\decoded_data.cpp"> + <Filter>io</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\file_system.cpp"> + <Filter>io</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\file_data.cpp"> + <Filter>io</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\file.cpp"> + <Filter>io</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\binding\_file.cpp"> + <Filter>io\binding</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\binding\_file_data.cpp"> + <Filter>io\binding</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\compressor.cpp"> + <Filter>io</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\libs\asura-lib-utils\io\binding\_compressor.cpp"> + <Filter>io\binding</Filter> </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\..\source\libs\asura-lib-utils\exceptions\exception.h"> <Filter>exceptions</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\libs\asura-lib-utils\filesystem\data_buffer.h"> - <Filter>filesystem</Filter> - </ClInclude> - <ClInclude Include="..\..\..\source\libs\asura-lib-utils\filesystem\decoded_data.h"> - <Filter>filesystem</Filter> - </ClInclude> - <ClInclude Include="..\..\..\source\libs\asura-lib-utils\filesystem\reloadable.h"> - <Filter>filesystem</Filter> - </ClInclude> - <ClInclude Include="..\..\..\source\libs\asura-lib-utils\filesystem\resource_manager.h"> - <Filter>filesystem</Filter> - </ClInclude> <ClInclude Include="..\..\..\source\libs\asura-lib-utils\math\curve.h"> <Filter>math</Filter> </ClInclude> @@ -100,6 +110,31 @@ <ClInclude Include="..\..\..\source\libs\asura-lib-utils\utils.h" /> <ClInclude Include="..\..\..\source\libs\asura-lib-utils\utils_module.h" /> <ClInclude Include="..\..\..\source\libs\asura-lib-utils\module.h" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\utils_config.h" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\manager.hpp" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\singleton.hpp" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\stringmap.hpp" /> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\io\data_buffer.h"> + <Filter>io</Filter> + </ClInclude> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\io\decoded_data.h"> + <Filter>io</Filter> + </ClInclude> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\io\file_system.h"> + <Filter>io</Filter> + </ClInclude> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\io\reloadable.h"> + <Filter>io</Filter> + </ClInclude> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\io\file_data.h"> + <Filter>io</Filter> + </ClInclude> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\io\file.h"> + <Filter>io</Filter> + </ClInclude> + <ClInclude Include="..\..\..\source\libs\asura-lib-utils\io\compressor.h"> + <Filter>io</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <None Include="..\..\..\source\libs\asura-lib-utils\math\rect.inl"> diff --git a/build/tests/05-physfs/05-physfs.vcxproj b/build/tests/05-physfs/05-physfs.vcxproj new file mode 100644 index 0000000..caa2ca6 --- /dev/null +++ b/build/tests/05-physfs/05-physfs.vcxproj @@ -0,0 +1,122 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <VCProjectVersion>15.0</VCProjectVersion> + <ProjectGuid>{5BECAAB3-9C80-4A62-99BB-E48F4667D9CD}</ProjectGuid> + <RootNamespace>My05physfs</RootNamespace> + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="Shared"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup /> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + <Link> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + <Link> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/build/tests/05-physfs/05-physfs.vcxproj.filters b/build/tests/05-physfs/05-physfs.vcxproj.filters new file mode 100644 index 0000000..3c6f4fd --- /dev/null +++ b/build/tests/05-physfs/05-physfs.vcxproj.filters @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="源文件"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="头文件"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions> + </Filter> + <Filter Include="资源文件"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> + </Filter> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/build/tests/05-physfs/05-physfs.vcxproj.user b/build/tests/05-physfs/05-physfs.vcxproj.user new file mode 100644 index 0000000..be25078 --- /dev/null +++ b/build/tests/05-physfs/05-physfs.vcxproj.user @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup /> +</Project>
\ No newline at end of file diff --git a/samples/Hello/main.macro.asset b/samples/Hello/main.macro.asset new file mode 100644 index 0000000..0dce4b9 --- /dev/null +++ b/samples/Hello/main.macro.asset @@ -0,0 +1,2 @@ +#define _DEBUG_BUILD 1 +#define _RELEASE_BUILD 1
\ No newline at end of file diff --git a/source/3rd-party/Luax/luax_class.hpp b/source/3rd-party/Luax/luax_class.hpp index 539ff1a..3d7ede6 100644 --- a/source/3rd-party/Luax/luax_class.hpp +++ b/source/3rd-party/Luax/luax_class.hpp @@ -62,28 +62,47 @@ namespace Luax state.RegisterEnum(name, __e); \ }while(0) +#define LUAX_PREPARE(L, T) \ + LUAX_STATE(L); \ + T* self = state.GetUserdata<T>(1); + + /// + /// ࣬Ϊʵֶ̬ҪЩӿڵⲿҪ̳д֮࣬оͻöӦʵķע̳д + /// ʱʵķʵLuaxNativeClassУʵֻᵼ¶ԡ + /// + class ILuaxNativeAccessor + { + public: + + /// + /// Աùʵref tableáȡ + /// + virtual bool PushLuaxMemberRef(LuaxState& state, int refID) { assert(false); return false; }; + + }; + /// /// Ҫ¶luanative classҪ̳дࡣͨluaʵҪȷüȷԣڶ߳Ҫȷͷš /// template<class T> - class LuaxNativeClass + class LuaxNativeClass : public virtual ILuaxNativeAccessor { public: + static bool IsTypeOf(ILuaxNativeAccessor); + /// - /// userdataΪkeyref tableuserdataһãάuserdataڡ + /// userdataΪkeyref tableuserdataһãάuserdataڡȽmember ref + /// ʵᱻαͬʵõƵЩʵ壬luaƵĵgc⡣ /// - template<class U> void LuaRetain(LuaxState& state, U* userdata); + template<class U> void LuaxRetain(LuaxState& state, U* userdata); /// /// userdataһref tableԳԻuserdata /// - template<class U> void LuaRelease(LuaxState& state, U* userdata); + template<class U> void LuaxRelease(LuaxState& state, U* userdata); - protected: - - LuaxNativeClass(); - virtual ~LuaxNativeClass(); + bool PushLuaxMemberRef(LuaxState& state, int refID) override; /// /// userdata pushջûгʼmUserdataʼúԪѳʼõuserdataջһá @@ -92,12 +111,17 @@ namespace Luax bool PushLuaxMemberTable(LuaxState& state); bool PushLuaxRefTable(LuaxState& state); + protected: + /// /// Աùʵref tableáȡ /// - void SetMemberRef(LuaxState& state, LuaxMemberRef& memRef, int idx); - bool PushMemberRef(LuaxState& state, LuaxMemberRef& memRef); - void ClearMemberRef(LuaxState& state, LuaxMemberRef& memRef); + void SetLuaxMemberRef(LuaxState& state, LuaxMemberRef& memRef, int idx); + bool PushLuaxMemberRef(LuaxState& state, LuaxMemberRef& memRef); + void ClearLuaxMemberRef(LuaxState& state, LuaxMemberRef& memRef); + + LuaxNativeClass(); + virtual ~LuaxNativeClass(); private: @@ -122,14 +146,16 @@ namespace Luax /// void BindToLua(LuaxState& state); - //------------------------------------------------------------------------------------------------------------ - /// - /// LuaxNativeClass<T>͵ʵ + /// class table͵С + /// + static LuaxStrongRef mClassTable; /// - static LuaxStrongRef mClassTable; // class table͵ - static LuaxStrongRef mSingletonRefTable; // ǵsingletonijԱԱ֤ᱻͨ - // ref tableijԱȫڵģֱ_LUAX_STRONGREF_TABLE + /// ǵsingletonùϵԱ֤ᱻͨref tableijԱȫڵģ + /// ֱ_LUAX_STRONGREF_TABLEuserdataLuaxRetain\LuaxReleasemember refʱʵͬ + /// Ǵref tableģtable_LUAX_STRONGREF_TABLE + /// + static LuaxStrongRef mSingletonRefTable; /// /// ͨuserdataõ: @@ -141,16 +167,12 @@ namespace Luax public: - //------------------------------------------------------------------------------------------------------------ // - LUAX_DECL_METHOD( l___tostring ); LUAX_DECL_METHOD( l_GetClass ); LUAX_DECL_METHOD( l_GetClassName ); - //------------------------------------------------------------------------------------------------------------ // - LUAX_DECL_METHOD( l___gc ); #if LUAX_ENABLE_NATIVE_EXTEND LUAX_DECL_METHOD( l_ExtendFactory ); @@ -158,7 +180,6 @@ namespace Luax LUAX_DECL_METHOD( l_GetRefTable ); LUAX_DECL_METHOD( l_New ); - //------------------------------------------------------------------------------------------------------------ // #if LUAX_ENABLE_NATIVE_EXTEND LUAX_DECL_METHOD( l_ExtendSingleton ); diff --git a/source/3rd-party/Luax/luax_class.inl b/source/3rd-party/Luax/luax_class.inl index 7a24896..e2b8de8 100644 --- a/source/3rd-party/Luax/luax_class.inl +++ b/source/3rd-party/Luax/luax_class.inl @@ -87,7 +87,7 @@ namespace Luax template<typename T> template<typename U> - void LuaxNativeClass<T>::LuaRetain(LuaxState& state, U* userdata) + void LuaxNativeClass<T>::LuaxRetain(LuaxState& state, U* userdata) { if (PushLuaxRefTable(state)) { @@ -105,7 +105,7 @@ namespace Luax template<typename T> template<typename U> - void LuaxNativeClass<T>::LuaRelease(LuaxState& state, U* userdata) + void LuaxNativeClass<T>::LuaxRelease(LuaxState& state, U* userdata) { if (PushLuaxRefTable(state)) { @@ -157,7 +157,7 @@ namespace Luax } } } - state.SetTop(top); + lua_settop(state, top); lua_pushnil(state); return false; } @@ -250,9 +250,9 @@ namespace Luax /// Աù /// template<typename T> - void LuaxNativeClass<T>::SetMemberRef(LuaxState& state, LuaxMemberRef& memRef, int idx) + void LuaxNativeClass<T>::SetLuaxMemberRef(LuaxState& state, LuaxMemberRef& memRef, int idx) { - ClearMemberRef(state, memRef); + ClearLuaxMemberRef(state, memRef); if (!lua_isnil(state, idx)) { idx = state.AbsIndex(idx); @@ -266,7 +266,7 @@ namespace Luax } template<typename T> - bool LuaxNativeClass<T>::PushMemberRef(LuaxState& state, LuaxMemberRef& memRef) + bool LuaxNativeClass<T>::PushLuaxMemberRef(LuaxState& state, LuaxMemberRef& memRef) { if (memRef) { @@ -285,8 +285,24 @@ namespace Luax return false; } + template<typename T> + bool LuaxNativeClass<T>::PushLuaxMemberRef(LuaxState& state, int refID) + { + if (PushLuaxRefTable(state)) + { + lua_rawgeti(state, -1, refID); + lua_replace(state, -2); // ref table + if (lua_isnil(state, -1)) + goto failed; + return true; + } + lua_pushnil(state); + failed: + return false; + } + template<typename T> - void LuaxNativeClass<T>::ClearMemberRef(LuaxState& state, LuaxMemberRef& memRef) + void LuaxNativeClass<T>::ClearLuaxMemberRef(LuaxState& state, LuaxMemberRef& memRef) { if (memRef) { diff --git a/source/3rd-party/Luax/luax_ref.h b/source/3rd-party/Luax/luax_ref.h index b7aabe5..d0001f2 100644 --- a/source/3rd-party/Luax/luax_ref.h +++ b/source/3rd-party/Luax/luax_ref.h @@ -14,7 +14,7 @@ namespace Luax { public: - enum + enum RefMode { STRONG_REF, WEAK_REF diff --git a/source/3rd-party/Luax/luax_state.cpp b/source/3rd-party/Luax/luax_state.cpp index 622f352..8c30c00 100644 --- a/source/3rd-party/Luax/luax_state.cpp +++ b/source/3rd-party/Luax/luax_state.cpp @@ -171,6 +171,11 @@ namespace Luax lua_pushlightuserdata(mState, (void*)value); } + void LuaxState::Push(std::string value) + { + Push(value.c_str()); + } + void LuaxState::PushValues(int idx, int n) { idx = AbsIndex(idx); diff --git a/source/3rd-party/Luax/luax_state.h b/source/3rd-party/Luax/luax_state.h index 564eba3..d675c7c 100644 --- a/source/3rd-party/Luax/luax_state.h +++ b/source/3rd-party/Luax/luax_state.h @@ -98,6 +98,7 @@ namespace Luax void Push(lua_CFunction value); void Push(void* data, size_t size); void Push(const void* value); + void Push(std::string value); /// /// idxʼnpushջidxᱻȡn @@ -210,7 +211,7 @@ namespace Luax }; //-------------------------------------------------------------------------------------------------------------- - // GetValue()ģʵ + // GetValue()ģػ template <> bool LuaxState::GetValue < bool >(int idx, const bool value); template <> cc8* LuaxState::GetValue < cc8* >(int idx, const cc8* value); @@ -228,7 +229,7 @@ namespace Luax template <> const void* LuaxState::GetValue < const void* >(int idx, const void* value); //-------------------------------------------------------------------------------------------------------------- - // CheckParamģʵ + // CheckParamģػ template <> bool LuaxState::CheckParam < bool >(int idx); template <> cc8* LuaxState::CheckParam < cc8* >(int idx); @@ -254,7 +255,7 @@ namespace Luax if(!state.CheckParams(1, params)) return 0 #define LUAX_STATE(L) \ - LuaxState& state = LuaxRuntime::Get().GetLuaxState(L) + Luax::LuaxState& state = Luax::LuaxRuntime::Get().GetLuaxState(L) } diff --git a/source/3rd-party/Luax/luax_state.inl b/source/3rd-party/Luax/luax_state.inl index 4af45a2..20d132c 100644 --- a/source/3rd-party/Luax/luax_state.inl +++ b/source/3rd-party/Luax/luax_state.inl @@ -25,8 +25,7 @@ namespace Luax assert(IsType(-1, LUA_TFUNCTION)); \ Pop(); - _assertmethod(-1, "New"); - //_assertmethod(-1, "__gc"); + //_assertmethod(-1, "New"); #undef _assertmethod @@ -104,6 +103,17 @@ namespace Luax } } + template<typename T> + void LuaxState::SetFieldByIndex(int idx, int key, T value) + { + if (IsTableOrUserdata(idx)) + { + idx = AbsIndex(idx); + this->Push(value); + lua_rawseti(mState, idx, key); + } + } + template<typename T> T LuaxState::GetField(int idx, cc8* key, T value) { diff --git a/source/Asura.Editor/core/signal.h b/source/Asura.Editor/core/signal.h new file mode 100644 index 0000000..f1ab9b4 --- /dev/null +++ b/source/Asura.Editor/core/signal.h @@ -0,0 +1,52 @@ +#ifndef __ASRUA_EDTIRO_SIGNAL_H__ +#define __ASRUA_EDTIRO_SIGNAL_H__ + +#include <vector> + +#include <asura-lib-utils/scripting/portable.hpp> + +#include "../widgets/widget.h" +#include "slot.h" + +namespace AsuraEditor +{ + + /// + /// ؼ¼ + /// + class Signal + { + public: + Signal(); + + /// + /// Fire¼connectļߣãconnectĺ + /// + void operator()(void* userdata) + { + for (auto callback : mCallbacks) + callback(); + } + + /// + /// עص + /// + void Connect(const Slot& callback) + { + mCallbacks.push_back(callback); + } + + /// + /// + /// + void Disconnect(); + + private: + + std::vector<Slot> mCallbacks; // + + }; + +} + +#endif
\ No newline at end of file diff --git a/source/Asura.Editor/core/slot.h b/source/Asura.Editor/core/slot.h new file mode 100644 index 0000000..ff565cf --- /dev/null +++ b/source/Asura.Editor/core/slot.h @@ -0,0 +1,43 @@ +#ifndef __ASURA_EDITOR_SLOT_H__ +#define __ASURA_EDITOR_SLOT_H__ + +#include <asura-lib-utils/scripting/portable.hpp> +#include <asura-lib-core/input/event.h> + +#include "../widgets/widget.h" + +namespace AsuraEditor +{ + + /// + /// Ӧsignalıհ + /// + class Slot + { + public: + Slot(Luax::LuaxState& state, Widget& widget, int refID) + : mState(state) + , mRefID(refID) + , mWidget(widget) + { + } + + void operator()() + { + mWidget.PushLuaxMemberRef(mState, mRefID); + if (lua_isfunction(mState, -1)) // callback + { + mState.Call(0, 0); + } + } + + private: + Luax::LuaxState& mState; + Widget& mWidget; + int mRefID; + + }; + +} + +#endif
\ No newline at end of file diff --git a/source/Asura.Editor/dui_module.cpp b/source/Asura.Editor/dui_module.cpp index e69de29..63b7361 100644 --- a/source/Asura.Editor/dui_module.cpp +++ b/source/Asura.Editor/dui_module.cpp @@ -0,0 +1,8 @@ +#include "dui_module.h" + +namespace AsuraEditor +{ + + + +} diff --git a/source/Asura.Editor/dui_module.h b/source/Asura.Editor/dui_module.h index abcaca5..48c341f 100644 --- a/source/Asura.Editor/dui_module.h +++ b/source/Asura.Editor/dui_module.h @@ -1,6 +1,24 @@ #ifndef __ASRUA_EDITOR_DIRECTUI_MODULE_H__ #define __ASRUA_EDITOR_DIRECTUI_MODULE_H__ +#include <asura-lib-utils/module.h> +namespace AsuraEditor +{ + + /// + /// Direct UI module. + /// + class DUIModule : public AsuraEngine::Module + { + public: + + void Initialize(Luax::LuaxState& state) override; + + void Finalize(Luax::LuaxState& state) override; + + }; + +} #endif
\ No newline at end of file diff --git a/source/Asura.Editor/editor.h b/source/Asura.Editor/editor.h index 6555c81..b56852f 100644 --- a/source/Asura.Editor/editor.h +++ b/source/Asura.Editor/editor.h @@ -1,14 +1,29 @@ #ifndef __ASURA_EDITOR_H__ #define __ASURA_EDITOR_H__ +#include <asura-lib-utils/scripting/portable.hpp> + namespace AsuraEditor { /// - /// + /// ༭ʵ /// class Editor { + public: + + /// + /// ýlua State + /// + Luax::LuaxState& GetLuaxState(); + + private: + + /// + /// еstate + /// + lua_State* mMainState; }; diff --git a/source/Asura.Editor/events/events.h b/source/Asura.Editor/events/events.h deleted file mode 100644 index bbe5cc3..0000000 --- a/source/Asura.Editor/events/events.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __ASUSRA_EDITOR_EVENT_H__ -#define __ASUSRA_EDITOR_EVENT_H__ - -namespace AsuraEditor -{ - namespace Events - { - - enum EventType - { - GRAPHIC_EVENT, - KEYBOARD_EVENT, - MOUSE_EVENT - }; - - enum GraphicEvent - { - EVENT_PAINT, - }; - - } -} - -#endif
\ No newline at end of file diff --git a/source/Asura.Editor/graphics/shader.h b/source/Asura.Editor/graphics/shader.h deleted file mode 100644 index 7511e1c..0000000 --- a/source/Asura.Editor/graphics/shader.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __ASURA_EDITOR_SHADER_H__ -#define __ASURA_EDITOR_SHADER_H__ - -#include <Asura.h> - -namespace AsuraEditor -{ - - /// - /// ༭ʹõshaderluaӿڡ - /// - class Shader : public AEGraphics::Shader - { - public: - - - }; - -} - -#endif
\ No newline at end of file diff --git a/source/Asura.Editor/graphics/shader.cpp b/source/Asura.Editor/scripts/asset_view.lua index e69de29..e69de29 100644 --- a/source/Asura.Editor/graphics/shader.cpp +++ b/source/Asura.Editor/scripts/asset_view.lua diff --git a/source/Asura.Editor/scripts/main.lua b/source/Asura.Editor/scripts/main.lua index a513f87..76fab7a 100644 --- a/source/Asura.Editor/scripts/main.lua +++ b/source/Asura.Editor/scripts/main.lua @@ -1,5 +1,4 @@ -local Editor = require("Asura.Editor") --༭ ---༭Asura.Editor/Scriptsʵ +--༭Asura.Editor/scriptsʵ diff --git a/source/Asura.Editor/scripts/scene_view.lua b/source/Asura.Editor/scripts/scene_view.lua index ff96b2c..db4790f 100644 --- a/source/Asura.Editor/scripts/scene_view.lua +++ b/source/Asura.Editor/scripts/scene_view.lua @@ -1,2 +1 @@ -- 场景窗口 - diff --git a/source/Asura.Editor/widgets/binding/_button.cpp b/source/Asura.Editor/widgets/binding/_button.cpp new file mode 100644 index 0000000..463aef6 --- /dev/null +++ b/source/Asura.Editor/widgets/binding/_button.cpp @@ -0,0 +1,60 @@ +#include "../button.h" + +using namespace Luax; + +namespace AsuraEditor +{ + + LUAX_REGISTRY(Button) + { + + // Button.EStatus.xxx + LUAX_REGISTER_ENUM(state, "EStatus", + { "NORMAL", BUTTON_STATUS_NORMAL }, + { "PUSHED", BUTTON_STATUS_PUSHED }, + { "HOVER", BUTTON_STATUS_HOVER }, + { "DISABLED", BUTTON_STATUS_DISABLED }, + { "FOCUSED", BUTTON_STATUS_FOCUSED } + ); + + // Button.EMsg.xxx + LUAX_REGISTER_ENUM(state, "EMessage", + { "CLICK", BUTTON_MSG_CLICK }, + { "HOVER", BUTTON_MSG_HOVER }, + { "FOCUS", BUTTON_MSG_KILLFOCUS } + ); + + } + + LUAX_POSTPROCESS(Button) + { + + } + + // button:Connect(msg, callback) + LUAX_IMPL_METHOD(Button, _Connect) + { + LUAX_STATE(L); + + Button* self = state.GetUserdata<Button>(1); + int msg = state.CheckParam<int>(2); + if (!lua_isfunction(L, 3)) + return state.ErrorType(3, "callback"); + + LuaxMemberRef ref; + self->SetLuaxMemberRef(state, ref, 3); + if (ref) + { + self->mCallbacksRef.push_back(ref); + Slot slot = Slot(state, (*self), ref.refID); + self->Connect(msg, slot); + } + } + + // button:SetImage(image) + LUAX_IMPL_METHOD(Button, _SetImage) + { + + } + +}
\ No newline at end of file diff --git a/source/Asura.Editor/widgets/button.cpp b/source/Asura.Editor/widgets/button.cpp index e69de29..97de284 100644 --- a/source/Asura.Editor/widgets/button.cpp +++ b/source/Asura.Editor/widgets/button.cpp @@ -0,0 +1,10 @@ +#include "button.h" + +namespace AsuraEditor +{ + + Button::Button() + { + } + +}
\ No newline at end of file diff --git a/source/Asura.Editor/widgets/button.h b/source/Asura.Editor/widgets/button.h index 00f1c99..8edc919 100644 --- a/source/Asura.Editor/widgets/button.h +++ b/source/Asura.Editor/widgets/button.h @@ -1,29 +1,69 @@ #ifndef __ASURA_EDITOR_BUTTON_H__ #define __ASURA_EDITOR_BUTTON_H__ -// Asura.Engine Headers -#include <Scripting/Luax.hpp> +#include <vector> -#include "Widget.h" +#include <asura-lib-utils/scripting/portable.hpp> +#include <asura-lib-core/graphics/image.h> + +#include "../core/signal.h" +#include "widget.h" namespace AsuraEditor { + enum ButtonStatus + { + BUTTON_STATUS_NORMAL = 0, + BUTTON_STATUS_PUSHED = 1, + BUTTON_STATUS_HOVER = 2, + BUTTON_STATUS_DISABLED = 3, + BUTTON_STATUS_FOCUSED = 4, + _BUTTON_STATUS_COUNT = 5, + }; + + enum ButtonMessage + { + BUTTON_MSG_CLICK = 0, + BUTTON_MSG_HOVER = 1, + BUTTON_MSG_KILLFOCUS = 2, + _BUTTON_MSG_COUNT = 3, + }; + class Button : public Widget , public AEScripting::Portable<Button> { - public: Button(); + ~Button(); + + void OnEvent(AEInput::Event& e) override; + void OnPaint() override; + + void Connect(int msg, Slot callback); + void Disconnect(int msg); + void DisconnectAll(int msg); + void DisconnectAllMsg(); + + int GetStatus(); + void SetImage(int status, AEGraphics::Image* image); + + LUAX_DECL_FACTORY(Button); private: - // Image mIcon; // ͼ꣬Ҫ - // Text mText; //ť + LUAX_DECL_METHOD(_Connect); + LUAX_DECL_METHOD(_Disconnect); + LUAX_DECL_METHOD(_SetImage); + + int mStatus; // ǰ״̬ + Signal mSignals[_BUTTON_MSG_COUNT]; // 3Ϣsignal + AEGraphics::Image* mImage[_BUTTON_STATUS_COUNT]; // 5״̬ͼ - LUAX_DECL_FACTORY(Button); // AsuraEditor.Button + Luax::LuaxMemberRef mImageRef[_BUTTON_STATUS_COUNT];// ͼ + std::vector<Luax::LuaxMemberRef> mCallbacksRef; // ص }; diff --git a/source/Asura.Editor/widgets/label.h b/source/Asura.Editor/widgets/label.h index 6889818..1d053f8 100644 --- a/source/Asura.Editor/widgets/label.h +++ b/source/Asura.Editor/widgets/label.h @@ -1,15 +1,22 @@ #ifndef __ASURA_EDITOR_LABEL_H__ #define __ASURA_EDITOR_LABEL_H__ +#include <asura-lib-utils/scripting/portable.hpp> +#include <asura-lib-core/graphics/image.h> + +#include "widget.h" + namespace AsuraEditor { class Label + : public Widget + , public AEScripting::Portable<Label> { - public: - + void OnEvent(AEInput::Event& e) override; + void OnPaint() override; }; diff --git a/source/Asura.Editor/widgets/widget.h b/source/Asura.Editor/widgets/widget.h index 5fb18f1..9ffd1fb 100644 --- a/source/Asura.Editor/widgets/widget.h +++ b/source/Asura.Editor/widgets/widget.h @@ -1,21 +1,40 @@ #ifndef __ASURA_EDITOR_WIDGET_H__ #define __ASURA_EDITOR_WIDGET_H__ +#include <list> + +#include <asura-lib-utils/scripting/portable.hpp> #include <asura-lib-utils/type.h> +#include <asura-lib-utils/math/rect.hpp> +#include <asura-lib-utils/math/vector2.hpp> +#include <asura-lib-core/input/event.h> -namespace AusraEditor +namespace AsuraEditor { - + /// /// Asura EditorĿؼȾں¼ѯֻ¼Ӧӿڡ /// ASURA_ABSTRACT class Widget + : public virtual AEScripting::NativeAccessor { public: - // ؼлƷ - virtual void Draw() = 0; + /// + /// ؼֻбڵѡΪfocusʱŻᴦ룬ԺܸЧ + /// + virtual void OnEvent(AEInput::Event& e) = 0; + + /// + /// + /// + virtual void OnPaint() = 0; + + protected: + + AEMath::Vector2i mPos; + AEMath::Recti mBBox; }; diff --git a/source/Asura.Editor/window/window.h b/source/Asura.Editor/window/window.h deleted file mode 100644 index 7b265ef..0000000 --- a/source/Asura.Editor/window/window.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __ASURA_EDITOR_WINDOW_H__ -#define __ASURA_EDITOR_WINDOW_H__ - -namespace AsuraEditor -{ - - class Window - { - - }; - -} - -#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-core/application.h b/source/libs/asura-lib-core/application.h index 983dbce..b61154d 100644 --- a/source/libs/asura-lib-core/application.h +++ b/source/libs/asura-lib-core/application.h @@ -65,9 +65,9 @@ namespace AsuraEngine private: /// - /// Lua state. + /// ̵߳lua stateӦѭС /// - lua_State* mLuaState; + lua_State* mMainLuaState; /// /// Asura libsᰴն˳ʼ˳ʱִ˳ diff --git a/source/libs/asura-lib-core/graphics/binding/canvas.binding.cpp b/source/libs/asura-lib-core/graphics/binding/_canvas.cpp index e69de29..e69de29 100644 --- a/source/libs/asura-lib-core/graphics/binding/canvas.binding.cpp +++ b/source/libs/asura-lib-core/graphics/binding/_canvas.cpp diff --git a/source/libs/asura-lib-core/graphics/binding/color.binding.cpp b/source/libs/asura-lib-core/graphics/binding/_color.cpp index e69de29..e69de29 100644 --- a/source/libs/asura-lib-core/graphics/binding/color.binding.cpp +++ b/source/libs/asura-lib-core/graphics/binding/_color.cpp diff --git a/source/libs/asura-lib-core/graphics/binding/gif.binding.cpp b/source/libs/asura-lib-core/graphics/binding/_gif.cpp index e69de29..e69de29 100644 --- a/source/libs/asura-lib-core/graphics/binding/gif.binding.cpp +++ b/source/libs/asura-lib-core/graphics/binding/_gif.cpp diff --git a/source/libs/asura-lib-core/graphics/binding/image.binding.cpp b/source/libs/asura-lib-core/graphics/binding/_image.cpp index e69de29..e69de29 100644 --- a/source/libs/asura-lib-core/graphics/binding/image.binding.cpp +++ b/source/libs/asura-lib-core/graphics/binding/_image.cpp diff --git a/source/libs/asura-lib-core/graphics/binding/image_data.binding.cpp b/source/libs/asura-lib-core/graphics/binding/_image_data.cpp index 72e33da..72e33da 100644 --- a/source/libs/asura-lib-core/graphics/binding/image_data.binding.cpp +++ b/source/libs/asura-lib-core/graphics/binding/_image_data.cpp diff --git a/source/libs/asura-lib-core/graphics/binding/mesh2d.binding.cpp b/source/libs/asura-lib-core/graphics/binding/_mesh2d.cpp index e69de29..e69de29 100644 --- a/source/libs/asura-lib-core/graphics/binding/mesh2d.binding.cpp +++ b/source/libs/asura-lib-core/graphics/binding/_mesh2d.cpp diff --git a/source/libs/asura-lib-core/graphics/binding/mesh2d_data.binding.cpp b/source/libs/asura-lib-core/graphics/binding/_mesh2d_data.cpp index 6e15052..6e15052 100644 --- a/source/libs/asura-lib-core/graphics/binding/mesh2d_data.binding.cpp +++ b/source/libs/asura-lib-core/graphics/binding/_mesh2d_data.cpp diff --git a/source/libs/asura-lib-core/graphics/binding/shader.binding.cpp b/source/libs/asura-lib-core/graphics/binding/_shader.cpp index 2f2f507..2f2f507 100644 --- a/source/libs/asura-lib-core/graphics/binding/shader.binding.cpp +++ b/source/libs/asura-lib-core/graphics/binding/_shader.cpp diff --git a/source/libs/asura-lib-core/graphics/binding/sprite_batch.binding.cpp b/source/libs/asura-lib-core/graphics/binding/_sprite_batch.cpp index e69de29..e69de29 100644 --- a/source/libs/asura-lib-core/graphics/binding/sprite_batch.binding.cpp +++ b/source/libs/asura-lib-core/graphics/binding/_sprite_batch.cpp diff --git a/source/libs/asura-lib-core/graphics/binding/window.binding.cpp b/source/libs/asura-lib-core/graphics/binding/_window.cpp index 3befc8c..3befc8c 100644 --- a/source/libs/asura-lib-core/graphics/binding/window.binding.cpp +++ b/source/libs/asura-lib-core/graphics/binding/_window.cpp diff --git a/source/libs/asura-lib-core/graphics/image.h b/source/libs/asura-lib-core/graphics/image.h index 2dd3a4a..d8577ad 100644 --- a/source/libs/asura-lib-core/graphics/image.h +++ b/source/libs/asura-lib-core/graphics/image.h @@ -69,8 +69,10 @@ namespace AsuraEngine LUAX_DECL_METHOD(l_GetSize); }; - + } } +namespace AEGraphics = AsuraEngine::Graphics; + #endif
\ No newline at end of file diff --git a/source/libs/asura-lib-core/graphics/stb_decoder.cpp b/source/libs/asura-lib-core/graphics/stb_decoder.cpp index b14d0f3..a13d6b8 100644 --- a/source/libs/asura-lib-core/graphics/stb_decoder.cpp +++ b/source/libs/asura-lib-core/graphics/stb_decoder.cpp @@ -1,6 +1,6 @@ -#include "STBDecoder.h" +#include <asura-lib-utils/exceptions/exception.h> -#include "Exceptions/Exception.h" +#include "stb_decoder.h" #include "stb/stb_image.h" namespace AsuraEngine diff --git a/source/libs/asura-lib-core/input/cursor.h b/source/libs/asura-lib-core/input/cursor.h index da4a765..a8e53a6 100644 --- a/source/libs/asura-lib-core/input/cursor.h +++ b/source/libs/asura-lib-core/input/cursor.h @@ -4,16 +4,18 @@ #include <SDL2/SDL.h> -#include "Scripting/Portable.h" -#include "Graphics/ImageData.h" -#include "InputDevice.hpp" +#include <asura-lib-utils/scripting/portable.hpp> + +#include "../graphics/image_data.h" + +#include "input_device.hpp" namespace AsuraEngine { namespace Input { - class Cursor : public Scripting::Portable + class Cursor ASURA_FINAL : public AEScripting::Portable<Cursor> { public: @@ -29,6 +31,8 @@ namespace AsuraEngine CursorType GetType() const; SystemCursor GetSystemType() const; + LUAX_DECL_FACTORY(Cursor); + private: SDL_Cursor* mCursorHandle; @@ -36,17 +40,6 @@ namespace AsuraEngine CursorType mType; SystemCursor mSystemType; - public: - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_FACTORY(Cursor); - - LUAX_DECL_ENUM(EnumCursorType); - LUAX_DECL_ENUM(EnumSystemCursor); - - //---------------------------------------------------------------------------------------------------------- - }; } diff --git a/source/libs/asura-lib-core/input/event.h b/source/libs/asura-lib-core/input/event.h new file mode 100644 index 0000000..a24e806 --- /dev/null +++ b/source/libs/asura-lib-core/input/event.h @@ -0,0 +1,45 @@ +#ifndef __ASURA_ENGINE_EVENT_H__ +#define __ASURA_ENGINE_EVENT_H__ + +namespace AsuraEngine +{ + namespace Input + { + + enum EventType + { + EVENT_BEGIN_MOUSE__ , + EVENT_LEFT_DOWN , + EVENT_LEFT_UP , + EVENT_LEFT_DCLICK , + EVENT_MIDDLE_DOWN , + EVENT_MIDDLE_UP , + EVENT_MIDDLE_DCLICK , + EVENT_RIGHT_DOWN , + EVENT_RIGHT_UP , + EVENT_RIGHT_DCLICK , + EVENT_MOTION , + EVENT_END_MOUSE__ , + EVENT_ENTER_WINDOW , + EVENT_LEAVE_WINDOW , + EVENT_MOUSEWHEEL + }; + + struct Event + { + int type; + union + { + // 갴¼ + struct { + int id; + } button; + }; + }; + + } +} + +namespace AEInput = AsuraEngine::Input; + +#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-core/input/input_device.hpp b/source/libs/asura-lib-core/input/input_device.hpp index eb0b7a3..46f5be8 100644 --- a/source/libs/asura-lib-core/input/input_device.hpp +++ b/source/libs/asura-lib-core/input/input_device.hpp @@ -1,9 +1,10 @@ #ifndef __ASURA_ENGINE_INPUT_BASE_H__ #define __ASURA_ENGINE_INPUT_BASE_H__ -#include "Scripting/Portable.h" -#include "Config.h" -#include "Singleton.hpp" +#include <asura-lib-utils/scripting/portable.hpp> + +#include "../core_config.h" +#include "../singleton.hpp" namespace AsuraEngine { @@ -15,7 +16,7 @@ namespace AsuraEngine /// template<class T> ASURA_ABSTRACT class InputDevice - : virtual public Scripting::Portable + : virtual public Scripting::Portable<T> , virtual public Singleton<T> { public: diff --git a/source/libs/asura-lib-core/stringmap.cpp b/source/libs/asura-lib-core/input/joypad.h index e69de29..e69de29 100644 --- a/source/libs/asura-lib-core/stringmap.cpp +++ b/source/libs/asura-lib-core/input/joypad.h diff --git a/source/libs/asura-lib-core/input/mouse.defs b/source/libs/asura-lib-core/input/mouse.defs new file mode 100644 index 0000000..de1d117 --- /dev/null +++ b/source/libs/asura-lib-core/input/mouse.defs @@ -0,0 +1,7 @@ + +enum MouseButton +{ + MOUSE_BUTTON_LEFT, + MOUSE_BUTTON_MIDDLE, + MOUSE_BUTTON_RIGHT, +}; diff --git a/source/libs/asura-lib-utils/filesystem/resource_manager.cpp b/source/libs/asura-lib-core/threading/binding/_coroutine.cpp index e69de29..e69de29 100644 --- a/source/libs/asura-lib-utils/filesystem/resource_manager.cpp +++ b/source/libs/asura-lib-core/threading/binding/_coroutine.cpp diff --git a/source/libs/asura-lib-core/threading/binding/_thread.cpp b/source/libs/asura-lib-core/threading/binding/_thread.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/libs/asura-lib-core/threading/binding/_thread.cpp diff --git a/source/libs/asura-lib-core/threading/coroutine.cpp b/source/libs/asura-lib-core/threading/coroutine.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/libs/asura-lib-core/threading/coroutine.cpp diff --git a/source/libs/asura-lib-core/threading/coroutine.h b/source/libs/asura-lib-core/threading/coroutine.h new file mode 100644 index 0000000..f511e48 --- /dev/null +++ b/source/libs/asura-lib-core/threading/coroutine.h @@ -0,0 +1,27 @@ +#ifndef __ASURA_COROUTINE_H__ +#define __ASURA_COROUTINE_H__ + +#include <asura-lib-utils/scripting/portable.hpp> + +namespace AsuraEngine +{ + namespace Threading + { + + class Coroutine ASURA_FINAL + : public AEScripting::Portable<Coroutine> + { + public: + + LUAX_DECL_FACTORY(Coroutine); + + private: + + + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-core/threading/thread.cpp b/source/libs/asura-lib-core/threading/thread.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/libs/asura-lib-core/threading/thread.cpp diff --git a/source/libs/asura-lib-core/threading/thread.h b/source/libs/asura-lib-core/threading/thread.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/libs/asura-lib-core/threading/thread.h diff --git a/source/libs/asura-lib-framework/scripts/component.lua b/source/libs/asura-lib-framework/scripts/component.lua index 9306f3b..b560bd3 100644 --- a/source/libs/asura-lib-framework/scripts/component.lua +++ b/source/libs/asura-lib-framework/scripts/component.lua @@ -3,7 +3,7 @@ AsuraEngine.Component = AsuraEngine.Class("Component") local Component = AsuraEngine.Component -- Component要显示在inspector的变量 -Component.gameobject = AsuraEngine.Type.GameObject +Component.entity = AsuraEngine.Type.Entity function Component.Extend(cname) self.base(cname) @@ -11,8 +11,8 @@ function Component.Extend(cname) end -function Component:Ctor(gameobject) - self.gameobject = gameobject +function Component:Ctor(entity) + self.entity = entity end function Component:OnEvent(e) diff --git a/source/libs/asura-lib-framework/scripts/gameobject.lua b/source/libs/asura-lib-framework/scripts/entity.lua index a2d20ef..ea8e14d 100644 --- a/source/libs/asura-lib-framework/scripts/gameobject.lua +++ b/source/libs/asura-lib-framework/scripts/entity.lua @@ -1,22 +1,23 @@ -- -- 实体,作为scene中的实体存在。Scene中唯一管理的就是实体entity,游戏里的所有component都依附于entity存在,包括camera组件。 -- +module "AsuraEngine" require "transform" -AsuraEngine.GameObject = AsuraEngine.Asset.Extend("GameObject") +AsuraEngine.Entity = AsuraEngine.Asset.Extend("Entity") -local GameObject = AsuraEngine.GameObject +local Entity = AsuraEngine.Entity -function GameObject:Ctor() +function Entity:Ctor() self.transform = AsuraEngine.Transform.New() self.subentities = {} -- Extend node entities end -function GameObject:AddChild(gameobject) - table.insert(self.child, gameobject) +function Entity:AddChild(entity) + table.insert(self.child, entity) end -function GameObject:AddComponent(type, name) +function Entity:AddComponent(type, name) local cname = type if name == nil then cname = name @@ -25,21 +26,19 @@ function GameObject:AddComponent(type, name) self.components[cname] = compoennt end --- 根据组件名拿到组件 -function GameObject:GetComponent(name) +function Entity:GetComponent(name) return self.components[name] end --- 根据组件类型拿到组件 -function GameObject:GetComponentByType(tname) +function Entity:GetComponentByType(type) end -function GameObject:OnEnable() +function Entity:OnEnable() end -function GameObject:OnEvent(e) +function Entity:OnEvent(e) if self.components == nil or type(self.components) ~= "table" then AsuraEditor.LogError("") return @@ -51,7 +50,7 @@ function GameObject:OnEvent(e) end end -function GameObject:OnUpdate(dt) +function Entity:OnUpdate(dt) for name, component in self.components do if component.OnUpdate ~= nil then component:OnUpdate(dt) @@ -59,7 +58,7 @@ function GameObject:OnUpdate(dt) end end -function GameObject:OnRender() +function Entity:OnRender() for name, component in self.components do if component.OnRender ~= nil then component.OnRender() @@ -67,7 +66,7 @@ function GameObject:OnRender() end end -function GameObject:OnDisable() +function Entity:OnDisable() for name, component in self.components do if component.OnDisable ~= nil then component.OnDisable() @@ -75,41 +74,41 @@ function GameObject:OnDisable() end end -function GameObject:GetTrasform() +function Entity:GetTrasform() return self.transform end -function GameObject:GetPosition() +function Entity:GetPosition() end -function GameObject:GetScale() +function Entity:GetScale() end -function GameObject:GetRotation() +function Entity:GetRotation() end -function GameObject:SetTrasform(transform) +function Entity:SetTrasform(transform) end -function GameObject:SetPosition() +function Entity:SetPosition() end -function GameObject:SetScale() +function Entity:SetScale() end -function GameObject:SetRotation() +function Entity:SetRotation() end --写asset -function GameObject:ToAsset() +function Entity:ToAsset() end -return GameObject
\ No newline at end of file +return Entity
\ No newline at end of file diff --git a/source/libs/asura-lib-framework/scripts/filesystem/entity_loader.lua b/source/libs/asura-lib-framework/scripts/filesystem/entity_loader.lua index 57a890f..39ae0d9 100644 --- a/source/libs/asura-lib-framework/scripts/filesystem/entity_loader.lua +++ b/source/libs/asura-lib-framework/scripts/filesystem/entity_loader.lua @@ -1,4 +1,4 @@ -local loader = AsuraEngine.Loader.New("gameobject") +local loader = AsuraEngine.Loader.New("entity") function loader.OnLoad(asset) diff --git a/source/libs/asura-lib-framework/scripts/graphics/animator.lua b/source/libs/asura-lib-framework/scripts/graphics/animator.lua index c019dfa..fd2f979 100644 --- a/source/libs/asura-lib-framework/scripts/graphics/animator.lua +++ b/source/libs/asura-lib-framework/scripts/graphics/animator.lua @@ -8,9 +8,9 @@ local Animator = AsuraEngine.Animator Animator.spriteRenderer = AsuraEngine.Type.SpriteRenderer Animator.animation = AsuraEngine.Type.Animation -function Animator:Ctor(gameobject, animation) - self.base(gameobject) - self.spriteRenderer = gameobject:GetSpriteRenderer() +function Animator:Ctor(entity, animation) + self.base(entity) + self.spriteRenderer = entity:GetSpriteRenderer() self.animation = animation end diff --git a/source/libs/asura-lib-framework/scripts/graphics/particle_system.lua b/source/libs/asura-lib-framework/scripts/graphics/particle_system.lua index 8de3258..065a845 100644 --- a/source/libs/asura-lib-framework/scripts/graphics/particle_system.lua +++ b/source/libs/asura-lib-framework/scripts/graphics/particle_system.lua @@ -4,8 +4,8 @@ AsuraEngine.ParticleSystem = AsuraEngine.Component.Extend("ParticleSystem") local ParticleSystem = AsuraEngine.ParticleSystem -function ParticleSystem.Ctor(self, gameobject, def) - self.base(gameobject) +function ParticleSystem.Ctor(self, entity, def) + self.base(entity) self.spriteRenderer = AsuraEngine.SpriteRenderer.New() end diff --git a/source/libs/asura-lib-framework/scripts/scene.lua b/source/libs/asura-lib-framework/scripts/scene.lua index 3036ce1..11ac86c 100644 --- a/source/libs/asura-lib-framework/scripts/scene.lua +++ b/source/libs/asura-lib-framework/scripts/scene.lua @@ -6,7 +6,7 @@ AsuraEngine.Scene = AsuraEngine.Asset.Extend("Scene") local Scene = AsuraEngine.Scene function Scene.Ctor(self) - self.rootGameObjects = {} --当前场景的所有root gameobject + self.rootGameObjects = {} --当前场景的所有root entity self.super.Ctor(self) end diff --git a/source/libs/asura-lib-utils/filesystem/resource_manager.h b/source/libs/asura-lib-utils/filesystem/resource_manager.h deleted file mode 100644 index 36d46cf..0000000 --- a/source/libs/asura-lib-utils/filesystem/resource_manager.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef __ASURA_ENGINE_RESOURCE_MANAGER_H__ -#define __ASURA_ENGINE_RESOURCE_MANAGER_H__ - -#include <string> - -#include "../scripting/portable.hpp" -#include "data_buffer.h" - -namespace AsuraEngine -{ - namespace Filesystem - { - - /// - /// Դء洢ԴָĿ¼ȡ - /// - class ResourceManager ASURA_FINAL - { - public: - - ResourceManager(); - ~ResourceManager(); - - /// - /// װظĿ¼ - /// - void Mount(const std::string& root); - - /// - /// ȡļһdata bufferעҪȷȷڴ棬ڵôʹunique_ptr - /// - DataBuffer* LoadFile(const std::string& path); - - /// - /// data buffer - /// - void SaveFile(const std::string& path, const DataBuffer* buffer); - - //---------------------------------------------------------------------------------------------------------- - - LUAX_DECL_SINGLETON(ResourceManager); - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-utils/io/binding/_compressor.cpp b/source/libs/asura-lib-utils/io/binding/_compressor.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/libs/asura-lib-utils/io/binding/_compressor.cpp diff --git a/source/libs/asura-lib-utils/filesystem/binding/data_buffer.binding.cpp b/source/libs/asura-lib-utils/io/binding/_data_buffer.cpp index 8e92eee..d9eca36 100644 --- a/source/libs/asura-lib-utils/filesystem/binding/data_buffer.binding.cpp +++ b/source/libs/asura-lib-utils/io/binding/_data_buffer.cpp @@ -4,17 +4,17 @@ using namespace Luax; namespace AsuraEngine { - namespace Filesystem + namespace IO { LUAX_REGISTRY(DataBuffer) { LUAX_REGISTER_METHODS(state, - { "New", _New }, - { "GetBuffer", _GetBuffer }, - { "GetSize", _GetSize }, - { "Load", _Load }, - { "Clear", _Clear } + { "New", _New }, + { "GetBuffer", _GetData }, + { "GetSize", _GetSize }, + { "Load", _Load }, + { "Clear", _Clear } ); } @@ -50,12 +50,12 @@ namespace AsuraEngine } // lsting, len = databuffer:GetBuffer() - LUAX_IMPL_METHOD(DataBuffer, _GetBuffer) + LUAX_IMPL_METHOD(DataBuffer, _GetData) { LUAX_SETUP(L, "U"); DataBuffer* self = state.GetUserdata<DataBuffer>(1); - lua_pushlstring(L, self->GetBuffer(), self->GetSize()); + lua_pushlstring(L, self->GetData(), self->GetSize()); return 2; } diff --git a/source/libs/asura-lib-utils/io/binding/_file.cpp b/source/libs/asura-lib-utils/io/binding/_file.cpp new file mode 100644 index 0000000..4120258 --- /dev/null +++ b/source/libs/asura-lib-utils/io/binding/_file.cpp @@ -0,0 +1,186 @@ +#include "../file.h" + +namespace AsuraEngine +{ + namespace IO + { + + LUAX_REGISTRY(File) + { + } + + LUAX_POSTPROCESS(File) + { + LUAX_REGISTER_ENUM(state, "EFileMode", + { "CLOSED", FILE_MODE_CLOSED }, + { "READ", FILE_MODE_READ }, + { "WRITE", FILE_MODE_WRITE }, + { "APPEND", FILE_MODE_APPEND } + ); + + LUAX_REGISTER_ENUM(state, "EBufferMode", + { "NONE", BUFFER_MODE_NONE}, + { "LINE", BUFFER_MODE_LINE}, + { "FULL", BUFFER_MODE_FULL} + ); + } + + // file = File.New(name) + LUAX_IMPL_METHOD(File, _New) + { + LUAX_STATE(L); + + cc8* name = state.CheckParam<cc8*>(1); + File* file = new File(name); + file->PushLuaxUserdata(state); + return 1; + } + + // successsed = file:Open(mode) + LUAX_IMPL_METHOD(File, _Open) + { + LUAX_PREPARE(L, File); + + File::FileMode mode = (File::FileMode)state.CheckParam<int>(2); + state.Push(self->Open(mode)); + return 1; + } + + // successed = file:Close() + LUAX_IMPL_METHOD(File, _Close) + { + LUAX_PREPARE(L, File); + + state.Push(self->Close()); + return 1; + } + + // opened = file:IsOpen() + LUAX_IMPL_METHOD(File, _IsOpen) + { + LUAX_PREPARE(L, File); + + state.Push(self->IsOpen()); + return 1; + } + + // mode = file:GetMode() + LUAX_IMPL_METHOD(File, _GetMode) + { + LUAX_PREPARE(L, File); + + File::FileMode mode = self->GetMode(); + state.Push((int)mode); + return 1; + } + + // size = file:GetSize() + LUAX_IMPL_METHOD(File, _GetSize) + { + LUAX_PREPARE(L, File); + + state.Push(self->GetSize()); + return 1; + } + + // size = file:Read(dst, len) + // returns: + // size ʵʶĴС + // params: + // self ļ + // dst Ŀ껺 + // len ĴС + LUAX_IMPL_METHOD(File, _Read) + { + LUAX_PREPARE(L, File); + + DataBuffer* db = state.CheckUserdata<DataBuffer>(2); + if (!db) return state.ErrorType(2, "DataBuffer"); + int len = state.CheckParam<int>(3); + int size = self->Read(db, len); + state.Push(size); + return 1; + } + + // isEOF = file:IsEOF() + LUAX_IMPL_METHOD(File, _IsEOF) + { + LUAX_PREPARE(L, File); + + state.Push(self->IsEOF()); + return 1; + } + + // isWrite = file:Write(data buffer) + LUAX_IMPL_METHOD(File, _Write) + { + LUAX_PREPARE(L, File); + + DataBuffer* db = state.CheckUserdata<DataBuffer>(2); + if (!db) return state.ErrorType(2, "DataBuffer"); + state.Push(self->Write(db)); + return 1; + } + + // isFlushed = file:Flush() + LUAX_IMPL_METHOD(File, _Flush) + { + LUAX_PREPARE(L, File); + + state.Push(self->Flush()); + return 1; + } + + // pos = file:Tell() + LUAX_IMPL_METHOD(File, _Tell) + { + LUAX_PREPARE(L, File); + + state.Push(self->Tell()); + return 1; + } + + // isSeek = file:Seek(pos) + LUAX_IMPL_METHOD(File, _Seek) + { + LUAX_PREPARE(L, File); + + int pos = state.CheckParam<int>(2); + state.Push(self->Seek(pos)); + return 1; + } + + // isSetted = file:SetBuffer(mode, size) + LUAX_IMPL_METHOD(File, _SetBuffer) + { + LUAX_PREPARE(L, File); + + BufferMode mode = (BufferMode)state.CheckParam<int>(2); + int size = state.CheckParam<int>(3); + state.Push(self->SetBuffer(mode, size)); + return 1; + } + + // size, mode = file:GetBuffer() + LUAX_IMPL_METHOD(File, _GetBuffer) + { + LUAX_PREPARE(L, File); + + size_t size = 0; + BufferMode mode = self->GetBuffer(ASURA_OUT size); + state.Push((int)size); + state.Push((int)mode); + return 2; + } + + // name = file:GetFileName() + LUAX_IMPL_METHOD(File, _GetFileName) + { + LUAX_PREPARE(L, File); + + state.Push(self->GetFileName()); + return 1; + } + + } +}
\ No newline at end of file diff --git a/source/libs/asura-lib-utils/io/binding/_file_data.cpp b/source/libs/asura-lib-utils/io/binding/_file_data.cpp new file mode 100644 index 0000000..56f65f7 --- /dev/null +++ b/source/libs/asura-lib-utils/io/binding/_file_data.cpp @@ -0,0 +1,64 @@ +#include "../file_data.h" + +using namespace std; + +namespace AsuraEngine +{ + namespace IO + { + +#define PREPARE(L) \ + LUAX_STATE(L); \ + FileData* self = state.GetUserdata<FileData>(1); + + LUAX_REGISTRY(FileData) + { + LUAX_REGISTER_METHODS(state, + { "GetFileName", _GetFileName }, + { "GetExtension", _GetExtension }, + { "GetName", _GetName }, + { "GetDataBuffer", _GetDataBuffer } + ); + } + + LUAX_POSTPROCESS(FileData) + { + } + + // filename = filedata:GetFileName() + LUAX_IMPL_METHOD(FileData, _GetFileName) + { + PREPARE(L); + string filename = self->GetFileName(); + state.Push(filename); + return 1; + } + + // extension = filedata:GetExtension() + LUAX_IMPL_METHOD(FileData, _GetExtension) + { + PREPARE(L); + string extension = self->GetExtension(); + state.Push(extension); + return 1; + } + + // name = filedata:GetName() + LUAX_IMPL_METHOD(FileData, _GetName) + { + PREPARE(L); + string extension = self->GetName(); + state.Push(extension); + return 1; + } + + // databuffer = filedata:GetDataBuffer() + LUAX_IMPL_METHOD(FileData, _GetDataBuffer) + { + PREPARE(L); + self->PushLuaxMemberRef(state, self->mDataRef); + return 1; + } + + } +} diff --git a/source/libs/asura-lib-utils/io/binding/_file_system.cpp b/source/libs/asura-lib-utils/io/binding/_file_system.cpp new file mode 100644 index 0000000..8cb60bc --- /dev/null +++ b/source/libs/asura-lib-utils/io/binding/_file_system.cpp @@ -0,0 +1,267 @@ +#include "../file_system.h" + +using namespace Luax; + +namespace AsuraEngine +{ + namespace IO + { + +#define PREPARE(l) \ + LUAX_STATE(l); \ + Filesystem* fs = Filesystem::Get(); + + LUAX_REGISTRY(Filesystem) + { + LUAX_REGISTER_METHODS(state, + { "Init", _Init }, + { "Mount", _Mount }, + { "Unmount", _Unmount }, + { "GetMountPoint", _GetMountPoint }, + { "SetWriteDirectory", _SetWriteDirectory }, + { "GetWriteDirectory", _GetWriteDirectory }, + { "CreateFile", _CreateFile }, + { "CreateDirectory", _CreateDirectory }, + { "Write", _Write }, + { "Append", _Append }, + { "Remove", _Remove }, + { "Read", _Read }, + { "GetFileInfo", _GetFileInfo }, + { "GetDirectoryItems", _GetDirectoryItems } + ); + } + + LUAX_POSTPROCESS(Filesystem) + { + LUAX_REGISTER_ENUM(state, "EFileType", + { "FILE", FILE_TYPE_FILE }, + { "DIRECTORY", FILE_TYPE_DIRECTORY }, + { "SYMLINK", FILE_TYPE_SYMLINK }, + { "OTHER", FILE_TYPE_OTHER } + ); + } + + // Filesystem.Init(arg0) + LUAX_IMPL_METHOD(Filesystem, _Init) + { + PREPARE(L); + + const char* arg0 = state.CheckParam<const char*>(1); + fs->Init(arg0); + return 0; + } + + // successed = Filesystem.Mount(path, mountpoint, prepend) + // successed = Filesystem.Mount(data buffer, archievename, mountpoint, prepend) + LUAX_IMPL_METHOD(Filesystem, _Mount) + { + PREPARE(L); + bool mounted = false; + + if (state.IsType(1, LUA_TSTRING)) + { + cc8* path = state.GetValue<cc8*>(1, ""); + cc8* moutpoint = state.GetValue<cc8*>(2, "/"); + bool prepend = state.GetValue<bool>(3, false); + mounted = fs->Mount(path, moutpoint, prepend); + } + else if (state.IsType(1, LUA_TUSERDATA)) + { + DataBuffer* db = state.CheckUserdata<DataBuffer>(1); + if (!db) + return state.ErrorType(1, "Data Buffer"); + cc8* arcname = state.GetValue<cc8*>(2, ""); + cc8* mountpoint = state.GetValue<cc8*>(3, "/"); + bool prepend = state.GetValue<bool>(4, false); + mounted = fs->Mount(db, arcname, mountpoint, prepend); + // retain + fs->LuaxRetain<DataBuffer>(state, db); + } + state.Push(mounted); + return 1; + } + + // successed = Filesystem.Unmount(path) + // successed = Filesystem.Unmount(data buffer) + LUAX_IMPL_METHOD(Filesystem, _Unmount) + { + PREPARE(L); + bool unmounted = false; + + if (state.IsType(1, LUA_TSTRING)) + { + cc8* path = state.GetValue<cc8*>(1, ""); + unmounted = fs->Unmount(path); + } + else if (state.IsType(1, LUA_TUSERDATA)) + { + DataBuffer* db = state.CheckUserdata<DataBuffer>(1); + if (!db) + return state.ErrorType(1, "Data Buffer"); + unmounted = fs->Unmount(db); + if (unmounted) + fs->LuaxRelease<DataBuffer>(state, db); + } + state.Push(unmounted); + return 1; + } + + // moutpoint = Filesystem.GetMountPoint(path) + LUAX_IMPL_METHOD(Filesystem, _GetMountPoint) + { + PREPARE(L); + + cc8* path = state.CheckParam<cc8*>(1); + std::string mp; + if (fs->GetMountPoint(path, ASURA_OUT mp)) + state.Push(mp); + else + state.PushNil(); + + return 1; + } + + // Filesystem.SetWriteDirectory(dir) + LUAX_IMPL_METHOD(Filesystem, _SetWriteDirectory) + { + PREPARE(L); + + cc8* dir = state.CheckParam<cc8*>(1); + fs->SetWriteDirectory(dir); + return 0; + } + + // dir = Filesystem.GetWriteDirectory() + LUAX_IMPL_METHOD(Filesystem, _GetWriteDirectory) + { + PREPARE(L); + + std::string dir = fs->GetWriteDirectory(); + state.Push(dir); + return 1; + } + + // file = Filesystem.CreateFile(name) + LUAX_IMPL_METHOD(Filesystem, _CreateFile) + { + PREPARE(L); + + cc8* name = state.CheckParam<cc8*>(1); + File* file = fs->NewFile(name); + if (file) + file->PushLuaxUserdata(state); + else + state.PushNil(); + return 1; + } + + // successed = Filesystem.CreateDirectory(name) + LUAX_IMPL_METHOD(Filesystem, _CreateDirectory) + { + PREPARE(L); + + cc8* path = state.CheckParam<cc8*>(1); + state.Push(fs->NewDirectory(path)); + return 1; + } + + // successed = Filesystem.Write(path, data buffer) + LUAX_IMPL_METHOD(Filesystem, _Write) + { + PREPARE(L); + + cc8* path = state.CheckParam<cc8*>(1); + DataBuffer* db = state.CheckUserdata<DataBuffer>(2); + state.Push(fs->Write(path, db)); + return 1; + } + + // successed = Filesystem.Append(path, data buffer) + LUAX_IMPL_METHOD(Filesystem, _Write) + { + PREPARE(L); + + cc8* path = state.CheckParam<cc8*>(1); + DataBuffer* db = state.CheckUserdata<DataBuffer>(2); + state.Push(fs->Append(path, db)); + return 1; + } + + // successed = Filesystem.Remove(path) + LUAX_IMPL_METHOD(Filesystem, _Remove) + { + PREPARE(L); + + cc8* path = state.CheckParam<cc8*>(1); + state.Push(fs->Remove(path)); + return 1; + } + + // filedata = Filesystem.Read(path) + LUAX_IMPL_METHOD(Filesystem, _Read) + { + PREPARE(L); + + cc8* path = state.CheckParam<cc8*>(1); + FileData* fd = fs->Read(path); + if (fd) + { + fd->mData->PushLuaxUserdata(state); + fd->SetLuaxMemberRef(state, fd->mDataRef, -1); // fd->mDataRef = data buffer + state.Pop(1); // data buffer + fd->PushLuaxUserdata(state); + } + else + { + state.PushNil(); + } + return 1; + } + + // fileinfo = Filesystem.GetFileInfo(path) + // fileinfoĸʽ: + // {size = , modtime = , type =} + LUAX_IMPL_METHOD(Filesystem, _GetFileInfo) + { + PREPARE(L); + + cc8* path = state.CheckParam<cc8*>(1); + FileInfo info; + if (fs->GetFileInfo(path, &info)) + { + lua_newtable(L); // info table + state.SetField(-1, "size", info.size); + state.SetField(-1, "modetime", info.modtime); + state.SetField(-1, "type", info.type); + } + else + { + state.PushNil(); + } + return 1; + } + + // items = Filesystem.GetDirectoryItems(path) + LUAX_IMPL_METHOD(Filesystem, _GetDirectoryItems) + { + PREPARE(L); + + cc8* path = state.CheckParam<cc8*>(1); + std::vector<std::string> items; + if(fs->GetDirectoryItems(path, ASURA_OUT items)) + { + lua_newtable(L); // item list + for (int i = 0; i < items.size(); ++i) + { + state.SetFieldByIndex(-1, i + 1, items[i]); + } + } + else + { + state.PushNil(); + } + return 1; + } + + } +} diff --git a/source/libs/asura-lib-utils/io/compressor.cpp b/source/libs/asura-lib-utils/io/compressor.cpp new file mode 100644 index 0000000..095eff4 --- /dev/null +++ b/source/libs/asura-lib-utils/io/compressor.cpp @@ -0,0 +1,11 @@ +#include "compressor.h" + +namespace AsuraEngine +{ + namespace IO + { + + + + } +}
\ No newline at end of file diff --git a/source/libs/asura-lib-utils/io/compressor.h b/source/libs/asura-lib-utils/io/compressor.h new file mode 100644 index 0000000..30a074c --- /dev/null +++ b/source/libs/asura-lib-utils/io/compressor.h @@ -0,0 +1,30 @@ +#ifndef __ASURA_COMPRESSOR_H__ +#define __ASURA_COMPRESSOR_H__ + +#include "../scripting/portable.hpp" + +namespace AsuraEngine +{ + namespace IO + { + + class Compressor ASURA_FINAL + : public AEScripting::Portable<Compressor> + { + public: + + LUAX_DECL_SINGLETON(Compressor); + + private: + + LUAX_DECL_METHOD(_Compress); + LUAX_DECL_METHOD(_Decompress); + + + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-utils/filesystem/data_buffer.cpp b/source/libs/asura-lib-utils/io/data_buffer.cpp index 32a123f..98675e9 100644 --- a/source/libs/asura-lib-utils/filesystem/data_buffer.cpp +++ b/source/libs/asura-lib-utils/io/data_buffer.cpp @@ -4,7 +4,7 @@ namespace AsuraEngine { - namespace Filesystem + namespace IO { DataBuffer::DataBuffer(DataBuffer& src) @@ -34,7 +34,7 @@ namespace AsuraEngine void DataBuffer::Load(DataBuffer& db) { - Load(db.GetBuffer(), db.GetSize()); + Load(db.GetData(), db.GetSize()); } void DataBuffer::Load(const void* data, std::size_t size) @@ -47,7 +47,17 @@ namespace AsuraEngine memcpy(mBytes, data, size); } - byte* DataBuffer::GetBuffer() + void DataBuffer::Move(void* bytes, std::size_t size) + { + if (!mBytes) + { + delete[] mBytes; + } + mBytes = (byte*)bytes; + mSize = size; + } + + byte* DataBuffer::GetData() { return mBytes; } diff --git a/source/libs/asura-lib-utils/filesystem/data_buffer.h b/source/libs/asura-lib-utils/io/data_buffer.h index 5c80efb..c7383fa 100644 --- a/source/libs/asura-lib-utils/filesystem/data_buffer.h +++ b/source/libs/asura-lib-utils/io/data_buffer.h @@ -7,42 +7,39 @@ namespace AsuraEngine { - namespace Filesystem + namespace IO { /// /// ڴݵķװеʹData bufferװֱʹconst void*ͨresource managerȡ /// class DataBuffer ASURA_FINAL - : public Scripting::Portable<DataBuffer> + : public AEScripting::Portable<DataBuffer> { public: + LUAX_DECL_FACTORY(DataBuffer); + DataBuffer(DataBuffer& src); DataBuffer(std::size_t size); DataBuffer(const void* bytes, std::size_t size); ~DataBuffer(); - byte* GetBuffer(); + byte* GetData(); size_t GetSize(); void Load(DataBuffer& db); void Load(const void* bytes, std::size_t size); + void Move(void* bytes, std::size_t size); void Clear(); private: byte* mBytes; size_t mSize; - - //------------------------------------------------------------------------------------------------------------ - - public: - - LUAX_DECL_FACTORY(DataBuffer); LUAX_DECL_METHOD(_New); - LUAX_DECL_METHOD(_GetBuffer); + LUAX_DECL_METHOD(_GetData); LUAX_DECL_METHOD(_GetSize); LUAX_DECL_METHOD(_Load); LUAX_DECL_METHOD(_Clear); @@ -52,4 +49,6 @@ namespace AsuraEngine } } +namespace AEIO = AsuraEngine::IO; + #endif
\ No newline at end of file diff --git a/source/libs/asura-lib-utils/filesystem/decoded_data.cpp b/source/libs/asura-lib-utils/io/decoded_data.cpp index 125c652..b208455 100644 --- a/source/libs/asura-lib-utils/filesystem/decoded_data.cpp +++ b/source/libs/asura-lib-utils/io/decoded_data.cpp @@ -3,7 +3,7 @@ namespace AsuraEngine { - namespace Filesystem + namespace IO { DecodedData::DecodedData(const DataBuffer* databuffer) diff --git a/source/libs/asura-lib-utils/filesystem/decoded_data.h b/source/libs/asura-lib-utils/io/decoded_data.h index 49b5815..e201e91 100644 --- a/source/libs/asura-lib-utils/filesystem/decoded_data.h +++ b/source/libs/asura-lib-utils/io/decoded_data.h @@ -9,7 +9,7 @@ namespace AsuraEngine { - namespace Filesystem + namespace IO { /// diff --git a/source/libs/asura-lib-utils/io/file.cpp b/source/libs/asura-lib-utils/io/file.cpp new file mode 100644 index 0000000..092a90d --- /dev/null +++ b/source/libs/asura-lib-utils/io/file.cpp @@ -0,0 +1,286 @@ +#include <physfs/physfs.h> + +#include <asura-lib-utils/exceptions/exception.h> + +#include "file.h" + +namespace AsuraEngine +{ + namespace IO + { + + File::File(const std::string& filename) + : mFileName(filename) + , mFileHandle(nullptr) + , mMode(FILE_MODE_CLOSED) + , mBufferMode(BUFFER_MODE_NONE) + , mBufferSize(0) + { + size_t dot = filename.rfind('.'); + if (dot != std::string::npos) + { + mExtension = filename.substr(dot + 1); + mName = filename.substr(0, dot); + } + else + mName = filename; + } + + File::~File() + { + if (mMode != FILE_MODE_CLOSED) + Close(); + } + + bool File::Open(FileMode mode) + { + if (!PHYSFS_isInit()) + throw Exception("Physfs is NOT initialized."); + + if (mode == FILE_MODE_CLOSED) + return; + + if (mode == FILE_MODE_READ && !PHYSFS_exists(mFileName.c_str())) + throw Exception("Could NOT open file %s. Does not exist.", mFileName.c_str()); + + if (mode == FILE_MODE_APPEND || mode == FILE_MODE_WRITE) + { + if (!PHYSFS_getWriteDir()) + { + throw Exception("Could NOT set write directory."); + } + } + + // Ѿ֮ǰͲٴµhandle + if (mFileHandle != nullptr) + return; + + PHYSFS_getLastErrorCode(); + + PHYSFS_File* handle = nullptr; + + switch (mode) + { + case FILE_MODE_READ: + handle = PHYSFS_openRead(mFileName.c_str()); + break; + case FILE_MODE_APPEND: + handle = PHYSFS_openAppend(mFileName.c_str()); + break; + case FILE_MODE_WRITE: + handle = PHYSFS_openWrite(mFileName.c_str()); + break; + } + + if (handle == nullptr) + { + const char *err = PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()); + if (err == nullptr) + err = "unknown error"; + throw Exception("Could not open file %s (%s)", mFileName.c_str(), err); + } + + mFileHandle = handle; + mMode = mode; + + if (mFileHandle != nullptr && !SetBuffer(mBufferMode,mBufferSize)) + { + mBufferMode = BUFFER_MODE_NONE; + mBufferSize = 0; + } + + return mFileHandle != nullptr; + } + + bool File::Close() + { + if (mFileHandle == nullptr || !PHYSFS_close(mFileHandle)) + return false; + mMode = FILE_MODE_CLOSED; + mFileHandle = nullptr; + return true; + } + + bool File::IsOpen() + { + return mMode != FILE_MODE_CLOSED && mFileHandle != nullptr; + } + + size_t File::GetSize() + { + if (mFileHandle == nullptr) + { + Open(FILE_MODE_READ); + size_t size = PHYSFS_fileLength(mFileHandle); + Close(); + return size; + } + return PHYSFS_fileLength(mFileHandle); + } + + size_t File::Read(ASURA_OUT DataBuffer* dst, size_t length) + { + ASSERT(dst); + + if (dst->GetSize() < length) + throw Exception("Data buffer is too small compares to read length."); + + if (!mFileHandle || mMode != FILE_MODE_READ) + throw Exception("File \"%s\" is not opened for reading", mFileName); + + size_t max = PHYSFS_fileLength(mFileHandle); + length = (length > max) ? max : length; + + if (length < 0) + throw Exception("Invalid read size."); + + return PHYSFS_readBytes(mFileHandle, dst->GetData(), length); + } + + size_t File::ReadAll(ASURA_OUT DataBuffer* dst) + { + ASSERT(dst); + + if (!mFileHandle || mMode != FILE_MODE_READ) + throw Exception("File \"%s\" is not opened for reading", mFileName); + + size_t length = PHYSFS_fileLength(mFileHandle); + + if (dst->GetSize() < length) + throw Exception("Data buffer is too small compares to file length."); + + return PHYSFS_readBytes(mFileHandle, dst->GetData(), length); + } + +#ifdef ASURA_WINDOWS + inline bool test_eof(File *that, PHYSFS_File *) + { + int64 pos = that->Tell(); + int64 size = that->GetSize(); + return pos == -1 || size == -1 || pos >= size; + } +#else + inline bool test_eof(File *, PHYSFS_File *file) + { + return PHYSFS_eof(file); + } +#endif + + bool File::IsEOF() + { + return mFileHandle == nullptr || test_eof(this, mFileHandle); + } + + size_t File::Tell() + { + if (!mFileHandle) + return - 1; + + return PHYSFS_tell(mFileHandle); + } + + bool File::Seek(size_t pos) + { + return mFileHandle != nullptr && PHYSFS_seek(mFileHandle, pos) != 0; + } + + bool File::Write(ASURA_REF DataBuffer* src) + { + if (!mFileHandle || (mMode != FILE_MODE_APPEND && mMode != FILE_MODE_WRITE)) + throw Exception("File is not opened for writing."); + + byte* data = src->GetData(); + int size = src->GetSize(); + + if (size < 0) + throw Exception("Invalid write size."); + + size_t written = PHYSFS_writeBytes(mFileHandle, data, size); + + if (written != src->GetSize()) + return false; + + // л + if (mBufferSize == BUFFER_MODE_LINE && mBufferSize > size) + { + if (memchr(data, '\n', size) != nullptr) + Flush(); + } + + return true; + } + + bool File::Flush() + { + if (!mFileHandle || (mMode != FILE_MODE_WRITE && mMode != FILE_MODE_APPEND)) + throw Exception("File is not opened for writing."); + + return PHYSFS_flush(mFileHandle) != 0; + } + + bool File::SetBuffer(BufferMode mode, size_t size) + { + if (size < 0) + return false; + + // If the file isn't open, we'll make sure the buffer values are set in + // File::open. + if (!IsOpen()) + { + mBufferMode = mode; + mBufferSize = size; + return true; + } + + int ret = 1; + + switch (mode) + { + case BUFFER_MODE_NONE: + default: + ret = PHYSFS_setBuffer(mFileHandle, 0); + size = 0; + break; + case BUFFER_MODE_LINE: + case BUFFER_MODE_FULL: + ret = PHYSFS_setBuffer(mFileHandle, size); + break; + } + + if (ret == 0) + return false; + + mBufferMode = mode; + mBufferSize = size; + + return true; + } + + File::BufferMode File::GetBuffer(ASURA_OUT size_t& size) + { + size = mBufferSize; + return mBufferMode; + } + + const std::string& File::GetFileName() + { + return mFileName; + } + + const std::string& File::GetName() + { + return mName; + } + + const std::string& File::GetExtension() + { + return mExtension; + } + + File::FileMode File::GetMode() + { + return mMode; + } + + } +}
\ No newline at end of file diff --git a/source/libs/asura-lib-utils/io/file.h b/source/libs/asura-lib-utils/io/file.h new file mode 100644 index 0000000..e8f676e --- /dev/null +++ b/source/libs/asura-lib-utils/io/file.h @@ -0,0 +1,132 @@ +#ifndef __ASURA_ENGINE_FILE_H__ +#define __ASURA_ENGINE_FILE_H__ + +#include "physfs/physfs.h" + +#include "../scripting/portable.hpp" + +#include "file_data.h" + +namespace AsuraEngine +{ + namespace IO + { + + /// + /// ʽļָд㡢Сʹȡʱʹñ࣬ʹFilesystem.read()ֱӶȡļȫ + /// ݣһFileData + /// + class File ASURA_FINAL + : public AEScripting::Portable<File> + { + public: + + LUAX_DECL_FACTORY(File); + + /// + /// ļдģʽ + /// + enum FileMode + { + FILE_MODE_CLOSED, + FILE_MODE_READ, + FILE_MODE_WRITE, + FILE_MODE_APPEND, + }; + + /// + /// ļдʱΪ + /// + enum BufferMode + { + BUFFER_MODE_NONE, ///< ʹû壬дļ + BUFFER_MODE_LINE, ///< л壬зߴﵽСʱдļ + BUFFER_MODE_FULL, ///< ȫ壬ʱдļ + }; + + File(const std::string& filename); + ~File(); + + bool Open(FileMode mode); + bool Close(); + bool IsOpen(); + FileMode GetMode(); + size_t GetSize(); + + /// + /// ȡdata bufferض + /// + size_t Read(ASURA_OUT DataBuffer* dst, size_t length); + size_t ReadAll(ASURA_OUT DataBuffer* dst); + + /// + /// Ƿļβ + /// + bool IsEOF(); + + /// + /// data bufferед룬Ƿɹ + /// + bool Write(ASURA_REF DataBuffer* src); + + /// + /// ˻壬ǿջдļ + /// + bool Flush(); + + /// + /// صǰдλ + /// + size_t Tell(); + + /// + /// Ӧλ + /// + bool Seek(size_t pos); + + /// + /// ûСģʽ + /// + bool SetBuffer(BufferMode mode, size_t size); + + /// + /// ȡСģʽ + /// + BufferMode GetBuffer(ASURA_OUT size_t& size); + + const std::string& GetFileName(); + const std::string& GetName(); + const std::string& GetExtension(); + + private: + + PHYSFS_File* mFileHandle; ///< physfs ļ + std::string mFileName; ///< ļ + std::string mExtension; ///< չ + std::string mName; ///< չļ + FileMode mMode; ///< ļģʽ + BufferMode mBufferMode; ///< д뻺ģʽ + size_t mBufferSize; ///< д뻺С + + LUAX_DECL_METHOD(_New); + LUAX_DECL_METHOD(_Open); + LUAX_DECL_METHOD(_Close); + LUAX_DECL_METHOD(_IsOpen); + LUAX_DECL_METHOD(_GetMode); + LUAX_DECL_METHOD(_GetSize); + LUAX_DECL_METHOD(_Read); + LUAX_DECL_METHOD(_IsEOF); + LUAX_DECL_METHOD(_Write); + LUAX_DECL_METHOD(_Flush); + LUAX_DECL_METHOD(_Tell); + LUAX_DECL_METHOD(_Seek); + LUAX_DECL_METHOD(_SetBuffer); + LUAX_DECL_METHOD(_GetBuffer); + LUAX_DECL_METHOD(_GetFileName); + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-utils/io/file_data.cpp b/source/libs/asura-lib-utils/io/file_data.cpp new file mode 100644 index 0000000..47d9095 --- /dev/null +++ b/source/libs/asura-lib-utils/io/file_data.cpp @@ -0,0 +1,57 @@ +#include "file_data.h" + +namespace AsuraEngine +{ + namespace IO + { + + FileData::FileData(const std::string& filename) + : mData(nullptr) + , mFileName(filename) + { + size_t dot = filename.rfind('.'); + if (dot != std::string::npos) + { + mExtension = filename.substr(dot + 1); + mName = filename.substr(0, dot); + } + else + mName = filename; + } + + FileData::~FileData() + { + } + + void FileData::BindData(DataBuffer* buffer) + { + mData = buffer; + } + + const std::string& FileData::GetFileName() + { + return mFileName; + } + + const std::string& FileData::GetExtension() + { + return mExtension; + } + + const std::string& FileData::GetName() + { + return mName; + } + + void FileData::BindData(ASURA_MOVE DataBuffer* buffer) + { + mData = buffer; + } + + DataBuffer* FileData::GetDataBuffer() + { + return mData; + } + + } +} diff --git a/source/libs/asura-lib-utils/io/file_data.h b/source/libs/asura-lib-utils/io/file_data.h new file mode 100644 index 0000000..e20f41b --- /dev/null +++ b/source/libs/asura-lib-utils/io/file_data.h @@ -0,0 +1,68 @@ +#ifndef __ASURA_ENGINE_FILE_DATA_H__ +#define __ASURA_ENGINE_FILE_DATA_H__ + +#include <string> + +#include <asura-lib-utils/scripting/portable.hpp> + +#include "data_buffer.h" + +namespace AsuraEngine +{ + namespace IO + { + + class Filesystem; + + /// + /// filesystemֱӶȡļʱFileDataļݺϢFilesystem + /// + class FileData ASURA_FINAL + : public AEScripting::Portable<FileData> + { + public: + + LUAX_DECL_FACTORY(FileData); + + /// + /// ļݣͨDatabufferݺʹСڲӿڶData bufferΪҲdata buffer + /// + DataBuffer* GetDataBuffer(); + + const std::string& GetFileName(); + const std::string& GetExtension(); + const std::string& GetName(); + + private: + + friend class Filesystem; + + FileData(const std::string& name); + ~FileData(); + + /// + /// data buffer + /// + void BindData(ASURA_MOVE DataBuffer* buffer); + + /// + /// Data bufferfiledataʱ٣luaüΪ0ʱluaGC١mDataʱһԱá + /// + ASURA_REF DataBuffer* mData; + Luax::LuaxMemberRef mDataRef; + + std::string mFileName; ///< չļ + std::string mExtension; ///< չ + std::string mName; ///< ͺļ + + LUAX_DECL_METHOD(_GetFileName); + LUAX_DECL_METHOD(_GetExtension); + LUAX_DECL_METHOD(_GetName); + LUAX_DECL_METHOD(_GetDataBuffer); + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-utils/io/file_system.cpp b/source/libs/asura-lib-utils/io/file_system.cpp new file mode 100644 index 0000000..20f3cb2 --- /dev/null +++ b/source/libs/asura-lib-utils/io/file_system.cpp @@ -0,0 +1,198 @@ +#include <physfs/physfs.h> + +#include "../exceptions/exception.h" + +#include "file.h" +#include "file_data.h" +#include "file_system.h" + +using namespace std; + +namespace AsuraEngine +{ + namespace IO + { + +#ifdef ASURA_WINDOWS + #include <windows.h> + #include <direct.h> +#else + #include <sys/param.h> + #include <unistd.h> +#endif + + Filesystem::~Filesystem() + { + if (mInited) //PHYSFS_isInit + PHYSFS_deinit(); + } + + void Filesystem::Init(const char* arg0) + { + if (!PHYSFS_init(arg0)) + throw Exception("Failed to initialize filesystem: %s", PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode())); + + mInited = true; + } + + bool Filesystem::Mount(const std::string& locpath, const std::string& montpoint/* = "/"*/, bool prepend /*= false*/) + { + if (!mInited) + return false; + + return PHYSFS_mount(locpath.c_str(), montpoint.c_str(), !prepend); + } + + bool Filesystem::Mount(DataBuffer* db, const std::string& archivename, const std::string& mountpoint /*= "/"*/, bool prepend /*= false*/) + { + if (!mInited) + return false; + if (PHYSFS_mountMemory(db->GetData(), db->GetSize(), nullptr, archivename.c_str(), mountpoint.c_str(), !prepend)) + { + mMountData[archivename] = db; + return true; + } + return false; + } + + bool Filesystem::Unmount(const std::string& locpath) + { + if (!mInited) + return false; + + // ǹ鵵ӳɾ + auto datait = mMountData.find(locpath); + if (datait != mMountData.end() && PHYSFS_unmount(locpath.c_str()) != 0) + { + mMountData.erase(datait); + return true; + } + + return PHYSFS_unmount(locpath.c_str()); + } + + bool Filesystem::Unmount(DataBuffer* db) + { + for (const auto& dp : mMountData) + { + if (dp.second == db) + { + std::string archive = dp.first; + return Unmount(archive); + } + } + } + + bool Filesystem::GetMountPoint(const std::string& locpath, ASURA_OUT std::string& mountpoint) + { + if (!mInited) + return false; + const char* point = PHYSFS_getMountPoint(locpath.c_str()); + if (point != nullptr) + { + mountpoint = point; + return true; + } + return false; + } + + void Filesystem::SetWriteDirectory(const std::string locpath) + { + if (!mInited) + return; + if (!PHYSFS_setWriteDir(locpath.c_str())) + throw Exception("Failed to set write directory %s", locpath.c_str()); + } + + std::string Filesystem::GetWriteDirectory() + { + return PHYSFS_getWriteDir(); + } + + File* Filesystem::NewFile(const std::string& name) + { + return new File(name); + } + + bool Filesystem::NewDirectory(const std::string& path) + { + if (!mInited) + return false; + if (!PHYSFS_getWriteDir()) + return false; + if (!PHYSFS_mkdir(path.c_str())) + return false; + return true; + } + + bool Filesystem::Write(const std::string& name, ASURA_REF DataBuffer* buffer) + { + File file(name); + file.Open(File::FILE_MODE_WRITE); + if (!file.Write(buffer)) + throw Exception("Data could not be written."); + } + + bool Filesystem::Append(const std::string& name, ASURA_REF DataBuffer* buffer) + { + File file(name); + file.Open(File::FILE_MODE_APPEND); + if (!file.Write(buffer)) + throw Exception("Data could not be append."); + } + + FileData* Filesystem::Read(const std::string& name) + { + File file = File(name); + file.Open(File::FILE_MODE_READ); + int size = file.GetSize(); + DataBuffer* db = new DataBuffer(size); + if (db) + { + file.ReadAll(db); + FileData* fd = new FileData(name); + fd->BindData(db); + return fd; + } + return nullptr; + } + + bool Filesystem::Remove(const std::string& path) + { + if (!mInited) + return false; + if (PHYSFS_getWriteDir() == 0) + return false; + + if (!PHYSFS_delete(path.c_str())) + return false; + + return true; + } + + bool Filesystem::GetFileInfo(const std::string& filepath, ASURA_OUT FileInfo* info) + { + if (!mInited) + return false; + + PHYSFS_Stat stat = {}; + if (!PHYSFS_stat(filepath.c_str(), &stat)) + return false; + + info->size = (int64)stat.filesize; + info->modtime = (int64)stat.modtime; + + if (stat.filetype == PHYSFS_FILETYPE_REGULAR) + info->type = FILE_TYPE_FILE; + else if (stat.filetype == PHYSFS_FILETYPE_DIRECTORY) + info->type = FILE_TYPE_DIRECTORY; + else if (stat.filetype == PHYSFS_FILETYPE_SYMLINK) + info->type = FILE_TYPE_SYMLINK; + else + info->type = FILE_TYPE_OTHER; + + return true; + } + + } +}
\ No newline at end of file diff --git a/source/libs/asura-lib-utils/io/file_system.h b/source/libs/asura-lib-utils/io/file_system.h new file mode 100644 index 0000000..1af0292 --- /dev/null +++ b/source/libs/asura-lib-utils/io/file_system.h @@ -0,0 +1,110 @@ +#ifndef __ASURA_ENGINE_FILESYSTEM_H__ +#define __ASURA_ENGINE_FILESYSTEM_H__ + +#include <map> +#include <string> + +#include "../scripting/portable.hpp" +#include "../singleton.hpp" +#include "../type.h" + +#include "file_data.h" +#include "file.h" + +namespace AsuraEngine +{ + namespace IO + { + + enum FileType + { + FILE_TYPE_FILE, ///< ļ + FILE_TYPE_DIRECTORY, ///< ļ + FILE_TYPE_SYMLINK, ///< + FILE_TYPE_OTHER, ///< + }; + + struct FileInfo + { + int64 size; + int64 modtime; + FileType type; + }; + + /// + /// Դء洢ԴָĿ¼ȡ۱༭ʱҪƷʵĻƣûIJϷĿ¼ + /// £file systemµġFilesystemʱͱ༭õ࣬AssetDatabaseԴ࣬framework + /// ʵ֣дFilesystemʵ֣AssetDatabaseṩļݴӦԴķ + /// + class Filesystem ASURA_FINAL + : public Singleton<Filesystem> + , public AEScripting::Portable<Filesystem> + { + public: + + LUAX_DECL_SINGLETON(Filesystem); + + void Init(const char* arg0); + + /// + /// ǰִļļ + /// + std::string GetWorkingDirectory(); + + bool Mount(const std::string& locpath, const std::string& montpoint = "/", bool prepend = false); + bool Mount(DataBuffer* db, const std::string& archivename, const std::string& mountpoint = "/", bool prepend = false); + + bool Unmount(const std::string& locpath); + bool Unmount(DataBuffer* db); + + bool GetMountPoint(const std::string& locpath, ASURA_OUT std::string& mountpoint); + + void SetWriteDirectory(const std::string locpath); + std::string GetWriteDirectory(); + File* NewFile(const std::string& name); + bool NewDirectory(const std::string& path); + bool Write(const std::string& path, ASURA_REF DataBuffer* buffer); + bool Append(const std::string& path, ASURA_REF DataBuffer* buffer); + bool Remove(const std::string& path); + + FileData* Read(const std::string& path); + bool GetFileInfo(const std::string& path, ASURA_OUT FileInfo* info); + + bool GetDirectoryItems(const std::string& path, ASURA_OUT std::vector<std::string>& items); + + private: + + typedef std::map<std::string, DataBuffer*> MountDataMap; + + bool mInited; ///< Ƿʼɹ + std::string mCwd; ///< ǰִļĹĿ¼ + MountDataMap mMountData; ///< ·ѹĵӳ + + LUAX_DECL_METHOD(_Init); + LUAX_DECL_METHOD(_Mount); + LUAX_DECL_METHOD(_Unmount); + LUAX_DECL_METHOD(_GetMountPoint); + + LUAX_DECL_METHOD(_SetWriteDirectory); + LUAX_DECL_METHOD(_GetWriteDirectory); + LUAX_DECL_METHOD(_CreateFile); + LUAX_DECL_METHOD(_CreateDirectory); + + LUAX_DECL_METHOD(_Write); + LUAX_DECL_METHOD(_Append); + LUAX_DECL_METHOD(_Remove); + + LUAX_DECL_METHOD(_Read); + + LUAX_DECL_METHOD(_GetFileInfo); + + LUAX_DECL_METHOD(_GetDirectoryItems); + + }; + + } +} + +namespace AEIO = AsuraEngine::IO; + +#endif
\ No newline at end of file diff --git a/source/libs/asura-lib-utils/filesystem/reloadable.h b/source/libs/asura-lib-utils/io/reloadable.h index 7c4ea52..cf30296 100644 --- a/source/libs/asura-lib-utils/filesystem/reloadable.h +++ b/source/libs/asura-lib-utils/io/reloadable.h @@ -5,7 +5,7 @@ namespace AsuraEngine { - namespace Filesystem + namespace IO { /// diff --git a/source/libs/asura-lib-core/manager.hpp b/source/libs/asura-lib-utils/manager.hpp index 7b4e272..7b4e272 100644 --- a/source/libs/asura-lib-core/manager.hpp +++ b/source/libs/asura-lib-utils/manager.hpp diff --git a/source/libs/asura-lib-utils/math/rect.hpp b/source/libs/asura-lib-utils/math/rect.hpp index f635007..1751634 100644 --- a/source/libs/asura-lib-utils/math/rect.hpp +++ b/source/libs/asura-lib-utils/math/rect.hpp @@ -13,8 +13,20 @@ namespace AsuraEngine Rect(); ~Rect(T x, T y, T w, T h); - template <typename U> - explicit Rect(const Rect<U>& rect); + /// + /// x,yǷrectڡ + /// + bool Contain(T x, T y); + + /// + /// Ƿཻཻľ + /// + bool Intersect(const Rect& src, Rect& intersection); + + /// + /// Ƿཻཻľ + /// + static bool Intersect(const Rect<T>& src1, const Rect<T>& src2, Rect<T>& intersection); T x, y, w, h; }; @@ -25,8 +37,11 @@ namespace AsuraEngine typedef Rect<int> Recti; typedef Rect<unsigned int> Rectu; typedef Rect<float> Rectf; + typedef Rect<long> Reftl; } } +namespace AEMath = AsuraEngine::Math; + #endif
\ No newline at end of file diff --git a/source/libs/asura-lib-utils/scripting/portable.hpp b/source/libs/asura-lib-utils/scripting/portable.hpp index 00ede90..097a9fe 100644 --- a/source/libs/asura-lib-utils/scripting/portable.hpp +++ b/source/libs/asura-lib-utils/scripting/portable.hpp @@ -21,7 +21,14 @@ namespace AsuraEngine template<typename T> using Portable = Luax::LuaxNativeClass<T>; + /// + /// ҪΪ࣬userdatamember ref̳д࣬ע̳С + /// + using NativeAccessor = Luax::ILuaxNativeAccessor; + } } +namespace AEScripting = AsuraEngine::Scripting; + #endif
\ No newline at end of file diff --git a/source/libs/asura-lib-core/singleton.hpp b/source/libs/asura-lib-utils/singleton.hpp index 756209a..756209a 100644 --- a/source/libs/asura-lib-core/singleton.hpp +++ b/source/libs/asura-lib-utils/singleton.hpp diff --git a/source/libs/asura-lib-utils/stringmap.cpp b/source/libs/asura-lib-utils/stringmap.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/libs/asura-lib-utils/stringmap.cpp diff --git a/source/libs/asura-lib-core/stringmap.hpp b/source/libs/asura-lib-utils/stringmap.hpp index ddba128..ddba128 100644 --- a/source/libs/asura-lib-core/stringmap.hpp +++ b/source/libs/asura-lib-utils/stringmap.hpp diff --git a/source/libs/asura-lib-utils/type.h b/source/libs/asura-lib-utils/type.h index 72ed8cc..aa00108 100644 --- a/source/libs/asura-lib-utils/type.h +++ b/source/libs/asura-lib-utils/type.h @@ -25,6 +25,8 @@ namespace AsuraEngine typedef std::size_t size_t; + typedef const char cc8; + //---------------------------------------------------------------------------------------------------------------- #ifndef ASSERT @@ -51,6 +53,8 @@ namespace AsuraEngine #define ASURA_ATTRIBUTE_USED #define ASURA_ABSTRACT #define ASURA_API ASURA_LIBRARY_EXPORT + + #define ASURA_WINDOWS 1 #else #define ASURA_FINAL final #define ASURA_LIBRARY_EXPORT __attribute__((visibility("default"))) @@ -61,6 +65,16 @@ namespace AsuraEngine #define ASURA_ABSTRACT #define ASURA_API ASURA_LIBRARY_EXPORT #endif + + /// + /// ò + /// +#define ASURA_OUT +#define ASURA_REF + /// + /// ƶָȨ + /// +#define ASURA_MOVE //---------------------------------------------------------------------------------------------------------------- diff --git a/source/libs/asura-lib-utils/utils_config.h b/source/libs/asura-lib-utils/utils_config.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/libs/asura-lib-utils/utils_config.h diff --git a/source/tests/02-luax/main.cpp b/source/tests/02-luax/main.cpp index cd718ac..ebb9df8 100644 --- a/source/tests/02-luax/main.cpp +++ b/source/tests/02-luax/main.cpp @@ -140,7 +140,7 @@ int Boy::l_Speak(lua_State* L) LUAX_STATE(L); Boy* self = state.CheckUserdata<Boy>(1); - self->PushMemberRef(state, self->mCallbak); + self->PushLuaxMemberRef(state, self->mCallbak); state.Call(0, 1); return 1; } @@ -150,7 +150,7 @@ int Boy::l_Write(lua_State* L) LUAX_STATE(L); // self, func Boy* self = state.CheckUserdata<Boy>(1); - self->SetMemberRef(state, self->mCallbak, 2); + self->SetLuaxMemberRef(state, self->mCallbak, 2); return 0; } @@ -187,9 +187,70 @@ void Boy::RegisterLuaxPostprocess(LuaxState& state) } //---------------------------------------------------------------------------------------------------------------- +/// +/// Ӧsignalıհ +/// +class Slot +{ +public: + Slot(LuaxState& state, Boy* widget, int refID) + : mState(state) + , mRefID(refID) + , mWidget(widget) + { + } + + void operator()() + { + ASSERT(mState); + ASSERT(mWidget); + + mWidget->PushLuaxMemberRef(mState, mRefID); + if (lua_isfunction(mState, -1)) // callback + { + mState.Call(0, 0); + } + } -class Girl : public LuaxNativeClass<Girl> +private: + LuaxState & mState; // + Boy* mWidget; // ӦĿؼ + int mRefID; // ؼ + +}; +/// +/// ؼ¼ +/// +class Signal { +public: + Signal(); + + /// + /// Fire¼connectļߣãconnectĺ + /// + void operator()() + { + for (auto callback : mCallbacks) + callback(); + } + + /// + /// עص + /// + void Connect(const Slot& callback) + { + mCallbacks.push_back(callback); + } + + /// + /// + /// + void Disconnect(); + +private: + std::vector<Slot> mCallbacks; // + }; //---------------------------------------------------------------------------------------------------------------- diff --git a/source/tests/05-physfs/ok.txt b/source/tests/05-physfs/ok.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/tests/05-physfs/ok.txt |