diff options
author | chai <chaifix@163.com> | 2019-08-02 20:51:00 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-08-02 20:51:00 +0800 |
commit | bad78945ceba425f6a80e3b8dca2414d592970eb (patch) | |
tree | 8bf7540766349c534bf9e5746b24fd7507ba034e | |
parent | 99b90496765df21c5f377f42b9ed073ccb34c1fd (diff) |
*修改文件名格式
434 files changed, 10175 insertions, 6490 deletions
diff --git a/Bin/win64/LuaxTest.exe b/Bin/win64/LuaxTest.exe Binary files differdeleted file mode 100644 index 3acc2da..0000000 --- a/Bin/win64/LuaxTest.exe +++ /dev/null diff --git a/Build/Asura.Editor/Asura.Editor.vcxproj b/Build/Asura.Editor/Asura.Editor.vcxproj index 72dc736..b2168db 100644 --- a/Build/Asura.Editor/Asura.Editor.vcxproj +++ b/Build/Asura.Editor/Asura.Editor.vcxproj @@ -117,47 +117,51 @@ </Link> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="..\..\source\Asura.Editor\controls\button.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\controls\content.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\controls\label.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\controls\toggle.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\controls\panel.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\editor.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\graphics\brush.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\graphics\drawer.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\graphics\draw_info.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\graphics\slider.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\graphics\style.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\graphics\pen.cpp" /> - <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\system\file_watcher.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\system\editor_window.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUIButton.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUIContent.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUILabel.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUIPanel.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUISlider.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUIToggle.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Controls\TextUtil.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Editor.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Graphics\Brush.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Graphics\Drawer.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Graphics\DrawInfo.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Graphics\Pen.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Graphics\Style.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Layout\HorizontalLayout.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Layout\VerticalLayout.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Main.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\System\ContainerWindow.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\System\FileWatcher.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\System\MenuController.cpp" /> </ItemGroup> <ItemGroup> - <ClInclude Include="..\..\source\Asura.Editor\config.h" /> - <ClInclude Include="..\..\source\Asura.Editor\controls\button.h" /> - <ClInclude Include="..\..\source\Asura.Editor\controls\content.h" /> - <ClInclude Include="..\..\source\Asura.Editor\controls\label.h" /> - <ClInclude Include="..\..\source\Asura.Editor\controls\toggle.h" /> - <ClInclude Include="..\..\source\Asura.Editor\controls\panel.h" /> - <ClInclude Include="..\..\source\Asura.Editor\core\gui_state.h" /> - <ClInclude Include="..\..\source\Asura.Editor\editor.h" /> - <ClInclude Include="..\..\source\Asura.Editor\graphics\brush.h" /> - <ClInclude Include="..\..\source\Asura.Editor\graphics\drawer.h" /> - <ClInclude Include="..\..\source\Asura.Editor\graphics\draw_info.h" /> - <ClInclude Include="..\..\source\Asura.Editor\graphics\slider.h" /> - <ClInclude Include="..\..\source\Asura.Editor\graphics\style.h" /> - <ClInclude Include="..\..\source\Asura.Editor\graphics\pen.h" /> - <ClInclude Include="..\..\source\Asura.Editor\graphics\shader.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Config.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUIButton.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUIContent.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUILabel.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUIPanel.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUISlider.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUIToggle.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Controls\TextUtil.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Core\GUIState.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Editor.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\Brush.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\Drawer.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\DrawInfo.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\Pen.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\Shader.h" /> <ClInclude Include="..\..\source\Asura.Editor\graphics\shaders\image.shader.h" /> <ClInclude Include="..\..\source\Asura.Editor\graphics\shaders\polygon.shader.h" /> - <ClInclude Include="..\..\source\Asura.Editor\layout\horizontal_layout.h" /> - <ClInclude Include="..\..\source\Asura.Editor\layout\vertical_layout.h" /> - <ClInclude Include="..\..\source\Asura.Editor\system\file_watcher.h" /> - <ClInclude Include="..\..\source\Asura.Editor\system\editor_window.h" /> - <ClInclude Include="..\..\source\Asura.Editor\type.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\Style.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Layout\HorizontalLayout.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Layout\VerticalLayout.h" /> + <ClInclude Include="..\..\source\Asura.Editor\System\ContainerWindow.h" /> + <ClInclude Include="..\..\source\Asura.Editor\System\FileWatcher.h" /> + <ClInclude Include="..\..\source\Asura.Editor\System\MenuController.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Type.h" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/Build/Asura.Editor/Asura.Editor.vcxproj.filters b/Build/Asura.Editor/Asura.Editor.vcxproj.filters index 0e979a4..a535cb8 100644 --- a/Build/Asura.Editor/Asura.Editor.vcxproj.filters +++ b/Build/Asura.Editor/Asura.Editor.vcxproj.filters @@ -1,134 +1,149 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> - <Filter Include="layout"> - <UniqueIdentifier>{7654ef3d-54c4-490f-bb24-e6a67bd63e1e}</UniqueIdentifier> + <Filter Include="Controls"> + <UniqueIdentifier>{a4345092-d09c-424c-8d7c-c076914fb6a2}</UniqueIdentifier> </Filter> - <Filter Include="core"> + <Filter Include="Core"> <UniqueIdentifier>{f67906bd-4f7c-4ac6-bca1-019617435a8b}</UniqueIdentifier> </Filter> - <Filter Include="system"> - <UniqueIdentifier>{48600309-cddd-49cd-b939-7a19a2b1eaa3}</UniqueIdentifier> - </Filter> - <Filter Include="graphics"> + <Filter Include="Graphics"> <UniqueIdentifier>{4be8ce5c-0921-4341-a976-92d31aa84c8c}</UniqueIdentifier> </Filter> - <Filter Include="graphics\shaders"> + <Filter Include="Graphics\shaders"> <UniqueIdentifier>{b4c26f9c-9f4e-4332-a6e2-33456b4abecb}</UniqueIdentifier> </Filter> - <Filter Include="controls"> - <UniqueIdentifier>{a236e36b-9b74-48a2-a4c9-f70dbb321f14}</UniqueIdentifier> + <Filter Include="Layout"> + <UniqueIdentifier>{7654ef3d-54c4-490f-bb24-e6a67bd63e1e}</UniqueIdentifier> + </Filter> + <Filter Include="System"> + <UniqueIdentifier>{48600309-cddd-49cd-b939-7a19a2b1eaa3}</UniqueIdentifier> + </Filter> + <Filter Include="Controls\Binding"> + <UniqueIdentifier>{1e378398-d7f0-4616-a986-b6a86faeaa8c}</UniqueIdentifier> </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="..\..\source\Asura.Editor\layout\horizontal_layout.cpp"> - <Filter>layout</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUIButton.cpp"> + <Filter>Controls</Filter> + </ClCompile> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUIContent.cpp"> + <Filter>Controls</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\layout\vertical_layout.cpp"> - <Filter>layout</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUILabel.cpp"> + <Filter>Controls</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\editor.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\main.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\system\file_watcher.cpp"> - <Filter>system</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUIPanel.cpp"> + <Filter>Controls</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\graphics\drawer.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUIToggle.cpp"> + <Filter>Controls</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\graphics\draw_info.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Graphics\Brush.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\graphics\brush.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Graphics\Drawer.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\graphics\pen.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Graphics\DrawInfo.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\system\editor_window.cpp"> - <Filter>system</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Graphics\Pen.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\graphics\style.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Graphics\Style.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\controls\button.cpp"> - <Filter>controls</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Layout\HorizontalLayout.cpp"> + <Filter>Layout</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\controls\content.cpp"> - <Filter>controls</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Layout\VerticalLayout.cpp"> + <Filter>Layout</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\controls\label.cpp"> - <Filter>controls</Filter> + <ClCompile Include="..\..\source\Asura.Editor\System\FileWatcher.cpp"> + <Filter>System</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\controls\toggle.cpp"> - <Filter>controls</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Editor.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Main.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUISlider.cpp"> + <Filter>Controls</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\controls\panel.cpp"> - <Filter>controls</Filter> + <ClCompile Include="..\..\source\Asura.Editor\System\MenuController.cpp"> + <Filter>System</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\graphics\slider.cpp"> - <Filter>controls</Filter> + <ClCompile Include="..\..\source\Asura.Editor\System\ContainerWindow.cpp"> + <Filter>System</Filter> + </ClCompile> + <ClCompile Include="..\..\source\Asura.Editor\Controls\TextUtil.cpp"> + <Filter>Controls</Filter> </ClCompile> </ItemGroup> <ItemGroup> - <ClInclude Include="..\..\source\Asura.Editor\layout\horizontal_layout.h"> - <Filter>layout</Filter> + <ClInclude Include="..\..\source\Asura.Editor\graphics\shaders\image.shader.h"> + <Filter>Graphics\shaders</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\layout\vertical_layout.h"> - <Filter>layout</Filter> + <ClInclude Include="..\..\source\Asura.Editor\graphics\shaders\polygon.shader.h"> + <Filter>Graphics\shaders</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\editor.h" /> - <ClInclude Include="..\..\source\Asura.Editor\system\file_watcher.h"> - <Filter>system</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUIButton.h"> + <Filter>Controls</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\config.h" /> - <ClInclude Include="..\..\source\Asura.Editor\type.h" /> - <ClInclude Include="..\..\source\Asura.Editor\graphics\drawer.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUIContent.h"> + <Filter>Controls</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\graphics\shaders\image.shader.h"> - <Filter>graphics\shaders</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUILabel.h"> + <Filter>Controls</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\graphics\shader.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUIPanel.h"> + <Filter>Controls</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\graphics\draw_info.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUIToggle.h"> + <Filter>Controls</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\graphics\brush.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Core\GUIState.h"> + <Filter>Core</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\graphics\pen.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\Brush.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\graphics\shaders\polygon.shader.h"> - <Filter>graphics\shaders</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\Drawer.h"> + <Filter>Graphics</Filter> + </ClInclude> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\DrawInfo.h"> + <Filter>Graphics</Filter> + </ClInclude> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\Pen.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\system\editor_window.h"> - <Filter>system</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\Shader.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\core\gui_state.h"> - <Filter>core</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\Style.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\graphics\style.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Layout\HorizontalLayout.h"> + <Filter>Layout</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\controls\button.h"> - <Filter>controls</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Layout\VerticalLayout.h"> + <Filter>Layout</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\controls\content.h"> - <Filter>controls</Filter> + <ClInclude Include="..\..\source\Asura.Editor\System\FileWatcher.h"> + <Filter>System</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\controls\label.h"> - <Filter>controls</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Config.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Editor.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Type.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUISlider.h"> + <Filter>Controls</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\controls\toggle.h"> - <Filter>controls</Filter> + <ClInclude Include="..\..\source\Asura.Editor\System\MenuController.h"> + <Filter>System</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\controls\panel.h"> - <Filter>controls</Filter> + <ClInclude Include="..\..\source\Asura.Editor\System\ContainerWindow.h"> + <Filter>System</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\graphics\slider.h"> - <Filter>controls</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Controls\TextUtil.h"> + <Filter>Controls</Filter> </ClInclude> </ItemGroup> </Project>
\ No newline at end of file diff --git a/Build/Asura.Runner/Asura.Runner.vcxproj b/Build/Asura.Runner/Asura.Runner.vcxproj index ecf025b..0c18dc5 100644 --- a/Build/Asura.Runner/Asura.Runner.vcxproj +++ b/Build/Asura.Runner/Asura.Runner.vcxproj @@ -18,13 +18,6 @@ <Platform>x64</Platform> </ProjectConfiguration> </ItemGroup> - <ItemGroup> - <ClCompile Include="..\..\source\Asura.Runner\main.cpp" /> - <ClCompile Include="..\..\source\Asura.Runner\runner.cpp" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\..\source\Asura.Runner\runner.h" /> - </ItemGroup> <PropertyGroup Label="Globals"> <VCProjectVersion>15.0</VCProjectVersion> <ProjectGuid>{E21A839A-C7C6-4B83-89FB-C921AEBEA9CD}</ProjectGuid> @@ -83,7 +76,6 @@ <Optimization>Disabled</Optimization> <SDLCheck>true</SDLCheck> <ConformanceMode>true</ConformanceMode> - <AdditionalIncludeDirectories>$(SolutionDir)..\source\external;$(SolutionDir)..\source\modules;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> @@ -116,13 +108,14 @@ <IntrinsicFunctions>true</IntrinsicFunctions> <SDLCheck>true</SDLCheck> <ConformanceMode>true</ConformanceMode> - <AdditionalIncludeDirectories>$(SolutionDir)..\source\external;$(SolutionDir)..\source\modules;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> <Link> <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> </Link> </ItemDefinitionGroup> + <ItemGroup> + </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> diff --git a/Build/Asura.Runner/Asura.Runner.vcxproj.filters b/Build/Asura.Runner/Asura.Runner.vcxproj.filters index 1819f86..3c6f4fd 100644 --- a/Build/Asura.Runner/Asura.Runner.vcxproj.filters +++ b/Build/Asura.Runner/Asura.Runner.vcxproj.filters @@ -1,10 +1,17 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> - <ClCompile Include="..\..\source\Asura.Runner\main.cpp" /> - <ClCompile Include="..\..\source\Asura.Runner\runner.cpp" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\..\source\Asura.Runner\runner.h" /> + <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/Source/Asura.Editor/main.cpp b/Source/Asura.Editor/main.cpp index ed055cf..207474b 100644 --- a/Source/Asura.Editor/main.cpp +++ b/Source/Asura.Editor/main.cpp @@ -9,13 +9,13 @@ * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * - * 1. The origin of this software must not be misrepresented; you must not + * 1. The origin of this software m_ust not be m_isrepresented; you m_ust not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. + * 2. Altered source versions m_ust be plainly m_arked as such, and m_ust not be + * m_isrepresented as being the original software. + * 3. This notice m_ay not be removed or altered from any source distribution. **/ /// diff --git a/bin/win64/01-window.exe b/bin/win64/01-window.exe Binary files differdeleted file mode 100644 index f3f2e54..0000000 --- a/bin/win64/01-window.exe +++ /dev/null diff --git a/bin/win64/05-physfs.exe b/bin/win64/05-physfs.exe Binary files differdeleted file mode 100644 index e325343..0000000 --- a/bin/win64/05-physfs.exe +++ /dev/null diff --git a/bin/win64/LuaxTest.exe b/bin/win64/LuaxTest.exe Binary files differdeleted file mode 100644 index 3acc2da..0000000 --- a/bin/win64/LuaxTest.exe +++ /dev/null diff --git a/bin/win64/SDL2.dll b/bin/win64/SDL2.dll Binary files differdeleted file mode 100644 index becc4ba..0000000 --- a/bin/win64/SDL2.dll +++ /dev/null diff --git a/bin/win64/bindingGen.exe b/bin/win64/bindingGen.exe Binary files differdeleted file mode 100644 index 016c299..0000000 --- a/bin/win64/bindingGen.exe +++ /dev/null diff --git a/bin/win64/bindingGen.exe.config b/bin/win64/bindingGen.exe.config deleted file mode 100644 index 731f6de..0000000 --- a/bin/win64/bindingGen.exe.config +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<configuration> - <startup> - <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> - </startup> -</configuration>
\ No newline at end of file diff --git a/bin/win64/img.jpg b/bin/win64/img.jpg Binary files differdeleted file mode 100644 index 8987cfe..0000000 --- a/bin/win64/img.jpg +++ /dev/null diff --git a/bin/win64/img.png b/bin/win64/img.png Binary files differdeleted file mode 100644 index 0d11f85..0000000 --- a/bin/win64/img.png +++ /dev/null diff --git a/bin/win64/physfs.txt b/bin/win64/physfs.txt deleted file mode 100644 index 00530bc..0000000 --- a/bin/win64/physfs.txt +++ /dev/null @@ -1 +0,0 @@ -hello, world
\ No newline at end of file diff --git a/bin/win64/physfs2.txt b/bin/win64/physfs2.txt deleted file mode 100644 index c0f0d31..0000000 --- a/bin/win64/physfs2.txt +++ /dev/null @@ -1,4528 +0,0 @@ -// This file has been modified from Ken Silverman's original release - -#define NOSOUND - -/*************************************************************************************************** -WINMAIN.CPP & SYSMAIN.H - -Windows layer code written by Ken Silverman (http://advsys.net/ken) (1997-2005) -Additional modifications by Tom Dobrowolski (http://ged.ax.pl/~tomkh) -You may use this code for non-commercial purposes as long as credit is maintained. -***************************************************************************************************/ - - //To compile, link with ddraw.lib, dinput.lib AND dxguid.lib. Be sure ddraw.h and dinput.h - //are in include path - -#include "StdAfx.h" -#include "msvc.h" -#include "Engine/Minidump.h" -#define WIN32_LEAN_AND_MEAN -#include <windows.h> - -#ifndef NODRAW -#define DIRECTDRAW_VERSION 0x0700 -#include "ddraw.h" -#endif -#ifndef NOINPUT -#define DIRECTINPUT_VERSION 0x0800 -#include "dinput.h" -#endif -#ifndef NOSOUND -#define DIRECTSOUND_VERSION 0x0900 -#include <mmsystem.h> //dsound.h requires this when using LEAN_AND_MEAN -#include "dsound.h" -#ifndef USEKZ -#include <stdio.h> //for fopen -#else -extern long kzopen (const char *); -extern long kzread (void *, long); -extern long kzseek (long, long); -extern void kzclose (); -extern long kzeof (); -#endif -#define DSOUNDINITCOM 1 //0=Link DSOUND.DLL, 1=Use COM interface to init DSOUND -#ifndef USEKENSOUND -#define USEKENSOUND 1 //0=playsound undefined (umixer only), 1=Ken's fancy sound renderer, 2=Standard Directsound secondary buffers -#endif -#define USETHREADS 20 //0=Disable, nonzero=enable multithreading and this is sleep value (20 is good) - //Use threads to fix audio gaps (and possibly other bugs too!) -#else -#define USETHREADS 0 -#endif - -#if ((USEKENSOUND == 1) && (USETHREADS != 0)) - //WinXP:Sleep(0)=infinite,Sleep(1-16)=64hz,Sleep(17-32)=32hz,Sleep(33-48)=21.3hz, etc...) - //Remember to add /MD, /MT or /link libcmt.lib kernel32.lib /nodefaultlib to compile options! -#include <process.h> -static HANDLE hmutx; -#define ENTERMUTX WaitForSingleObject(hmutx,USETHREADS) //Do NOT use ,INFINITE) - too dangerous! -#define LEAVEMUTX ReleaseMutex(hmutx) -#else -#define ENTERMUTX -#define LEAVEMUTX -#endif - -#pragma warning(disable:4730) -#pragma warning(disable:4731) - -char *prognam = "Voxelstein3D"; -long progresiz = 1; -long progwndflags, progwndx = 0x80000000, progwndy, progwndadd[2]; -#ifndef NOINPUT -long dinputkeyboardflags = DISCL_NONEXCLUSIVE|DISCL_FOREGROUND; -long dinputmouseflags = DISCL_EXCLUSIVE|DISCL_FOREGROUND; -#endif - -#define WM_MOUSEWHEEL 0x020A - -extern long initapp (long argc, char **argv); -extern void initapp2(); -extern void uninitapp (); -extern void doframe (); - -static long quitprogram = 0, quitparam; -void breath(); - -void (*MenuFunc)(int iID, HANDLE hComponent) = NULL; - - //Global window variables -static WNDCLASS wc; -HWND ghwnd; -HINSTANCE ghinst, ghpinst; -LPSTR gcmdline; -int gncmdshow; - -long ActiveApp = 1, alwaysactive = 0; -long xres = 640, yres = 480, colbits = 8, fullscreen = 1, maxpages = 8; - - // Note! Without clipper blit is faster but only with software bliter -//#define NO_CLIPPER - -//======================== CPU detection code begins ======================== - -static long cputype = 0; -static OSVERSIONINFO osvi; - -#ifdef __WATCOMC__ - -long testflag (long); -#pragma aux testflag =\ - "pushfd"\ - "pop eax"\ - "mov ebx, eax"\ - "xor eax, ecx"\ - "push eax"\ - "popfd"\ - "pushfd"\ - "pop eax"\ - "xor eax, ebx"\ - "mov eax, 1"\ - "jne menostinx"\ - "xor eax, eax"\ - "menostinx:"\ - parm nomemory [ecx]\ - modify exact [eax ebx]\ - value [eax] - -void cpuid (long, long *); -#pragma aux cpuid =\ - ".586"\ - "cpuid"\ - "mov dword ptr [esi], eax"\ - "mov dword ptr [esi+4], ebx"\ - "mov dword ptr [esi+8], ecx"\ - "mov dword ptr [esi+12], edx"\ - parm [eax][esi]\ - modify exact [eax ebx ecx edx]\ - value - -#endif -#ifdef _MSC_VER - -#pragma warning(disable:4799) //I know how to use EMMS - -static _inline long testflag (long c) -{ - _asm - { - mov ecx, c - pushfd - pop eax - mov edx, eax - xor eax, ecx - push eax - popfd - pushfd - pop eax - xor eax, edx - mov eax, 1 - jne menostinx - xor eax, eax - menostinx: - } -} - -static _inline void cpuid (long a, long *s) -{ - _asm - { - push ebx - push esi - mov eax, a - cpuid - mov esi, s - mov dword ptr [esi+0], eax - mov dword ptr [esi+4], ebx - mov dword ptr [esi+8], ecx - mov dword ptr [esi+12], edx - pop esi - pop ebx - } -} - -#endif - - //Bit numbers of return value: - //0:FPU, 4:RDTSC, 15:CMOV, 22:MMX+, 23:MMX, 25:SSE, 26:SSE2, 30:3DNow!+, 31:3DNow! -static long getcputype () -{ - long i, cpb[4], cpid[4]; - if (!testflag(0x200000)) return(0); - cpuid(0,cpid); if (!cpid[0]) return(0); - cpuid(1,cpb); i = (cpb[3]&~((1<<22)|(1<<30)|(1<<31))); - cpuid(0x80000000,cpb); - if (((unsigned long)cpb[0]) > 0x80000000) - { - cpuid(0x80000001,cpb); - i |= (cpb[3]&(1<<31)); - if (!((cpid[1]^0x68747541)|(cpid[3]^0x69746e65)|(cpid[2]^0x444d4163))) //AuthenticAMD - i |= (cpb[3]&((1<<22)|(1<<30))); - } - if (i&(1<<25)) i |= (1<<22); //SSE implies MMX+ support - return(i); -} - -//========================= CPU detection code ends ========================= - -//================== Fast & accurate TIMER FUNCTIONS begins ================== - -#if 0 -#ifdef __WATCOMC__ - -__int64 rdtsc64 (); -#pragma aux rdtsc64 = "rdtsc" value [edx eax] modify nomemory parm nomemory; - -#endif -#ifdef _MSC_VER - -static __forceinline __int64 rdtsc64 () { _asm rdtsc } - -#endif - -static __int64 pertimbase, rdtimbase, nextimstep; -static double perfrq, klockmul, klockadd; - -void initklock () -{ - __int64 q; - QueryPerformanceFrequency((LARGE_INTEGER *)&q); - perfrq = (double)q; - rdtimbase = rdtsc64(); - QueryPerformanceCounter((LARGE_INTEGER *)&pertimbase); - nextimstep = 4194304; klockmul = 0.000000001; klockadd = 0.0; -} - -void readklock (double *tim) -{ - __int64 q = rdtsc64()-rdtimbase; - if (q > nextimstep) - { - __int64 p; - double d; - QueryPerformanceCounter((LARGE_INTEGER *)&p); - d = klockmul; klockmul = ((double)(p-pertimbase))/(((double)q)*perfrq); - klockadd += (d-klockmul)*((double)q); - do { nextimstep <<= 1; } while (q > nextimstep); - } - (*tim) = ((double)q)*klockmul + klockadd; -} -#else - -static __int64 klocksub; -static double klockmul; - -void initklock () -{ - __int64 q; - QueryPerformanceFrequency((LARGE_INTEGER *)&q); - klockmul = 1.0/((double)q); - QueryPerformanceCounter((LARGE_INTEGER *)&klocksub); -} - -void readklock (double *tim) -{ - __int64 q; - QueryPerformanceCounter((LARGE_INTEGER *)&q); - (*tim) = ((double)(q-klocksub))*klockmul; -} - -#endif - -//=================== Fast & accurate TIMER FUNCTIONS ends =================== - -//DirectDraw VARIABLES & CODE--------------------------------------------------------------- -#ifndef NODRAW - -PALETTEENTRY pal[256]; -long ddrawuseemulation = 0; -long ddrawdebugmode = -1; // -1 = off, old ddrawuseemulation = on - -static __int64 mask8a = 0x00ff00ff00ff00ff; -static __int64 mask8b; //0x10000d0010000d00 (fullscreen), 0x10000c0010000c00 (windowed) -static __int64 mask8c = 0x0000f8000000f800; -static __int64 mask8d = 0xff000000ff000000; -static __int64 mask8e = 0x00ff000000ff0000; -static __int64 mask8f; //0x00d000d000d000d0 (fullscreen), 0x0aca0aca0aca0aca (windowed) -static __int64 mask8g; //0xd000d000d000d000 (fullscreen), 0xca0aca0aca0aca0a (windowed) -static long mask8cnt = 0; -static __int64 mask8h = 0x0007050500070505; -static __int64 mask8lut[8] = -{ - 0x0000000000000000,0x0000001300000013, - 0x0000080000000800,0x0000081300000813, - 0x0010000000100000,0x0010001300100013, - 0x0010080000100800,0x0010081300100813 -}; -static __int64 maskrb15 = 0x00f800f800f800f8; -static __int64 maskgg15 = 0x0000f8000000f800; -static __int64 maskml15 = 0x2000000820000008; -static __int64 maskrb16 = 0x00f800f800f800f8; -static __int64 maskgg16 = 0x0000fc000000fc00; -static __int64 maskml16 = 0x2000000420000004; -static __int64 mask16a = 0x0000800000008000; -static __int64 mask16b = 0x8000800080008000; -static __int64 mask24a = 0x00ffffff00000000; -static __int64 mask24b = 0x00000000ffffff00; -static __int64 mask24c = 0x0000000000ffffff; -static __int64 mask24d = 0xffffff0000000000; - -static long lpal[256]; - - //Beware of alignment issues!!! -void kblit32 (long rplc, long rbpl, long rxsiz, long rysiz, - long wplc, long cdim, long wbpl) -{ -#ifdef _MSC_VER - if ((rxsiz <= 0) || (rysiz <= 0)) return; - if (colbits == 8) - { - long x, y; - switch(cdim) - { - case 15: case 16: - //for(y=0;y<rysiz;y++) - // for(x=0;x<rxsiz;x++) - // *(short *)(wplc+y*wbpl+x*2) = - // lpal[*(unsigned char *)(rplc+y*rbpl+x)]; - if (cputype&(1<<22)) //MMX+ - { - _asm - { - push ebx - push esi - push edi - mov esi, rplc - mov edi, wplc -begall8_16: mov edx, edi - mov eax, esi - add esi, rbpl - add edi, wbpl - mov ecx, rxsiz - test edx, 6 - jz short start_8_16 -pre_8_16: movzx ebx, byte ptr [eax] - mov bx, word ptr lpal[ebx*4] - mov [edx], bx - sub ecx, 1 - jz short endall8_16 - add eax, 1 - add edx, 2 - test edx, 6 - jnz short pre_8_16 -start_8_16: sub ecx, 3 - add eax, ecx - lea edx, [edx+ecx*2] - neg ecx - jge short skip8_16 - xor ebx, ebx -beg8_16: mov bl, byte ptr [eax+ecx] - movd mm0, lpal[ebx*4] - mov bl, byte ptr [eax+ecx+1] - movd mm1, lpal[ebx*4] - punpcklwd mm0, mm1 - mov bl, byte ptr [eax+ecx+2] - movd mm1, lpal[ebx*4] - mov bl, byte ptr [eax+ecx+3] - movd mm2, lpal[ebx*4] - punpcklwd mm1, mm2 - punpckldq mm0, mm1 - movntq [edx+ecx*2], mm0 - add ecx, 4 - jl short beg8_16 -skip8_16: sub ecx, 3 - jz short endall8_16 -end8_16: movzx ebx, byte ptr [eax+ecx+3] - mov bx, word ptr lpal[ebx*4] - mov [edx+ecx*2+6], bx - add ecx, 1 - jnz short end8_16 -endall8_16: sub rysiz, 1 ;/ - jnz short begall8_16 - pop edi - pop esi - pop ebx - emms - } - } - else - { - _asm - { - push ebx - push esi - push edi - mov esi, rplc - mov edi, wplc -begall8_16b: mov edx, edi - mov eax, esi - add esi, rbpl - add edi, wbpl - mov ecx, rxsiz - test edx, 6 - jz short start_8_16b -pre_8_16b: movzx ebx, byte ptr [eax] - mov bx, word ptr lpal[ebx*4] - mov [edx], bx - sub ecx, 1 - jz short endall8_16b - add eax, 1 - add edx, 2 - test edx, 6 - jnz short pre_8_16b -start_8_16b: sub ecx, 3 - add eax, ecx - lea edx, [edx+ecx*2] - neg ecx - jge short skip8_16b - xor ebx, ebx -beg8_16b: mov bl, byte ptr [eax+ecx] - movd mm0, lpal[ebx*4] - mov bl, byte ptr [eax+ecx+1] - movd mm1, lpal[ebx*4] - punpcklwd mm0, mm1 - mov bl, byte ptr [eax+ecx+2] - movd mm1, lpal[ebx*4] - mov bl, byte ptr [eax+ecx+3] - movd mm2, lpal[ebx*4] - punpcklwd mm1, mm2 - punpckldq mm0, mm1 - movq [edx+ecx*2], mm0 - add ecx, 4 - jl short beg8_16b -skip8_16b: sub ecx, 3 - jz short endall8_16b -end8_16b: movzx ebx, byte ptr [eax+ecx+3] - mov bx, word ptr lpal[ebx*4] - mov [edx+ecx*2+6], bx - add ecx, 1 - jnz short end8_16b -endall8_16b: sub rysiz, 1 ;/ - jnz short begall8_16b - pop edi - pop esi - pop ebx - emms - } - } - break; - case 24: - //Should work, but slow&ugly! :/ - for(y=0;y<rysiz;y++) - for(x=0;x<rxsiz;x++) - *(long *)(wplc+y*wbpl+x*3) = lpal[*(unsigned char *)(rplc+y*rbpl+x)]; - break; - case 32: - //for(y=0;y<rysiz;y++) - // for(x=0;x<rxsiz;x++) - // *(long *)(wplc+y*wbpl+(x<<2)) = lpal[*(unsigned char *)(rplc+y*rbpl+x)]; - if (cputype&(1<<22)) //MMX+ - { - _asm - { - push ebx - push esi - push edi - mov esi, rplc - mov edi, wplc -begall8_32: mov edx, edi - mov eax, esi - add esi, rbpl - add edi, wbpl - mov ecx, rxsiz - xor ebx, ebx - test edx, 4 - jz short start_8_32 - mov bl, byte ptr [eax] - movd mm0, lpal[ebx*4] - movd [edx], mm0 - sub ecx, 1 - jz short endall8_32 - add eax, 1 - add edx, 4 -start_8_32: sub ecx, 1 - add eax, ecx - lea edx, [edx+ecx*4] - neg ecx - jge short skip8_32 -beg8_32: mov bl, byte ptr [eax+ecx] - movd mm0, lpal[ebx*4] - mov bl, byte ptr [eax+ecx+1] - punpckldq mm0, lpal[ebx*4] - movntq [edx+ecx*4], mm0 - add ecx, 2 - jl short beg8_32 -skip8_32: cmp ecx, 1 - jz short endall8_32 - movzx ebx, byte ptr [eax] - movd mm0, lpal[ebx*4] - movd [edx], mm0 -endall8_32: sub rysiz, 1 ;/ - jnz short begall8_32 - pop edi - pop esi - pop ebx - emms - } - } - else - { - _asm - { - push ebx - push esi - push edi - mov esi, rplc - mov edi, wplc -begall8_32b: mov edx, edi - mov eax, esi - add esi, rbpl - add edi, wbpl - mov ecx, rxsiz - xor ebx, ebx - test edx, 4 - jz short start_8_32b - mov bl, byte ptr [eax] - movd mm0, lpal[ebx*4] - movd [edx], mm0 - sub ecx, 1 - jz short endall8_32b - add eax, 1 - add edx, 4 -start_8_32b: sub ecx, 1 - add eax, ecx - lea edx, [edx+ecx*4] - neg ecx - jge short skip8_32b -beg8_32b: mov bl, byte ptr [eax+ecx] - movd mm0, lpal[ebx*4] - mov bl, byte ptr [eax+ecx+1] - punpckldq mm0, lpal[ebx*4] - movq [edx+ecx*4], mm0 - add ecx, 2 - jl short beg8_32b -skip8_32b: cmp ecx, 1 - jz short endall8_32b - movzx ebx, byte ptr [eax] - movd mm0, lpal[ebx*4] - movd [edx], mm0 -endall8_32b: sub rysiz, 1 ;/ - jnz short begall8_32b - pop edi - pop esi - pop ebx - emms - } - } - break; - } - } - else if (colbits == 32) - { - switch (cdim) - { - case 8: - rxsiz &= ~7; if (rxsiz <= 0) return; - if (cputype&(1<<22)) //MMX+ - { - _asm - { - push ebx - push esi - - movq mm7, mask8a - movq mm6, mask8b - movq mm4, mask8d - - mov eax, rplc - mov edx, wplc - mov ecx, rxsiz - mov ebx, rysiz - shr ecx, 1 - lea eax, [eax+ecx*8] - lea edx, [edx+ecx*2-8] - neg ecx - mov rxsiz, ecx - - mov ecx, mask8cnt - xor ecx, 1 - mov mask8cnt, ecx - add ecx, ebx - test ecx, 1 - je into8b - - begall8:psubd mm4, mask8h - pmovmskb esi, mm4 - and esi, 7 - paddd mm4, mask8lut[esi*8] - - mov ecx, rxsiz - movq mm5, mask8c - beg8a: - ;src: AaaaaaaaRrrrrrrrGgggggggBbbbbbbbAaaaaaaaRrrrrrrrGgggggggBbbbbbbb - ;dst: RrrGggBbRrrGggBb - movq mm3, [eax+ecx*8] ;mm0: A1 R1 G1 B1 A0 R0 G0 B0 - movq mm1, [eax+ecx*8+8] ;mm1: A3 R3 G3 B3 A2 R2 G2 B2 - psubusb mm3, mm4 - psubusb mm1, mm4 - movq mm2, mm3 ;mm2: 00 R1 G1 B1 00 R0 G0 B0 - punpckldq mm3, mm1 ;mm3: 00 R2 G2 B2 A0 R0 G0 B0 - pand mm3, mm7 ;mm3: 00 R2 00 B2 00 R0 00 B0 - pmulhw mm3, mm6 ;mm3: 00 R2 00 B2 00 R0 00 B0 ;16<<8 13<<8 16<<8 13<<8 - punpckhdq mm2, mm1 ;mm2: 00 R3 G3 B3 00 R1 G1 B1 - pand mm2, mm5 ;mm2: 00 00 G3 00 00 00 G1 00 - pslld mm2, 5 ;mm2: 00 G3 00 00 00 G1 00 00 - movq mm1, mm3 ;mm1: 00 R2 00 B2 00 R0 00 B0 - pslld mm1, 20 ;mm1: 00 B2 00 00 00 B0 00 00 - paddd mm3, mm1 ;mm3: 00 C2 00 B2 00 C0 00 B0 - psrld mm3, 16 ;mm3: 00 00 00 C2 00 00 00 C0 ;(B2<<4)+R2 (B0<<4)+R0 - paddd mm3, mm2 ;mm3: 00 G3 00 C2 00 G1 00 C0 - - movq mm0, [eax+ecx*8+16] ;mm0: A5 R5 G5 B5 A4 R4 G4 B4 - movq mm1, [eax+ecx*8+24] ;mm1: A7 R7 G7 B7 A6 R6 G6 B6 - psubusb mm0, mm4 - psubusb mm1, mm4 - movq mm2, mm0 ;mm2: 00 R5 G5 B5 00 R4 G4 B4 - punpckldq mm0, mm1 ;mm0: 00 R6 G6 B6 A4 R4 G4 B4 - pand mm0, mm7 ;mm0: 00 R6 00 B6 00 R4 00 B4 - pmulhw mm0, mm6 ;mm0: 00 R6 00 B6 00 R4 00 B4 ;16<<8 13<<8 16<<8 13<<8 - prefetchnta [eax+ecx*8+120] - punpckhdq mm2, mm1 ;mm2: 00 R7 G7 B7 00 R5 G5 B5 - add ecx, 4 - pand mm2, mm5 ;mm2: 00 00 G7 00 00 00 G5 00 - pslld mm2, 5 ;mm2: 00 G7 00 00 00 G5 00 00 - movq mm1, mm0 ;mm1: 00 R6 00 B6 00 R4 00 B4 - pslld mm1, 20 ;mm1: 00 B6 00 00 00 B4 00 00 - paddd mm0, mm1 ;mm0: 00 C6 00 B6 00 C4 00 B4 - psrld mm0, 16 ;mm0: 00 00 00 C6 00 00 00 C4 ;(B6<<4)+R6 (B4<<4)+R4 - paddd mm0, mm2 ;mm0: 00 G7 00 C6 00 G5 00 C4 - - packuswb mm3, mm0 ;mm3: G7 C6 G5 C4 G3 C2 G1 C0 - paddd mm3, mask8g ;mm3: C7 C6 C5 C4 C3 C2 C1 C0 - movntq [edx+ecx*2], mm3 - js short beg8a - - add eax, rbpl - add edx, wbpl - sub ebx, 1 - jz endit8 - - into8b:psubd mm4, mask8h - pmovmskb esi, mm4 - and esi, 7 - paddd mm4, mask8lut[esi*8] - - mov ecx, rxsiz - movq mm5, mask8e - beg8b: - ;src: AaaaaaaaRrrrrrrrGgggggggBbbbbbbbAaaaaaaaRrrrrrrrGgggggggBbbbbbbb - ;dst: RrrGggBbRrrGggBb - movq mm3, [eax+ecx*8] ;mm3: A1 R1 G1 B1 A0 R0 G0 B0 - movq mm1, [eax+ecx*8+8] ;mm1: A3 R3 G3 B3 A2 R2 G2 B2 - psubusb mm3, mm4 - psubusb mm1, mm4 - movq mm2, mm3 ;mm2: 00 R1 G1 B1 00 R0 G0 B0 - punpckhdq mm3, mm1 ;mm3: 00 R3 G3 B3 00 R1 G1 B1 - pand mm3, mm7 ;mm3: 00 R3 00 B3 00 R1 00 B1 - pmulhw mm3, mm6 ;mm3: 00 R3 00 B3 00 R1 00 B1 ;16<<8 13<<8 16<<8 13<<8 - punpckldq mm2, mm1 ;mm2: 00 R2 G2 B2 00 R0 G0 B0 - psrlw mm2, 11 ;mm2: 00 00 00 G2 00 00 00 G0 - movq mm1, mm3 ;mm1: 00 R3 00 B3 00 R1 00 B1 - pslld mm1, 20 ;mm1: 00 B3 00 00 00 B1 00 00 - paddd mm3, mm1 ;mm3: 00 C3 00 B3 00 C1 00 B1 - pand mm3, mm5 ;mm3: 00 C3 00 00 00 C1 00 00 ;(B3<<4)+R3 (B1<<4)+R1 - paddd mm3, mm2 ;mm3: 00 C3 00 G2 00 C1 00 G0 - - movq mm0, [eax+ecx*8+16] ;mm0: A5 R5 G5 B5 A4 R4 G4 B4 - movq mm1, [eax+ecx*8+24] ;mm1: A7 R7 G7 B7 A6 R6 G6 B6 - psubusb mm0, mm4 - psubusb mm1, mm4 - movq mm2, mm0 ;mm2: 00 R5 G5 B5 00 R4 G4 B4 - punpckhdq mm0, mm1 ;mm0: 00 R7 G7 B7 00 R5 G5 B5 - pand mm0, mm7 ;mm0: 00 R7 00 B7 00 R5 00 B5 - pmulhw mm0, mm6 ;mm0: 00 R7 00 B7 00 R5 00 B5 ;16<<8 13<<8 16<<8 13<<8 - prefetchnta [eax+ecx*8+120] - punpckldq mm2, mm1 ;mm2: 00 R6 G6 B6 00 R4 G4 B4 - add ecx, 4 - psrlw mm2, 11 ;mm2: 00 00 00 G6 00 00 00 G4 - movq mm1, mm0 ;mm1: 00 R7 00 B7 00 R5 00 B5 - pslld mm1, 20 ;mm1: 00 B7 00 00 00 B5 00 00 - paddd mm0, mm1 ;mm0: 00 C7 00 B7 00 C5 00 B5 - pand mm0, mm5 ;mm0: 00 C7 00 00 00 C5 00 00 ;(B7<<4)+R7 (B5<<4)+R5 - paddd mm0, mm2 ;mm0: 00 C7 00 G6 00 C5 00 G4 - - packuswb mm3, mm0 ;mm3: C7 G6 C5 G4 C3 G2 C1 G0 - paddd mm3, mask8f ;mm3: C7 C6 C5 C4 C3 C2 C1 C0 - movntq [edx+ecx*2], mm3 - js short beg8b - - add eax, rbpl - add edx, wbpl - sub ebx, 1 - jnz begall8 - - endit8:psubd mm4, mask8h - pmovmskb esi, mm4 - and esi, 7 - paddd mm4, mask8lut[esi*8] - movq mask8d, mm4 - - pop esi - pop ebx - emms - } - } - else - { - _asm - { - push ebx - push esi - - movq mm7, mask8a - movq mm6, mask8b - movq mm4, mask8d - - mov eax, rplc - mov edx, wplc - mov ecx, rxsiz - mov ebx, rysiz - shr ecx, 1 - lea eax, [eax+ecx*8] - lea edx, [edx+ecx*2-8] - neg ecx - mov rxsiz, ecx - - mov ecx, mask8cnt - xor ecx, 1 - mov mask8cnt, ecx - add ecx, ebx - test ecx, 1 - je into8bb - - begall8b:psubd mm4, mask8h - pmovmskb esi, mm4 - and esi, 7 - paddd mm4, mask8lut[esi*8] - - mov ecx, rxsiz - movq mm5, mask8c - beg8ab: - ;src: AaaaaaaaRrrrrrrrGgggggggBbbbbbbbAaaaaaaaRrrrrrrrGgggggggBbbbbbbb - ;dst: RrrGggBbRrrGggBb - movq mm3, [eax+ecx*8] ;mm0: A1 R1 G1 B1 A0 R0 G0 B0 - movq mm1, [eax+ecx*8+8] ;mm1: A3 R3 G3 B3 A2 R2 G2 B2 - psubusb mm3, mm4 - psubusb mm1, mm4 - movq mm2, mm3 ;mm2: 00 R1 G1 B1 00 R0 G0 B0 - punpckldq mm3, mm1 ;mm3: 00 R2 G2 B2 A0 R0 G0 B0 - pand mm3, mm7 ;mm3: 00 R2 00 B2 00 R0 00 B0 - pmulhw mm3, mm6 ;mm3: 00 R2 00 B2 00 R0 00 B0 ;16<<8 13<<8 16<<8 13<<8 - punpckhdq mm2, mm1 ;mm2: 00 R3 G3 B3 00 R1 G1 B1 - pand mm2, mm5 ;mm2: 00 00 G3 00 00 00 G1 00 - pslld mm2, 5 ;mm2: 00 G3 00 00 00 G1 00 00 - movq mm1, mm3 ;mm1: 00 R2 00 B2 00 R0 00 B0 - pslld mm1, 20 ;mm1: 00 B2 00 00 00 B0 00 00 - paddd mm3, mm1 ;mm3: 00 C2 00 B2 00 C0 00 B0 - psrld mm3, 16 ;mm3: 00 00 00 C2 00 00 00 C0 ;(B2<<4)+R2 (B0<<4)+R0 - paddd mm3, mm2 ;mm3: 00 G3 00 C2 00 G1 00 C0 - - movq mm0, [eax+ecx*8+16] ;mm0: A5 R5 G5 B5 A4 R4 G4 B4 - movq mm1, [eax+ecx*8+24] ;mm1: A7 R7 G7 B7 A6 R6 G6 B6 - psubusb mm0, mm4 - psubusb mm1, mm4 - movq mm2, mm0 ;mm2: 00 R5 G5 B5 00 R4 G4 B4 - punpckldq mm0, mm1 ;mm0: 00 R6 G6 B6 A4 R4 G4 B4 - pand mm0, mm7 ;mm0: 00 R6 00 B6 00 R4 00 B4 - pmulhw mm0, mm6 ;mm0: 00 R6 00 B6 00 R4 00 B4 ;16<<8 13<<8 16<<8 13<<8 - punpckhdq mm2, mm1 ;mm2: 00 R7 G7 B7 00 R5 G5 B5 - add ecx, 4 - pand mm2, mm5 ;mm2: 00 00 G7 00 00 00 G5 00 - pslld mm2, 5 ;mm2: 00 G7 00 00 00 G5 00 00 - movq mm1, mm0 ;mm1: 00 R6 00 B6 00 R4 00 B4 - pslld mm1, 20 ;mm1: 00 B6 00 00 00 B4 00 00 - paddd mm0, mm1 ;mm0: 00 C6 00 B6 00 C4 00 B4 - psrld mm0, 16 ;mm0: 00 00 00 C6 00 00 00 C4 ;(B6<<4)+R6 (B4<<4)+R4 - paddd mm0, mm2 ;mm0: 00 G7 00 C6 00 G5 00 C4 - - packuswb mm3, mm0 ;mm3: G7 C6 G5 C4 G3 C2 G1 C0 - paddd mm3, mask8g ;mm3: C7 C6 C5 C4 C3 C2 C1 C0 - movq [edx+ecx*2], mm3 - js short beg8ab - - add eax, rbpl - add edx, wbpl - sub ebx, 1 - jz endit8b - - into8bb:psubd mm4, mask8h - pmovmskb esi, mm4 - and esi, 7 - paddd mm4, mask8lut[esi*8] - - mov ecx, rxsiz - movq mm5, mask8e - beg8bb: - ;src: AaaaaaaaRrrrrrrrGgggggggBbbbbbbbAaaaaaaaRrrrrrrrGgggggggBbbbbbbb - ;dst: RrrGggBbRrrGggBb - movq mm3, [eax+ecx*8] ;mm3: A1 R1 G1 B1 A0 R0 G0 B0 - movq mm1, [eax+ecx*8+8] ;mm1: A3 R3 G3 B3 A2 R2 G2 B2 - psubusb mm3, mm4 - psubusb mm1, mm4 - movq mm2, mm3 ;mm2: 00 R1 G1 B1 00 R0 G0 B0 - punpckhdq mm3, mm1 ;mm3: 00 R3 G3 B3 00 R1 G1 B1 - pand mm3, mm7 ;mm3: 00 R3 00 B3 00 R1 00 B1 - pmulhw mm3, mm6 ;mm3: 00 R3 00 B3 00 R1 00 B1 ;16<<8 13<<8 16<<8 13<<8 - punpckldq mm2, mm1 ;mm2: 00 R2 G2 B2 00 R0 G0 B0 - psrlw mm2, 11 ;mm2: 00 00 00 G2 00 00 00 G0 - movq mm1, mm3 ;mm1: 00 R3 00 B3 00 R1 00 B1 - pslld mm1, 20 ;mm1: 00 B3 00 00 00 B1 00 00 - paddd mm3, mm1 ;mm3: 00 C3 00 B3 00 C1 00 B1 - pand mm3, mm5 ;mm3: 00 C3 00 00 00 C1 00 00 ;(B3<<4)+R3 (B1<<4)+R1 - paddd mm3, mm2 ;mm3: 00 C3 00 G2 00 C1 00 G0 - - movq mm0, [eax+ecx*8+16] ;mm0: A5 R5 G5 B5 A4 R4 G4 B4 - movq mm1, [eax+ecx*8+24] ;mm1: A7 R7 G7 B7 A6 R6 G6 B6 - psubusb mm0, mm4 - psubusb mm1, mm4 - movq mm2, mm0 ;mm2: 00 R5 G5 B5 00 R4 G4 B4 - punpckhdq mm0, mm1 ;mm0: 00 R7 G7 B7 00 R5 G5 B5 - pand mm0, mm7 ;mm0: 00 R7 00 B7 00 R5 00 B5 - pmulhw mm0, mm6 ;mm0: 00 R7 00 B7 00 R5 00 B5 ;16<<8 13<<8 16<<8 13<<8 - punpckldq mm2, mm1 ;mm2: 00 R6 G6 B6 00 R4 G4 B4 - add ecx, 4 - psrlw mm2, 11 ;mm2: 00 00 00 G6 00 00 00 G4 - movq mm1, mm0 ;mm1: 00 R7 00 B7 00 R5 00 B5 - pslld mm1, 20 ;mm1: 00 B7 00 00 00 B5 00 00 - paddd mm0, mm1 ;mm0: 00 C7 00 B7 00 C5 00 B5 - pand mm0, mm5 ;mm0: 00 C7 00 00 00 C5 00 00 ;(B7<<4)+R7 (B5<<4)+R5 - paddd mm0, mm2 ;mm0: 00 C7 00 G6 00 C5 00 G4 - - packuswb mm3, mm0 ;mm3: C7 G6 C5 G4 C3 G2 C1 G0 - paddd mm3, mask8f ;mm3: C7 C6 C5 C4 C3 C2 C1 C0 - movq [edx+ecx*2], mm3 - js short beg8bb - - add eax, rbpl - add edx, wbpl - sub ebx, 1 - jnz begall8b - - endit8b:psubd mm4, mask8h - pmovmskb esi, mm4 - and esi, 7 - paddd mm4, mask8lut[esi*8] - movq mask8d, mm4 - - pop esi - pop ebx - emms - } - - } - //mask8cnt ^= 1; - - break; - case 15: - if (cputype&(1<<22)) //MMX+ - { - _asm - { - push ebx - push esi - - movq mm7, maskrb15 - movq mm6, maskgg15 - movq mm5, maskml15 - - mov eax, rplc - mov edx, wplc - mov ecx, rxsiz - mov ebx, rysiz - add ecx, 2 - shr ecx, 1 - lea eax, [eax+ecx*8] - lea edx, [edx+ecx*4-8] - neg ecx - mov rysiz, ecx ;Use rysiz as scratch register - jmp short into15 - beg15: ;src: AaaaaaaaRrrrrrrrGgggggggBbbbbbbb """ - ; --------Rrrrr---Ggggg---Bbbbb--- """ - ;dst: -RrrrrGggggBbbbb-RrrrrGggggBbbbb " - movntq [edx+ecx*4], mm0 - into15:movq mm0, [eax+ecx*8] ;AaaaaaaaRrrrrrrrGgggggggBbbbbbbb " - movq mm1, [eax+ecx*8+8] ;AaaaaaaaRrrrrrrrGgggggggBbbbbbbb " - movq mm2, mm0 - movq mm3, mm1 - pand mm0, mm7 ;--------Rrrrr-----------Bbbbb--- " - pand mm1, mm7 ;--------Rrrrr-----------Bbbbb--- " - pmaddwd mm0, mm5 ;-----------Rrrrr-----Bbbbb------ " ;8192 8 8192 8 - pmaddwd mm1, mm5 ;-----------Rrrrr-----Bbbbb------ " ;8192 8 8192 8 - prefetchnta [eax+ecx*8+72] - add ecx, 2 - pand mm2, mm6 ;----------------Ggggg----------- " - pand mm3, mm6 ;----------------Ggggg----------- " - por mm0, mm2 ;-----------RrrrrGggggBbbbb------ " - por mm1, mm3 ;-----------RrrrrGggggBbbbb------ " - psrld mm0, 6 ;-----------------RrrrrGggggBbbbb " - psrld mm1, 6 ;-----------------RrrrrGggggBbbbb " - packssdw mm0, mm1 ;RrrrrGggggBbbbb """ - js short beg15 - - test rxsiz, 2 - jz short skip15a - movd [edx+ecx*4], mm0 - psrlq mm0, 32 - add ecx, 1 - skip15a:test rxsiz, 1 - jz short skip15b - movd esi, mm0 - mov [edx+ecx*4], si - skip15b: - - add eax, rbpl - add edx, wbpl - sub ebx, 1 - mov ecx, rysiz - jnz short into15 - emms - - pop esi - pop ebx - } - } - else - { - _asm - { - push ebx - push esi - - movq mm7, maskrb15 - movq mm6, maskgg15 - movq mm5, maskml15 - - mov eax, rplc - mov edx, wplc - mov ecx, rxsiz - mov ebx, rysiz - add ecx, 2 - shr ecx, 1 - lea eax, [eax+ecx*8] - lea edx, [edx+ecx*4-8] - neg ecx - mov rysiz, ecx ;Use rysiz as scratch register - jmp short into15b - beg15b: ;src: AaaaaaaaRrrrrrrrGgggggggBbbbbbbb """ - ; --------Rrrrr---Ggggg---Bbbbb--- """ - ;dst: -RrrrrGggggBbbbb-RrrrrGggggBbbbb " - movq [edx+ecx*4], mm0 - into15b:movq mm0, [eax+ecx*8] ;AaaaaaaaRrrrrrrrGgggggggBbbbbbbb " - movq mm1, [eax+ecx*8+8] ;AaaaaaaaRrrrrrrrGgggggggBbbbbbbb " - movq mm2, mm0 - movq mm3, mm1 - pand mm0, mm7 ;--------Rrrrr-----------Bbbbb--- " - pand mm1, mm7 ;--------Rrrrr-----------Bbbbb--- " - pmaddwd mm0, mm5 ;-----------Rrrrr-----Bbbbb------ " ;8192 8 8192 8 - pmaddwd mm1, mm5 ;-----------Rrrrr-----Bbbbb------ " ;8192 8 8192 8 - add ecx, 2 - pand mm2, mm6 ;----------------Ggggg----------- " - pand mm3, mm6 ;----------------Ggggg----------- " - por mm0, mm2 ;-----------RrrrrGggggBbbbb------ " - por mm1, mm3 ;-----------RrrrrGggggBbbbb------ " - psrld mm0, 6 ;-----------------RrrrrGggggBbbbb " - psrld mm1, 6 ;-----------------RrrrrGggggBbbbb " - packssdw mm0, mm1 ;RrrrrGggggBbbbb """ - js short beg15b - - test rxsiz, 2 - jz short skip15ab - movd [edx+ecx*4], mm0 - psrlq mm0, 32 - add ecx, 1 - skip15ab:test rxsiz, 1 - jz short skip15bb - movd esi, mm0 - mov [edx+ecx*4], si - skip15bb: - - add eax, rbpl - add edx, wbpl - sub ebx, 1 - mov ecx, rysiz - jnz short into15b - emms - - pop esi - pop ebx - } - } - break; - case 16: - if (cputype&(1<<22)) //MMX+ - { - _asm - { - push ebx - push esi - - movq mm7, maskrb16 - movq mm6, maskgg16 - movq mm5, maskml16 - mov eax, rplc - mov edx, wplc - mov ecx, rxsiz - mov ebx, rysiz - add ecx, 2 - shr ecx, 1 - lea eax, [eax+ecx*8] - lea edx, [edx+ecx*4-8] - neg ecx - mov rysiz, ecx ;Use rysiz as scratch register - jmp short into16 - beg16: ;src: AaaaaaaaRrrrrrrrGgggggggBbbbbbbb """ - ; --------Rrrrr---Gggggg--Bbbbb--- """ - ;dst: RrrrrGgggggBbbbbRrrrrGgggggBbbbb " - movntq [edx+ecx*4], mm0 - into16:movq mm0, [eax+ecx*8] ;AaaaaaaaRrrrrrrrGgggggggBbbbbbbb " - movq mm1, [eax+ecx*8+8] ;AaaaaaaaRrrrrrrrGgggggggBbbbbbbb " - movq mm2, mm0 - movq mm3, mm1 - pand mm0, mm7 ;--------Rrrrr-----------Bbbbb--- " - pand mm1, mm7 ;--------Rrrrr-----------Bbbbb--- " - pmaddwd mm0, mm5 ;-----------Rrrrr------Bbbbb----- " ;8192 4 8192 4 - prefetchnta [eax+ecx*8+72] - add ecx, 2 - pmaddwd mm1, mm5 ;-----------Rrrrr------Bbbbb----- " ;8192 4 8192 4 - pand mm2, mm6 ;----------------Gggggg---------- " - pand mm3, mm6 ;----------------Gggggg---------- " - por mm0, mm2 ;-----------RrrrrGgggggBbbbb----- " - por mm1, mm3 ;-----------RrrrrGgggggBbbbb----- " - psrld mm0, 5 ;----------------RrrrrGgggggBbbbb " - psrld mm1, 5 ;----------------RrrrrGgggggBbbbb " - pshufw mm0, mm0, 8 ;--------------------------------RrrrrGgggggBbbbbRrrrrGgggggBbbbb - pshufw mm1, mm1, 8 ;--------------------------------RrrrrGgggggBbbbbRrrrrGgggggBbbbb - punpckldq mm0, mm1 ;RrrrrGgggggBbbbbRrrrrGgggggBbbbb " - js short beg16 - - test rxsiz, 2 - jz short skip16a - movd [edx+ecx*4], mm0 - psrlq mm0, 32 - add ecx, 1 - skip16a:test rxsiz, 1 - jz short skip16b - movd esi, mm0 - mov [edx+ecx*4], si - skip16b: - - add eax, rbpl - add edx, wbpl - sub ebx, 1 - mov ecx, rysiz - jnz short into16 - emms - - pop esi - pop ebx - } - } - else - { - _asm - { - push ebx - push esi - - movq mm7, maskrb16 - movq mm6, maskgg16 - movq mm5, maskml16 - movq mm4, mask16a - mov eax, rplc - mov edx, wplc - mov ecx, rxsiz - mov ebx, rysiz - add ecx, 2 - shr ecx, 1 - lea eax, [eax+ecx*8] - lea edx, [edx+ecx*4-8] - neg ecx - mov rysiz, ecx ;Use rysiz as scratch register - jmp short into16b - beg16b: ;src: AaaaaaaaRrrrrrrrGgggggggBbbbbbbb """ - ; --------Rrrrr---Gggggg--Bbbbb--- """ - ;dst: RrrrrGgggggBbbbbRrrrrGgggggBbbbb " - movq [edx+ecx*4], mm0 - into16b:movq mm0, [eax+ecx*8] ;AaaaaaaaRrrrrrrrGgggggggBbbbbbbb " - movq mm1, [eax+ecx*8+8] ;AaaaaaaaRrrrrrrrGgggggggBbbbbbbb " - movq mm2, mm0 - movq mm3, mm1 - pand mm0, mm7 ;--------Rrrrr-----------Bbbbb--- " - pand mm1, mm7 ;--------Rrrrr-----------Bbbbb--- " - pmaddwd mm0, mm5 ;-----------Rrrrr------Bbbbb----- " ;8192 4 8192 4 - add ecx, 2 - pmaddwd mm1, mm5 ;-----------Rrrrr------Bbbbb----- " ;8192 4 8192 4 - pand mm2, mm6 ;----------------Gggggg---------- " - pand mm3, mm6 ;----------------Gggggg---------- " - por mm0, mm2 ;-----------RrrrrGgggggBbbbb----- " - por mm1, mm3 ;-----------RrrrrGgggggBbbbb----- " - psrld mm0, 5 ;----------------RrrrrGgggggBbbbb " - psrld mm1, 5 ;----------------RrrrrGgggggBbbbb " - psubd mm0, mm4 ;subtract 32768 from all 4 dwords so packssdw doesn't saturate - psubd mm1, mm4 - packssdw mm0, mm1 - paddw mm0, mask16b ;convert back to unsigned short - js short beg16b - - test rxsiz, 2 - jz short skip16ab - movd [edx+ecx*4], mm0 - psrlq mm0, 32 - add ecx, 1 - skip16ab:test rxsiz, 1 - jz short skip16bb - movd esi, mm0 - mov [edx+ecx*4], si - skip16bb: - - add eax, rbpl - add edx, wbpl - sub ebx, 1 - mov ecx, rysiz - jnz short into16b - emms - - pop esi - pop ebx - } - } - break; - case 24: - rxsiz &= ~3; if (rxsiz <= 0) return; - if (cputype&(1<<22)) //MMX+ - { - _asm - { - push ebx - push edi - - movq mm7, mask24a - movq mm6, mask24b - movq mm5, mask24c - movq mm4, mask24d - mov eax, rplc - mov edi, wplc - mov ebx, rysiz - mov ecx, rxsiz - shr ecx, 1 - lea eax, [eax+ecx*8] - sub edi, 12 - neg ecx - mov rxsiz, ecx - - prebeg24:mov edx, edi - mov ecx, rxsiz - beg24: ;src: aRGB aRGB aRGB aRGB - ; RGBR GB-- --RG BRGB (intermediate step) - ;dst: RGBR GBRG BRGB - movq mm0, [eax+ecx*8] ;mm0: [aRGB aRGB] - movq mm1, [eax+ecx*8+8] ;mm1: [aRGB aRGB] - pslld mm1, 8 ;mm1: [RGB- RGB-] - movq mm2, mm0 ;mm2: [aRGB aRGB] - movq mm3, mm1 ;mm3: [RGB- RGB-] - - pand mm0, mm7 ;mm0: [-RGB ----] - pand mm1, mm6 ;mm1: [---- RGB-] - pand mm2, mm5 ;mm2: [---- -RGB] - pand mm3, mm4 ;mm3: [RGB- ----] - psrlq mm0, 8 ;mm0: [--RG B---] - add edx, 12 - add ecx, 2 - psllq mm1, 8 ;mm1: [---R GB--] - por mm0, mm2 ;mm0: [--RG BRGB] - por mm1, mm3 ;mm1: [RGBR GB--] - - movd [edx], mm0 ;mm0: [--RG BRGB] - psrlq mm0, 32 ;mm0: [---- --RG] - por mm0, mm1 ;mm0: [RGBR GBRG] - movd [edx+4], mm0 - psrlq mm0, 32 ;mm0: [---- RGBR] - movd [edx+8], mm0 - - prefetchnta [eax+ecx*8+128] - js short beg24 - - add eax, rbpl - add edi, wbpl - sub ebx, 1 - jnz short prebeg24 - emms - - pop edi - pop ebx - } - } - else - { - _asm - { - push ebx - push edi - - movq mm7, mask24a - movq mm6, mask24b - movq mm5, mask24c - movq mm4, mask24d - mov eax, rplc - mov edi, wplc - mov ebx, rysiz - mov ecx, rxsiz - shr ecx, 1 - lea eax, [eax+ecx*8] - sub edi, 12 - neg ecx - mov rxsiz, ecx - - prebeg24b:mov edx, edi - mov ecx, rxsiz - beg24b: ;src: aRGB aRGB aRGB aRGB - ; RGBR GB-- --RG BRGB (intermediate step) - ;dst: RGBR GBRG BRGB - movq mm0, [eax+ecx*8] ;mm0: [aRGB aRGB] - movq mm1, [eax+ecx*8+8] ;mm1: [aRGB aRGB] - pslld mm1, 8 ;mm1: [RGB- RGB-] - movq mm2, mm0 ;mm2: [aRGB aRGB] - movq mm3, mm1 ;mm3: [RGB- RGB-] - - pand mm0, mm7 ;mm0: [-RGB ----] - pand mm1, mm6 ;mm1: [---- RGB-] - pand mm2, mm5 ;mm2: [---- -RGB] - pand mm3, mm4 ;mm3: [RGB- ----] - psrlq mm0, 8 ;mm0: [--RG B---] - add edx, 12 - add ecx, 2 - psllq mm1, 8 ;mm1: [---R GB--] - por mm0, mm2 ;mm0: [--RG BRGB] - por mm1, mm3 ;mm1: [RGBR GB--] - - movd [edx], mm0 ;mm0: [--RG BRGB] - psrlq mm0, 32 ;mm0: [---- --RG] - por mm0, mm1 ;mm0: [RGBR GBRG] - movd [edx+4], mm0 - psrlq mm0, 32 ;mm0: [---- RGBR] - movd [edx+8], mm0 - - js short beg24b - - add eax, rbpl - add edi, wbpl - sub ebx, 1 - jnz short prebeg24b - emms - - pop edi - pop ebx - } - } - break; - case 32: - if (cputype&(1<<22)) //MMX+ - { - _asm - { - push ebx - push esi - push edi - - mov eax, rplc - mov edx, wplc - mov ecx, rxsiz - mov ebx, rysiz - add ecx, 2 - shr ecx, 1 - lea eax, [eax+ecx*8] - lea edx, [edx+ecx*8] - neg ecx - mov rysiz, ecx - mov esi, rbpl - mov edi, wbpl - jmp short into32 - - beg32:movntq qword ptr [edx+ecx*8-8], mm0 - into32:movq mm0, qword ptr [eax+ecx*8] - prefetchnta [eax+ecx*8+16] - add ecx, 1 - jnz short beg32 - - test rxsiz, 1 - jz short skip32 - movd dword ptr [edx+ecx*8-8], mm0 - skip32: - - add eax, esi - add edx, edi - sub ebx, 1 - mov ecx, rysiz - jnz short into32 - emms - - pop edi - pop esi - pop ebx - } - } - else - { - _asm - { - push ebx - push esi - push edi - - mov eax, rplc - mov edx, wplc - mov ecx, rxsiz - mov ebx, rysiz - add ecx, 2 - shr ecx, 1 - lea eax, [eax+ecx*8] - lea edx, [edx+ecx*8] - neg ecx - mov rysiz, ecx - mov esi, rbpl - mov edi, wbpl - jmp short into32b - - beg32b:movq qword ptr [edx+ecx*8-8], mm0 - into32b:movq mm0, qword ptr [eax+ecx*8] - add ecx, 1 - jnz short beg32b - - test rxsiz, 1 - jz short skip32b - movd dword ptr [edx+ecx*8-8], mm0 - skip32b: - - add eax, esi - add edx, edi - sub ebx, 1 - mov ecx, rysiz - jnz short into32b - emms - - pop edi - pop esi - pop ebx - } - } - break; - } - } -#endif -} - -#ifndef REFRESHACK - LPDIRECTDRAW lpdd = 0; -#else - LPDIRECTDRAW lpdd0 = 0; - LPDIRECTDRAW2 lpdd = 0; - long refreshz = 0; -#endif - LPDIRECTDRAWSURFACE ddsurf[3] = {0,0,0}; -static LPDIRECTDRAWPALETTE ddpal = 0; -#ifndef NO_CLIPPER -static LPDIRECTDRAWCLIPPER ddclip = 0; -static RGNDATA *ddcliprd = 0; -static unsigned long ddcliprdbytes = 0; -#endif -static DDSURFACEDESC ddsd; -static long ddlocked = 0, ddrawemulbpl = 0; -static void *ddrawemulbuf = 0; -static long cantlockprimary = 1; //FUKFUKFUKFUK -#define OFFSCREENHACK 1 //FUKFUKFUKFUK - - //The official DirectDraw method for retrieving video modes! -#define MAXVALIDMODES 256 -typedef struct { long x, y; char c, r0, g0, b0, a0, rn, gn, bn, an; } validmodetype; -static validmodetype validmodelist[MAXVALIDMODES]; -static long validmodecnt = 0; -validmodetype curvidmodeinfo; - -#ifdef __WATCOMC__ - -#pragma aux bsf = "bsf eax, eax" parm [eax] modify nomemory exact [eax] value [eax] -#pragma aux bsr = "bsr eax, eax" parm [eax] modify nomemory exact [eax] value [eax] - -#endif -#ifdef _MSC_VER - -static _inline long bsf (long a) { _asm bsf eax, a } //is it safe to assume eax is return value? -static _inline long bsr (long a) { _asm bsr eax, a } //is it safe to assume eax is return value? - -#endif - -static void grabmodeinfo (long x, long y, DDPIXELFORMAT *ddpf, validmodetype *valptr) -{ - memset(valptr,0,sizeof(validmodetype)); - - valptr->x = x; valptr->y = y; - if (ddpf->dwFlags&DDPF_PALETTEINDEXED8) { valptr->c = 8; return; } - if (ddpf->dwFlags&DDPF_RGB) - { - valptr->c = (char)ddpf->dwRGBBitCount; - if (ddpf->dwRBitMask) - { - valptr->r0 = (char)bsf(ddpf->dwRBitMask); - valptr->rn = (char)(bsr(ddpf->dwRBitMask)-(valptr->r0)+1); - } - if (ddpf->dwGBitMask) - { - valptr->g0 = (char)bsf(ddpf->dwGBitMask); - valptr->gn = (char)(bsr(ddpf->dwGBitMask)-(valptr->g0)+1); - } - if (ddpf->dwBBitMask) - { - valptr->b0 = (char)bsf(ddpf->dwBBitMask); - valptr->bn = (char)(bsr(ddpf->dwBBitMask)-(valptr->b0)+1); - } - if (ddpf->dwRGBAlphaBitMask) - { - valptr->a0 = (char)bsf(ddpf->dwRGBAlphaBitMask); - valptr->an = (char)(bsr(ddpf->dwRGBAlphaBitMask)-(valptr->a0)+1); - } - } -} - -HRESULT WINAPI lpEnumModesCallback (LPDDSURFACEDESC dsd, LPVOID lpc) -{ - grabmodeinfo(dsd->dwWidth,dsd->dwHeight,&dsd->ddpfPixelFormat,&validmodelist[validmodecnt]); validmodecnt++; - if (validmodecnt >= MAXVALIDMODES) return(DDENUMRET_CANCEL); else return(DDENUMRET_OK); -} - -long getvalidmodelist (validmodetype **davalidmodelist) -{ - if (!lpdd) return(0); - if (!validmodecnt) lpdd->EnumDisplayModes(0,0,0,lpEnumModesCallback); - (*davalidmodelist) = validmodelist; - return(validmodecnt); -} - -void uninitdirectdraw () -{ - if (ddpal) { ddpal->Release(); ddpal = 0; } - if (lpdd) - { -#ifndef NO_CLIPPER - if (ddcliprd) { free(ddcliprd); ddcliprd = 0; ddcliprdbytes = 0; } - if (ddclip) { ddclip->Release(); ddclip = 0; } -#endif - if (ddsurf[0]) { ddsurf[0]->Release(); ddsurf[0] = 0; } - if (ddrawemulbuf) { free(ddrawemulbuf); ddrawemulbuf = 0; } - lpdd->Release(); lpdd = 0; - } -} - -void updatepalette (long start, long danum) -{ - long i; - if (colbits == 8) - { - switch(ddrawuseemulation) - { - case 15: - for(i=start+danum-1;i>=start;i--) - lpal[i] = (((pal[i].peRed>>3)&31)<<10) + (((pal[i].peGreen>>3)&31)<<5) + ((pal[i].peBlue>>3)&31); - return; - case 16: - for(i=start+danum-1;i>=start;i--) - lpal[i] = (((pal[i].peRed>>3)&31)<<11) + (((pal[i].peGreen>>2)&63)<<5) + ((pal[i].peBlue>>3)&31); - return; - case 24: case 32: - for(i=start+danum-1;i>=start;i--) - lpal[i] = ((pal[i].peRed)<<16) + ((pal[i].peGreen)<<8) + pal[i].peBlue; - return; - default: break; - } - } - if (!ddpal) return; - if (ddpal->SetEntries(0,start,danum,&pal[start]) == DDERR_SURFACELOST) - { ddsurf[0]->Restore(); ddpal->SetEntries(0,start,danum,&pal[start]); } -} - - //((z/(16-1))^.8)*255, ((z/(32-1))^.8)*255, ((z/((13 fullscreen/12 windowed)-1))^.8)*255 -static char palr[16] = {0,29,51,70,89,106,123,139,154,169,184,199,213,227,241,255}; -static char palg[32] = {0,16,28,39,50,59,69,78,86,95,103,111,119,127,135,143, - 150,158,165,172,180,187,194,201,208,215,222,228,235,242,248,255}; -static char palb[16] = {0,35,61,84,106,127,146,166,184,203,220,238,255,0,0,0}; - -void emul8setpal () -{ - long i, r, g, b; - - if (fullscreen) - { - //13 shades of blue in fullscreen mode - *(long *)&palb[0] = 0+( 35<<8)+( 61<<16)+( 84<<24); - *(long *)&palb[4] = 106+(127<<8)+(146<<16)+(166<<24); - *(long *)&palb[8] = 184+(203<<8)+(220<<16)+(238<<24); - mask8b = 0x10000d0010000d00; - mask8f = 0x00d000d000d000d0; - mask8g = 0xd000d000d000d000; - - i = 0; - for(b=0;b<13;b++) - for(r=0;r<16;r++) - { - pal[i].peRed = palr[r]; - pal[i].peGreen = 0; - pal[i].peBlue = palb[b]; - pal[i].peFlags = PC_NOCOLLAPSE; - i++; - } //224 cols - for(g=0;g<32;g++) - { - pal[i].peRed = 0; - pal[i].peGreen = palg[g]; - pal[i].peBlue = 0; - pal[i].peFlags = PC_NOCOLLAPSE; - i++; - } - } - else - { - //12 shades of blue in fullscreen mode - *(long *)&palb[0] = 0+( 37<<8)+( 65<<16)+( 90<<24); - *(long *)&palb[4] = 114+(136<<8)+(157<<16)+(178<<24); - *(long *)&palb[8] = 198+(217<<8)+(236<<16)+(255<<24); - mask8b = 0x10000c0010000c00; - mask8f = 0x0aca0aca0aca0aca; - mask8g = 0xca0aca0aca0aca0a; - - for(i=0;i<10;i++) { pal[i].peFlags = PC_EXPLICIT; pal[i].peRed = (char)i; pal[i].peGreen = pal[i].peBlue = 0; } - for(b=0;b<12;b++) - for(r=0;r<16;r++) - { - pal[i].peRed = palr[r]; - pal[i].peGreen = 0; - pal[i].peBlue = palb[b]; - pal[i].peFlags = PC_NOCOLLAPSE; - i++; - } //192 cols - for(g=0;g<32;g++) - { - pal[i].peRed = 0; - pal[i].peGreen = palg[g]; - pal[i].peBlue = 0; - pal[i].peFlags = PC_NOCOLLAPSE; - i++; - } - for(;i<256-10;i++) { pal[i].peFlags = PC_NOCOLLAPSE; pal[i].peRed = pal[i].peGreen = pal[i].peBlue = 0; } - for(;i<256;i++) { pal[i].peFlags = PC_EXPLICIT; pal[i].peRed = (char)i; pal[i].peGreen = pal[i].peBlue = 0; } - } -} - - // Note! - // debugmode is automatically turned off after changeres or initdirectdraw! - // do NOT call debugdirectdraw inside startdirectdraw()..stopdirectdraw() section -void debugdirectdraw () -{ -#ifndef NOINPUT - extern long mouse_acquire, kbd_acquire; - extern void setacquire (long mouse, long kbd); - static long old_acq = 0; -#endif - if (ddrawdebugmode == -1) { - if (!ddrawuseemulation) { - ddrawemulbuf = malloc(((xres*yres+7)&~7)*((colbits+7)>>3)+16); if (!ddrawemulbuf) return; // error! - ddrawemulbpl = ((colbits+7)>>3)*xres; - ddrawdebugmode = 0; - ddrawuseemulation = 32; - } else - ddrawdebugmode = ddrawuseemulation; -#ifndef NOINPUT - old_acq = (mouse_acquire&1) + ((kbd_acquire&1)<<1); - setacquire(0,0); -#endif - } else { - ddrawuseemulation = ddrawdebugmode; - if (!ddrawuseemulation) { - if (ddrawemulbuf) { free(ddrawemulbuf); ddrawemulbuf = 0; } - } - ddrawdebugmode = -1; -#ifndef NOINPUT - setacquire(old_acq&1, old_acq>>1); -#endif - } -} - -long initdirectdraw (long daxres, long dayres, long dacolbits) -{ - HRESULT hr; - DDSCAPS ddscaps; - char buf[256]; - long ncolbits; - - xres = daxres; yres = dayres; colbits = dacolbits; -#ifndef REFRESHACK - if ((hr = DirectDrawCreate(0,&lpdd,0)) >= 0) - { -#else - if ((hr = DirectDrawCreate(0,&lpdd0,0)) >= 0) - { - lpdd0->QueryInterface(IID_IDirectDraw2,(void **)&lpdd); -#endif - if (fullscreen) - { - if ((hr = lpdd->SetCooperativeLevel(ghwnd,DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN)) >= 0) - { - ddrawdebugmode = -1; - ncolbits = dacolbits; ddrawuseemulation = 0; - //ncolbits = 8; //HACK FOR TESTING! - //ncolbits = 16; //HACK FOR TESTING! - do - { -#ifndef REFRESHACK - if ((hr = lpdd->SetDisplayMode(daxres,dayres,ncolbits)) >= 0) -#else - if ((hr = lpdd->SetDisplayMode(daxres,dayres,ncolbits,refreshz,0)) >= 0) -#endif - { - if (1)//(ncolbits != dacolbits) // FULLSCREEN ALPHA PERFORMANCE HACK! - { - ddrawemulbuf = malloc(((daxres*dayres+7)&~7)*((dacolbits+7)>>3)+16); - if (!ddrawemulbuf) { ncolbits = 0; break; } - ddrawemulbpl = ((dacolbits+7)>>3)*daxres; - ddrawuseemulation = ncolbits; - } - ddsd.dwSize = sizeof(ddsd); - ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE|DDSCAPS_COMPLEX|DDSCAPS_FLIP; - if (maxpages > 2) ddsd.dwBackBufferCount = 2; - else ddsd.dwBackBufferCount = 1; - if ((hr = lpdd->CreateSurface(&ddsd,&ddsurf[0],0)) >= 0) - { - DDPIXELFORMAT ddpf; - ddpf.dwSize = sizeof(DDPIXELFORMAT); - if (!ddsurf[0]->GetPixelFormat(&ddpf)) - grabmodeinfo(daxres,dayres,&ddpf,&curvidmodeinfo); - - ddscaps.dwCaps = DDSCAPS_BACKBUFFER; - if ((hr = ddsurf[0]->GetAttachedSurface(&ddscaps,&ddsurf[1])) >= 0) - { -#if (OFFSCREENHACK) - DDSURFACEDESC nddsd; - ddsurf[2] = ddsurf[1]; - ZeroMemory(&nddsd,sizeof(nddsd)); - nddsd.dwSize = sizeof(nddsd); - nddsd.dwFlags = DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT; - nddsd.dwWidth = (daxres|1); //This hack (|1) ensures pitch isn't near multiple of 4096 (slow on P4)! - nddsd.dwHeight = dayres; - nddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY; - if ((hr = lpdd->CreateSurface(&nddsd,&ddsurf[1],0)) < 0) return(-1); -#endif - if (ncolbits != 8) return(1); - if (lpdd->CreatePalette(DDPCAPS_8BIT,pal,&ddpal,0) >= 0) - { - ddsurf[0]->SetPalette(ddpal); - if (ddrawuseemulation) - { emul8setpal(); updatepalette(0,256); } - return(1); - } - } - } - } - switch(dacolbits) - { - case 8: - switch (ncolbits) - { - case 8: ncolbits = 32; break; - case 32: ncolbits = 24; break; - case 24: ncolbits = 16; break; - case 16: ncolbits = 15; break; - default: ncolbits = 0; break; - } - break; - case 32: - switch (ncolbits) - { - case 32: ncolbits = 24; break; - case 24: ncolbits = 16; break; - case 16: ncolbits = 15; break; - case 15: ncolbits = 8; break; - default: ncolbits = 0; break; - } - break; - default: ncolbits = 0; break; - } - } while (ncolbits); - if (!ncolbits) - { - validmodetype *validmodelist; - char vidlistbuf[4096]; - long i, j; - - validmodecnt = getvalidmodelist(&validmodelist); - wsprintf(vidlistbuf,"Valid fullscreen %d-bit DirectDraw modes:\n",colbits); - j = 0; - for(i=0;i<validmodecnt;i++) - if (validmodelist[i].c == colbits) - { - wsprintf(buf,"/%dx%d\n",validmodelist[i].x,validmodelist[i].y); - strcat(vidlistbuf,buf); - j++; - } - if (!j) strcat(vidlistbuf,"None! Try a different bit depth."); - - wsprintf(buf,"initdirectdraw failed: 0x%x",hr); - MessageBox(ghwnd,vidlistbuf,buf,MB_OK); - - uninitdirectdraw(); - return(0); - } - } - } - else - { - if ((hr = lpdd->SetCooperativeLevel(ghwnd,DDSCL_NORMAL)) >= 0) - { - ddsd.dwSize = sizeof(ddsd); - ddsd.dwFlags = DDSD_CAPS; - ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; - if ((hr = lpdd->CreateSurface(&ddsd,&ddsurf[0],0)) >= 0) - { -#ifndef NO_CLIPPER - //Create clipper object for windowed mode - if ((hr = lpdd->CreateClipper(0,&ddclip,0)) == DD_OK) - { - ddclip->SetHWnd(0,ghwnd); //Associate clipper with window - hr = ddsurf[0]->SetClipper(ddclip); - if (hr == DD_OK) - { -#endif - ddsd.dwSize = sizeof(ddsd); - ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS; -#if (OFFSCREENHACK == 0) - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; -#else - ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY; -#endif - ddsd.dwWidth = xres; - ddsd.dwHeight = yres; - if ((hr = lpdd->CreateSurface(&ddsd,&ddsurf[1],0)) >= 0) - { - DDCAPS ddcaps; - HDC hDC = GetDC(0); - ncolbits = GetDeviceCaps(hDC,BITSPIXEL); - ReleaseDC(0,hDC); - - ddcaps.dwSize = sizeof(ddcaps); - if (lpdd->GetCaps(&ddcaps,0) == DD_OK) //Better to catch DDERR_CANTLOCKSURFACE here than in startdirectdraw() - if (ddcaps.dwCaps&DDCAPS_NOHARDWARE) cantlockprimary = 1; //For LCD screens mainly - if (osvi.dwMajorVersion >= 6) cantlockprimary = 1; //Longhorn/Vista - - //03/08/2004: Now that clipper works for ddrawemulbuf, ddrawemulbuf is not only - //faster, but it supports WM_SIZE dragging better than ddsurf[0]->Blt! :) - // - //kblit32 currently supports these modes: - // colbits -> ncolbits - // 8 -> . 15 16 24 32 - // 15 -> . . . . . - // 16 -> . . . . . - // 24 -> . . . . . - // 32 -> 8 15 16 24 32 - if ((ncolbits != colbits) || ((colbits == 32) && (!cantlockprimary))) - { -#if (OFFSCREENHACK) - if (colbits != colbits) -#endif - { - ddrawemulbuf = malloc(((xres*yres+7)&~7)*((colbits+7)>>3)+16); - if (ddrawemulbuf) - { - ddrawemulbpl = ((colbits+7)>>3)*xres; - ddrawuseemulation = ncolbits; - if ((ncolbits == 8) && (colbits == 32)) emul8setpal(); - } - } - } - - if ((ncolbits == 8) || (colbits == 8)) updatepalette(0,256); - - DDPIXELFORMAT ddpf; - ddpf.dwSize = sizeof(DDPIXELFORMAT); - if (!ddsurf[0]->GetPixelFormat(&ddpf)) //colbits = ddpf.dwRGBBitCount; - { - grabmodeinfo(daxres,dayres,&ddpf,&curvidmodeinfo); - - //If mode is 555 color (and not 565), use 15-bit emulation code... - if ((colbits != 16) && (ncolbits == 16) - && (curvidmodeinfo.r0 == 10) && (curvidmodeinfo.rn == 5) - && (curvidmodeinfo.g0 == 5) && (curvidmodeinfo.gn == 5) - && (curvidmodeinfo.b0 == 0) && (curvidmodeinfo.bn == 5)) - ddrawuseemulation = 15; - } - - if (ncolbits == 8) - if (lpdd->CreatePalette(DDPCAPS_8BIT,pal,&ddpal,0) >= 0) - ddsurf[0]->SetPalette(ddpal); - - return(1); - } -#ifndef NO_CLIPPER - } - } -#endif - } - } - } - } - uninitdirectdraw(); - wsprintf(buf,"initdirectdraw failed: 0x%08lx",hr); - MessageBox(ghwnd,buf,"ERROR",MB_OK); - return(0); -} - -void stopdirectdraw () -{ - if (!ddlocked) return; - if (!ddrawuseemulation) ddsurf[1]->Unlock(ddsd.lpSurface); - ddlocked = 0; -} - -long startdirectdraw (long *vidplc, long *dabpl, long *daxres, long *dayres) -{ - HRESULT hr; - - if (ddlocked) { stopdirectdraw(); ddlocked = 0; } //{ return(0); } - - if (ddrawuseemulation) - { - *vidplc = (long)ddrawemulbuf; *dabpl = xres*((colbits+7)>>3); - *daxres = xres; *dayres = yres; ddlocked = 1; - return(1); - } - - while (1) - { - if ((hr = ddsurf[1]->Lock(0,&ddsd,DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT,0)) == DD_OK) break; - if (hr == DDERR_SURFACELOST) - { - if (ddsurf[0]->Restore() != DD_OK) return(0); - if (ddsurf[1]->Restore() != DD_OK) return(0); - } - if (hr == DDERR_CANTLOCKSURFACE) return(-1); //if true, set cantlockprimary = 1; - if (hr != DDERR_WASSTILLDRAWING) return(0); - } - - //DDLOCK_WAIT MANDATORY! (to prevent sudden exit back to windows)! - //if (hr = ddsurf[1]->Lock(0,&ddsd,DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT,0) != DD_OK) - // return(0); - - *vidplc = (long)ddsd.lpSurface; *dabpl = ddsd.lPitch; - *daxres = xres; *dayres = yres; ddlocked = 1; - return(1); -} - -static HDC ghdc; -HDC startdc () -{ - ddsurf[1]->GetDC(&ghdc); - return(ghdc); -} - -void stopdc () -{ - ddsurf[1]->ReleaseDC(ghdc); -} - -void nextpage () -{ - HRESULT hr; - - if (ddrawdebugmode != -1) return; - - //Note: windowed mode could be faster by having kblit go directly - // to the ddsurf[0] (windows video memory) - if (ddrawuseemulation) - { - long i, fplace, bpl, xsiz, ysiz; - if (!fullscreen) - { - POINT topLeft, p2; - long j; -#ifndef NO_CLIPPER - RECT *r; - unsigned long siz; -#endif - - //Note: this hack for windowed mode saves an unnecessary blit by - // going directly to primary buffer (ddsurf[0]) - // Unfortunately, this means it ignores the clipper & you can't - // use the ddraw stretch function :/ - topLeft.x = 0; topLeft.y = 0; - if (!cantlockprimary) - { - ddsurf[2] = ddsurf[0]; ddsurf[0] = ddsurf[1]; ddsurf[1] = ddsurf[2]; - ClientToScreen(ghwnd,&topLeft); - } - else - { - p2.x = 0; p2.y = 0; - ClientToScreen(ghwnd,&p2); - } - - //This is sort of a hack... but it works - i = ddrawuseemulation; ddrawuseemulation = 0; - j = startdirectdraw(&fplace,&bpl,&xsiz,&ysiz); - if (j == -1) - { - if (!cantlockprimary) - { - ddsurf[2] = ddsurf[0]; ddsurf[0] = ddsurf[1]; ddsurf[1] = ddsurf[2]; //Undo earlier surface swap - cantlockprimary = 1; ddrawuseemulation = i; return; - } - } - else if (j) - { -#ifndef NO_CLIPPER - ddclip->GetClipList(0,0,&siz); - if (siz > ddcliprdbytes) - { - ddcliprdbytes = siz; - ddcliprd = (RGNDATA *)realloc(ddcliprd,siz); - } - if (!ddcliprd) - { -#endif - kblit32(max(-topLeft.y,0)*ddrawemulbpl + - max(-topLeft.x,0)*((colbits+7)>>3) + ((long)ddrawemulbuf), - ddrawemulbpl, - min(topLeft.x+xsiz,GetSystemMetrics(SM_CXSCREEN))-max(topLeft.x,0), - min(topLeft.y+ysiz,GetSystemMetrics(SM_CYSCREEN))-max(topLeft.y,0), - max(topLeft.y,0)*bpl+max(topLeft.x,0)*((i+7)>>3)+fplace, - i,bpl); -#ifndef NO_CLIPPER - } - else - { - ddclip->GetClipList(0,ddcliprd,&siz); - - r = (RECT *)ddcliprd->Buffer; - for(j=0;j<(long)ddcliprd->rdh.nCount;j++) - { - if (cantlockprimary) { r[j].left -= p2.x; r[j].top -= p2.y; r[j].right -= p2.x; r[j].bottom -= p2.y; } - kblit32(max(r[j].top -topLeft.y,0)*ddrawemulbpl + - max(r[j].left-topLeft.x,0)*((colbits+7)>>3) + ((long)ddrawemulbuf), - ddrawemulbpl, - min(topLeft.x+xsiz,r[j].right )-max(topLeft.x,r[j].left), - min(topLeft.y+ysiz,r[j].bottom)-max(topLeft.y,r[j].top ), - max(topLeft.x,r[j].left)*((i+7)>>3) + - max(topLeft.y,r[j].top )*bpl + fplace, - i,bpl); - } - } -#endif - stopdirectdraw(); - } - ddrawuseemulation = i; - - //Finish windowed mode hack to primary buffer - if (!cantlockprimary) { ddsurf[2] = ddsurf[0]; ddsurf[0] = ddsurf[1]; ddsurf[1] = ddsurf[2]; return; } - } - else - { - //This is sort of a hack... but it works - i = ddrawuseemulation; ddrawuseemulation = 0; - if (startdirectdraw(&fplace,&bpl,&xsiz,&ysiz)) - { - kblit32((long)ddrawemulbuf,ddrawemulbpl,min(xsiz,xres),min(ysiz,yres),fplace,i,bpl); - stopdirectdraw(); - } - ddrawuseemulation = i; - } - } - - if (fullscreen) - { -#if (OFFSCREENHACK) - RECT r; r.left = 0; r.top = 0; r.right = xres; r.bottom = yres; //with width hack, src rect not always: xres,yres - if (ddsurf[2]->GetBltStatus(DDGBS_CANBLT) == DDERR_WASSTILLDRAWING) return; - if (ddsurf[2]->BltFast(0,0,ddsurf[1],&r,DDBLTFAST_NOCOLORKEY) == DDERR_SURFACELOST) - { ddsurf[0]->Restore(); if (ddsurf[2]->BltFast(0,0,ddsurf[1],&r,DDBLTFAST_NOCOLORKEY) != DD_OK) return; } - if (ddsurf[0]->GetFlipStatus(DDGFS_CANFLIP) == DDERR_WASSTILLDRAWING) return; //wait for blit to complete - if (ddsurf[0]->Flip(0,0) == DDERR_SURFACELOST) { ddsurf[0]->Restore(); ddsurf[0]->Flip(0,0); } -#elif 1 - //NOTE! If not using DDFLIP_WAIT, >70fps only works - // when ddsd.dwBackBufferCount > 1 (triple+ buffering) - while (1) //Recommended flipper from 1997 DirectDraw 3.0 MSDN CD: - { - if ((hr = ddsurf[0]->Flip(0,DDFLIP_WAIT)) == DD_OK) break; - if (hr == DDERR_SURFACELOST) - { - if (ddsurf[0]->Restore() != DD_OK) break; - if (ddsurf[1]->Restore() != DD_OK) break; - } - if (hr != DDERR_WASSTILLDRAWING) break; - } -#else - //This loop allows windows to breath while waiting for the flip - // so, it gives smoother execution - // WARNING: bad things can happen if breath() receives WM_CLOSE!!! - while (1) - { - if ((hr = ddsurf[0]->Flip(0,0)) == DD_OK) break; - if (hr == DDERR_WASSTILLDRAWING) { breath(); continue; } - if (hr == DDERR_SURFACELOST) - { - if (ddsurf[0]->Restore() != DD_OK) break; - if (ddsurf[1]->Restore() != DD_OK) break; - } - break; - } -#endif - } - else - { - RECT rcSrc, rcDst; - POINT topLeft; - - rcSrc.left = 0; rcSrc.top = 0; - rcSrc.right = xres; rcSrc.bottom = yres; -#ifndef ZOOM_TEST - rcDst = rcSrc; -#else - GetClientRect(ghwnd, &rcDst); -#endif - topLeft.x = 0; topLeft.y = 0; - ClientToScreen(ghwnd,&topLeft); - rcDst.left += topLeft.x; rcDst.right += topLeft.x; - rcDst.top += topLeft.y; rcDst.bottom += topLeft.y; -#ifdef NO_CLIPPER - if (ddsurf[0]->BltFast(rcDst.left,rcDst.top,ddsurf[1],&rcSrc,DDBLTFAST_WAIT|DDBLTFAST_NOCOLORKEY) < 0) -#else - if (ddsurf[0]->Blt(&rcDst,ddsurf[1],&rcSrc,DDBLT_WAIT|DDBLT_ASYNC,0) < 0) -#endif - { - if (ddsurf[0]->IsLost() == DDERR_SURFACELOST) ddsurf[0]->Restore(); - if (ddsurf[1]->IsLost() == DDERR_SURFACELOST) ddsurf[1]->Restore(); -#ifdef NO_CLIPPER - ddsurf[0]->BltFast(rcDst.left,rcDst.top,ddsurf[1],&rcSrc,DDBLTFAST_WAIT|DDBLTFAST_NOCOLORKEY); -#else - ddsurf[0]->Blt(&rcDst,ddsurf[1],&rcSrc,DDBLT_WAIT|DDBLT_ASYNC,0); -#endif - } - } -} - -void ddflip2gdi () -{ - if (lpdd) lpdd->FlipToGDISurface(); -} - -long clearscreen (long fillcolor) -{ - DDBLTFX blt; - HRESULT hr; - - if (ddrawuseemulation) - { - long c = ((xres*yres+7)&~7)*((colbits+7)>>3); c >>= 3; - if (cputype&(1<<25)) //SSE - { - _asm - { - mov edx, ddrawemulbuf - mov ecx, c - movd mm0, fillcolor - punpckldq mm0, mm0 - clear32a: movntq qword ptr [edx], mm0 - add edx, 8 - sub ecx, 1 - jnz short clear32a - emms - } - } - else if (cputype&(1<<23)) //MMX - { - _asm - { - mov edx, ddrawemulbuf - mov ecx, c - movd mm0, fillcolor - punpckldq mm0, mm0 - clear32b: movq qword ptr [edx], mm0 - add edx, 8 - sub ecx, 1 - jnz short clear32b - emms - } - } - else - { - long q[2]; q[0] = q[1] = fillcolor; - _asm - { - mov edx, ddrawemulbuf - mov ecx, c - clear32c: fild qword ptr q - fistp qword ptr [edx] ;NOTE: fist doesn't have a 64-bit form! - add edx, 8 - sub ecx, 1 - jnz short clear32c - } - } - return(1); - } - - //Can't clear when locked: would SUPERCRASH! - if (ddlocked) - { - long i, j, x, p, pe; - - p = (long)ddsd.lpSurface; pe = ddsd.lPitch*yres + p; - if (colbits != 24) - { - switch(colbits) - { - case 8: fillcolor = (fillcolor&255)*0x1010101; i = xres ; break; - case 15: case 16: fillcolor = (fillcolor&65535)*0x10001; i = xres*2; break; - case 32: i = xres*4; break; - } - for(;p<pe;p+=ddsd.lPitch) - { -#if 0 - for(x=p,j=p+i-4;x<=j;x+=4) *(long *)x = fillcolor; -#else - j = (i>>3); - if (cputype&(1<<25)) //SSE - { - _asm - { - mov edx, p - mov ecx, j - movd mm0, fillcolor - punpckldq mm0, mm0 - clear32d: movntq qword ptr [edx], mm0 - add edx, 8 - sub ecx, 1 - jnz short clear32d - emms - } - } - else if (cputype&(1<<23)) //MMX - { - _asm - { - mov edx, p - mov ecx, j - movd mm0, fillcolor - punpckldq mm0, mm0 - clear32e: movq qword ptr [edx], mm0 - add edx, 8 - sub ecx, 1 - jnz short clear32e - emms - } - } - else - { - long q[2]; q[0] = q[1] = fillcolor; - _asm - { - mov edx, p - mov ecx, j - clear32f: fild qword ptr q - fistp qword ptr [edx] ;NOTE: fist doesn't have a 64-bit form! - add edx, 8 - sub ecx, 1 - jnz short clear32f - } - } - x = (i&~7)+p; - if (i&4) { *(long *)x = fillcolor; x += 4; } -#endif - if (i&2) { *(short *)x = (short)fillcolor; x += 2; } - if (i&1) { *(char *)x = (char)fillcolor; } - } - if (cputype&(1<<25)) _asm emms //SSE - } - else - { - long dacol[3]; - fillcolor &= 0xffffff; - dacol[0] = (fillcolor<<24)+fillcolor; //BRGB - dacol[1] = (fillcolor>>8)+(fillcolor<<16); //GBRG - dacol[2] = (fillcolor>>16)+(fillcolor<<8); //RGBR - i = xres*3; - for(;p<pe;p+=ddsd.lPitch) - { - j = p+i-12; - for(x=p;x<=j;x+=12) - { // x-j ?123?567?9AB - *(long *)(x ) = dacol[0]; // ? - *(long *)(x+4) = dacol[1]; // ?12 ? ? ? ? - *(long *)(x+8) = dacol[2]; // ? 9 BGR ? ? ? - } // ? 6 BGRBGR ? ? - switch(x-j) // ? 3 BGRBGRBGR ? - { // ? - case 9: *(short *)x = (short)dacol[0]; *(char *)(x+2) = (char)dacol[2]; break; - case 6: *(long *)x = dacol[0]; *(short *)(x+4) = (short)dacol[1]; break; - case 3: *(long *)x = dacol[0]; *(long *)(x+4) = dacol[1]; *(char *)(x+8) = (char)dacol[2]; break; - } - } - } - return(1); - } - - blt.dwSize = sizeof(blt); - blt.dwFillColor = fillcolor; - while (1) - { - //Try |DDBLT_ASYNC - hr = ddsurf[1]->Blt(0,0,0,DDBLT_COLORFILL,&blt); //Try |DDBLT_WAIT - if (hr == DD_OK) return(1); - if (hr == DDERR_SURFACELOST) - { - if (ddsurf[0]->Restore() != DD_OK) return(0); - if (ddsurf[1]->Restore() != DD_OK) return(0); - } - } -} - -long changeres (long daxres, long dayres, long dacolbits, long dafullscreen) -{ - uninitdirectdraw(); - - ShowWindow(ghwnd,FALSE); - if (dafullscreen) - { - SetWindowLong(ghwnd,GWL_EXSTYLE,WS_EX_TOPMOST); - SetWindowLong(ghwnd,GWL_STYLE,WS_POPUP); - MoveWindow(ghwnd,0,0,GetSystemMetrics(SM_CXSCREEN), - GetSystemMetrics(SM_CYSCREEN),0); - } - else - { - RECT rw; - SystemParametersInfo(SPI_GETWORKAREA,0,&rw,0); - - SetWindowLong(ghwnd,GWL_EXSTYLE, 0); - SetWindowLong(ghwnd,GWL_STYLE,progwndflags); - MoveWindow(ghwnd,((rw.right -rw.left-(daxres+progwndadd[0]))>>1) + rw.left, - ((rw.bottom-rw.top -(dayres+progwndadd[1]))>>1) + rw.top, - daxres+progwndadd[0], dayres+progwndadd[1], 0); - } - ShowWindow(ghwnd,TRUE); - - fullscreen = dafullscreen; - return(initdirectdraw(daxres,dayres,dacolbits)); -} - -// //How to use dc & draw text: -//HDC hdc; -//if (ddsurf[1]->GetDC(&hdc) == DD_OK) -//{ -// SetBkColor(hdc,RGB(0,0,255)); //SetBkMode(hdc,TRANSPARENT); -// SetTextColor(hdc,RGB(255,255,0)); -// //HFONT fontInUse = CreateFont(size,0,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS, -// // CLIP_DEFAULT_PRECIS,NONANTIALIASED_QUALITY,VARIABLE_PITCH,"Arial"); -// //oldFont = SelectObject(hdc,fontInUse); -// TextOut(hdc,x,y,message,strlen(message)); -// //SelectObject(hdc,oldFont); -// //DeleteObject(fontInUse); -// ddsurf[1]->ReleaseDC(hdc); -//} - -// //Do this to ensure GDI stuff is on the screen: -//lpdd->FlipToGDISurface(); - -// //Use real timers, (forget SetTimer/WM_TIMER crap): -//#include <mmsystem.h> -//void CALLBACK OneShotTimer(UINT wTimerID, UINT msg, DWORD dwUser, DWORD dw1, DWORD dw2) -// { printf("Alarm!"); } -//timeSetEvent(msInterval,msInterval,OneShotTimer,(DWORD)npSeq,TIME_PERIODIC); -#endif - -//DirectInput VARIABLES & CODE------------------------------------------------------- -char keystatus[256]; -static long shkeystatus = 0; -#define KEYBUFSIZ 256 -static long keybuf[KEYBUFSIZ], keybufr = 0, keybufw = 0, keybufw2 = 0; - -char ext_keystatus[256]; // +TD -char ext_mbstatus[8] = {0}; // +TD extended mouse button status -long ext_mwheel = 0; -#ifdef NOINPUT -long mouse_acquire = 0; -#else -long mouse_acquire = 1, kbd_acquire = 1; -static void (*setmousein)(long, long) = NULL; -static long mouse_out_x, mouse_out_y; -static HANDLE dinputevent[2] = {0,0}; - -static LPDIRECTINPUT gpdi = 0; -long initdirectinput (HWND hwnd) -{ - HRESULT hr; - char buf[256]; - - if ((hr = DirectInput8Create(ghinst,DIRECTINPUT_VERSION,IID_IDirectInput8A,(LPVOID*)&gpdi,0)) >= 0) return(1); - wsprintf(buf,"initdirectinput failed: %08lx\n",hr); - MessageBox(ghwnd,buf,"ERROR",MB_OK); - return(0); -} - -void uninitdirectinput () -{ - if (gpdi) { gpdi->Release(); gpdi = 0; } -} - -//DirectInput (KEYBOARD) VARIABLES & CODE------------------------------------------------------- -static LPDIRECTINPUTDEVICE gpKeyboard = 0; -#define KBDBUFFERSIZE 64 -DIDEVICEOBJECTDATA KbdBuffer[KBDBUFFERSIZE]; - -//#define KEYBUFSIZ 256 -//static long keybuf[KEYBUFSIZ], keybufr = 0, keybufw = 0, keybufw2 = 0; - -void uninitkeyboard () -{ - if (gpKeyboard) - { - if (dinputevent[1]) - { - gpKeyboard->SetEventNotification(dinputevent[1]); - CloseHandle(dinputevent[1]); dinputevent[1] = 0; - } - gpKeyboard->Unacquire(); gpKeyboard->Release(); gpKeyboard = 0; - } -} - -long initkeyboard (HWND hwnd) -{ - HRESULT hr; - DIPROPDWORD dipdw; - char buf[256]; - - if ((hr = gpdi->CreateDevice(GUID_SysKeyboard,&gpKeyboard,0)) < 0) goto initkeyboard_bad; - if ((hr = gpKeyboard->SetDataFormat(&c_dfDIKeyboard)) < 0) goto initkeyboard_bad; - if ((hr = gpKeyboard->SetCooperativeLevel(hwnd,dinputkeyboardflags)) < 0) goto initkeyboard_bad; - - dinputevent[1] = CreateEvent(0,0,0,0); if (!dinputevent[1]) goto initkeyboard_bad; - if ((hr = gpKeyboard->SetEventNotification(dinputevent[1])) < 0) goto initkeyboard_bad; - - dipdw.diph.dwSize = sizeof(DIPROPDWORD); - dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER); - dipdw.diph.dwObj = 0; - dipdw.diph.dwHow = DIPH_DEVICE; - dipdw.dwData = KBDBUFFERSIZE; - if ((hr = gpKeyboard->SetProperty(DIPROP_BUFFERSIZE,&dipdw.diph)) < 0) goto initkeyboard_bad; - if (kbd_acquire) { gpKeyboard->Acquire(); shkeystatus = 0; } - return(1); - -initkeyboard_bad:; - uninitkeyboard(); - wsprintf(buf,"initdirectinput(keyboard) failed: %08lx\n",hr); - MessageBox(ghwnd,buf,"ERROR",MB_OK); - return(0); -} - -long readkeyboard () -{ - HRESULT hr; - long i; - unsigned long dwItems; - DIDEVICEOBJECTDATA *lpdidod; - - dwItems = KBDBUFFERSIZE; - hr = gpKeyboard->GetDeviceData(sizeof(DIDEVICEOBJECTDATA),KbdBuffer,&dwItems,0); - //if (hr == DI_BUFFEROVERFLOW) ?; - if (hr == DIERR_INPUTLOST) - { - gpKeyboard->Acquire(); shkeystatus = 0; - hr = gpKeyboard->GetDeviceData(sizeof(DIDEVICEOBJECTDATA),KbdBuffer,&dwItems,0); - } - if (hr < 0) return(0); - for(i=0;i<(long)dwItems;i++) - { - lpdidod = &KbdBuffer[i]; - - if (lpdidod->dwData&128) keystatus[lpdidod->dwOfs] = 1; - else keystatus[lpdidod->dwOfs] = 0; - //event occured "GetTickCount()-lpdidod->dwTimeStamp" milliseconds ago - - // +TD: - if (lpdidod->dwData&128) ext_keystatus[lpdidod->dwOfs] = 1|2; - else ext_keystatus[lpdidod->dwOfs] &= ~1; // preserve bit 2 only - } - return(dwItems); -} - - -//DirectInput (MOUSE) VARIABLES & CODE------------------------------------------------------- - -static LPDIRECTINPUTDEVICE gpMouse = 0; -#define MOUSBUFFERSIZE 64 -DIDEVICEOBJECTDATA MousBuffer[MOUSBUFFERSIZE]; -static long gbstatus = 0, gkillbstatus = 0; - - //Mouse smoothing variables: -long mousmoth = 1; -static double dmoutsc; -float mousper; -static float mousince, mougoalx, mougoaly, mougoalz, moutscale; -static long moult[4], moultavg, moultavgcnt; - -void uninitmouse () -{ - if (gpMouse) - { - if (dinputevent[0]) - { - gpMouse->SetEventNotification(dinputevent[0]); - CloseHandle(dinputevent[0]); dinputevent[0] = 0; - } - gpMouse->Unacquire(); gpMouse->Release(); gpMouse = 0; - } -} - -long initmouse (HWND hwnd) -{ - HRESULT hr; - DIPROPDWORD dipdw; - char buf[256]; - - if ((hr = gpdi->CreateDevice(GUID_SysMouse,&gpMouse,0)) < 0) goto initmouse_bad; - if ((hr = gpMouse->SetDataFormat(&c_dfDIMouse)) < 0) goto initmouse_bad; -#ifndef PROJECT_ANIMATOR - if ((hr = gpMouse->SetCooperativeLevel(hwnd,dinputmouseflags)) < 0) goto initmouse_bad; -#endif - - dinputevent[0] = CreateEvent(0,0,0,0); if (!dinputevent[0]) goto initmouse_bad; - if ((hr = gpMouse->SetEventNotification(dinputevent[0])) < 0) goto initmouse_bad; - - dipdw.diph.dwSize = sizeof(DIPROPDWORD); - dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER); - dipdw.diph.dwObj = 0; - dipdw.diph.dwHow = DIPH_DEVICE; - dipdw.dwData = MOUSBUFFERSIZE; - if ((hr = gpMouse->SetProperty(DIPROP_BUFFERSIZE, &dipdw.diph)) < 0) goto initmouse_bad; - - if (mouse_acquire) { gpMouse->Acquire(); gbstatus = 0; } - mousper = 1.0; mousince = mougoalx = mougoaly = mougoalz = 0.0; - moult[0] = -1; moultavg = moultavgcnt = 0; - readklock(&dmoutsc); - return(1); - -initmouse_bad:; - uninitmouse(); - wsprintf(buf,"initdirectinput(mouse) failed: %08lx\n",hr); - MessageBox(ghwnd,buf,"ERROR",MB_OK); - return(0); -} - -void readmouse (float *fmousx, float *fmousy, float *fmousz, long *bstatus) -{ - double odmoutsc; - float f, fmousynctics; - long i, got, ltmin, ltmax, nlt0, nlt1, nlt2; - long mousx, mousy, mousz; - HRESULT hr; - unsigned long dwItems; - DIDEVICEOBJECTDATA *lpdidod; - - if ((!mouse_acquire) || (!gpMouse)) { *fmousx = 0; *fmousy = 0; *fmousz = 0; *bstatus = 0; return; } - - dwItems = MOUSBUFFERSIZE; - hr = gpMouse->GetDeviceData(sizeof(DIDEVICEOBJECTDATA),MousBuffer,&dwItems,0); - if (hr == DI_BUFFEROVERFLOW) moult[0] = -1; - if (hr == DIERR_INPUTLOST) - { - gpMouse->Acquire(); gbstatus = 0; - hr = gpMouse->GetDeviceData(sizeof(DIDEVICEOBJECTDATA),MousBuffer,&dwItems,0); - } - - //Estimate mouse period (mousper) in units of CPU cycles: - mousx = mousy = mousz = 0; got = 0; - i = 0; lpdidod = &MousBuffer[i]; - while (i < (long)dwItems) - { - moult[3] = moult[2]; moult[2] = moult[1]; moult[1] = moult[0]; - moult[0] = lpdidod->dwTimeStamp; - do - { - switch(lpdidod->dwOfs) - { - case DIMOFS_X: mousx += lpdidod->dwData; break; - case DIMOFS_Y: mousy += lpdidod->dwData; break; - case DIMOFS_Z: mousz += lpdidod->dwData; break; - case DIMOFS_BUTTON0: if (lpdidod->dwData&128) ext_mbstatus[0] = 1|2; else ext_mbstatus[0] &= 2; - gbstatus = ((gbstatus&~1)|((lpdidod->dwData>>7)&1)); moult[0] = -1; break; - case DIMOFS_BUTTON1: if (lpdidod->dwData&128) ext_mbstatus[1] = 1|2; else ext_mbstatus[1] &= 2; - gbstatus = ((gbstatus&~2)|((lpdidod->dwData>>6)&2)); moult[0] = -1; break; - case DIMOFS_BUTTON2: if (lpdidod->dwData&128) ext_mbstatus[2] = 1|2; else ext_mbstatus[2] &= 2; - gbstatus = ((gbstatus&~4)|((lpdidod->dwData>>5)&4)); moult[0] = -1; break; - case DIMOFS_BUTTON3: if (lpdidod->dwData&128) ext_mbstatus[3] = 1|2; else ext_mbstatus[3] &= 2; - gbstatus = ((gbstatus&~8)|((lpdidod->dwData>>4)&8)); moult[0] = -1; break; - } - i++; lpdidod = &MousBuffer[i]; - } while ((i < (long)dwItems) && ((long)lpdidod->dwTimeStamp == moult[0])); - - if (moult[0] != -1) - { - got++; - if ((moult[1] != -1) && (moult[2] != -1) && (moult[3] != -1)) - { - nlt0 = moult[0]-moult[1]; - nlt1 = moult[1]-moult[2]; - nlt2 = moult[2]-moult[3]; - ltmin = nlt0; ltmax = nlt0; - if (nlt1 < ltmin) ltmin = nlt1; - if (nlt2 < ltmin) ltmin = nlt2; - if (nlt1 > ltmax) ltmax = nlt1; - if (nlt2 > ltmax) ltmax = nlt2; - if (ltmin*2 >= ltmax) //WARNING: NT's timer has 10ms resolution! - { - moultavg += moult[0]-moult[3]; moultavgcnt += 3; - mousper = (float)moultavg/(float)moultavgcnt; - } - } - } - } - if (gkillbstatus) { gkillbstatus = 0; gbstatus = 0; } //Flush packets after task switch - (*bstatus) = gbstatus; - - //Calculate and return smoothed mouse data in: (fmousx, fmousy) - odmoutsc = dmoutsc; readklock(&dmoutsc); - fmousynctics = (float)((dmoutsc-odmoutsc)*1000.0); - - //At one time, readklock() wasn't always returning increasing values. - //This made fmousynctics <= 0 possible, causing /0. Fixed now :) - if ((!moultavgcnt) || (!mousmoth)) //|| ((*(long *)&fmousynctics) <= 0)) - { (*fmousx) = (float)mousx; (*fmousy) = (float)mousy; (*fmousz) = (float)mousz; return; } - - mousince = min(mousince+mousper*(float)got,mousper+fmousynctics); - if (fmousynctics >= mousince) { f = 1; mousince = 0; } - else { f = fmousynctics / mousince; mousince -= fmousynctics; } - mougoalx += (float)mousx; (*fmousx) = mougoalx*f; mougoalx -= (*fmousx); - mougoaly += (float)mousy; (*fmousy) = mougoaly*f; mougoaly -= (*fmousy); - mougoalz += (float)mousz; (*fmousz) = mougoalz*f; mougoalz -= (*fmousz); -} -void readmouse (float *fmousx, float *fmousy, long *bstatus) -{ - float fmousz; - readmouse(fmousx,fmousy,&fmousz,bstatus); -} - -void smartsleep (long timeoutms) -{ - MsgWaitForMultipleObjects(2,dinputevent,0,timeoutms,QS_KEY|QS_PAINT); -} - -#endif - - -// Kensound code begins ------------------------------------------------------- - -#ifndef NOSOUND -//-------------------------------------------------------------------------------------------------- -#define MAXUMIXERS 256 -#define UMIXERBUFSIZ 65536 -typedef struct -{ - LPDIRECTSOUNDBUFFER streambuf; - long samplerate, numspeakers, bytespersample, oplaycurs; - void (*mixfunc)(void *dasnd, long danumbytes); -} umixertyp; -static umixertyp umixer[MAXUMIXERS]; -static long umixernum = 0; - -extern LPDIRECTSOUND dsound; //Defined later - -long umixerstart (void damixfunc (void *, long), long dasamprate, long danumspeak, long dabytespersamp) -{ - DSBUFFERDESC dsbdesc; - DSBCAPS dsbcaps; - WAVEFORMATEX wfx; - void *w0 = 0, *w1 = 0; - unsigned long l0 = 0, l1 = 0; - - if ((dasamprate <= 0) || (danumspeak <= 0) || (dabytespersamp <= 0) || (umixernum >= MAXUMIXERS)) return(-1); - - umixer[umixernum].samplerate = dasamprate; - umixer[umixernum].numspeakers = danumspeak; - umixer[umixernum].bytespersample = dabytespersamp; - - wfx.wFormatTag = WAVE_FORMAT_PCM; - wfx.nSamplesPerSec = dasamprate; - wfx.wBitsPerSample = (dabytespersamp<<3); - wfx.nChannels = danumspeak; - wfx.nBlockAlign = (wfx.wBitsPerSample>>3) * wfx.nChannels; - wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; - wfx.cbSize = 0; - - memset(&dsbdesc,0,sizeof(DSBUFFERDESC)); - dsbdesc.dwSize = sizeof(DSBUFFERDESC); - dsbdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2|DSBCAPS_LOCSOFTWARE|DSBCAPS_GLOBALFOCUS; - dsbdesc.dwBufferBytes = UMIXERBUFSIZ; - dsbdesc.lpwfxFormat = &wfx; - if (dsound->CreateSoundBuffer(&dsbdesc,&umixer[umixernum].streambuf,0) != DS_OK) return(-1); - - //Zero out streaming buffer before beginning play - umixer[umixernum].streambuf->Lock(0,UMIXERBUFSIZ,&w0,&l0,&w1,&l1,0); - if (w0) memset(w0,(dabytespersamp-2)&128,l0); - if (w1) memset(w1,(dabytespersamp-2)&128,l1); - umixer[umixernum].streambuf->Unlock(w0,l0,w1,l1); - - umixer[umixernum].streambuf->SetCurrentPosition(0); - umixer[umixernum].streambuf->Play(0,0,DSBPLAY_LOOPING); - - umixer[umixernum].oplaycurs = 0; - umixer[umixernum].mixfunc = damixfunc; - umixernum++; - - return(umixernum-1); -} - -void umixerkill (long i) -{ - if ((unsigned long)i >= umixernum) return; - if (umixer[i].streambuf) - { umixer[i].streambuf->Stop(); umixer[i].streambuf->Release(); umixer[i].streambuf = 0; } - umixernum--; if (i != umixernum) umixer[i] = umixer[umixernum]; -} - -void umixerbreathe () -{ - void *w0 = 0, *w1 = 0; - unsigned long l, l0 = 0, l1 = 0, playcurs, writcurs; - long i; - - for(i=0;i<umixernum;i++) - { - if (!umixer[i].streambuf) continue; - if (umixer[i].streambuf->GetCurrentPosition(&playcurs,&writcurs) != DS_OK) continue; - playcurs += ((umixer[i].samplerate/8)<<(umixer[i].bytespersample+umixer[i].numspeakers-2)); - l = (((playcurs-umixer[i].oplaycurs)&(UMIXERBUFSIZ-1))>>(umixer[i].bytespersample+umixer[i].numspeakers-2)); - if (l <= 256) continue; - if (umixer[i].streambuf->Lock(umixer[i].oplaycurs&(UMIXERBUFSIZ-1),l<<(umixer[i].bytespersample+umixer[i].numspeakers-2),&w0,&l0,&w1,&l1,0) != DS_OK) continue; - if (w0) umixer[i].mixfunc(w0,l0); - if (w1) umixer[i].mixfunc(w1,l1); - umixer[i].oplaycurs += l0+l1; - umixer[i].streambuf->Unlock(w0,l0,w1,l1); - } -} -//-------------------------------------------------------------------------------------------------- -typedef struct { float x, y, z; } point3d; -#if (USEKENSOUND == 1) -#include <math.h> - - //Internal streaming buffer variables: -#define SNDSTREAMSIZ 16384 //(16384) Keep this a power of 2! -#define MINBREATHREND 256 //(256) Keep this high to avoid clicks, but much smaller than SNDSTREAMSIZ! -#define LSAMPREC 10 //(11) No WAV file can have more than 2^(31-LSAMPREC) samples -#define MAXPLAYINGSNDS 256 //(256) -#define VOLSEPARATION 1.f //(1.f) Range: 0 to 1, .5 good for headphones, 1 good for speakers -#define EARSEPARATION 8.f //(8.f) Used for L/R sample shifting -#define SNDMINDIST 32.f //(32.f) Shortest distance where volume is max / volume scale factor -#define SNDSPEED 4096.f //(4096.f) Speed of sound in units per second -#define NUMCOEF 4 //(4) # filter coefficients (4 and 8 are good choices) -#define LOGCOEFPREC 5 //(5) number of fractional bits of precision: 5 is ok -#define COEFRANG 32757 //(32757) DON'T make this > 32757 (not a typo) or else it'll overflow -#define KSND_3D 1 -#define KSND_MOVE 2 -#define KSND_LOOP 4 -#define KSND_LOPASS 8 -#define KSND_MEM 16 -#define KSND_LOOPFADE 32 //for internal use only - -typedef struct //For sounds longer than SNDSTREAMSIZ -{ - point3d *ptr; //followstat (-1 means not 3D sound, 0 means 3D sound but don't follow, else follow 3D!) - point3d p; //current position - long flags; //Bit0:1=3D, Bit1:1=follow 3D, Bit2:1=loop - long ssnd; //source sound - long ispos; //sub-sample counter (before doppler delay) - long ispos0; //L sub-sample counter - long ispos1; //R sub-sample counter - long isinc; //sub-sample increment - long ivolsc; //volume scale - long ivolsc0; //L volume scale - long ivolsc1; //R volume scale - short *coefilt; //pointer to coef (for low pass filter, etc...) -} rendersndtyp; -static rendersndtyp rendersnd[MAXPLAYINGSNDS]; -static long numrendersnd = 0; - -LPDIRECTSOUNDBUFFER streambuf = 0; -#endif -LPDIRECTSOUND dsound = 0; -#if (USEKENSOUND == 1) - - //format: (used by audplay* to cache filenames&files themselves) - //[index to next hashindex or -1][index to last filnam][ptr to snd_buf][char snd_filnam[?]\0] -#define AUDHASHINITSIZE 8192 -static char *audhashbuf = 0; -#define AUDHASHEADSIZE 256 //must be power of 2 -static long audhashead[AUDHASHEADSIZE], audhashpos, audlastloadedwav, audhashsiz; - -static point3d audiopos, audiostr, audiohei, audiofor; -static float rsamplerate; -static long lsnd[SNDSTREAMSIZ>>1], samplerate, numspeakers, bytespersample, oplaycurs = 0; -static char gshiftval = 0; -__declspec(align(16)) static short coef[NUMCOEF<<LOGCOEFPREC]; //Sound re-scale filter coefficients -__declspec(align(16)) static short coeflopass[NUMCOEF<<LOGCOEFPREC]; //Sound re-scale filter coefficients - - - //Same as: stricmp(st0,st1) except: '/' == '\' -static long filnamcmp (const char *st0, const char *st1) -{ - long i; - char ch0, ch1; - - for(i=0;st0[i];i++) - { - ch0 = st0[i]; if ((ch0 >= 'a') && (ch0 <= 'z')) ch0 -= 32; - ch1 = st1[i]; if ((ch1 >= 'a') && (ch1 <= 'z')) ch1 -= 32; - if (ch0 == '/') ch0 = '\\'; - if (ch1 == '/') ch1 = '\\'; - if (ch0 != ch1) return(-1); - } - if (!st1[i]) return(0); - return(-1); -} - -static long audcalchash (const char *st) -{ - long i, hashind; - char ch; - - for(i=0,hashind=0;st[i];i++) - { - ch = st[i]; - if ((ch >= 'a') && (ch <= 'z')) ch -= 32; - if (ch == '/') ch = '\\'; - hashind = (ch - hashind*3); - } - return(hashind&(AUDHASHEADSIZE-1)); -} - -static long audcheckhashsiz (long siz) -{ - long i; - - if (!audhashbuf) //Initialize hash table on first call - { - memset(audhashead,-1,sizeof(audhashead)); - if (!(audhashbuf = (char *)malloc(AUDHASHINITSIZE))) return(0); - audhashpos = 0; audlastloadedwav = -1; audhashsiz = AUDHASHINITSIZE; - } - if (audhashpos+siz > audhashsiz) //Make sure string fits in audhashbuf - { - i = audhashsiz; do { i <<= 1; } while (audhashpos+siz > i); - if (!(audhashbuf = (char *)realloc(audhashbuf,i))) return(0); - audhashsiz = i; - } - return(1); -} - -static void kensoundclose () -{ - numrendersnd = 0; - - ENTERMUTX; - if (streambuf) streambuf->Stop(); - - if (audhashbuf) - { - long i; - for(i=audlastloadedwav;i>=0;i=(*(long *)&audhashbuf[i+4])) - free((void *)(*(long *)&audhashbuf[i+8])); - free(audhashbuf); audhashbuf = 0; - } - audhashpos = audhashsiz = 0; - - if (streambuf) { streambuf->Release(); streambuf = 0; } - LEAVEMUTX; -} - -#define PI 3.14159265358979323 -static void initfilters () -{ - float f, f2, f3, f4, fcoef[NUMCOEF]; - long i, j, k, cenbias; - - //Generate polynomial filter - fewer divides algo. (See PIANO.C for derivation) - f4 = 1.0 / (float)(1<<LOGCOEFPREC); - for(j=0;j<NUMCOEF;j++) - { - for(k=0,f3=1.0;k<j;k++) f3 *= (float)(j-k); - for(k=j+1;k<NUMCOEF;k++) f3 *= (float)(j-k); - f3 = COEFRANG / f3; f = ((NUMCOEF-1)>>1); - for(i=0;i<(1<<LOGCOEFPREC);i++,f+=f4) - { - for(k=0,f2=f3;k<j;k++) f2 *= (f-(float)k); - for(k=j+1;k<NUMCOEF;k++) f2 *= (f-(float)k); - coef[i*NUMCOEF+j] = (short)f2; - } - } - //Sinc*RaisedCos filter (window-designed filter): - cenbias = (long)((float)(NUMCOEF-1)*.5f); - for(i=0;i<(1<<LOGCOEFPREC);i++) - { - f3 = 0; - for(j=0;j<NUMCOEF;j++) - { - f = ((float)((cenbias-j)*(1<<LOGCOEFPREC)+i))*PI/(float)(1<<LOGCOEFPREC); - if (f == 0) f2 = 1.f; else f2 = (float)(sin(f*.25) / (f*.25)); - f2 *= (cos((f+f)/(float)NUMCOEF)*.5+.5); //Hanning - fcoef[j] = f2; f3 += f2; - } - f3 = COEFRANG/f3; //NOTE: Enabling this code makes it LESS continuous! - for(j=0;j<NUMCOEF;j++) coeflopass[i*NUMCOEF+j] = (short)(fcoef[j]*f3); - } -} - -long kensoundflags = DSBCAPS_GETCURRENTPOSITION2; -static int kensoundinit (LPDIRECTSOUND dsound, int samprate, int numchannels, int bytespersamp) -{ - WAVEFORMATEX wft; - DSBUFFERDESC bufdesc; - void *w0, *w1; - unsigned long l0, l1; - - if (streambuf) kensoundclose(); - - samplerate = samprate; rsamplerate = 1.0/(float)samplerate; - numspeakers = numchannels; - bytespersample = bytespersamp; - gshiftval = (numspeakers+bytespersample-2); - - wft.wFormatTag = WAVE_FORMAT_PCM; - wft.nSamplesPerSec = samprate; - wft.wBitsPerSample = (bytespersamp<<3); - wft.nChannels = numchannels; - wft.nBlockAlign = bytespersamp*wft.nChannels; - wft.nAvgBytesPerSec = wft.nSamplesPerSec * wft.nBlockAlign; - wft.cbSize = 0; - - bufdesc.dwSize = sizeof(DSBUFFERDESC); - bufdesc.dwFlags = kensoundflags; - //|DSBCAPS_LOCSOFTWARE; //lowers latency, but causes delays between DirectInput & threads !?? - bufdesc.dwBufferBytes = SNDSTREAMSIZ; - bufdesc.dwReserved = 0; - bufdesc.lpwfxFormat = &wft; - if (dsound->CreateSoundBuffer(&bufdesc,&streambuf,0) != DS_OK) return(-1); - - //streambuf->SetVolume(curmusicvolume); - //streambuf->SetFrequency(curmusicfrequency); - //streambuf->SetPan(curmusicpan); - - //Zero out streaming buffer before beginning play - streambuf->Lock(0,SNDSTREAMSIZ,&w0,&l0,&w1,&l1,0); - if (w0) memset(w0,(bytespersample-2)&128,l0); - if (w1) memset(w1,(bytespersample-2)&128,l1); - streambuf->Unlock(w0,l0,w1,l1); - - initfilters(); - - streambuf->SetCurrentPosition(0); - streambuf->Play(0,0,DSBPLAY_LOOPING); - - return(0); -} - -static __forceinline long mulshr16 (long a, long d) -{ - _asm - { - mov eax, a - imul d - shrd eax, edx, 16 - } -} - -static __forceinline long mulshr32 (long a, long d) -{ - _asm - { - mov eax, a - imul d - mov eax, edx - } -} - - // ssnd: source sound - // ispos: sub-sample counter - // isinc: sub-sample increment per destination sample - // ivolsc: 31-bit volume scale - //ivolsci: 31-bit ivolsc increment per destination sample - // lptr: 32-bit sound pointer (step by 8 because rendersamps only renders 1 channel!) - // nsamp: number of destination samples to render -static void rendersamps (long dasnd, long ispos, long isinc, long ivolsc, long ivolsci, long *lptr, long nsamp, short *coefilt) -{ - long i, j, k; - - i = isinc*nsamp + ispos; if (i < isinc) return; //ispos < 0 for all samples! - j = *(long *)(dasnd-8); if ((ispos>>LSAMPREC) >= j) return; //ispos >= j for all samples! - //Clip off low ispos - if (ispos < 0) { k = (isinc-1-ispos)/isinc; ivolsc += ivolsci*k; ispos += isinc*k; lptr += k*2; nsamp -= k; } - if (((i-isinc)>>LSAMPREC) >= j) nsamp = ((j<<LSAMPREC)-ispos+isinc-1)/isinc; //Clip off high ispos - -#if (NUMCOEF == 1) - do //Very fast sound rendering; terrible quality! - { - lptr[0] += mulshr32(((short *)dasnd)[ispos>>LSAMPREC],ivolsc); - ivolsc += ivolsci; ispos += isinc; lptr += 2; nsamp--; - } while (nsamp); -#elif (NUMCOEF == 2) - short *ssnd; //Fast sound rendering; ok quality - do - { - ssnd = (short *)(((ispos>>LSAMPREC)<<1)+dasnd); - lptr[0] += mulshr32((long)(((((long)ssnd[1])-((long)ssnd[0]))*(ispos&((1<<LSAMPREC)-1)))>>LSAMPREC)+((long)ssnd[0]),ivolsc); - ivolsc += ivolsci; ispos += isinc; lptr += 2; nsamp--; - } while (nsamp); -#elif (NUMCOEF == 4) -#if 0 - short *soef, *ssnd; //Slow sound rendering; great quality - do - { - ssnd = (short *)(((ispos>>LSAMPREC)<<1)+dasnd); - soef = &coef[((ispos&((1<<LSAMPREC)-1))>>(LSAMPREC-LOGCOEFPREC))<<2]; - lptr[0] += mulshr32((long)ssnd[0]*(long)soef[0]+ - (long)ssnd[1]*(long)soef[1]+ - (long)ssnd[2]*(long)soef[2]+ - (long)ssnd[3]*(long)soef[3],ivolsc>>15); - ivolsc += ivolsci; ispos += isinc; lptr += 2; nsamp--; - } while (nsamp); -#else - - //c = &coef[l]; - //h = &ssnd[u>>LSAMPREC] - // c[3] c[2] c[1] c[0] - //*h[3] *h[2] *h[1] *h[0] - //+p[3] +p[2] +p[1] +p[0] = s1 - if (cputype&(1<<23)) //MMX - { - _asm - { - push ebx - push esi - push edi - push ebp - mov esi, ispos - mov edi, lptr - mov ecx, nsamp - lea edi, [edi+ecx*8] - neg ecx - mov edx, dasnd - mov ebx, isinc - movd mm2, ivolsc - movd mm3, ivolsci - - test cputype, 1 shl 22 - mov ebp, coefilt - jnz short srndmmp - - mov eax, 0xffff0000 - movd mm7, eax - srndmmx:mov eax, esi ;MMX loop begins here - shr esi, LSAMPREC - movq mm0, [edx+esi*2] - lea esi, [eax+ebx] - and eax, (1<<LSAMPREC)-1 - shr eax, LSAMPREC-LOGCOEFPREC - pmaddwd mm0, [ebp+eax*8] - movd mm5, [edi+ecx*8] - movq mm1, mm0 - punpckhdq mm0, mm0 - paddd mm0, mm1 - movq mm4, mm2 - pand mm4, mm7 ;mm4: 0 0 (ivolsc&0xff00) 0 - pmaddwd mm0, mm4 - paddd mm2, mm3 - psrad mm0, 15 - paddd mm5, mm0 - movd [edi+ecx*8], mm5 - add ecx, 1 - jnz short srndmmx - jmp short srend - - srndmmp:mov eax, esi ;MMX+ loop begins here - shr esi, LSAMPREC - movq mm0, [edx+esi*2] - lea esi, [eax+ebx] - and eax, (1<<LSAMPREC)-1 - shr eax, LSAMPREC-LOGCOEFPREC - pmaddwd mm0, [ebp+eax*8] - movd mm5, [edi+ecx*8] - pshufw mm1, mm0, 0xe - paddd mm0, mm1 - pshufw mm4, mm2, 0xe6 ;mm4: 0 0 (ivolsc&0xff00) 0 - pmaddwd mm0, mm4 - paddd mm2, mm3 - psrad mm0, 15 - paddd mm5, mm0 - movd [edi+ecx*8], mm5 - add ecx, 1 - jnz short srndmmp -srend: - pop ebp - pop edi - pop esi - pop ebx - } - } -#endif -#endif -} - -static void rendersampsloop (long dasnd, long ispos, long isinc, long ivolsc, long ivolsci, long *lptr, long nsamp, short *coefilt) -{ - long i, k, numsamps, repstart; - - i = isinc*nsamp + ispos; if (i < isinc) return; //ispos < 0 for all samples! - //Clip off low ispos - if (ispos < 0) { k = (isinc-1-ispos)/isinc; ivolsc += ivolsci*k; ispos += isinc*k; lptr += k*2; nsamp -= k; } - numsamps = *(long *)(dasnd-8); - repstart = *(long *)(dasnd-12); - - //Make sure loop transition is smooth when using (NUMCOEF > 1) - *(long *)(dasnd+(numsamps<<1) ) = *(long *)(dasnd+(repstart<<1) ); - *(long *)(dasnd+(numsamps<<1)+4) = *(long *)(dasnd+(repstart<<1)+4); - - while (i-isinc >= (numsamps<<LSAMPREC)) - { - k = ((numsamps<<LSAMPREC)-ispos+isinc-1)/isinc; - rendersamps(dasnd,ispos,isinc,ivolsc,ivolsci,lptr,k,coefilt); - ivolsc += ivolsci*k; ispos += isinc*k; lptr += k*2; nsamp -= k; - ispos -= ((numsamps-repstart)<<LSAMPREC); //adjust ispos so last sample equivalent to repstart - i = isinc*nsamp + ispos; - } - rendersamps(dasnd,ispos,isinc,ivolsc,ivolsci,lptr,nsamp,coefilt); - - //Restore loop transition to silence (in case sound is also played without looping) - *(long *)(dasnd+(numsamps<<1) ) = 0; - *(long *)(dasnd+(numsamps<<1)+4) = 0; -} - - // lptr: 32-bit sound pointer - // dptr: 16-bit destination pointer - // nsamp: number of destination samples to render -static void audclipcopy (long *lptr, short *dptr, long nsamp) -{ - if (cputype&(1<<23)) //MMX - { -#if 0 - _asm - { - mov eax, lptr - mov edx, dptr - mov ecx, nsamp - lea edx, [edx+ecx*4] - lea eax, [eax+ecx*8] - neg ecx - begc0: movq mm0, [eax+ecx*8] - packssdw mm0, mm0 - movd [edx+ecx*4], mm0 - add ecx, 1 - jnz short begc0 - } -#else - _asm //Same as above, but does 8-byte aligned writes instead of 4 - { - mov eax, lptr - mov edx, dptr - mov ecx, nsamp - test edx, 4 - lea edx, [edx+ecx*4] - lea eax, [eax+ecx*8] - jz short skipc - neg ecx - movq mm0, [eax+ecx*8] - packssdw mm0, mm0 - movd [edx+ecx*4], mm0 - add ecx, 2 - jg short endc - jz short skipd - jmp short begc1 - skipc:neg ecx - add ecx, 1 - begc1:movq mm0, [eax+ecx*8-8] - packssdw mm0, [eax+ecx*8] - movq [edx+ecx*4-4], mm0 - add ecx, 2 - jl short begc1 - jg short endc - skipd:movq mm0, [eax-8] - packssdw mm0, mm0 - movd [edx-4], mm0 - endc: - } -#endif - } -} - -void setears3d (float iposx, float iposy, float iposz, - float iforx, float ifory, float iforz, - float iheix, float iheiy, float iheiz) -{ - ENTERMUTX; - float f = 1.f/sqrt(iheix*iheix+iheiy*iheiy+iheiz*iheiz); //Make audiostr same magnitude as audiofor - audiopos.x = iposx; audiopos.y = iposy; audiopos.z = iposz; - audiofor.x = iforx; audiofor.y = ifory; audiofor.z = iforz; - audiohei.x = iheix; audiohei.y = iheiy; audiohei.z = iheiz; - audiostr.x = (iheiy*iforz - iheiz*ifory)*f; - audiostr.y = (iheiz*iforx - iheix*iforz)*f; - audiostr.z = (iheix*ifory - iheiy*iforx)*f; - LEAVEMUTX; -} - - //Because of 3D position calculations, it is better to render sound in sync with the movement - // and not at random times. In other words, call kensoundbreath with lower "minleng" values - // when calling from breath() than from other places, such as kensoundthread() -static void kensoundbreath (long minleng) -{ - void *w[2]; - unsigned long l[2], playcurs, writcurs, leng, u; - long i, j, k, m, n, *lptr[2], nsinc0, nsinc1, volsci0, volsci1; - - if (!streambuf) return; - streambuf->GetStatus(&u); if (!(u&DSBSTATUS_LOOPING)) return; - if (streambuf->GetCurrentPosition(&playcurs,&writcurs) != DS_OK) return; - leng = ((playcurs-oplaycurs)&(SNDSTREAMSIZ-1)); if (leng < minleng) return; - i = (oplaycurs&(SNDSTREAMSIZ-1)); - if (i < ((playcurs-1)&(SNDSTREAMSIZ-1))) - memset(&lsnd[i>>1],0,leng<<1); - else - { - memset(&lsnd[i>>1],0,((-oplaycurs)&(SNDSTREAMSIZ-1))<<1); - memset(lsnd,0,(playcurs&(SNDSTREAMSIZ-1))<<1); - } - - if (!numrendersnd) - { - streambuf->Lock(i,leng,&w[0],&l[0],&w[1],&l[1],0); - if (w[0]) memset(w[0],(bytespersample-2)&128,l[0]); - if (w[1]) memset(w[1],(bytespersample-2)&128,l[1]); - streambuf->Unlock(w[0],l[0],w[1],l[1]); - } - else - { - streambuf->Lock(i,leng,&w[0],&l[0],&w[1],&l[1],0); - - lptr[0] = &lsnd[i>>1]; lptr[1] = lsnd; - for(j=numrendersnd-1;j>=0;j--) - { - if (rendersnd[j].flags&KSND_MOVE) rendersnd[j].p = *rendersnd[j].ptr; //Get new 3D position - if (rendersnd[j].flags&KSND_3D) - { - n = (signed long)(leng>>gshiftval); - - float f, g, h; - f = (rendersnd[j].p.x-audiopos.x)*(rendersnd[j].p.x-audiopos.x)+(rendersnd[j].p.y-audiopos.y)*(rendersnd[j].p.y-audiopos.y)+(rendersnd[j].p.z-audiopos.z)*(rendersnd[j].p.z-audiopos.z); - g = (rendersnd[j].p.x-audiopos.x)*audiostr.x+(rendersnd[j].p.y-audiopos.y)*audiostr.y+(rendersnd[j].p.z-audiopos.z)*audiostr.z; - if (f <= SNDMINDIST*SNDMINDIST) { f = SNDMINDIST; h = (float)rendersnd[j].ivolsc; } else { f = sqrt(f); h = ((float)rendersnd[j].ivolsc)*SNDMINDIST/f; } - g /= f; //g=-1:pure left, g=0:center, g=1:pure right - //Should use exponential scaling to keep volume constant! - volsci0 = (long)((1.f-max(g*VOLSEPARATION,0))*h); - volsci1 = (long)((1.f+min(g*VOLSEPARATION,0))*h); - volsci0 = (volsci0-rendersnd[j].ivolsc0)/n; - volsci1 = (volsci1-rendersnd[j].ivolsc1)/n; - - //ispos? = ispos + (f voxels)*(.00025sec/voxel) * (isinc*samplerate subsamples/sec); - m = rendersnd[j].isinc*samplerate; - k = rendersnd[j].isinc*n + rendersnd[j].ispos; - h = max((f-SNDMINDIST)+g*(EARSEPARATION*.5f),0); nsinc0 = k - mulshr16((long)(h*(65536.f/SNDSPEED)),m); - h = max((f-SNDMINDIST)-g*(EARSEPARATION*.5f),0); nsinc1 = k - mulshr16((long)(h*(65536.f/SNDSPEED)),m); - nsinc0 = (nsinc0-rendersnd[j].ispos0)/n; - nsinc1 = (nsinc1-rendersnd[j].ispos1)/n; - } - else - { - nsinc0 = rendersnd[j].isinc; - nsinc1 = rendersnd[j].isinc; - volsci0 = 0; - volsci1 = 0; - } - if (rendersnd[j].flags&KSND_LOOPFADE) - { - n = -(signed long)(leng>>gshiftval); - volsci0 = rendersnd[j].ivolsc0/n; - volsci1 = rendersnd[j].ivolsc1/n; - } - for(m=0;m<2;m++) - if (w[m]) - { - k = (l[m]>>gshiftval); - if (!(rendersnd[j].flags&KSND_LOOP)) - { - rendersamps(rendersnd[j].ssnd,rendersnd[j].ispos0,nsinc0,rendersnd[j].ivolsc0,volsci0,lptr[m] ,k,rendersnd[j].coefilt); - rendersamps(rendersnd[j].ssnd,rendersnd[j].ispos1,nsinc1,rendersnd[j].ivolsc1,volsci1,lptr[m]+1,k,rendersnd[j].coefilt); - rendersnd[j].ispos += rendersnd[j].isinc*k; - rendersnd[j].ispos0 += nsinc0*k; rendersnd[j].ivolsc0 += volsci0*k; - rendersnd[j].ispos1 += nsinc1*k; rendersnd[j].ivolsc1 += volsci1*k; - - //Delete sound only when both L&R channels have played through all their samples - if (((rendersnd[j].ispos0>>LSAMPREC) >= (*(long *)(rendersnd[j].ssnd-8))) && - ((rendersnd[j].ispos1>>LSAMPREC) >= (*(long *)(rendersnd[j].ssnd-8)))) - { - (*(long *)(rendersnd[j].ssnd-16))--; numrendersnd--; - if (j != numrendersnd) rendersnd[j] = rendersnd[numrendersnd]; - break; - } - } - else - { - long numsamps, repleng; - numsamps = ((*(long *)(rendersnd[j].ssnd-8))<<LSAMPREC); - repleng = numsamps-((*(long *)(rendersnd[j].ssnd-12))<<LSAMPREC); - - for(n=rendersnd[j].ispos0;n>=numsamps;n-=repleng); - rendersampsloop(rendersnd[j].ssnd,n,nsinc0,rendersnd[j].ivolsc0,volsci0,lptr[m] ,k,rendersnd[j].coefilt); - for(n=rendersnd[j].ispos1;n>=numsamps;n-=repleng); - rendersampsloop(rendersnd[j].ssnd,n,nsinc1,rendersnd[j].ivolsc1,volsci1,lptr[m]+1,k,rendersnd[j].coefilt); - rendersnd[j].ispos += rendersnd[j].isinc*k; - rendersnd[j].ispos0 += nsinc0*k; - rendersnd[j].ispos1 += nsinc1*k; - rendersnd[j].ivolsc0 += volsci0*k; - rendersnd[j].ivolsc1 += volsci1*k; - - //Hack to keep sample pointers away from the limit... - while ((rendersnd[j].ispos0 >= numsamps) && (rendersnd[j].ispos1 >= numsamps)) - { - rendersnd[j].ispos -= repleng; - rendersnd[j].ispos0 -= repleng; rendersnd[j].ispos1 -= repleng; - } - } - } - if ((m >= 2) && (rendersnd[j].flags&KSND_LOOPFADE)) //Remove looping sound after fade-out - { - (*(long *)(rendersnd[j].ssnd-16))--; numrendersnd--; - if (j != numrendersnd) rendersnd[j] = rendersnd[numrendersnd]; - } - if (cputype&(1<<23)) _asm emms //MMX - } - for(m=0;m<2;m++) if (w[m]) audclipcopy(lptr[m],(short *)w[m],l[m]>>gshiftval); - if (cputype&(1<<23)) _asm emms //MMX - streambuf->Unlock(w[0],l[0],w[1],l[1]); - } - - oplaycurs = playcurs; -} - -#if (USETHREADS != 0) -static void kensoundthread (void *_) -{ - while (!quitprogram) - { - ENTERMUTX; - kensoundbreath(SNDSTREAMSIZ>>1); //WARNING: Don't call breath() here - WaitForSingleObject will fail :/ - LEAVEMUTX; - Sleep(USETHREADS); - } - quitprogram = 2; -} -#endif - - //Returns pointer to sound data; loads file if not already loaded. -long audgetfilebufptr (const char *filnam) -{ - WAVEFORMATEX wft; - long i, j, leng, hashind, newsnd, *lptr, repstart; - char tempbuf[12], *fptr; -#ifndef USEKZ - FILE *fil; -#endif - - if (audhashbuf) - { - for(i=audhashead[audcalchash(filnam)];i>=0;i=(*(long *)&audhashbuf[i])) - if (!filnamcmp(filnam,&audhashbuf[i+12])) return(*(long *)&audhashbuf[i+8]); - } - - //Load WAV file here! - repstart = 0x80000000; - if (filnam[0] == '<') //Sound is in memory! (KSND_MEM flag) - { - unsigned long u; //Filename is in weird hex format - for(i=1,u=0;i<9;i++) u = (u<<4)+(filnam[i]&15); - fptr = (char *)u; - - memcpy(tempbuf,fptr,12); fptr += 12; - if (*(long *)&tempbuf[0] != 0x46464952) return(0); //RIFF - if (*(long *)&tempbuf[8] != 0x45564157) return(0); //WAVE - for(j=16;j;j--) - { - memcpy(tempbuf,fptr,8); fptr += 8; i = *(long *)&tempbuf[0]; leng = *(long *)&tempbuf[4]; - if (i == 0x61746164) break; //data - if (i == 0x20746d66) //fmt - { - memcpy(&wft,fptr,16); fptr += 16; - if ((wft.wFormatTag != WAVE_FORMAT_PCM) || (wft.nChannels != 1)) return(0); - if (leng == 20) { memcpy(&repstart,fptr,4); fptr += 4; } - else if (leng > 16) fptr += ((leng-16+1)&~1); - continue; - } - fptr += ((leng+1)&~1); - //if (fptr > ?eof?) return(0); //corrupt WAV files in memory aren't detected :/ - } - if ((!j) || (!leng)) return(0); - } - else - { -#ifndef USEKZ - if (!(fil = fopen(filnam,"rb"))) return(0); - fread(tempbuf,12,1,fil); - if (*(long *)&tempbuf[0] != 0x46464952) { fclose(fil); return(0); } //RIFF - if (*(long *)&tempbuf[8] != 0x45564157) { fclose(fil); return(0); } //WAVE - for(j=16;j;j--) - { - fread(&tempbuf,8,1,fil); i = *(long *)&tempbuf[0]; leng = *(long *)&tempbuf[4]; - if (i == 0x61746164) break; //data - if (i == 0x20746d66) //fmt - { - fread(&wft,16,1,fil); - if ((wft.wFormatTag != WAVE_FORMAT_PCM) || (wft.nChannels != 1)) { fclose(fil); return(0); } - if (leng == 20) fread(&repstart,4,1,fil); - else if (leng > 16) fseek(fil,(leng-16+1)&~1,SEEK_CUR); - continue; - } - fseek(fil,(leng+1)&~1,SEEK_CUR); - if (feof(fil)) { fclose(fil); return(0); } - } - if ((!j) || (!leng)) { fclose(fil); return(0); } -#else - if (!kzopen(filnam)) return(0); - kzread(tempbuf,12); - if (*(long *)&tempbuf[0] != 0x46464952) { kzclose(); return(0); } //RIFF - if (*(long *)&tempbuf[8] != 0x45564157) { kzclose(); return(0); } //WAVE - for(j=16;j;j--) - { - kzread(tempbuf,8); i = *(long *)&tempbuf[0]; leng = *(long *)&tempbuf[4]; - if (i == 0x61746164) break; //data - if (i == 0x20746d66) //fmt - { - kzread(&wft,16); - if ((wft.wFormatTag != WAVE_FORMAT_PCM) || (wft.nChannels != 1)) { kzclose(); return(0); } - if (leng == 20) kzread(&repstart,4); - else if (leng > 16) kzseek((leng-16+1)&~1,SEEK_CUR); - continue; - } - kzseek((leng+1)&~1,SEEK_CUR); - if (kzeof()) { kzclose(); return(0); } - } - if ((!j) || (!leng)) { kzclose(); return(0); } -#endif - } - - if (wft.wBitsPerSample == 16) i = leng; else i = (leng<<1); //Convert 8-bit to 16-bit - - if (filnam[0] == '<') //Sound is in memory! (KSND_MEM flag) - { - if (!(newsnd = (long)malloc(16+i+8))) return(0); - memcpy((void *)(newsnd+16),fptr,leng); - } - else - { -#ifndef USEKZ - if (!(newsnd = (long)malloc(16+i+8))) { fclose(fil); return(0); } - fread((void *)(newsnd+16),leng,1,fil); - fclose(fil); -#else - if (!(newsnd = (long)malloc(16+i+8))) { kzclose(); return(0); } - kzread((void *)(newsnd+16),leng); - kzclose(); -#endif - } - - if (wft.wBitsPerSample == 8) //Convert 8-bit to 16-bit - { - j = newsnd+16; - for(i=leng-1;i>=0;i--) (*(short *)((i<<1)+j)) = (((short)((*(signed char *)(i+j))-128))<<8); - wft.wBitsPerSample = 16; leng <<= 1; - } - *(long *)(newsnd) = 0; //Allocation count - *(long *)(newsnd+4) = repstart; //Loop repeat start sample - *(long *)(newsnd+8) = (leng>>1); // /((wft.wBitsPerSample>>3)*wft.nChannels); //numsamples - *(float *)(newsnd+12) = (float)(wft.nSamplesPerSec<<LSAMPREC); - *(long *)(newsnd+leng+16) = *(long *)(newsnd+leng+20) = 0; - - //Write new file info to hash - j = 12+strlen(filnam)+1; if (!audcheckhashsiz(j)) return(0); - hashind = audcalchash(filnam); - *(long *)&audhashbuf[audhashpos] = audhashead[hashind]; - *(long *)&audhashbuf[audhashpos+4] = audlastloadedwav; - *(long *)&audhashbuf[audhashpos+8] = newsnd; - strcpy(&audhashbuf[audhashpos+12],filnam); - audhashead[hashind] = audhashpos; audlastloadedwav = audhashpos; audhashpos += j; - - return(newsnd); -} - - // filnam: ASCIIZ string of filename (can be inside .ZIP file if USEKZ is enabled) - // Filenames are compared with a hash, and samples are cached, so don't worry about speed! - //volperc: volume scale (0 is silence, 100 is max volume) - // frqmul: frequency multiplier (1.0 is no scale) - // pos: if 0, then doesn't use 3D, if nonzero, this is pointer to 3D position - // flags: bit 0: 1=3D sound, 0=simple sound - // bit 1: 1=dynamic 3D position update (from given pointer), 0=disable (ignored if !pos) - // bit 2: 1=loop sound (use playsoundupdate to disable, for non 3D sounds use dummy point3d!) - // Valid values for flags: - // flags=0: 0 flags=4: KSND_LOOP - // flags=1: KSND_3D flags=5: KSND_LOOP|KSND_3D - // flags=3: KSND_MOVE flags=7: KSND_LOOP|KSND_MOVE - // - // NOTE: When using flags=4 (KSND_LOOP without KSND_3D or KSND_MOVE), you can pass a unique - // non-zero dummy pointer pos to playsound. This way, you can use playsoundupdate() to stop - // the individual sound. If you pass a NULL pointer, then only way to stop the sound is - // by stopping all sounds. -void playsound (const char *filnam, long volperc, float frqmul, void *pos, long flags) -{ - void *w[2]; - unsigned long l[2], playcurs, writcurs, u; - long i, j, k, m, ispos, ispos0, ispos1, isinc, ivolsc, ivolsc0, ivolsc1, newsnd, *lptr[2], numsamps; - short *coefilt; - float f, g, h; - - if (!dsound) return; - ENTERMUTX; - if (!streambuf) { LEAVEMUTX; return; } - streambuf->GetStatus(&u); if (!(u&DSBSTATUS_LOOPING)) { LEAVEMUTX; return; } - - if (flags&KSND_MEM) - { - char tempbuf[10]; //Convert to ASCII string so filnamcmp()&audcalchash() works right - tempbuf[9] = 0; u = (unsigned long)filnam; - for(i=8;i>0;i--) { tempbuf[i] = (u&15)+64; u >>= 4; } - tempbuf[0] = '<'; //This invalid filename char tells audgetfilebufptr it's KSND_MEM - if (!(newsnd = audgetfilebufptr(tempbuf))) { LEAVEMUTX; return; } - } - else - { - if (!(newsnd = audgetfilebufptr(filnam))) { LEAVEMUTX; return; } - } - newsnd += 16; - - ispos = 0; isinc = (long)((*(float *)(newsnd-4))*frqmul*rsamplerate); - ivolsc = (volperc<<15)/100; if (ivolsc >= 32768) ivolsc = 32767; ivolsc <<= 16; - - if (!pos) flags &= ~(KSND_3D|KSND_MOVE); //null pointers not allowed for 3D sound - if (flags&KSND_MOVE) flags |= KSND_3D; //moving sound must be 3D sound - if ((flags&KSND_LOOP) && ((*(long *)(newsnd-12)) == 0x80000000)) - flags &= ~KSND_LOOP; //WAV must support looping to allow looping - - if (!(flags&KSND_LOPASS)) coefilt = coef; else coefilt = coeflopass; - - if (flags&KSND_3D) - { - f = (((point3d *)pos)->x-audiopos.x)*(((point3d *)pos)->x-audiopos.x)+(((point3d *)pos)->y-audiopos.y)*(((point3d *)pos)->y-audiopos.y)+(((point3d *)pos)->z-audiopos.z)*(((point3d *)pos)->z-audiopos.z); - g = (((point3d *)pos)->x-audiopos.x)*audiostr.x+(((point3d *)pos)->y-audiopos.y)*audiostr.y+(((point3d *)pos)->z-audiopos.z)*audiostr.z; - if (f <= SNDMINDIST*SNDMINDIST) { f = SNDMINDIST; h = (float)ivolsc; } else { f = sqrt(f); h = ((float)ivolsc)*SNDMINDIST/f; } - g /= f; //g=-1:pure left, g=0:center, g=1:pure right - //Should use exponential scaling to keep volume constant! - ivolsc0 = (long)((1.f-max(g*VOLSEPARATION,0))*h); - ivolsc1 = (long)((1.f+min(g*VOLSEPARATION,0))*h); - //ispos? = ispos + (f voxels)*(.00025sec/voxel) * (isinc*samplerate subsamples/sec); - m = isinc*samplerate; - h = max((f-SNDMINDIST)+g*(EARSEPARATION*.5f),0); ispos0 = -mulshr16((long)(h*(65536.f/SNDSPEED)),m); - h = max((f-SNDMINDIST)-g*(EARSEPARATION*.5f),0); ispos1 = -mulshr16((long)(h*(65536.f/SNDSPEED)),m); - } - else { ispos0 = ispos1 = 0; ivolsc0 = ivolsc1 = ivolsc; } - - kensoundbreath(SNDSTREAMSIZ>>1); //Not necessary, but for good luck - if (streambuf->GetCurrentPosition(&playcurs,&writcurs) != DS_OK) { LEAVEMUTX; return; } - //If you use playcurs instead of writcurs, beginning of sound gets cut off :/ - //on WinXP: ((writcurs-playcurs)&(SNDSTREAMSIZ-1)) ranges from 6880 to 8820 (step 4) - i = (writcurs&(SNDSTREAMSIZ-1)); - if (streambuf->Lock(i,(oplaycurs-i)&(SNDSTREAMSIZ-1),&w[0],&l[0],&w[1],&l[1],0) != DS_OK) { LEAVEMUTX; return; } - lptr[0] = &lsnd[i>>1]; lptr[1] = lsnd; - for(m=0;m<2;m++) - if (w[m]) - { - j = (l[m]>>gshiftval); - if (!(flags&KSND_LOOP)) - { - rendersamps(newsnd,ispos0,isinc,ivolsc0,0,lptr[m] ,j,coefilt); - rendersamps(newsnd,ispos1,isinc,ivolsc1,0,lptr[m]+1,j,coefilt); - j *= isinc; ispos += j; ispos0 += j; ispos1 += j; - } - else - { - long numsamps, repleng, n; - numsamps = ((*(long *)(newsnd-8))<<LSAMPREC); - repleng = numsamps-((*(long *)(newsnd-12))<<LSAMPREC); - - for(n=ispos0;n>=numsamps;n-=repleng); - rendersampsloop(newsnd,n,isinc,ivolsc0,0,lptr[m] ,j,coefilt); - for(n=ispos1;n>=numsamps;n-=repleng); - rendersampsloop(newsnd,n,isinc,ivolsc1,0,lptr[m]+1,j,coefilt); - j *= isinc; ispos += j; ispos0 += j; ispos1 += j; - - //Hack to keep sample pointers away from the limit... - while ((ispos0 >= numsamps) && (ispos1 >= numsamps)) - { ispos -= repleng; ispos0 -= repleng; ispos1 -= repleng; } - } - } - for(m=0;m<2;m++) if (w[m]) audclipcopy(lptr[m],(short *)w[m],l[m]>>gshiftval); - if (cputype&(1<<23)) _asm emms //MMX - streambuf->Unlock(w[0],l[0],w[1],l[1]); - - //Save params to continue playing later (when both L&R channels haven't played through) - numsamps = *(long *)(newsnd-8); - if ((((ispos0>>LSAMPREC) < numsamps) || ((ispos1>>LSAMPREC) < numsamps) || (flags&KSND_LOOP)) && (numrendersnd < MAXPLAYINGSNDS)) - { - rendersnd[numrendersnd].ptr = (point3d *)pos; - if (flags&KSND_3D) rendersnd[numrendersnd].p = *((point3d *)pos); - else { rendersnd[numrendersnd].p.x = rendersnd[numrendersnd].p.y = rendersnd[numrendersnd].p.z = 0; } - rendersnd[numrendersnd].flags = flags; - rendersnd[numrendersnd].ssnd = newsnd; - rendersnd[numrendersnd].ispos = ispos; - rendersnd[numrendersnd].ispos0 = ispos0; - rendersnd[numrendersnd].ispos1 = ispos1; - rendersnd[numrendersnd].isinc = isinc; - rendersnd[numrendersnd].ivolsc = ivolsc; - rendersnd[numrendersnd].ivolsc0 = ivolsc0; - rendersnd[numrendersnd].ivolsc1 = ivolsc1; - rendersnd[numrendersnd].coefilt = coefilt; - numrendersnd++; - (*(long *)(newsnd-16))++; - } - - LEAVEMUTX; -} - - //Use this function to update a pointer location (if you need to move things around in memory) - //special cases: if (optr== 0) changes all pointers - // if (nptr== 0) changes KSND_MOVE to KSND_3D - // if (nptr==-1) changes KSND_MOVE to KSND_3D and stops sound (using KSND_LOOPFADE) - //examples: playsoundupdate(&spr[delete_me].p,&spr[--numspr].p); //update pointer location - // playsoundupdate(&spr[just_before_respawn],0); //stop position updates from pointer - // playsoundupdate(&my_looping_sound,(point3d *)-1); //turn off a looping sound - // playsoundupdate(0,0); //stop all position updates - // playsoundupdate(0,(point3d *)-1); //turn off all sounds -void playsoundupdate (void *optr, void *nptr) -{ - long i; - - if (!dsound) return; - ENTERMUTX; - for(i=numrendersnd-1;i>=0;i--) - { - if ((rendersnd[i].ptr != (point3d *)optr) && (optr)) continue; - if (((long)nptr) == -2) { rendersnd[i].flags |= KSND_LOPASS; rendersnd[i].coefilt = coeflopass; continue; } - if (((long)nptr) == -3) { rendersnd[i].flags &= ~KSND_LOPASS; rendersnd[i].coefilt = coef; continue; } - rendersnd[i].ptr = (point3d *)nptr; - if (!((((long)nptr)+1)&~1)) - { - rendersnd[i].flags &= ~KSND_MOVE; //nptr == {0,-1} - if (nptr) rendersnd[i].flags |= KSND_LOOPFADE; //nptr == {-1} - } - } - LEAVEMUTX; -} - -#endif -// Kensound code ends --------------------------------------------------------- - -// DirectSound variables & code ---------------------------------------------- - -#ifdef DSOUNDINITCOM -static HRESULT coinit; -#endif - -#define MAXSOUNDS 256 -LPDIRECTSOUNDBUFFER dsprim = 0; -#if (USEKENSOUND == 2) -LPDIRECTSOUNDBUFFER dsbuf[MAXSOUNDS]; -LPDIRECTSOUND3DBUFFER ds3dbuf[MAXSOUNDS]; -LPDIRECTSOUND3DLISTENER ds3dlis = 0; -static long sndindex = -1; -#endif -static long globvolume = 100; - - //0=-10000,1-100=CINT(log10(z/100)*1000) -signed short volperc2db100[104] = -{ - -10000,-2000,-1699,-1523,-1398,-1301,-1222,-1155,-1097,-1046, // 0 to 9 - -1000, -959, -921, -886, -854, -824, -796, -770, -745, -721, //10 to 19 - -699, -678, -658, -638, -620, -602, -585, -569, -553, -538, //20 to 29 - -523, -509, -495, -481, -469, -456, -444, -432, -420, -409, //30 to 39 - -398, -387, -377, -367, -357, -347, -337, -328, -319, -310, //40 to 49 - -301, -292, -284, -276, -268, -260, -252, -244, -237, -229, //50 to 59 - -222, -215, -208, -201, -194, -187, -180, -174, -167, -161, //60 to 69 - -155, -149, -143, -137, -131, -125, -119, -114, -108, -102, //70 to 79 - -97, -92, -86, -81, -76, -71, -66, -60, -56, -51, //80 to 89 - -46, -41, -36, -32, -27, -22, -18, -13, -9, -4, //90 to 99 - 0, //100 -}; - -void setvolume (long percentmax) -{ - if (!dsprim) return; - globvolume = min(max(percentmax,0),100); - dsprim->SetVolume(volperc2db100[globvolume]); -} - -void uninitdirectsound () -{ - long i; - - if (!dsound) return; -#if (USEKENSOUND == 1) - kensoundclose(); -#endif - -#if (USEKENSOUND == 2) - for(i=MAXSOUNDS-1;i>=0;i--) - if (ds3dbuf[i]) { ds3dbuf[i]->Release(); ds3dbuf[i] = 0; } - if (ds3dlis) { ds3dlis->Release(); ds3dlis = 0; } - for(i=MAXSOUNDS-1;i>=0;i--) - if (dsbuf[i]) { dsbuf[i]->Release(); dsbuf[i] = 0; } -#endif - dsound->Release(); dsound = 0; -} - -void initdirectsound () -{ - DSBUFFERDESC dsbdesc; - long i; - - if (dsound) uninitdirectsound(); - -#if (USEKENSOUND == 2) - for(i=0;i<MAXSOUNDS;i++) { dsbuf[i] = 0; ds3dbuf[i] = 0; } -#endif - -#ifdef DSOUNDINITCOM - if (coinit == S_OK) - { - HRESULT dsrval = CoCreateInstance(CLSID_DirectSound,NULL,CLSCTX_INPROC_SERVER, - IID_IDirectSound,(void **)&dsound); - if (dsrval == S_OK) { - dsrval = (dsound)->Initialize(NULL); - //dsrval = IDirectSound_Initialize(dsound,NULL); - //(dsound)->Release(lpds); - if (dsrval != S_OK) { dsound = NULL; return; } - } - } -#else - if (DirectSoundCreate(0,&dsound,0) != DS_OK) { MessageBox(ghwnd,"DirectSoundCreate","ERROR",MB_OK); exit(0); } -#endif - if (dsound->SetCooperativeLevel(ghwnd,DSSCL_PRIORITY) != DS_OK) { MessageBox(ghwnd,"SetCooperativeLevel","ERROR",MB_OK); exit(0); } - - //Create primary buffer - dsbdesc.dwSize = sizeof(DSBUFFERDESC); - dsbdesc.dwFlags = DSBCAPS_PRIMARYBUFFER; -#if (USEKENSOUND == 2) - dsbdesc.dwFlags |= DSBCAPS_CTRL3D|DSBCAPS_CTRLVOLUME; -#endif - dsbdesc.dwBufferBytes = 0; //0 for primary - dsbdesc.dwReserved = 0; - dsbdesc.lpwfxFormat = 0; //0 for primary - if (dsound->CreateSoundBuffer(&dsbdesc,&dsprim,0) < 0) - { dsound->Release(); MessageBox(ghwnd,"CreateSoundBuffer (primary) failed","ERROR",MB_OK); exit(0); } - - dsprim->Play(0,0,DSBPLAY_LOOPING); //Force mixer to always be on - -#if (USEKENSOUND == 2) - //Default listener orientation: - // <1,0,0>: right - // <0,1,0>: up - // <0,0,1>: front - //Initialize 3D sound - if (dsprim->QueryInterface(IID_IDirectSound3DListener,(void **)&ds3dlis) != S_OK) - { dsound->Release(); MessageBox(ghwnd,"Query...Listener failed","ERROR",MB_OK); exit(0); } - ds3dlis->SetDistanceFactor(.03,DS3D_DEFERRED); //1 (meters/unit) - ds3dlis->SetRolloffFactor(.03,DS3D_DEFERRED); //1 - ds3dlis->SetDopplerFactor(1,DS3D_DEFERRED); //1 - ds3dlis->SetPosition(0,0,0,DS3D_DEFERRED); //0,0,0 - ds3dlis->SetVelocity(0,0,0,DS3D_DEFERRED); //0,0,0 - ds3dlis->SetOrientation(0,0,1,0,1,0,DS3D_DEFERRED); //0,0,1,0,1,0 - ds3dlis->CommitDeferredSettings(); -#endif - - if (globvolume != 100) dsprim->SetVolume(globvolume); - -#if (USEKENSOUND == 1) - kensoundinit(dsound,44100,2,2); //last line -#endif -} - -#if (USEKENSOUND == 2) - -#define MINSNDLENG 4096 //is 1764 min size? too bad it fails sometimes :/ 1764*25 = 44100 -long loadwav (LPDIRECTSOUNDBUFFER *dabuf, const char *fnam, float freqmul, unsigned long daflags) -{ - WAVEFORMATEX wft; - DSBUFFERDESC bufdesc; - void *w0, *w1; - unsigned long l0, l1, leng; - char tempbuf[12]; - -#ifndef USEKZ - FILE *fil; - if (!(fil = fopen(fnam,"rb"))) return(0); - fread(tempbuf,12,1,fil); - if (*(long *)&tempbuf[0] != 0x46464952) { fclose(fil); return(0); } //RIFF - if (*(long *)&tempbuf[8] != 0x45564157) { fclose(fil); return(0); } //WAVE - for(l1=16;l1;l1--) - { - fread(&tempbuf,8,1,fil); l0 = *(long *)&tempbuf[0]; leng = *(long *)&tempbuf[4]; - if (l0 == 0x61746164) break; //data - if (l0 == 0x20746d66) //fmt - { - fread(&wft,16,1,fil); - //if ((wft.wFormatTag != WAVE_FORMAT_PCM) || (wft.nChannels != 1)) { fclose(fil); return(0); } - if (leng > 16) fseek(fil,(leng-16+1)&~1,SEEK_CUR); - continue; - } - fseek(fil,(leng+1)&~1,SEEK_CUR); - if (feof(fil)) { fclose(fil); return(0); } - } - if (!l1) { fclose(fil); return(0); } -#else - if (!kzopen(fnam)) return(0); - kzread(tempbuf,12); - if (*(long *)&tempbuf[0] != 0x46464952) { kzclose(); return(0); } //RIFF - if (*(long *)&tempbuf[8] != 0x45564157) { kzclose(); return(0); } //WAVE - for(l1=16;l1;l1--) - { - kzread(tempbuf,8); l0 = *(long *)&tempbuf[0]; leng = *(long *)&tempbuf[4]; - if (l0 == 0x61746164) break; //data - if (l0 == 0x20746d66) //fmt - { - kzread(&wft,16); - //if ((wft.wFormatTag != WAVE_FORMAT_PCM) || (wft.nChannels != 1)) { kzclose(); return(0); } - if (leng > 16) kzseek((leng-16+1)&~1,SEEK_CUR); - continue; - } - kzseek((leng+1)&~1,SEEK_CUR); - if (kzeof()) { kzclose(); return(0); } - } - if (!l1) { kzclose(); return(0); } -#endif - - if (*(long *)&freqmul != 0x3f800000) - { - wft.nSamplesPerSec = (long)((float)wft.nSamplesPerSec * freqmul); - wft.nAvgBytesPerSec = wft.nSamplesPerSec * wft.nBlockAlign; - } - wft.cbSize = 0; - - bufdesc.dwSize = sizeof(DSBUFFERDESC); - bufdesc.dwFlags = daflags; - bufdesc.dwBufferBytes = max(leng,MINSNDLENG); - bufdesc.dwReserved = 0; - bufdesc.lpwfxFormat = &wft; - //bufdesc.guid3DAlgorithm = GUID_NULL; -#ifndef USEKZ - if (dsound->CreateSoundBuffer(&bufdesc,dabuf,0) != DS_OK) - { fclose(fil); return(0); } - //write wave data to directsound buffer you just created - if (((*dabuf)->Lock(0,leng,&w0,&l0,&w1,&l1,0)) == DSERR_BUFFERLOST) { fclose(fil); return(0); } - if (w0) fread(w0,l0,1,fil); - if (w1) fread(w1,l1,1,fil); - (*dabuf)->Unlock(w0,l0,w1,l1); - fclose(fil); -#else - if (dsound->CreateSoundBuffer(&bufdesc,dabuf,0) != DS_OK) - { kzclose(); return(0); } - //write wave data to directsound buffer you just created - (*dabuf)->Lock(0,leng,&w0,&l0,&w1,&l1,0); - if (w0) kzread(w0,l0); - if (w1) kzread(w1,l1); - (*dabuf)->Unlock(w0,l0,w1,l1); - kzclose(); -#endif - - //This hack is because DSOUND seems to have problems with very short secondary buffers! - if (leng < MINSNDLENG) - { - if (((*dabuf)->Lock(leng,MINSNDLENG-leng,&w0,&l0,&w1,&l1,0)) == DSERR_BUFFERLOST) return(0); - if (w0) memset(w0,(wft.wBitsPerSample==8)<<7,l0); - if (w1) memset(w1,(wft.wBitsPerSample==8)<<7,l1); - (*dabuf)->Unlock(w0,l0,w1,l1); - } - - return(1); -} - -void setears3d (float iposx, float iposy, float iposz, - float iforx, float ifory, float iforz, - float iheix, float iheiy, float iheiz) -{ - if (!ds3dlis) return; - ds3dlis->SetPosition(iposx,iposy,iposz,DS3D_DEFERRED); - ds3dlis->SetOrientation(iforx,ifory,iforz,iheix,iheiy,iheiz,DS3D_DEFERRED); //0,0,1,0,1,0 - ds3dlis->CommitDeferredSettings(); -} - -long reallyuglyandslowhack4sound () -{ - long i; - unsigned long u; - - sndindex++; - - i = (sndindex&(MAXSOUNDS-1)); - if (ds3dbuf[i]) { ds3dbuf[i]->Release(); ds3dbuf[i] = 0; } - if (dsbuf[i]) { dsbuf[i]->Release(); dsbuf[i] = 0; } - - for(i=0;i<MAXSOUNDS;i++) - { - if (!dsbuf[i]) continue; - dsbuf[i]->GetStatus(&u); - if (!(u&DSBSTATUS_PLAYING)) - { - if (ds3dbuf[i]) { ds3dbuf[i]->Release(); ds3dbuf[i] = 0; } - if (dsbuf[i]) { dsbuf[i]->Release(); dsbuf[i] = 0; } - } - } - return(sndindex&(MAXSOUNDS-1)); -} - -void playsound (const char *filnam, long volperc, float freqmul) -{ - unsigned long u, cnt; - long i; - - if (!dsound) return; - i = reallyuglyandslowhack4sound(); - - if ((!dsound) || ((unsigned long)i >= MAXSOUNDS)) return; - for(cnt=2;cnt;cnt--) - { - if (!dsbuf[i]) if (!loadwav(&dsbuf[i],filnam,freqmul,(((volperc-100)>>31)&DSBCAPS_CTRLVOLUME)|DSBCAPS_STATIC)) return; - dsbuf[i]->GetStatus(&u); if (u&DSBSTATUS_PLAYING) return; - if (volperc < 100) dsbuf[i]->SetVolume(volperc2db100[max(volperc,0)]); - dsbuf[i]->SetCurrentPosition(0); - if (dsbuf[i]->Play(0,0,0) != DSERR_BUFFERLOST) return; - dsbuf[i]->Release(); dsbuf[i] = 0; - } -} - -void playsound (const char *filnam, long volperc, float freqmul, void *pos, long flags) -{ - unsigned long u, cnt; - long i; - - if (!dsound) return; - if (!(flags&1)) { playsound(filnam,volperc,freqmul); return; } - - i = reallyuglyandslowhack4sound(); - - if ((!dsound) || ((unsigned long)i >= MAXSOUNDS)) return; - for(cnt=2;cnt;cnt--) - { - if (!dsbuf[i]) - { - if (!loadwav(&dsbuf[i],filnam,freqmul,(((volperc-100)>>31)&DSBCAPS_CTRLVOLUME)| - DSBCAPS_CTRL3D|DSBCAPS_STATIC|DSBCAPS_MUTE3DATMAXDISTANCE)) return; - if (ds3dbuf[i]) { ds3dbuf[i]->Release(); ds3dbuf[i] = 0; } - dsbuf[i]->QueryInterface(IID_IDirectSound3DBuffer,(void **)&ds3dbuf[i]); - ds3dbuf[i]->SetMode(DS3DMODE_NORMAL,DS3D_DEFERRED); //DS3DMODE_NORMAL - //ds3dbuf[i]->SetMaxDistance(1000000000,DS3D_DEFERRED); //1000000000 - //ds3dbuf[i]->SetMinDistance(1,DS3D_DEFERRED); //1 - ds3dbuf[i]->SetPosition(((point3d *)pos)->x,((point3d *)pos)->y,((point3d *)pos)->z,DS3D_DEFERRED); //0,0,0 - //ds3dbuf[i]->SetVelocity(0,0,0,DS3D_DEFERRED); //0,0,0 - //ds3dbuf[i]->SetConeAngles(0,360,DS3D_DEFERRED); //0,360 - //ds3dbuf[i]->SetConeOrientation(0,0,0,DS3D_DEFERRED); //0,0,0 - //ds3dbuf[i]->SetConeOutsideVolume(DSBVOLUME_MAX,DS3D_DEFERRED); //DSBVOLUME_MAX - ds3dlis->CommitDeferredSettings(); - } - else - { - ds3dbuf[i]->SetPosition(((point3d *)pos)->x,((point3d *)pos)->y,((point3d *)pos)->z,DS3D_IMMEDIATE); - } - dsbuf[i]->GetStatus(&u); if (u&DSBSTATUS_PLAYING) return; - if (volperc < 100) dsbuf[i]->SetVolume(volperc2db100[max(volperc,0)]); - dsbuf[i]->SetCurrentPosition(0); - if (dsbuf[i]->Play(0,0,0) != DSERR_BUFFERLOST) return; - if (ds3dbuf[i]) { ds3dbuf[i]->Release(); ds3dbuf[i] = 0; } - if (dsbuf[i]) { dsbuf[i]->Release(); dsbuf[i] = 0; } - } -} - -void playsoundupdate (void *oposptr, void *nposptr) -{ - //if (!nptr) follow = 0 -} - -#endif -#endif - -//Quitting routines ---------------------------------------------------------- - -long (*catchwmclose)() = 0; -void quitloop () { PostMessage(ghwnd,WM_CLOSE,0,0); } - -void evilquit (const char *str) //Evil because this function makes awful assumptions!!! -{ -#ifndef NODRAW - stopdirectdraw(); - ddflip2gdi(); -#endif - if (str) MessageBox(ghwnd,str,"fatal error!",MB_OK); -#ifndef NOINPUT - uninitmouse(); - uninitkeyboard(); - uninitdirectinput(); -#endif -#ifndef NOSOUND - uninitdirectsound(); -#endif -#ifndef NODRAW - uninitdirectdraw(); -#endif - uninitapp(); - ExitProcess(0); -} - -//GENERAL WINDOWS CODE------------------------------------------------------------------- - -void setalwaysactive (long active) { alwaysactive = active; } - -#ifndef NODRAW -long canrender () { return(ActiveApp); } -#endif - -#ifndef NOINPUT -void setacquire (long mouse, long kbd) -{ - if (mouse_acquire != mouse) - { - if (ActiveApp && gpMouse) { if (mouse) { gpMouse->Acquire(); gbstatus = 0; } else gpMouse->Unacquire(); } - mouse_acquire = mouse; - } - if (kbd_acquire != kbd) - { - if (ActiveApp && gpKeyboard) { if (kbd) { gpKeyboard->Acquire(); shkeystatus = 0; } else gpKeyboard->Unacquire(); } - kbd_acquire = kbd; - } -} -void setmouseout (void (*in)(long,long), long x, long y) -{ - if (fullscreen) return; - setmousein = in; - setacquire(0, kbd_acquire); - - POINT topLeft; - topLeft.x = 0; topLeft.y = 0; - ClientToScreen(ghwnd, &topLeft); - SetCursorPos(topLeft.x + x, topLeft.y + y); -} - - //Use fancy clipper to determine if mouse cursor (x,y) is outside the window - //Note: x,y is relative to top-left corner of ghwnd -long ismouseout (long x, long y) -{ - if (fullscreen) return(0); -#ifndef NO_CLIPPER - //unsigned long siz; - - //ddclip->GetClipList(0,0,&siz); - //if (siz > ddcliprdbytes) - //{ - // ddcliprdbytes = siz; - // ddcliprd = (RGNDATA *)realloc(ddcliprd,siz); - //} -#ifndef NODRAW - if (ddcliprd) - { - POINT abspos; - RECT *r; - long j; - //ddclip->GetClipList(0,ddcliprd,&siz); - - abspos.x = x; abspos.y = y; - ClientToScreen(ghwnd,&abspos); - - r = (RECT *)ddcliprd->Buffer; - for(j=0;j<(long)ddcliprd->rdh.nCount;j++) - { - if ((abspos.x >= r[j].left) && (abspos.x < r[j].right) && - (abspos.y >= r[j].top) && (abspos.y < r[j].bottom)) - return(0); - } - return(1); - } -#endif -#endif - return(((unsigned long)x >= (unsigned long)xres) || ((unsigned long)y >= (unsigned long)yres)); -} - -#endif - -long (CALLBACK *peekwindowproc)(HWND,UINT,WPARAM,LPARAM) = 0; -long CALLBACK WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - // mouse pos: - static long omx, omy; - long mx, my; - - if (peekwindowproc) { mx = peekwindowproc(hwnd,msg,wParam,lParam); if (mx >= 0) return(mx); } - switch (msg) - { - case WM_SYSCOMMAND: - if ((wParam == SC_KEYMENU) || (wParam == SC_HOTKEY)) return(0); - break; - case WM_ACTIVATEAPP: - ActiveApp = (BOOL)wParam; //!((BOOL)HIWORD(wParam)); - shkeystatus = 0; -#ifndef NOINPUT - gkillbstatus = 1; -#endif - break; - - case WM_ACTIVATE: - //ActiveApp = LOWORD(wParam); //((wParam&65535) != WA_INACTIVE); -#ifndef NOINPUT - if (gpMouse) { if (ActiveApp && mouse_acquire) { gpMouse->Acquire(); gbstatus = 0; } else gpMouse->Unacquire(); } - if (gpKeyboard) { if (ActiveApp && kbd_acquire) { gpKeyboard->Acquire(); shkeystatus = 0; } else gpKeyboard->Unacquire(); } -#endif -#ifndef NODRAW - if ((!fullscreen) && (ActiveApp) && (ddpal) && (ddsurf[0])) - { - if (ddsurf[0]->IsLost() == DDERR_SURFACELOST) ddsurf[0]->Restore(); - ddsurf[0]->SetPalette(ddpal); - updatepalette(0,256); - } - InvalidateRect(hwnd,0,1); -#endif - break; - case WM_PAINT: -#ifndef NODRAW - if (!fullscreen) nextpage(); -#endif - break; - - case WM_SIZE: - gncmdshow = wParam; - if (wParam == SIZE_MAXHIDE) - ActiveApp = 0; - else if (wParam == SIZE_MINIMIZED) - ActiveApp = 0; - else - { - ActiveApp = 1; -#ifndef NODRAW -#ifndef ZOOM_TEST - if ((!fullscreen) && (ddsurf[1])) - { - long oxres = xres, oyres = yres; - xres = LOWORD(lParam); yres = HIWORD(lParam); - - if (ddsurf[1]) { ddsurf[1]->Release(); ddsurf[1] = 0; } - - ddsd.dwSize = sizeof(ddsd); - ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS; - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - ddsd.dwWidth = xres; - ddsd.dwHeight = yres; - lpdd->CreateSurface(&ddsd,&ddsurf[1],0); - - if (ddrawemulbuf) - { - long i, x, y, ye, pw, pr; - - i = ((colbits+7)>>3)*xres; - if (i < ddrawemulbpl) - { - pw = pr = ((long)ddrawemulbuf); ye = min(yres,oyres); - for(y=1;y<ye;y++) - { - pw += i; pr += ddrawemulbpl; - memcpy((void *)pw,(void *)pr,i); - } - } - - ddrawemulbuf = realloc(ddrawemulbuf,((xres*yres+7)&~7)*((colbits+7)>>3)+16); - if (!ddrawemulbuf) - { - xres = oxres; yres = oyres; //oops :/ - ddrawemulbuf = realloc(ddrawemulbuf,((xres*yres+7)&~7)*((colbits+7)>>3)+16); - i = ddrawemulbpl; - } - - if (i > ddrawemulbpl) - { - pw = yres*i + ((long)ddrawemulbuf); - pr = yres*ddrawemulbpl + ((long)ddrawemulbuf); - for(y=yres-1;y>=0;y--) - { - pw -= i; pr -= ddrawemulbpl; - for(x=i-1;x>=ddrawemulbpl;x--) *(char *)(pw+x) = 0; - for(;x>=0;x--) *(char *)(pw+x) = *(char *)(pr+x); - } - } - if (yres > oyres) memset((void *)(oyres*i+((long)ddrawemulbuf)),0,(yres-oyres)*i); - - ddrawemulbpl = i; - } - } -#endif -#endif - } -#ifndef NOINPUT - if (gpMouse) { if (ActiveApp && mouse_acquire) { gpMouse->Acquire(); gbstatus = 0; } else gpMouse->Unacquire(); } - if (gpKeyboard) { if (ActiveApp && kbd_acquire) { gpKeyboard->Acquire(); shkeystatus = 0; } else gpKeyboard->Unacquire(); } -#endif - break; - case WM_KEYDOWN: -#ifdef NOINPUT - keystatus[((lParam>>16)&127)+((lParam>>17)&128)] = 1; -#endif - case WM_SYSKEYDOWN: - if ((wParam&0xff) == 0xff) break; //Fixes SHIFT+[ext key] on XP - switch (lParam&0x17f0000) - { - case 0x02a0000: shkeystatus |= (1<<16); break; //0x2a - case 0x0360000: shkeystatus |= (1<<17); break; //0x36 - case 0x01d0000: shkeystatus |= (1<<18); break; //0x1d - case 0x11d0000: shkeystatus |= (1<<19); break; //0x9d - case 0x0380000: shkeystatus |= (1<<20); break; //0x38 - case 0x1380000: shkeystatus |= (1<<21); break; //0xb8 - default: - { - long i = ((keybufw2+1)&(KEYBUFSIZ-1)); - keybuf[keybufw2&(KEYBUFSIZ-1)] = (((lParam>>8)&0x7f00)+((lParam>>9)&0x8000))+shkeystatus; - if (i != keybufr) keybufw2 = i; //prevent fifo overlap - } - } - return(0); - case WM_KEYUP: -#ifdef NOINPUT - keystatus[((lParam>>16)&127)+((lParam>>17)&128)] = 0; -#endif - case WM_SYSKEYUP: - if ((wParam&0xff) == 0xff) break; //Fixes SHIFT+[ext key] on XP - switch (lParam&0x17f0000) - { - case 0x02a0000: shkeystatus &= ~(3<<16); break; //0x2a - case 0x0360000: shkeystatus &= ~(3<<16); break; //0x36 - case 0x01d0000: shkeystatus &= ~(1<<18); break; //0x1d - case 0x11d0000: shkeystatus &= ~(1<<19); break; //0x9d - case 0x0380000: shkeystatus &= ~(1<<20); break; //0x38 - case 0x1380000: shkeystatus &= ~(1<<21); break; //0xb8 - } - return(0); - case WM_CHAR: - if (keybufw2 != keybufr) //stick ASCII code in last FIFO value - keybuf[(keybufw2-1)&(KEYBUFSIZ-1)] |= (wParam&255); - return(0); - case WM_MOUSEWHEEL: - mx = (signed short)HIWORD(wParam); - if (mx > 0) ext_mbstatus[6] = 2; - else if (mx < 0) ext_mbstatus[7] = 2; - ext_mwheel = min(max(ext_mwheel+mx,(unsigned long)(1<<16)-(unsigned long)(1<<31)),(unsigned long)(1<<31)-(unsigned long)(1<<16)); - - break; -#ifndef NOINPUT - case WM_MOUSEMOVE: - mx = LOWORD(lParam); - my = HIWORD(lParam); - if (gpMouse && ActiveApp && setmousein) { - mouse_acquire = 1; - gpMouse->Acquire(); gbstatus = 0; - setmousein(mx, my); - setmousein = NULL; - } - break; -#endif - case WM_LBUTTONDOWN: if (!mouse_acquire) ext_mbstatus[0] = 1|2; break; - case WM_LBUTTONUP: if (!mouse_acquire) ext_mbstatus[0] &= ~2; break; - case WM_RBUTTONDOWN: if (!mouse_acquire) ext_mbstatus[1] = 1|2; break; - case WM_RBUTTONUP: if (!mouse_acquire) ext_mbstatus[1] &= ~2; break; -#ifndef NODRAW - case WM_ERASEBKGND: return(1); //flicker bug? - case WM_NCPAINT: if (fullscreen) return(0); break; //don't redraw window frame - flicker bug? -#endif - case WM_CLOSE: - if (catchwmclose) { if (!catchwmclose()) return(1); } - - //FYI: Application terminates in this order: - //if (keystatus[1]) Post(WM_CLOSE) //Located inside doframe - //WM_CLOSE: uninitdirect* //WARNING: must be before DestroyWindow! - // DestroyWindow! - // Post(WM_DESTROY) - //WM_DESTROY: Post(WM_QUIT) - //WM_QUIT: quitprogram = 1; - //if (quitprogram) exit(); -#ifndef NOINPUT - uninitmouse(); - uninitkeyboard(); - uninitdirectinput(); -#endif -#ifndef NOSOUND - uninitdirectsound(); -#endif -#ifndef NODRAW - uninitdirectdraw(); -#endif - uninitapp(); - break; - case WM_COMMAND: - { - // from a menu - if(HIWORD(wParam) == 0 && MenuFunc != NULL) - { - MenuFunc(LOWORD(wParam), (HANDLE)lParam); - } - break; - } - case WM_DESTROY: - //Does this remove taskbar icon? - UnregisterClass(wc.lpszClassName,ghinst); - PostQuitMessage(0); - return(0); - default: break; - } - return(DefWindowProc(hwnd,msg,wParam,lParam)); -} - -long keyread () -{ - long i; - - if (keybufr == keybufw) return(0); - i = keybuf[keybufr]; keybufr = ((keybufr+1)&(KEYBUFSIZ-1)); -#if 0 //defined(_DEBUG) && !defined(NODRAW) - if (((i>>8)&255) == 0x2e && (i&(3<<18))) { // && (i&(3<<20))) { - debugdirectdraw(); - if (ddrawdebugmode != -1) __asm { int 3 }; - } -#endif - return(i); -} - -void breath () -{ - MSG msg; - while (PeekMessage(&msg,0,0,0,PM_REMOVE)) //&msg,ghwnd, |PM_NOYIELD? - { - if (msg.message == WM_QUIT) { quitprogram = 1; quitparam = msg.wParam; return; } - TranslateMessage(&msg); - DispatchMessage(&msg); - } - keybufw = keybufw2; // to be safe with multithreads - -#ifndef NOSOUND -#if (USEKENSOUND == 1) - ENTERMUTX; - kensoundbreath(MINBREATHREND); - LEAVEMUTX; - umixerbreathe(); -#endif -#endif -} - - //10/20/2004: this code is useless now that quotes are automatically stripped off properly in WinMain() - //Call like this: arg2filename(argv[1],".ksm",curfilename); - //Make sure curfilename length is long enough! -void arg2filename (const char *oarg, const char *ext, char *narg) -{ - long i; - - //Chop off quotes at beginning and end of filename - for(i=strlen(oarg);i>0;i--) - if (oarg[i-1] == '\\') break; - if ((!i) && (oarg[0] == '\"')) i = 1; - strcpy(narg,&oarg[i]); - if (narg[0] == 0) return; - if (narg[strlen(narg)-1] == '\"') narg[strlen(narg)-1] = 0; - strlwr(narg); - if (!strstr(narg,ext)) strcat(narg,ext); -} - -#ifdef __WATCOMC__ - - //Precision: bits 8-9:, Rounding: bits 10-11: - //00 = 24-bit (0) 00 = nearest/even (0) - //01 = reserved (1) 01 = -inf (4) - //10 = 53-bit (2) 10 = inf (8) - //11 = 64-bit (3) 11 = 0 (c) -static long fpuasm[2]; -void fpuinit (long); -#pragma aux fpuinit =\ - "fninit"\ - "fstcw fpuasm"\ - "and byte ptr fpuasm[1], 0f0h"\ - "or byte ptr fpuasm[1], al"\ - "fldcw fpuasm"\ - parm [eax] - -#endif -#ifdef _MSC_VER - - //Precision: bits 8-9:, Rounding: bits 10-11: - //00 = 24-bit (0) 00 = nearest/even (0) - //01 = reserved (1) 01 = -inf (4) - //10 = 53-bit (2) 10 = inf (8) - //11 = 64-bit (3) 11 = 0 (c) -static long fpuasm[2]; -static _inline void fpuinit (long a) -{ - _asm - { - mov eax, a - fninit - fstcw fpuasm - and byte ptr fpuasm[1], 0f0h - or byte ptr fpuasm[1], al - fldcw fpuasm - } -} - -#endif - -#ifndef NO_CONSOLE - int main(int argc, char *argv[]) -#else - int WINAPI WinMain (HINSTANCE hinst, HINSTANCE hpinst, LPSTR cmdline, int ncmdshow) -#endif -{ - long i, j, k, inquote; - - Minidump::Activate(); - MemoryLeakFinder::Activate(); - -#ifndef NO_CONSOLE - HINSTANCE hinst = (HINSTANCE)GetModuleHandle(NULL); - HINSTANCE hpinst = 0; - LPSTR cmdline = ""; - int ncmdshow = SW_SHOW; -#endif - - ghinst = hinst; ghpinst = hpinst; gcmdline = cmdline; gncmdshow = ncmdshow; - - cputype = getcputype(); - if ((cputype&((1<<0)+(1<<4))) != ((1<<0)+(1<<4))) - { MessageBox(0,"Sorry, this program requires FPU&RDTSC support (>=Pentium)",prognam,MB_OK); return(-1); } - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&osvi); - - initklock(); -#ifndef NOINPUT - for(i=0;i<256;i++) keystatus[i] = 0; - for(i=0;i<256;i++) ext_keystatus[i] = 0; -#endif - -#ifdef NO_CONSOLE - //Convert Windows command line into ANSI 'C' command line... - int argc; - char *argv[MAX_PATH>>1]; - argv[0] = "exe"; argc = 1; j = inquote = 0; - for(i=0;cmdline[i];i++) - { - k = (((cmdline[i] != ' ') && (cmdline[i] != '\t')) || (inquote)); - if (cmdline[i] == '\"') inquote ^= 1; - if (j < k) { argv[argc++] = &cmdline[i+inquote]; j = inquote+1; continue; } - if ((j) && (!k)) - { - if ((j == 2) && (cmdline[i-1] == '\"')) cmdline[i-1] = 0; - cmdline[i] = 0; j = 0; - } - } - if ((j == 2) && (cmdline[i-1] == '\"')) cmdline[i-1] = 0; - argv[argc] = 0; -#endif - if (initapp(argc,argv) < 0) return(-1); - - wc.style = CS_HREDRAW | CS_VREDRAW; - wc.lpfnWndProc = WindowProc; - wc.cbClsExtra = wc.cbWndExtra = 0; - wc.hInstance = ghinst; - wc.hIcon = LoadIcon(ghinst,IDI_APPLICATION); - wc.hCursor = LoadCursor(0,IDC_ARROW); -#ifndef NODRAW - wc.hbrBackground = 0; -#else -#ifdef _MSC_VER - //wc.hbrBackground = (HBRUSH__ *)GetStockObject(BLACK_BRUSH); - wc.hbrBackground = (struct HBRUSH__ *)GetStockObject(BLACK_BRUSH); -#endif -#ifdef __WATCOMC__ - wc.hbrBackground = GetStockObject(BLACK_BRUSH); -#endif -#endif - wc.lpszMenuName = 0; - wc.lpszClassName = prognam; - RegisterClass(&wc); - - progwndflags = WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX; - progwndadd[1] = GetSystemMetrics(SM_CYCAPTION); - if (progresiz) { - progwndflags |= WS_MAXIMIZEBOX|WS_THICKFRAME; - progwndadd[0] = GetSystemMetrics(SM_CXSIZEFRAME)*2; - progwndadd[1] += GetSystemMetrics(SM_CYSIZEFRAME)*2; - } else { - progwndadd[0] = GetSystemMetrics(SM_CXFIXEDFRAME)*2; - progwndadd[1] += GetSystemMetrics(SM_CYFIXEDFRAME)*2; - } - -#ifndef NODRAW - if (fullscreen) - { - if ((ghwnd = CreateWindowEx(WS_EX_TOPMOST,prognam,prognam,WS_POPUP,0,0,GetSystemMetrics(SM_CXSCREEN), - GetSystemMetrics(SM_CYSCREEN),0,0,ghinst,0)) == 0) return(0); - } - else - { -#endif - if (progwndx == 0x80000000) - { - RECT rw; - SystemParametersInfo(SPI_GETWORKAREA,0,&rw,0); - progwndx = ((rw.right -rw.left-(xres+progwndadd[0]))>>1) + rw.left; - progwndy = ((rw.bottom-rw.top -(yres+progwndadd[1]))>>1) + rw.top; - } - if ((ghwnd = CreateWindowEx(0,prognam,prognam,progwndflags, - progwndx,progwndy,xres+progwndadd[0],yres+progwndadd[1],0,0,ghinst,0)) == 0) return(0); -#ifndef NODRAW - } -#endif - - ShowWindow(ghwnd,gncmdshow); -#ifndef NODRAW - if ((!fullscreen) && (gncmdshow == SW_MAXIMIZE)) - { - RECT rw; - SystemParametersInfo(SPI_GETWORKAREA,0,&rw,0); - xres = rw.right -rw.left; - yres = rw.bottom-rw.top; - } -#endif - - //Enable this for smooth start-up, but beware: it halts disk caches! - //HANDLE hProc = GetCurrentProcess(); - //SetPriorityClass(hProc,REALTIME_PRIORITY_CLASS); - -#ifndef NODRAW - if (!initdirectdraw(xres,yres,colbits)) { DestroyWindow(ghwnd); return(0); } -#endif -#if 0 //defined(_DEBUG) && !defined(NODRAW) - debugdirectdraw(); // enable debug mode by default -#endif - -#ifndef NOSOUND -#ifdef DSOUNDINITCOM - coinit = CoInitialize(NULL); -#endif - initdirectsound(); -#endif - - UpdateWindow(ghwnd); - -#ifndef NOINPUT - if (!initdirectinput(ghwnd)) - { - DestroyWindow(ghwnd); -#ifndef NOSOUND - uninitdirectsound(); -#endif -#ifndef NODRAW - uninitdirectdraw(); -#endif - return(0); - } - if (!initkeyboard(ghwnd)) - { - uninitdirectinput(); DestroyWindow(ghwnd); -#ifndef NOSOUND - uninitdirectsound(); -#endif -#ifndef NODRAW - uninitdirectdraw(); -#endif - return(0); - } - if (!initmouse(ghwnd)) - { - uninitkeyboard(); uninitdirectinput(); DestroyWindow(ghwnd); -#ifndef NOSOUND - uninitdirectsound(); -#endif -#ifndef NODRAW - uninitdirectdraw(); -#endif - return(0); - } -#endif - -#if ((USEKENSOUND == 1) && (USETHREADS != 0)) - if (dsound) - { - hmutx = CreateMutex(0,0,0); - _beginthread(kensoundthread,0,0); - } -#endif - - initapp2(); - - breath(); - while (!quitprogram) - { - if (alwaysactive || ActiveApp) { fpuinit(0x2); doframe(); } - else WaitMessage(); - breath(); - } -#if ((USEKENSOUND == 1) && (USETHREADS != 0)) - if (dsound) - { - while (quitprogram != 2) Sleep(USETHREADS); - ENTERMUTX; - CloseHandle(hmutx); - } -#endif -#ifndef NOSOUND -#ifdef DSOUNDINITCOM - if (coinit == S_OK) CoUninitialize(); -#endif -#endif - - MemoryLeakFinder::DumpStatistics(); - - return(quitparam); -} diff --git a/bin/win64/shader.png b/bin/win64/shader.png Binary files differdeleted file mode 100644 index 4815bca..0000000 --- a/bin/win64/shader.png +++ /dev/null diff --git a/build/Asura.Editor/Asura.Editor.vcxproj b/build/Asura.Editor/Asura.Editor.vcxproj index 72dc736..b2168db 100644 --- a/build/Asura.Editor/Asura.Editor.vcxproj +++ b/build/Asura.Editor/Asura.Editor.vcxproj @@ -117,47 +117,51 @@ </Link> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="..\..\source\Asura.Editor\controls\button.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\controls\content.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\controls\label.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\controls\toggle.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\controls\panel.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\editor.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\graphics\brush.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\graphics\drawer.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\graphics\draw_info.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\graphics\slider.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\graphics\style.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\graphics\pen.cpp" /> - <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\system\file_watcher.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\system\editor_window.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUIButton.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUIContent.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUILabel.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUIPanel.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUISlider.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUIToggle.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Controls\TextUtil.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Editor.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Graphics\Brush.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Graphics\Drawer.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Graphics\DrawInfo.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Graphics\Pen.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Graphics\Style.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Layout\HorizontalLayout.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Layout\VerticalLayout.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Main.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\System\ContainerWindow.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\System\FileWatcher.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\System\MenuController.cpp" /> </ItemGroup> <ItemGroup> - <ClInclude Include="..\..\source\Asura.Editor\config.h" /> - <ClInclude Include="..\..\source\Asura.Editor\controls\button.h" /> - <ClInclude Include="..\..\source\Asura.Editor\controls\content.h" /> - <ClInclude Include="..\..\source\Asura.Editor\controls\label.h" /> - <ClInclude Include="..\..\source\Asura.Editor\controls\toggle.h" /> - <ClInclude Include="..\..\source\Asura.Editor\controls\panel.h" /> - <ClInclude Include="..\..\source\Asura.Editor\core\gui_state.h" /> - <ClInclude Include="..\..\source\Asura.Editor\editor.h" /> - <ClInclude Include="..\..\source\Asura.Editor\graphics\brush.h" /> - <ClInclude Include="..\..\source\Asura.Editor\graphics\drawer.h" /> - <ClInclude Include="..\..\source\Asura.Editor\graphics\draw_info.h" /> - <ClInclude Include="..\..\source\Asura.Editor\graphics\slider.h" /> - <ClInclude Include="..\..\source\Asura.Editor\graphics\style.h" /> - <ClInclude Include="..\..\source\Asura.Editor\graphics\pen.h" /> - <ClInclude Include="..\..\source\Asura.Editor\graphics\shader.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Config.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUIButton.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUIContent.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUILabel.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUIPanel.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUISlider.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUIToggle.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Controls\TextUtil.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Core\GUIState.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Editor.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\Brush.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\Drawer.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\DrawInfo.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\Pen.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\Shader.h" /> <ClInclude Include="..\..\source\Asura.Editor\graphics\shaders\image.shader.h" /> <ClInclude Include="..\..\source\Asura.Editor\graphics\shaders\polygon.shader.h" /> - <ClInclude Include="..\..\source\Asura.Editor\layout\horizontal_layout.h" /> - <ClInclude Include="..\..\source\Asura.Editor\layout\vertical_layout.h" /> - <ClInclude Include="..\..\source\Asura.Editor\system\file_watcher.h" /> - <ClInclude Include="..\..\source\Asura.Editor\system\editor_window.h" /> - <ClInclude Include="..\..\source\Asura.Editor\type.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\Style.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Layout\HorizontalLayout.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Layout\VerticalLayout.h" /> + <ClInclude Include="..\..\source\Asura.Editor\System\ContainerWindow.h" /> + <ClInclude Include="..\..\source\Asura.Editor\System\FileWatcher.h" /> + <ClInclude Include="..\..\source\Asura.Editor\System\MenuController.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Type.h" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/build/Asura.Editor/Asura.Editor.vcxproj.filters b/build/Asura.Editor/Asura.Editor.vcxproj.filters index 0e979a4..a535cb8 100644 --- a/build/Asura.Editor/Asura.Editor.vcxproj.filters +++ b/build/Asura.Editor/Asura.Editor.vcxproj.filters @@ -1,134 +1,149 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> - <Filter Include="layout"> - <UniqueIdentifier>{7654ef3d-54c4-490f-bb24-e6a67bd63e1e}</UniqueIdentifier> + <Filter Include="Controls"> + <UniqueIdentifier>{a4345092-d09c-424c-8d7c-c076914fb6a2}</UniqueIdentifier> </Filter> - <Filter Include="core"> + <Filter Include="Core"> <UniqueIdentifier>{f67906bd-4f7c-4ac6-bca1-019617435a8b}</UniqueIdentifier> </Filter> - <Filter Include="system"> - <UniqueIdentifier>{48600309-cddd-49cd-b939-7a19a2b1eaa3}</UniqueIdentifier> - </Filter> - <Filter Include="graphics"> + <Filter Include="Graphics"> <UniqueIdentifier>{4be8ce5c-0921-4341-a976-92d31aa84c8c}</UniqueIdentifier> </Filter> - <Filter Include="graphics\shaders"> + <Filter Include="Graphics\shaders"> <UniqueIdentifier>{b4c26f9c-9f4e-4332-a6e2-33456b4abecb}</UniqueIdentifier> </Filter> - <Filter Include="controls"> - <UniqueIdentifier>{a236e36b-9b74-48a2-a4c9-f70dbb321f14}</UniqueIdentifier> + <Filter Include="Layout"> + <UniqueIdentifier>{7654ef3d-54c4-490f-bb24-e6a67bd63e1e}</UniqueIdentifier> + </Filter> + <Filter Include="System"> + <UniqueIdentifier>{48600309-cddd-49cd-b939-7a19a2b1eaa3}</UniqueIdentifier> + </Filter> + <Filter Include="Controls\Binding"> + <UniqueIdentifier>{1e378398-d7f0-4616-a986-b6a86faeaa8c}</UniqueIdentifier> </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="..\..\source\Asura.Editor\layout\horizontal_layout.cpp"> - <Filter>layout</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUIButton.cpp"> + <Filter>Controls</Filter> + </ClCompile> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUIContent.cpp"> + <Filter>Controls</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\layout\vertical_layout.cpp"> - <Filter>layout</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUILabel.cpp"> + <Filter>Controls</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\editor.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\main.cpp" /> - <ClCompile Include="..\..\source\Asura.Editor\system\file_watcher.cpp"> - <Filter>system</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUIPanel.cpp"> + <Filter>Controls</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\graphics\drawer.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUIToggle.cpp"> + <Filter>Controls</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\graphics\draw_info.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Graphics\Brush.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\graphics\brush.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Graphics\Drawer.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\graphics\pen.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Graphics\DrawInfo.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\system\editor_window.cpp"> - <Filter>system</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Graphics\Pen.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\graphics\style.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Graphics\Style.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\controls\button.cpp"> - <Filter>controls</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Layout\HorizontalLayout.cpp"> + <Filter>Layout</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\controls\content.cpp"> - <Filter>controls</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Layout\VerticalLayout.cpp"> + <Filter>Layout</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\controls\label.cpp"> - <Filter>controls</Filter> + <ClCompile Include="..\..\source\Asura.Editor\System\FileWatcher.cpp"> + <Filter>System</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\controls\toggle.cpp"> - <Filter>controls</Filter> + <ClCompile Include="..\..\source\Asura.Editor\Editor.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Main.cpp" /> + <ClCompile Include="..\..\source\Asura.Editor\Controls\GUISlider.cpp"> + <Filter>Controls</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\controls\panel.cpp"> - <Filter>controls</Filter> + <ClCompile Include="..\..\source\Asura.Editor\System\MenuController.cpp"> + <Filter>System</Filter> </ClCompile> - <ClCompile Include="..\..\source\Asura.Editor\graphics\slider.cpp"> - <Filter>controls</Filter> + <ClCompile Include="..\..\source\Asura.Editor\System\ContainerWindow.cpp"> + <Filter>System</Filter> + </ClCompile> + <ClCompile Include="..\..\source\Asura.Editor\Controls\TextUtil.cpp"> + <Filter>Controls</Filter> </ClCompile> </ItemGroup> <ItemGroup> - <ClInclude Include="..\..\source\Asura.Editor\layout\horizontal_layout.h"> - <Filter>layout</Filter> + <ClInclude Include="..\..\source\Asura.Editor\graphics\shaders\image.shader.h"> + <Filter>Graphics\shaders</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\layout\vertical_layout.h"> - <Filter>layout</Filter> + <ClInclude Include="..\..\source\Asura.Editor\graphics\shaders\polygon.shader.h"> + <Filter>Graphics\shaders</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\editor.h" /> - <ClInclude Include="..\..\source\Asura.Editor\system\file_watcher.h"> - <Filter>system</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUIButton.h"> + <Filter>Controls</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\config.h" /> - <ClInclude Include="..\..\source\Asura.Editor\type.h" /> - <ClInclude Include="..\..\source\Asura.Editor\graphics\drawer.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUIContent.h"> + <Filter>Controls</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\graphics\shaders\image.shader.h"> - <Filter>graphics\shaders</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUILabel.h"> + <Filter>Controls</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\graphics\shader.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUIPanel.h"> + <Filter>Controls</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\graphics\draw_info.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUIToggle.h"> + <Filter>Controls</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\graphics\brush.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Core\GUIState.h"> + <Filter>Core</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\graphics\pen.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\Brush.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\graphics\shaders\polygon.shader.h"> - <Filter>graphics\shaders</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\Drawer.h"> + <Filter>Graphics</Filter> + </ClInclude> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\DrawInfo.h"> + <Filter>Graphics</Filter> + </ClInclude> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\Pen.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\system\editor_window.h"> - <Filter>system</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\Shader.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\core\gui_state.h"> - <Filter>core</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Graphics\Style.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\graphics\style.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Layout\HorizontalLayout.h"> + <Filter>Layout</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\controls\button.h"> - <Filter>controls</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Layout\VerticalLayout.h"> + <Filter>Layout</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\controls\content.h"> - <Filter>controls</Filter> + <ClInclude Include="..\..\source\Asura.Editor\System\FileWatcher.h"> + <Filter>System</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\controls\label.h"> - <Filter>controls</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Config.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Editor.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Type.h" /> + <ClInclude Include="..\..\source\Asura.Editor\Controls\GUISlider.h"> + <Filter>Controls</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\controls\toggle.h"> - <Filter>controls</Filter> + <ClInclude Include="..\..\source\Asura.Editor\System\MenuController.h"> + <Filter>System</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\controls\panel.h"> - <Filter>controls</Filter> + <ClInclude Include="..\..\source\Asura.Editor\System\ContainerWindow.h"> + <Filter>System</Filter> </ClInclude> - <ClInclude Include="..\..\source\Asura.Editor\graphics\slider.h"> - <Filter>controls</Filter> + <ClInclude Include="..\..\source\Asura.Editor\Controls\TextUtil.h"> + <Filter>Controls</Filter> </ClInclude> </ItemGroup> </Project>
\ No newline at end of file diff --git a/build/Asura.Runner/Asura.Runner.vcxproj b/build/Asura.Runner/Asura.Runner.vcxproj index ecf025b..0c18dc5 100644 --- a/build/Asura.Runner/Asura.Runner.vcxproj +++ b/build/Asura.Runner/Asura.Runner.vcxproj @@ -18,13 +18,6 @@ <Platform>x64</Platform> </ProjectConfiguration> </ItemGroup> - <ItemGroup> - <ClCompile Include="..\..\source\Asura.Runner\main.cpp" /> - <ClCompile Include="..\..\source\Asura.Runner\runner.cpp" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\..\source\Asura.Runner\runner.h" /> - </ItemGroup> <PropertyGroup Label="Globals"> <VCProjectVersion>15.0</VCProjectVersion> <ProjectGuid>{E21A839A-C7C6-4B83-89FB-C921AEBEA9CD}</ProjectGuid> @@ -83,7 +76,6 @@ <Optimization>Disabled</Optimization> <SDLCheck>true</SDLCheck> <ConformanceMode>true</ConformanceMode> - <AdditionalIncludeDirectories>$(SolutionDir)..\source\external;$(SolutionDir)..\source\modules;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> @@ -116,13 +108,14 @@ <IntrinsicFunctions>true</IntrinsicFunctions> <SDLCheck>true</SDLCheck> <ConformanceMode>true</ConformanceMode> - <AdditionalIncludeDirectories>$(SolutionDir)..\source\external;$(SolutionDir)..\source\modules;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> <Link> <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> </Link> </ItemDefinitionGroup> + <ItemGroup> + </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> diff --git a/build/Asura.Runner/Asura.Runner.vcxproj.filters b/build/Asura.Runner/Asura.Runner.vcxproj.filters index 1819f86..3c6f4fd 100644 --- a/build/Asura.Runner/Asura.Runner.vcxproj.filters +++ b/build/Asura.Runner/Asura.Runner.vcxproj.filters @@ -1,10 +1,17 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> - <ClCompile Include="..\..\source\Asura.Runner\main.cpp" /> - <ClCompile Include="..\..\source\Asura.Runner\runner.cpp" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\..\source\Asura.Runner\runner.h" /> + <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/external/Luax/Luax.vcxproj b/build/external/Luax/Luax.vcxproj index b9b130d..4ea48a3 100644 --- a/build/external/Luax/Luax.vcxproj +++ b/build/external/Luax/Luax.vcxproj @@ -154,8 +154,8 @@ </ProjectReference> </ItemGroup> <ItemGroup> - <None Include="..\..\..\Source\external\Luax\luax_class.inl" /> - <None Include="..\..\..\Source\external\Luax\luax_state.inl" /> + <None Include="..\..\..\source\external\Luax\luax_class.inc" /> + <None Include="..\..\..\source\external\Luax\luax_state.inc" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/build/external/Luax/Luax.vcxproj.filters b/build/external/Luax/Luax.vcxproj.filters index afb32e8..9029fa7 100644 --- a/build/external/Luax/Luax.vcxproj.filters +++ b/build/external/Luax/Luax.vcxproj.filters @@ -28,7 +28,7 @@ <ClCompile Include="..\..\..\source\external\Luax\luax_watchdog.cpp" /> </ItemGroup> <ItemGroup> - <None Include="..\..\..\Source\external\Luax\luax_state.inl" /> - <None Include="..\..\..\Source\external\Luax\luax_class.inl" /> + <None Include="..\..\..\source\external\Luax\luax_class.inc" /> + <None Include="..\..\..\source\external\Luax\luax_state.inc" /> </ItemGroup> </Project>
\ No newline at end of file diff --git a/build/modules/asura-base/asura-base.vcxproj b/build/modules/asura-base/asura-base.vcxproj index 970e6b1..f49fccb 100644 --- a/build/modules/asura-base/asura-base.vcxproj +++ b/build/modules/asura-base/asura-base.vcxproj @@ -18,6 +18,9 @@ <Platform>x64</Platform> </ProjectConfiguration> </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\source\modules\asura-base\Config.h" /> + </ItemGroup> <PropertyGroup Label="Globals"> <VCProjectVersion>15.0</VCProjectVersion> <ProjectGuid>{E10B78AA-B90E-4BB7-BAAD-0E2E4C4B9BD1}</ProjectGuid> @@ -119,9 +122,6 @@ <OptimizeReferences>true</OptimizeReferences> </Link> </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="..\..\..\source\modules\asura-base\config.h" /> - </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> diff --git a/build/modules/asura-base/asura-base.vcxproj.filters b/build/modules/asura-base/asura-base.vcxproj.filters index bd24c8d..cae08e9 100644 --- a/build/modules/asura-base/asura-base.vcxproj.filters +++ b/build/modules/asura-base/asura-base.vcxproj.filters @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> - <ClInclude Include="..\..\..\source\modules\asura-base\config.h" /> + <ClInclude Include="..\..\..\source\modules\asura-base\Config.h" /> </ItemGroup> </Project>
\ No newline at end of file diff --git a/build/modules/asura-box2d/asura-box2d.vcxproj b/build/modules/asura-box2d/asura-box2d.vcxproj index 485460a..b41df12 100644 --- a/build/modules/asura-box2d/asura-box2d.vcxproj +++ b/build/modules/asura-box2d/asura-box2d.vcxproj @@ -117,32 +117,32 @@ </Link> </ItemDefinitionGroup> <ItemGroup> - <ClInclude Include="..\..\..\source\modules\asura-box2d\box2d_module.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\body.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\chain_shape.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\circle_shape.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\contact.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\debug_draw.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\distance_joint.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\edge_shape.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\fixture.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\friction_joint.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\gear_joint.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\joint.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\motor_joint.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\mouse_joint.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\polygon_shape.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\prismatic_joint.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\pulley_joint.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\revolute_joint.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\rope_joint.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\shape.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\weld_joint.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\wheel_joint.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\world.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Box2DModule.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\Body.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\ChainShape.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\CircleShape.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\Contact.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\DebugDraw.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\DistanceJoint.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\EdgeShape.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\Fixture.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\FrictionJoint.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\GearJoint.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\Joint.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\MotorJoint.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\MouseJoint.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\PolygonShape.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\PrismaticJoint.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\PulleyJoint.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\RevoluteJoint.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\RopeJoint.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\Shape.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\WeldJoint.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\WheelJoint.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\World.h" /> </ItemGroup> <ItemGroup> - <ClCompile Include="..\..\..\source\modules\asura-box2d\box2d_module.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-box2d\Box2DModule.cpp" /> <ClCompile Include="..\..\..\source\modules\asura-box2d\physics\binding\_body.cpp" /> <ClCompile Include="..\..\..\source\modules\asura-box2d\physics\binding\_world.cpp" /> </ItemGroup> diff --git a/build/modules/asura-box2d/asura-box2d.vcxproj.filters b/build/modules/asura-box2d/asura-box2d.vcxproj.filters index a7a33eb..5415a04 100644 --- a/build/modules/asura-box2d/asura-box2d.vcxproj.filters +++ b/build/modules/asura-box2d/asura-box2d.vcxproj.filters @@ -1,89 +1,89 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> - <ClInclude Include="..\..\..\source\modules\asura-box2d\box2d_module.h" /> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\body.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Box2DModule.h" /> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\Body.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\chain_shape.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\ChainShape.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\circle_shape.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\CircleShape.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\contact.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\Contact.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\debug_draw.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\DebugDraw.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\distance_joint.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\DistanceJoint.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\edge_shape.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\EdgeShape.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\fixture.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\Fixture.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\friction_joint.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\FrictionJoint.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\gear_joint.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\GearJoint.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\joint.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\Joint.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\motor_joint.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\MotorJoint.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\mouse_joint.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\MouseJoint.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\polygon_shape.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\PolygonShape.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\prismatic_joint.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\PrismaticJoint.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\pulley_joint.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\PulleyJoint.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\revolute_joint.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\RevoluteJoint.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\rope_joint.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\RopeJoint.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\shape.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\Shape.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\weld_joint.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\WeldJoint.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\wheel_joint.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\WheelJoint.h"> + <Filter>Physics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-box2d\physics\world.h"> - <Filter>physics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-box2d\Physics\World.h"> + <Filter>Physics</Filter> </ClInclude> </ItemGroup> <ItemGroup> - <Filter Include="physics"> + <Filter Include="Physics"> <UniqueIdentifier>{c01b5c57-f3a7-445f-aed3-e0a27dbe74c2}</UniqueIdentifier> </Filter> - <Filter Include="physics\binding"> + <Filter Include="Physics\binding"> <UniqueIdentifier>{3fb6587c-0c9d-4f6e-9e72-653032d9b238}</UniqueIdentifier> </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="..\..\..\source\modules\asura-box2d\box2d_module.cpp" /> <ClCompile Include="..\..\..\source\modules\asura-box2d\physics\binding\_body.cpp"> - <Filter>physics\binding</Filter> + <Filter>Physics\binding</Filter> </ClCompile> <ClCompile Include="..\..\..\source\modules\asura-box2d\physics\binding\_world.cpp"> - <Filter>physics\binding</Filter> + <Filter>Physics\binding</Filter> </ClCompile> + <ClCompile Include="..\..\..\source\modules\asura-box2d\Box2DModule.cpp" /> </ItemGroup> </Project>
\ No newline at end of file diff --git a/build/modules/asura-core/asura-core.vcxproj b/build/modules/asura-core/asura-core.vcxproj index fcb37c4..a14c816 100644 --- a/build/modules/asura-core/asura-core.vcxproj +++ b/build/modules/asura-core/asura-core.vcxproj @@ -122,11 +122,11 @@ </Link> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="..\..\..\source\modules\asura-core\application.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\core_module.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\font\glyph.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\font\string.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\font\ttf.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Application.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\CoreModule.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Font\Glyph.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Font\String.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Font\TTF.cpp" /> <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_canvas.cpp" /> <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_color.cpp" /> <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_color32.cpp" /> @@ -139,104 +139,102 @@ <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_sprite_batch.cpp" /> <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_texture.cpp" /> <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_vertex_buffer.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\canvas.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\color.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\color32.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\gfx_device.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\image.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\index_buffer.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\matrix_stack.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\mesh2d.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\quad.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\render_target.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\shader.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\shape.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\sprite_batch.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\texture.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\gpu_buffer.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\vertex_buffer.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\Canvas.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\Color.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\Color32.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\DrawInfo.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\GfxDevice.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\GPUBuffer.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\Image.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\IndexBuffer.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\MatrixStack.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\Mesh2D.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\Quad.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\RenderTarget.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\Shader.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\Shape.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\SpriteBatch.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\Texture.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\VertexBuffer.cpp" /> <ClCompile Include="..\..\..\source\modules\asura-core\image\binding\_image_data.cpp" /> <ClCompile Include="..\..\..\source\modules\asura-core\image\binding\_image_decode_task.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\image\image_data.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\image\image_decode_task.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\image\png_decoder.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\image\stb_decoder.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\input\clipboard.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\input\input_device.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\input\input_manager.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\mesh\am2_handler.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\mesh\mesh2d_data.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\mesh\mesh2d_handler.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\mesh\obj_handler.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\profiler\gpu_profiler.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\profiler\stats.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\threading\channel.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\threading\thread_ex.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\time\timer.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Image\ImageData.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Image\ImageDecodeTask.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Image\PngDecoder.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Image\StbDecoder.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Input\ClipBoard.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Input\InputDevice.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Input\InputManager.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Mesh\Am2Handler.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Mesh\Mesh2DData.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Mesh\Mesh2DHandler.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Mesh\ObjHandler.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Profiler\GPUProfiler.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Profiler\Stats.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Threads\Channel.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Threads\ThreadEx.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Time\Timer.cpp" /> <ClCompile Include="..\..\..\source\modules\asura-core\window\binding\_window.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\window\window.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\window\window_impl_glew.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\window\window_impl_glut.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\window\window_impl_sdl.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Window\Window.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Window\WindowImplGlew.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Window\WindowImplSDL.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Window\WinodwImplGlut.cpp" /> </ItemGroup> <ItemGroup> - <ClInclude Include="..\..\..\source\modules\asura-core\application.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\core_config.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\core_module.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\font\glyph.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\font\string.hpp" /> - <ClInclude Include="..\..\..\source\modules\asura-core\font\ttf.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\font\utf.hpp" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\blend_mode.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\canvas.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\color.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\color32.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\color_palette.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\gfx_device.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\image.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\index_buffer.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\matrix_stack.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\mesh2d.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\quad.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\render_state.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\render_target.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\shader.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\shape.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\sprite_batch.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\texture.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\gpu_buffer.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\vertex_buffer.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\image\image_data.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\image\image_decoder.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\image\image_decode_task.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\image\png_decoder.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\image\stb_decoder.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\input\button.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\input\clipboard.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\input\input_device.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\input\input_manager.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\input\joystick_state.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\input\keyboard_state.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\input\mouse_state.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\mesh\am2_handler.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\mesh\mesh2d_data.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\mesh\mesh2d_handler.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\mesh\obj_handler.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\profiler\gpu_profiler.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\profiler\stats.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\threading\channel.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\threading\thread_ex.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\time\timer.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\type.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\window\window.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\window\window_impl_glew.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\window\window_impl_glut.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\window\window_impl_sdl.h" /> - </ItemGroup> - <ItemGroup> - <None Include="..\..\..\source\modules\asura-core\font\string.inl" /> - <None Include="..\..\..\source\modules\asura-core\font\utf.inl" /> - <None Include="..\..\..\source\modules\asura-core\input\keys.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Application.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\CoreConfig.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\CoreModule.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Font\Glyph.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Font\String.hpp" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Font\TTF.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Font\Utf.hpp" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\BlendMode.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\Canvas.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\Color.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\Color32.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\ColorPalette.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\DrawInfo.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\GfxDevice.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\GPUBuffer.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\Image.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\IndexBuffer.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\MatrixStack.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\Mesh2D.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\Quad.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\RenderState.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\RenderTarget.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\Shader.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\Shape.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\SpriteBatch.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\Texture.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\VertexBuffer.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Image\ImageData.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Image\ImageDecoder.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Image\ImageDecodeTask.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Image\PngDecoder.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Image\StbDecoder.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Input\Button.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Input\ClipBoard.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Input\InputDevice.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Input\InputManager.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Input\JoystickState.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Input\KeyboardState.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Input\Keys.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Input\MouseState.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Mesh\Am2Handler.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Mesh\Mesh2DData.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Mesh\Mesh2DHandler.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Mesh\ObjHandler.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Profiler\GPUProfiler.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Profiler\Stats.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Threads\Channel.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Threads\ThreadEx.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Time\Timer.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Type.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Window\Window.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Window\WindowImplGlew.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Window\WindowImplGlut.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Window\WindowImplSDL.h" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\external\glad\glad.vcxproj"> @@ -252,6 +250,10 @@ <Project>{7d41093f-e356-4c5b-a25f-41779bf86e54}</Project> </ProjectReference> </ItemGroup> + <ItemGroup> + <None Include="..\..\..\source\modules\asura-core\Font\String.inc" /> + <None Include="..\..\..\source\modules\asura-core\Font\Utf.inc" /> + </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> diff --git a/build/modules/asura-core/asura-core.vcxproj.filters b/build/modules/asura-core/asura-core.vcxproj.filters index c7b664b..6c45670 100644 --- a/build/modules/asura-core/asura-core.vcxproj.filters +++ b/build/modules/asura-core/asura-core.vcxproj.filters @@ -1,371 +1,377 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> - <Filter Include="graphics"> + <Filter Include="Graphics"> <UniqueIdentifier>{a338aae6-b932-4a59-9a2e-f07283aaea64}</UniqueIdentifier> </Filter> - <Filter Include="input"> - <UniqueIdentifier>{18c6a104-a8f9-4794-80a0-2fe9afdfca3e}</UniqueIdentifier> - </Filter> - <Filter Include="profiler"> - <UniqueIdentifier>{1a6ed8b6-908c-458d-a036-1ff57db1248a}</UniqueIdentifier> + <Filter Include="Graphics\Binding"> + <UniqueIdentifier>{4f6b2c19-1a06-48c9-b89d-52fa27bec5c1}</UniqueIdentifier> </Filter> - <Filter Include="font"> + <Filter Include="Font"> <UniqueIdentifier>{3a06866e-ed35-485f-94a5-548b522fd1f4}</UniqueIdentifier> </Filter> - <Filter Include="time"> - <UniqueIdentifier>{81dedac2-8d27-4c19-bf40-1503f0dbad1b}</UniqueIdentifier> + <Filter Include="Image"> + <UniqueIdentifier>{5061f7d5-03a9-480a-83eb-35d9806abde3}</UniqueIdentifier> </Filter> - <Filter Include="graphics\binding"> - <UniqueIdentifier>{4f6b2c19-1a06-48c9-b89d-52fa27bec5c1}</UniqueIdentifier> + <Filter Include="Image\binding"> + <UniqueIdentifier>{43e14e72-d4cb-47b8-b55c-7327a6fc0508}</UniqueIdentifier> </Filter> - <Filter Include="threading"> - <UniqueIdentifier>{05477a0e-f70b-4606-ae96-82ef7a7b8a1d}</UniqueIdentifier> + <Filter Include="Input"> + <UniqueIdentifier>{18c6a104-a8f9-4794-80a0-2fe9afdfca3e}</UniqueIdentifier> </Filter> - <Filter Include="input\binding"> + <Filter Include="Input\binding"> <UniqueIdentifier>{66e43743-1be3-414a-9f3c-473d40613892}</UniqueIdentifier> </Filter> - <Filter Include="image"> - <UniqueIdentifier>{5061f7d5-03a9-480a-83eb-35d9806abde3}</UniqueIdentifier> - </Filter> - <Filter Include="mesh"> + <Filter Include="Mesh"> <UniqueIdentifier>{0a758ae6-91a0-462a-968f-aa3412a714ae}</UniqueIdentifier> </Filter> - <Filter Include="window"> + <Filter Include="Profiler"> + <UniqueIdentifier>{1a6ed8b6-908c-458d-a036-1ff57db1248a}</UniqueIdentifier> + </Filter> + <Filter Include="Time"> + <UniqueIdentifier>{81dedac2-8d27-4c19-bf40-1503f0dbad1b}</UniqueIdentifier> + </Filter> + <Filter Include="Window"> <UniqueIdentifier>{7a73607c-8da6-4865-a992-5c7c8764bd5a}</UniqueIdentifier> </Filter> - <Filter Include="window\binding"> + <Filter Include="Window\binding"> <UniqueIdentifier>{139aa01b-d038-4361-9edd-f81d8ba37730}</UniqueIdentifier> </Filter> - <Filter Include="image\binding"> - <UniqueIdentifier>{43e14e72-d4cb-47b8-b55c-7327a6fc0508}</UniqueIdentifier> + <Filter Include="Threads"> + <UniqueIdentifier>{05477a0e-f70b-4606-ae96-82ef7a7b8a1d}</UniqueIdentifier> </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="..\..\..\source\modules\asura-core\application.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\canvas.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_canvas.cpp"> + <Filter>Graphics\Binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\color.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_color.cpp"> + <Filter>Graphics\Binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\mesh2d.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_color32.cpp"> + <Filter>Graphics\Binding</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_image.cpp"> + <Filter>Graphics\Binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\quad.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_mesh2d.cpp"> + <Filter>Graphics\Binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\render_target.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_shader.cpp"> + <Filter>Graphics\Binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\shader.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_sprite_batch.cpp"> + <Filter>Graphics\Binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\shape.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_texture.cpp"> + <Filter>Graphics\Binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\sprite_batch.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\window\binding\_window.cpp"> + <Filter>Window\binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\texture.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\image\binding\_image_data.cpp"> + <Filter>Image\binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\font\glyph.cpp"> - <Filter>font</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\image\binding\_image_decode_task.cpp"> + <Filter>Image\binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\font\string.cpp"> - <Filter>font</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_gpu_buffer.cpp"> + <Filter>Graphics\Binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\font\ttf.cpp"> - <Filter>font</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_index_buffer.cpp"> + <Filter>Graphics\Binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\time\timer.cpp"> - <Filter>time</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_vertex_buffer.cpp"> + <Filter>Graphics\Binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\profiler\stats.cpp"> - <Filter>profiler</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_gfx_device.cpp"> + <Filter>Graphics\Binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\core_module.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\color32.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Font\Glyph.cpp"> + <Filter>Font</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_canvas.cpp"> - <Filter>graphics\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Font\String.cpp"> + <Filter>Font</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_color.cpp"> - <Filter>graphics\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Font\TTF.cpp"> + <Filter>Font</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_color32.cpp"> - <Filter>graphics\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\Canvas.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_image.cpp"> - <Filter>graphics\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\Color.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_mesh2d.cpp"> - <Filter>graphics\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\Color32.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_shader.cpp"> - <Filter>graphics\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\GfxDevice.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_sprite_batch.cpp"> - <Filter>graphics\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\GPUBuffer.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\threading\thread_ex.cpp"> - <Filter>threading</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\Image.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\threading\channel.cpp"> - <Filter>threading</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\IndexBuffer.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\image.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\MatrixStack.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_texture.cpp"> - <Filter>graphics\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\Mesh2D.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\input\clipboard.cpp"> - <Filter>input</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\Quad.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\image\image_data.cpp"> - <Filter>image</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\RenderTarget.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\image\image_decode_task.cpp"> - <Filter>image</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\Shader.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\image\png_decoder.cpp"> - <Filter>image</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\Shape.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\image\stb_decoder.cpp"> - <Filter>image</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\SpriteBatch.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\mesh\mesh2d_data.cpp"> - <Filter>mesh</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\Texture.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\window\window.cpp"> - <Filter>window</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\VertexBuffer.cpp"> + <Filter>Graphics</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\window\window_impl_glew.cpp"> - <Filter>window</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Image\ImageData.cpp"> + <Filter>Image</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\window\window_impl_glut.cpp"> - <Filter>window</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Image\ImageDecodeTask.cpp"> + <Filter>Image</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\window\window_impl_sdl.cpp"> - <Filter>window</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Image\PngDecoder.cpp"> + <Filter>Image</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\window\binding\_window.cpp"> - <Filter>window\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Image\StbDecoder.cpp"> + <Filter>Image</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\image\binding\_image_data.cpp"> - <Filter>image\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Input\ClipBoard.cpp"> + <Filter>Input</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\image\binding\_image_decode_task.cpp"> - <Filter>image\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Input\InputDevice.cpp"> + <Filter>Input</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\matrix_stack.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Input\InputManager.cpp"> + <Filter>Input</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\gpu_buffer.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Mesh\Am2Handler.cpp"> + <Filter>Mesh</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\mesh\mesh2d_handler.cpp"> - <Filter>mesh</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Mesh\Mesh2DData.cpp"> + <Filter>Mesh</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\mesh\am2_handler.cpp"> - <Filter>mesh</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Mesh\Mesh2DHandler.cpp"> + <Filter>Mesh</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\mesh\obj_handler.cpp"> - <Filter>mesh</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Mesh\ObjHandler.cpp"> + <Filter>Mesh</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_gpu_buffer.cpp"> - <Filter>graphics\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Profiler\GPUProfiler.cpp"> + <Filter>Profiler</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\index_buffer.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Profiler\Stats.cpp"> + <Filter>Profiler</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\vertex_buffer.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Time\Timer.cpp"> + <Filter>Time</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_index_buffer.cpp"> - <Filter>graphics\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Window\Window.cpp"> + <Filter>Window</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_vertex_buffer.cpp"> - <Filter>graphics\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Window\WindowImplGlew.cpp"> + <Filter>Window</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\gfx_device.cpp"> - <Filter>graphics</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Window\WindowImplSDL.cpp"> + <Filter>Window</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\graphics\binding\_gfx_device.cpp"> - <Filter>graphics\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Window\WinodwImplGlut.cpp"> + <Filter>Window</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\profiler\gpu_profiler.cpp"> - <Filter>profiler</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Application.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\CoreModule.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-core\Threads\Channel.cpp"> + <Filter>Threads</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\input\input_device.cpp"> - <Filter>input</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Threads\ThreadEx.cpp"> + <Filter>Threads</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-core\input\input_manager.cpp"> - <Filter>input</Filter> + <ClCompile Include="..\..\..\source\modules\asura-core\Graphics\DrawInfo.cpp"> + <Filter>Graphics</Filter> </ClCompile> </ItemGroup> <ItemGroup> - <ClInclude Include="..\..\..\source\modules\asura-core\application.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\blend_mode.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Font\Glyph.h"> + <Filter>Font</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\canvas.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Font\String.hpp"> + <Filter>Font</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\color.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Font\TTF.h"> + <Filter>Font</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\color_palette.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\BlendMode.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\mesh2d.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\Canvas.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\quad.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\Color.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\render_state.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\Color32.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\render_target.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\ColorPalette.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\shader.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\GfxDevice.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\shape.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\GPUBuffer.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\sprite_batch.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\Image.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\texture.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\IndexBuffer.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\font\glyph.h"> - <Filter>font</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\MatrixStack.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\font\string.hpp"> - <Filter>font</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\Mesh2D.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\font\ttf.h"> - <Filter>font</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\Quad.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\font\utf.hpp"> - <Filter>font</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\RenderState.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\time\timer.h"> - <Filter>time</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\RenderTarget.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\profiler\stats.h"> - <Filter>profiler</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\Shader.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\core_module.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\type.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\core_config.h" /> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\color32.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\Shape.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\threading\thread_ex.h"> - <Filter>threading</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\SpriteBatch.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\threading\channel.h"> - <Filter>threading</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\Texture.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\image.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\VertexBuffer.h"> + <Filter>Graphics</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\input\clipboard.h"> - <Filter>input</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Image\ImageData.h"> + <Filter>Image</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\image\image_decoder.h"> - <Filter>image</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Image\ImageDecoder.h"> + <Filter>Image</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\image\image_data.h"> - <Filter>image</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Image\ImageDecodeTask.h"> + <Filter>Image</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\image\image_decode_task.h"> - <Filter>image</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Image\PngDecoder.h"> + <Filter>Image</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\image\png_decoder.h"> - <Filter>image</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Image\StbDecoder.h"> + <Filter>Image</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\image\stb_decoder.h"> - <Filter>image</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Input\Button.h"> + <Filter>Input</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\mesh\mesh2d_data.h"> - <Filter>mesh</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Input\ClipBoard.h"> + <Filter>Input</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\window\window.h"> - <Filter>window</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Input\InputDevice.h"> + <Filter>Input</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\window\window_impl_glew.h"> - <Filter>window</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Input\InputManager.h"> + <Filter>Input</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\window\window_impl_glut.h"> - <Filter>window</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Input\JoystickState.h"> + <Filter>Input</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\window\window_impl_sdl.h"> - <Filter>window</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Input\KeyboardState.h"> + <Filter>Input</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\matrix_stack.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Input\Keys.h"> + <Filter>Input</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\gpu_buffer.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Input\MouseState.h"> + <Filter>Input</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\mesh\mesh2d_handler.h"> - <Filter>mesh</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Mesh\Am2Handler.h"> + <Filter>Mesh</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\mesh\am2_handler.h"> - <Filter>mesh</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Mesh\Mesh2DData.h"> + <Filter>Mesh</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\mesh\obj_handler.h"> - <Filter>mesh</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Mesh\Mesh2DHandler.h"> + <Filter>Mesh</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\index_buffer.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Mesh\ObjHandler.h"> + <Filter>Mesh</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\vertex_buffer.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Profiler\GPUProfiler.h"> + <Filter>Profiler</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\graphics\gfx_device.h"> - <Filter>graphics</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Profiler\Stats.h"> + <Filter>Profiler</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\profiler\gpu_profiler.h"> - <Filter>profiler</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Time\Timer.h"> + <Filter>Time</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\input\input_manager.h"> - <Filter>input</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Window\Window.h"> + <Filter>Window</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\input\input_device.h"> - <Filter>input</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Window\WindowImplGlew.h"> + <Filter>Window</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\input\joystick_state.h"> - <Filter>input</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Window\WindowImplGlut.h"> + <Filter>Window</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\input\keyboard_state.h"> - <Filter>input</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Window\WindowImplSDL.h"> + <Filter>Window</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\input\mouse_state.h"> - <Filter>input</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Application.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\CoreConfig.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\CoreModule.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Type.h" /> + <ClInclude Include="..\..\..\source\modules\asura-core\Threads\Channel.h"> + <Filter>Threads</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-core\input\button.h"> - <Filter>input</Filter> + <ClInclude Include="..\..\..\source\modules\asura-core\Threads\ThreadEx.h"> + <Filter>Threads</Filter> + </ClInclude> + <ClInclude Include="..\..\..\source\modules\asura-core\Font\Utf.hpp"> + <Filter>Font</Filter> + </ClInclude> + <ClInclude Include="..\..\..\source\modules\asura-core\Graphics\DrawInfo.h"> + <Filter>Graphics</Filter> </ClInclude> </ItemGroup> <ItemGroup> - <None Include="..\..\..\source\modules\asura-core\font\string.inl"> - <Filter>font</Filter> - </None> - <None Include="..\..\..\source\modules\asura-core\font\utf.inl"> - <Filter>font</Filter> + <None Include="..\..\..\source\modules\asura-core\Font\String.inc"> + <Filter>Font</Filter> </None> - <None Include="..\..\..\source\modules\asura-core\input\keys.h"> - <Filter>input</Filter> + <None Include="..\..\..\source\modules\asura-core\Font\Utf.inc"> + <Filter>Font</Filter> </None> </ItemGroup> </Project>
\ No newline at end of file diff --git a/build/modules/asura-fmod/asura-fmod.vcxproj b/build/modules/asura-fmod/asura-fmod.vcxproj index a12412a..3852905 100644 --- a/build/modules/asura-fmod/asura-fmod.vcxproj +++ b/build/modules/asura-fmod/asura-fmod.vcxproj @@ -18,6 +18,10 @@ <Platform>x64</Platform> </ProjectConfiguration> </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\source\modules\asura-fmod\Audio\Source.h" /> + <ClInclude Include="..\..\..\source\modules\asura-fmod\FMODModule.h" /> + </ItemGroup> <PropertyGroup Label="Globals"> <VCProjectVersion>15.0</VCProjectVersion> <ProjectGuid>{CC451230-39E1-403A-8E1F-C3E7982049E5}</ProjectGuid> @@ -114,10 +118,6 @@ <OptimizeReferences>true</OptimizeReferences> </Link> </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="..\..\..\source\modules\asura-fmod\audio\source.h" /> - <ClInclude Include="..\..\..\source\modules\asura-fmod\fmod_module.h" /> - </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> diff --git a/build/modules/asura-fmod/asura-fmod.vcxproj.filters b/build/modules/asura-fmod/asura-fmod.vcxproj.filters index fbde100..66b3669 100644 --- a/build/modules/asura-fmod/asura-fmod.vcxproj.filters +++ b/build/modules/asura-fmod/asura-fmod.vcxproj.filters @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> - <Filter Include="audio"> + <Filter Include="Audio"> <UniqueIdentifier>{f6eae779-a9f2-4f5f-a62b-5d0fbf4cdc1b}</UniqueIdentifier> </Filter> </ItemGroup> <ItemGroup> - <ClInclude Include="..\..\..\source\modules\asura-fmod\audio\source.h"> - <Filter>audio</Filter> + <ClInclude Include="..\..\..\source\modules\asura-fmod\Audio\Source.h"> + <Filter>Audio</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-fmod\fmod_module.h" /> + <ClInclude Include="..\..\..\source\modules\asura-fmod\FMODModule.h" /> </ItemGroup> </Project>
\ No newline at end of file diff --git a/build/modules/asura-json/asura-json.vcxproj b/build/modules/asura-json/asura-json.vcxproj index 56a807b..64af220 100644 --- a/build/modules/asura-json/asura-json.vcxproj +++ b/build/modules/asura-json/asura-json.vcxproj @@ -18,6 +18,14 @@ <Platform>x64</Platform> </ProjectConfiguration> </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\source\modules\asura-json\JsonModule.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-json\Json\Json.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\source\modules\asura-json\JsonModule.h" /> + <ClInclude Include="..\..\..\source\modules\asura-json\Json\Json.h" /> + </ItemGroup> <PropertyGroup Label="Globals"> <VCProjectVersion>15.0</VCProjectVersion> <ProjectGuid>{1B83A353-9694-42E0-997E-79E150E1C2E5}</ProjectGuid> @@ -116,14 +124,6 @@ <OptimizeReferences>true</OptimizeReferences> </Link> </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="..\..\..\source\modules\asura-json\json\json.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-json\json_module.cpp" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\..\..\source\modules\asura-json\json\json.h" /> - <ClInclude Include="..\..\..\source\modules\asura-json\json_module.h" /> - </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> diff --git a/build/modules/asura-json/asura-json.vcxproj.filters b/build/modules/asura-json/asura-json.vcxproj.filters index 97944e6..7f255cb 100644 --- a/build/modules/asura-json/asura-json.vcxproj.filters +++ b/build/modules/asura-json/asura-json.vcxproj.filters @@ -1,20 +1,20 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> - <ClCompile Include="..\..\..\source\modules\asura-json\json_module.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-json\json\json.cpp"> - <Filter>json</Filter> - </ClCompile> + <Filter Include="Json"> + <UniqueIdentifier>{2884af6d-6bc5-4714-8b32-32edd8099000}</UniqueIdentifier> + </Filter> </ItemGroup> <ItemGroup> - <ClInclude Include="..\..\..\source\modules\asura-json\json_module.h" /> - <ClInclude Include="..\..\..\source\modules\asura-json\json\json.h"> - <Filter>json</Filter> - </ClInclude> + <ClCompile Include="..\..\..\source\modules\asura-json\Json\Json.cpp"> + <Filter>Json</Filter> + </ClCompile> + <ClCompile Include="..\..\..\source\modules\asura-json\JsonModule.cpp" /> </ItemGroup> <ItemGroup> - <Filter Include="json"> - <UniqueIdentifier>{2884af6d-6bc5-4714-8b32-32edd8099000}</UniqueIdentifier> - </Filter> + <ClInclude Include="..\..\..\source\modules\asura-json\Json\Json.h"> + <Filter>Json</Filter> + </ClInclude> + <ClInclude Include="..\..\..\source\modules\asura-json\JsonModule.h" /> </ItemGroup> </Project>
\ No newline at end of file diff --git a/build/modules/asura-log/asura-log.vcxproj.filters b/build/modules/asura-log/asura-log.vcxproj.filters index 3c6f4fd..9cd8510 100644 --- a/build/modules/asura-log/asura-log.vcxproj.filters +++ b/build/modules/asura-log/asura-log.vcxproj.filters @@ -1,17 +1,2 @@ <?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 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
\ No newline at end of file diff --git a/build/modules/asura-network/asura-network.vcxproj b/build/modules/asura-network/asura-network.vcxproj index 198777e..f18b768 100644 --- a/build/modules/asura-network/asura-network.vcxproj +++ b/build/modules/asura-network/asura-network.vcxproj @@ -19,7 +19,7 @@ </ProjectConfiguration> </ItemGroup> <ItemGroup> - <ClInclude Include="..\..\..\source\modules\asura-network\network_module.h" /> + <ClInclude Include="..\..\..\source\modules\asura-network\NetworkModule.h" /> </ItemGroup> <PropertyGroup Label="Globals"> <VCProjectVersion>15.0</VCProjectVersion> diff --git a/build/modules/asura-network/asura-network.vcxproj.filters b/build/modules/asura-network/asura-network.vcxproj.filters index a475832..67825d4 100644 --- a/build/modules/asura-network/asura-network.vcxproj.filters +++ b/build/modules/asura-network/asura-network.vcxproj.filters @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> - <Filter Include="network"> + <Filter Include="Network"> <UniqueIdentifier>{c48e682b-c747-4a26-aabc-98e5d05c179c}</UniqueIdentifier> </Filter> </ItemGroup> <ItemGroup> - <ClInclude Include="..\..\..\source\modules\asura-network\network_module.h" /> + <ClInclude Include="..\..\..\source\modules\asura-network\NetworkModule.h" /> </ItemGroup> </Project>
\ No newline at end of file diff --git a/build/modules/asura-openal/asura-openal.vcxproj b/build/modules/asura-openal/asura-openal.vcxproj index b96d3c4..5a9ae35 100644 --- a/build/modules/asura-openal/asura-openal.vcxproj +++ b/build/modules/asura-openal/asura-openal.vcxproj @@ -18,6 +18,26 @@ <Platform>x64</Platform> </ProjectConfiguration> </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\source\modules\asura-openal\Audio\Audio.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-openal\Audio\MPG123Decoder.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-openal\Audio\Sound.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-openal\Audio\SoundData.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-openal\Audio\SoundDecoder.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-openal\Audio\SoundDecodeTask.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-openal\Audio\Source.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-openal\Audio\VorbisDecoder.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\source\modules\asura-openal\Audio\Audio.h" /> + <ClInclude Include="..\..\..\source\modules\asura-openal\Audio\MPG123Decoder.h" /> + <ClInclude Include="..\..\..\source\modules\asura-openal\Audio\Sound.h" /> + <ClInclude Include="..\..\..\source\modules\asura-openal\Audio\SoundData.h" /> + <ClInclude Include="..\..\..\source\modules\asura-openal\Audio\SoundDecoder.h" /> + <ClInclude Include="..\..\..\source\modules\asura-openal\Audio\SoundDecodeTask.h" /> + <ClInclude Include="..\..\..\source\modules\asura-openal\Audio\Source.h" /> + <ClInclude Include="..\..\..\source\modules\asura-openal\Audio\VorbisDecoder.h" /> + </ItemGroup> <PropertyGroup Label="Globals"> <VCProjectVersion>15.0</VCProjectVersion> <ProjectGuid>{088C6ABA-26A6-43D1-8492-096EDB65597C}</ProjectGuid> @@ -116,26 +136,6 @@ <OptimizeReferences>true</OptimizeReferences> </Link> </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="..\..\..\source\modules\asura-openal\audio\audio.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-openal\audio\mpg123_decoder.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-openal\audio\sound.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-openal\audio\sound_data.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-openal\audio\sound_decoder.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-openal\audio\sound_decode_task.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-openal\audio\source.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-openal\audio\vorbis_decoder.cpp" /> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\..\..\source\modules\asura-openal\audio\audio.h" /> - <ClInclude Include="..\..\..\source\modules\asura-openal\audio\mpg123_decoder.h" /> - <ClInclude Include="..\..\..\source\modules\asura-openal\audio\sound.h" /> - <ClInclude Include="..\..\..\source\modules\asura-openal\audio\sound_data.h" /> - <ClInclude Include="..\..\..\source\modules\asura-openal\audio\sound_decoder.h" /> - <ClInclude Include="..\..\..\source\modules\asura-openal\audio\sound_decode_task.h" /> - <ClInclude Include="..\..\..\source\modules\asura-openal\audio\source.h" /> - <ClInclude Include="..\..\..\source\modules\asura-openal\audio\vorbis_decoder.h" /> - </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> diff --git a/build/modules/asura-openal/asura-openal.vcxproj.filters b/build/modules/asura-openal/asura-openal.vcxproj.filters index 4a7af79..23e13cd 100644 --- a/build/modules/asura-openal/asura-openal.vcxproj.filters +++ b/build/modules/asura-openal/asura-openal.vcxproj.filters @@ -1,63 +1,63 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> - <ClCompile Include="..\..\..\source\modules\asura-openal\audio\audio.cpp"> - <Filter>audio</Filter> + <Filter Include="Audio"> + <UniqueIdentifier>{35f52c38-26da-43eb-9ca2-8c5d32f38b37}</UniqueIdentifier> + </Filter> + <Filter Include="Audio\binding"> + <UniqueIdentifier>{dbd7324a-d1b4-4370-ba8d-df87b31d984c}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\source\modules\asura-openal\Audio\Audio.cpp"> + <Filter>Audio</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-openal\audio\mpg123_decoder.cpp"> - <Filter>audio</Filter> + <ClCompile Include="..\..\..\source\modules\asura-openal\Audio\MPG123Decoder.cpp"> + <Filter>Audio</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-openal\audio\sound.cpp"> - <Filter>audio</Filter> + <ClCompile Include="..\..\..\source\modules\asura-openal\Audio\Sound.cpp"> + <Filter>Audio</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-openal\audio\sound_data.cpp"> - <Filter>audio</Filter> + <ClCompile Include="..\..\..\source\modules\asura-openal\Audio\SoundData.cpp"> + <Filter>Audio</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-openal\audio\sound_decode_task.cpp"> - <Filter>audio</Filter> + <ClCompile Include="..\..\..\source\modules\asura-openal\Audio\SoundDecoder.cpp"> + <Filter>Audio</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-openal\audio\sound_decoder.cpp"> - <Filter>audio</Filter> + <ClCompile Include="..\..\..\source\modules\asura-openal\Audio\SoundDecodeTask.cpp"> + <Filter>Audio</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-openal\audio\source.cpp"> - <Filter>audio</Filter> + <ClCompile Include="..\..\..\source\modules\asura-openal\Audio\Source.cpp"> + <Filter>Audio</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-openal\audio\vorbis_decoder.cpp"> - <Filter>audio</Filter> + <ClCompile Include="..\..\..\source\modules\asura-openal\Audio\VorbisDecoder.cpp"> + <Filter>Audio</Filter> </ClCompile> </ItemGroup> <ItemGroup> - <ClInclude Include="..\..\..\source\modules\asura-openal\audio\audio.h"> - <Filter>audio</Filter> + <ClInclude Include="..\..\..\source\modules\asura-openal\Audio\Audio.h"> + <Filter>Audio</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-openal\audio\mpg123_decoder.h"> - <Filter>audio</Filter> + <ClInclude Include="..\..\..\source\modules\asura-openal\Audio\MPG123Decoder.h"> + <Filter>Audio</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-openal\audio\sound.h"> - <Filter>audio</Filter> + <ClInclude Include="..\..\..\source\modules\asura-openal\Audio\Sound.h"> + <Filter>Audio</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-openal\audio\sound_data.h"> - <Filter>audio</Filter> + <ClInclude Include="..\..\..\source\modules\asura-openal\Audio\SoundData.h"> + <Filter>Audio</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-openal\audio\sound_decode_task.h"> - <Filter>audio</Filter> + <ClInclude Include="..\..\..\source\modules\asura-openal\Audio\SoundDecoder.h"> + <Filter>Audio</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-openal\audio\sound_decoder.h"> - <Filter>audio</Filter> + <ClInclude Include="..\..\..\source\modules\asura-openal\Audio\SoundDecodeTask.h"> + <Filter>Audio</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-openal\audio\source.h"> - <Filter>audio</Filter> + <ClInclude Include="..\..\..\source\modules\asura-openal\Audio\Source.h"> + <Filter>Audio</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-openal\audio\vorbis_decoder.h"> - <Filter>audio</Filter> + <ClInclude Include="..\..\..\source\modules\asura-openal\Audio\VorbisDecoder.h"> + <Filter>Audio</Filter> </ClInclude> </ItemGroup> - <ItemGroup> - <Filter Include="audio"> - <UniqueIdentifier>{35f52c38-26da-43eb-9ca2-8c5d32f38b37}</UniqueIdentifier> - </Filter> - <Filter Include="audio\binding"> - <UniqueIdentifier>{dbd7324a-d1b4-4370-ba8d-df87b31d984c}</UniqueIdentifier> - </Filter> - </ItemGroup> </Project>
\ No newline at end of file diff --git a/build/modules/asura-plot/asura-plot.vcxproj.filters b/build/modules/asura-plot/asura-plot.vcxproj.filters index 13e717f..b4068b5 100644 --- a/build/modules/asura-plot/asura-plot.vcxproj.filters +++ b/build/modules/asura-plot/asura-plot.vcxproj.filters @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> - <Filter Include="plot"> + <Filter Include="Plot"> <UniqueIdentifier>{0f829a34-bb64-4d78-b97a-32c6679fc43b}</UniqueIdentifier> </Filter> </ItemGroup> diff --git a/build/modules/asura-steam/asura-steam.vcxproj.filters b/build/modules/asura-steam/asura-steam.vcxproj.filters index d48ea8c..aa62925 100644 --- a/build/modules/asura-steam/asura-steam.vcxproj.filters +++ b/build/modules/asura-steam/asura-steam.vcxproj.filters @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> - <Filter Include="steam"> + <Filter Include="Steam"> <UniqueIdentifier>{73580bc7-0dec-4284-a31a-9a84f284326a}</UniqueIdentifier> </Filter> </ItemGroup> diff --git a/build/modules/asura-utils/asura-utils.vcxproj b/build/modules/asura-utils/asura-utils.vcxproj index c84c5a5..f314953 100644 --- a/build/modules/asura-utils/asura-utils.vcxproj +++ b/build/modules/asura-utils/asura-utils.vcxproj @@ -122,89 +122,84 @@ </Link> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="..\..\..\source\modules\asura-utils\exceptions\exception.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\Exceptions\Exception.cpp" /> <ClCompile Include="..\..\..\source\modules\asura-utils\io\binding\_compressor.cpp" /> <ClCompile Include="..\..\..\source\modules\asura-utils\io\binding\_data_buffer.cpp" /> <ClCompile Include="..\..\..\source\modules\asura-utils\io\binding\_file.cpp" /> <ClCompile Include="..\..\..\source\modules\asura-utils\io\binding\_file_data.cpp" /> <ClCompile Include="..\..\..\source\modules\asura-utils\io\binding\_file_system.cpp" /> <ClCompile Include="..\..\..\source\modules\asura-utils\io\binding\_io_task.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\io\compressor.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\io\data_buffer.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\io\file.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\io\file_data.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\io\file_system.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\io\io_batch_task.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\io\io_task.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\math\curve.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\math\functions.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\math\matrix44.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\math\quaternion.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\math\ranged_value.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\math\transform.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\stringmap.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\binding\_coroutine.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\binding\_thread.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\conditional.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\coroutine.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\mutex.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\semaphore.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\thread.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\thread_impl_posix.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\thread_impl_sdl.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\thread_impl_std.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\thread_impl_win32.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\task.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\utils_module.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\IO\Compressor.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\IO\DataBuffer.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\IO\File.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\IO\FileData.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\IO\FileSystem.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\IO\IOBatchTask.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\IO\IOTask.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\Math\Curve.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\Math\Functions.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\Math\Matrix44.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\Math\Quaternion.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\Math\RangedValue.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\Math\Transform.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\StringMap.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\binding\_coroutine.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\binding\_thread.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\Conditional.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\Coroutine.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\Mutex.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\Semaphore.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\Task.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\Thread.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\ThreadImplPosix.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\ThreadImplSDL.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\ThreadImplStd.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\ThreadImplWin32.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\UtilsModule.cpp" /> </ItemGroup> <ItemGroup> - <ClInclude Include="..\..\..\source\modules\asura-utils\classes.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\exceptions\exception.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\io\compressor.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\io\data_buffer.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\io\decoded_data.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\io\file.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\io\file_data.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\io\file_system.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\io\io_batch_task.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\io\io_task.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\io\renewable.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\manager.hpp" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\math\curve.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\math\functions.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\math\matrix44.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\math\quaternion.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\math\ranged_value.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\math\rect.hpp" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\math\transform.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\math\vector2.hpp" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\math\vector3.hpp" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\math\vector4.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\module.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\scripting\portable.hpp" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\singleton.hpp" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\stringmap.hpp" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\conditional.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\coroutine.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\mutex.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\semaphore.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\threadable.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\thread.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\thread_impl_posix.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\thread_impl_sdl.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\thread_impl_std.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\thread_impl_win32.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\task.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\type.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\utils.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\utils_config.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\utils_module.h" /> - </ItemGroup> - <ItemGroup> - <None Include="..\..\..\source\modules\asura-utils\math\rect.inl" /> - <None Include="..\..\..\source\modules\asura-utils\math\vector2.inl" /> - <None Include="..\..\..\source\modules\asura-utils\math\vector3.inl" /> - <None Include="..\..\..\source\modules\asura-utils\math\vector4.inl" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Classes.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Exceptions\Exception.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\IO\Compressor.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\IO\DataBuffer.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\IO\DecodedData.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\IO\File.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\IO\FileData.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\IO\FileSystem.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\IO\IOBatchTask.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\IO\IOTask.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Manager.hpp" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Curve.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Functions.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Matrix44.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Quaternion.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Rand\Rand.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Rand\Random.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\RangedValue.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Rect.hpp" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Transform.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Vector2.hpp" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Vector3.hpp" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Vector4.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Module.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Scripting\Portable.hpp" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Singleton.hpp" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\StringMap.hpp" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\Conditional.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\Coroutine.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\Mutex.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\Semaphore.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\Task.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\Thread.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\Threadable.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\ThreadImplPosix.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\ThreadImplSDL.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\ThreadImplStd.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\ThreadImplWin32.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Type.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Utils.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\UtilsConfig.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\UtilsModule.h" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\external\lua51\lua51.vcxproj"> @@ -217,6 +212,12 @@ <Project>{aee37589-de0d-4139-8bdb-8179fdefb835}</Project> </ProjectReference> </ItemGroup> + <ItemGroup> + <None Include="..\..\..\source\modules\asura-utils\Math\Rect.inc" /> + <None Include="..\..\..\source\modules\asura-utils\Math\Vector2.inc" /> + <None Include="..\..\..\source\modules\asura-utils\Math\Vector3.inc" /> + <None Include="..\..\..\source\modules\asura-utils\Math\Vector4.inc" /> + </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> diff --git a/build/modules/asura-utils/asura-utils.vcxproj.filters b/build/modules/asura-utils/asura-utils.vcxproj.filters index 027855d..1305948 100644 --- a/build/modules/asura-utils/asura-utils.vcxproj.filters +++ b/build/modules/asura-utils/asura-utils.vcxproj.filters @@ -1,245 +1,253 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> - <Filter Include="exceptions"> + <Filter Include="Exceptions"> <UniqueIdentifier>{30702383-d458-4486-8d86-bd98db74d3c8}</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="io"> + <Filter Include="IO"> <UniqueIdentifier>{6eb6ffb5-ecd9-408b-a2f4-c14837822850}</UniqueIdentifier> </Filter> - <Filter Include="io\binding"> + <Filter Include="IO\binding"> <UniqueIdentifier>{b4b078e1-bb8d-4cb3-84b9-963e851be123}</UniqueIdentifier> </Filter> - <Filter Include="threading"> + <Filter Include="Math"> + <UniqueIdentifier>{d46782e8-fa86-46be-8e3e-728d313acfed}</UniqueIdentifier> + </Filter> + <Filter Include="Scripting"> + <UniqueIdentifier>{3a94ee03-c8db-4d2e-b0b6-5f6ba157580d}</UniqueIdentifier> + </Filter> + <Filter Include="Threads"> <UniqueIdentifier>{d617f453-4cd1-451b-801d-2f88d0072303}</UniqueIdentifier> </Filter> - <Filter Include="threading\binding"> + <Filter Include="Threads\binding"> <UniqueIdentifier>{e63982e2-a2ca-4aa2-be11-f98659586c1f}</UniqueIdentifier> </Filter> + <Filter Include="Math\Rand"> + <UniqueIdentifier>{6f471cc5-a89f-4be8-ba69-f04a5dd187f0}</UniqueIdentifier> + </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="..\..\..\source\modules\asura-utils\exceptions\exception.cpp"> - <Filter>exceptions</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\io\binding\_data_buffer.cpp"> + <Filter>IO\binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\math\curve.cpp"> - <Filter>math</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\io\binding\_file_system.cpp"> + <Filter>IO\binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\math\functions.cpp"> - <Filter>math</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\io\binding\_file.cpp"> + <Filter>IO\binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\math\matrix44.cpp"> - <Filter>math</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\io\binding\_file_data.cpp"> + <Filter>IO\binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\math\ranged_value.cpp"> - <Filter>math</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\io\binding\_compressor.cpp"> + <Filter>IO\binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\math\transform.cpp"> - <Filter>math</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\io\binding\_io_task.cpp"> + <Filter>IO\binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\utils_module.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\stringmap.cpp" /> - <ClCompile Include="..\..\..\source\modules\asura-utils\io\binding\_data_buffer.cpp"> - <Filter>io\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\Exceptions\Exception.cpp"> + <Filter>Exceptions</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\io\binding\_file_system.cpp"> - <Filter>io\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\IO\Compressor.cpp"> + <Filter>IO</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\io\data_buffer.cpp"> - <Filter>io</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\IO\DataBuffer.cpp"> + <Filter>IO</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\io\file_system.cpp"> - <Filter>io</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\IO\File.cpp"> + <Filter>IO</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\io\file_data.cpp"> - <Filter>io</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\IO\FileData.cpp"> + <Filter>IO</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\io\file.cpp"> - <Filter>io</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\IO\FileSystem.cpp"> + <Filter>IO</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\io\binding\_file.cpp"> - <Filter>io\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\IO\IOBatchTask.cpp"> + <Filter>IO</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\io\binding\_file_data.cpp"> - <Filter>io\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\IO\IOTask.cpp"> + <Filter>IO</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\io\compressor.cpp"> - <Filter>io</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\Math\Curve.cpp"> + <Filter>Math</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\io\binding\_compressor.cpp"> - <Filter>io\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\Math\Functions.cpp"> + <Filter>Math</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\coroutine.cpp"> - <Filter>threading</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\Math\Matrix44.cpp"> + <Filter>Math</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\thread.cpp"> - <Filter>threading</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\Math\Quaternion.cpp"> + <Filter>Math</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\thread_impl_posix.cpp"> - <Filter>threading</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\Math\RangedValue.cpp"> + <Filter>Math</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\thread_impl_sdl.cpp"> - <Filter>threading</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\Math\Transform.cpp"> + <Filter>Math</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\thread_impl_std.cpp"> - <Filter>threading</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\StringMap.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\UtilsModule.cpp" /> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\binding\_coroutine.cpp"> + <Filter>Threads\binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\thread_impl_win32.cpp"> - <Filter>threading</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\binding\_thread.cpp"> + <Filter>Threads\binding</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\io\io_task.cpp"> - <Filter>io</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\Conditional.cpp"> + <Filter>Threads</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\mutex.cpp"> - <Filter>threading</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\Coroutine.cpp"> + <Filter>Threads</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\binding\_coroutine.cpp"> - <Filter>threading\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\Mutex.cpp"> + <Filter>Threads</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\binding\_thread.cpp"> - <Filter>threading\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\Semaphore.cpp"> + <Filter>Threads</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\io\binding\_io_task.cpp"> - <Filter>io\binding</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\Task.cpp"> + <Filter>Threads</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\math\quaternion.cpp"> - <Filter>math</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\Thread.cpp"> + <Filter>Threads</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\task.cpp"> - <Filter>threading</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\ThreadImplPosix.cpp"> + <Filter>Threads</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\semaphore.cpp"> - <Filter>threading</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\ThreadImplSDL.cpp"> + <Filter>Threads</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\io\io_batch_task.cpp"> - <Filter>io</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\ThreadImplStd.cpp"> + <Filter>Threads</Filter> </ClCompile> - <ClCompile Include="..\..\..\source\modules\asura-utils\threading\conditional.cpp"> - <Filter>threading</Filter> + <ClCompile Include="..\..\..\source\modules\asura-utils\Threads\ThreadImplWin32.cpp"> + <Filter>Threads</Filter> </ClCompile> </ItemGroup> <ItemGroup> - <ClInclude Include="..\..\..\source\modules\asura-utils\exceptions\exception.h"> - <Filter>exceptions</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Exceptions\Exception.h"> + <Filter>Exceptions</Filter> + </ClInclude> + <ClInclude Include="..\..\..\source\modules\asura-utils\IO\Compressor.h"> + <Filter>IO</Filter> + </ClInclude> + <ClInclude Include="..\..\..\source\modules\asura-utils\IO\DataBuffer.h"> + <Filter>IO</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\math\curve.h"> - <Filter>math</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\IO\DecodedData.h"> + <Filter>IO</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\math\functions.h"> - <Filter>math</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\IO\File.h"> + <Filter>IO</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\math\matrix44.h"> - <Filter>math</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\IO\FileData.h"> + <Filter>IO</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\math\ranged_value.h"> - <Filter>math</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\IO\FileSystem.h"> + <Filter>IO</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\math\rect.hpp"> - <Filter>math</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\IO\IOBatchTask.h"> + <Filter>IO</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\math\transform.h"> - <Filter>math</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\IO\IOTask.h"> + <Filter>IO</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\math\vector2.hpp"> - <Filter>math</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Curve.h"> + <Filter>Math</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\math\vector3.hpp"> - <Filter>math</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Functions.h"> + <Filter>Math</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\math\vector4.h"> - <Filter>math</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Matrix44.h"> + <Filter>Math</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\scripting\portable.hpp"> - <Filter>scripting</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Quaternion.h"> + <Filter>Math</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\type.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\utils.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\utils_module.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\module.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\utils_config.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\manager.hpp" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\singleton.hpp" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\stringmap.hpp" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\io\data_buffer.h"> - <Filter>io</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\RangedValue.h"> + <Filter>Math</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\io\decoded_data.h"> - <Filter>io</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Rect.hpp"> + <Filter>Math</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\io\file_system.h"> - <Filter>io</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Transform.h"> + <Filter>Math</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\io\file_data.h"> - <Filter>io</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Vector2.hpp"> + <Filter>Math</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\io\file.h"> - <Filter>io</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Vector3.hpp"> + <Filter>Math</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\io\compressor.h"> - <Filter>io</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Vector4.h"> + <Filter>Math</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\coroutine.h"> - <Filter>threading</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Scripting\Portable.hpp"> + <Filter>Scripting</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\thread.h"> - <Filter>threading</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Classes.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Manager.hpp" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Module.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Singleton.hpp" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\StringMap.hpp" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Utils.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\UtilsConfig.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\UtilsModule.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\Conditional.h"> + <Filter>Threads</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\thread_impl_posix.h"> - <Filter>threading</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\Coroutine.h"> + <Filter>Threads</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\thread_impl_sdl.h"> - <Filter>threading</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\Mutex.h"> + <Filter>Threads</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\thread_impl_std.h"> - <Filter>threading</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\Semaphore.h"> + <Filter>Threads</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\thread_impl_win32.h"> - <Filter>threading</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\Task.h"> + <Filter>Threads</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\io\io_task.h"> - <Filter>io</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\Thread.h"> + <Filter>Threads</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\mutex.h"> - <Filter>threading</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\Threadable.h"> + <Filter>Threads</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\math\quaternion.h"> - <Filter>math</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\ThreadImplPosix.h"> + <Filter>Threads</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\task.h"> - <Filter>threading</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\ThreadImplSDL.h"> + <Filter>Threads</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\semaphore.h"> - <Filter>threading</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\ThreadImplStd.h"> + <Filter>Threads</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\io\io_batch_task.h"> - <Filter>io</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Threads\ThreadImplWin32.h"> + <Filter>Threads</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\threadable.h"> - <Filter>threading</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Rand\Rand.h"> + <Filter>Math\Rand</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\threading\conditional.h"> - <Filter>threading</Filter> + <ClInclude Include="..\..\..\source\modules\asura-utils\Type.h" /> + <ClInclude Include="..\..\..\source\modules\asura-utils\Math\Rand\Random.h"> + <Filter>Math\Rand</Filter> </ClInclude> - <ClInclude Include="..\..\..\source\modules\asura-utils\io\renewable.h" /> - <ClInclude Include="..\..\..\source\modules\asura-utils\classes.h" /> </ItemGroup> <ItemGroup> - <None Include="..\..\..\source\modules\asura-utils\math\rect.inl"> - <Filter>math</Filter> + <None Include="..\..\..\source\modules\asura-utils\Math\Rect.inc"> + <Filter>Math</Filter> </None> - <None Include="..\..\..\source\modules\asura-utils\math\vector2.inl"> - <Filter>math</Filter> + <None Include="..\..\..\source\modules\asura-utils\Math\Vector2.inc"> + <Filter>Math</Filter> </None> - <None Include="..\..\..\source\modules\asura-utils\math\vector3.inl"> - <Filter>math</Filter> + <None Include="..\..\..\source\modules\asura-utils\Math\Vector3.inc"> + <Filter>Math</Filter> </None> - <None Include="..\..\..\source\modules\asura-utils\math\vector4.inl"> - <Filter>math</Filter> + <None Include="..\..\..\source\modules\asura-utils\Math\Vector4.inc"> + <Filter>Math</Filter> </None> </ItemGroup> </Project>
\ No newline at end of file diff --git a/build/modules/asura-xml/asura-xml.vcxproj.filters b/build/modules/asura-xml/asura-xml.vcxproj.filters index d4c889c..d8f61eb 100644 --- a/build/modules/asura-xml/asura-xml.vcxproj.filters +++ b/build/modules/asura-xml/asura-xml.vcxproj.filters @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> - <Filter Include="xml"> + <Filter Include="XML"> <UniqueIdentifier>{d8671556-9eb0-4627-a264-e7b667109bc4}</UniqueIdentifier> </Filter> </ItemGroup> diff --git a/build/tools/bindingGen/obj/Debug/bindingGen.exe b/build/tools/bindingGen/obj/Debug/bindingGen.exe Binary files differindex db18b14..5053131 100644 --- a/build/tools/bindingGen/obj/Debug/bindingGen.exe +++ b/build/tools/bindingGen/obj/Debug/bindingGen.exe diff --git a/bin/win64/05-physfs.exe.lastcodeanalysissucceeded b/source/Asura.Editor/Config.h index e69de29..e69de29 100644 --- a/bin/win64/05-physfs.exe.lastcodeanalysissucceeded +++ b/source/Asura.Editor/Config.h diff --git a/source/Asura.Editor/Controls/GUIButton.cpp b/source/Asura.Editor/Controls/GUIButton.cpp new file mode 100644 index 0000000..f168982 --- /dev/null +++ b/source/Asura.Editor/Controls/GUIButton.cpp @@ -0,0 +1,11 @@ +#include "GUIButton.h" + +namespace_begin(AsuraEditor) + +bool GUIButton() +{ + return false; +} + + +namespace_end diff --git a/source/Asura.Editor/Controls/GUIButton.h b/source/Asura.Editor/Controls/GUIButton.h new file mode 100644 index 0000000..ece60ca --- /dev/null +++ b/source/Asura.Editor/Controls/GUIButton.h @@ -0,0 +1,14 @@ +#ifndef _ASURA_EDITOR_GUI_BUTTON_H_ +#define _ASURA_EDITOR_GUI_BUTTON_H_ + +#include <asura-utils/Classes.h> + +namespace_begin(AsuraEditor) + +bool GUIButton(); + + + +namespace_end + +#endif diff --git a/source/Asura.Editor/controls/button.cpp b/source/Asura.Editor/Controls/GUIContent.cpp index c5741c1..c5741c1 100644 --- a/source/Asura.Editor/controls/button.cpp +++ b/source/Asura.Editor/Controls/GUIContent.cpp diff --git a/source/Asura.Editor/Controls/GUIContent.h b/source/Asura.Editor/Controls/GUIContent.h new file mode 100644 index 0000000..c70a03c --- /dev/null +++ b/source/Asura.Editor/Controls/GUIContent.h @@ -0,0 +1,17 @@ +#ifndef _ASURA_EDITOR_GUI_CONTENT_H_ +#define _ASURA_EDITOR_GUI_CONTENT_H_ + +#include <asura-utils/Classes.h> + +namespace_begin(AsuraEditor) + +/// IMGUI content +class GUIContent +{ + +}; + + +namespace_end + +#endif diff --git a/source/Asura.Editor/controls/content.cpp b/source/Asura.Editor/Controls/GUILabel.cpp index c5741c1..c5741c1 100644 --- a/source/Asura.Editor/controls/content.cpp +++ b/source/Asura.Editor/Controls/GUILabel.cpp diff --git a/source/Asura.Editor/Controls/GUILabel.h b/source/Asura.Editor/Controls/GUILabel.h new file mode 100644 index 0000000..172a329 --- /dev/null +++ b/source/Asura.Editor/Controls/GUILabel.h @@ -0,0 +1,14 @@ +#ifndef _ASURA_EDITOR_GUI_LABEL_H_ +#define _ASURA_EDITOR_GUI_LABEL_H_ + +#include <asura-utils/Classes.h> + +namespace_begin(AsuraEditor) + +bool GUILabel(); + + + +namespace_end + +#endif diff --git a/source/Asura.Editor/controls/toggle.cpp b/source/Asura.Editor/Controls/GUIPanel.cpp index 40d2043..3a78af7 100644 --- a/source/Asura.Editor/controls/toggle.cpp +++ b/source/Asura.Editor/Controls/GUIPanel.cpp @@ -1,8 +1,6 @@ -#include "gui_button.h" +#include "GUIPanel.h" namespace_begin(AsuraEditor) -bool GUIToggle(); - namespace_end diff --git a/source/Asura.Editor/Controls/GUIPanel.h b/source/Asura.Editor/Controls/GUIPanel.h new file mode 100644 index 0000000..6bcd00d --- /dev/null +++ b/source/Asura.Editor/Controls/GUIPanel.h @@ -0,0 +1,16 @@ +#ifndef _ASURA_EDITOR_GUI_PANEL_H_ +#define _ASURA_EDITOR_GUI_PANEL_H_ + +#include <asura-utils/Classes.h> + +namespace_begin(AsuraEditor) + +/// IMGUI panel +class GUIPanel +{ + +}; + +namespace_end + +#endif diff --git a/source/Asura.Editor/controls/label.cpp b/source/Asura.Editor/Controls/GUISlider.cpp index c5741c1..9c20d5f 100644 --- a/source/Asura.Editor/controls/label.cpp +++ b/source/Asura.Editor/Controls/GUISlider.cpp @@ -1,4 +1,4 @@ -#include "gui_button.h" +#include "GUISlider.h" namespace_begin(AsuraEditor) diff --git a/source/Asura.Editor/Controls/GUISlider.h b/source/Asura.Editor/Controls/GUISlider.h new file mode 100644 index 0000000..8d91e85 --- /dev/null +++ b/source/Asura.Editor/Controls/GUISlider.h @@ -0,0 +1,14 @@ +#ifndef _ASURA_EDITOR_GUI_SLIDER_H_ +#define _ASURA_EDITOR_GUI_SLIDER_H_ + +#include <asura-utils/Classes.h> + +namespace_begin(AsuraEditor) + +void GUISlider(); + + +namespace_end + + +#endif diff --git a/source/Asura.Editor/Controls/GUIToggle.cpp b/source/Asura.Editor/Controls/GUIToggle.cpp new file mode 100644 index 0000000..7871098 --- /dev/null +++ b/source/Asura.Editor/Controls/GUIToggle.cpp @@ -0,0 +1 @@ +#include "GUIToggle.h" diff --git a/source/Asura.Editor/Controls/GUIToggle.h b/source/Asura.Editor/Controls/GUIToggle.h new file mode 100644 index 0000000..b26e919 --- /dev/null +++ b/source/Asura.Editor/Controls/GUIToggle.h @@ -0,0 +1,16 @@ +#ifndef _ASURA_EDITOR_GUI_TOGGLE_H_ +#define _ASURA_EDITOR_GUI_TOGGLE_H_ + +#include <asura-utils/Classes.h> + +namespace_begin(AsuraEditor) + +/// Radio button \ toggle button + +bool GUIToggle(); + + + +namespace_end + +#endif diff --git a/bin/win64/Luax.lib.lastcodeanalysissucceeded b/source/Asura.Editor/Controls/TextUtil.cpp index e69de29..e69de29 100644 --- a/bin/win64/Luax.lib.lastcodeanalysissucceeded +++ b/source/Asura.Editor/Controls/TextUtil.cpp diff --git a/source/Asura.Editor/Controls/TextUtil.h b/source/Asura.Editor/Controls/TextUtil.h new file mode 100644 index 0000000..24fb1e1 --- /dev/null +++ b/source/Asura.Editor/Controls/TextUtil.h @@ -0,0 +1,37 @@ +#ifndef _ASURA_EDITOR_TEXTUTIL_H_ +#define _ASURA_EDITOR_TEXTUTIL_H_ + +#include <asura-utils/Classes.h> + +namespace_begin(AsuraEditor) + +enum TextAlignment { + kLeft, + kCenter, + kRight, + kAuto, +}; + +enum TextAnchor { + kUpperLeft, + kUpperCenter, + kUpperRight, + kMiddleLeft, + kMiddleCenter, + kMiddleRight, + kLowerLeft, + kLowerCenter, + kLowerRight, + kDontCare ///< Special case for getting text mesh generators: The anchoring used for the text doesn't modify the size of the generated text, so if you just want to query for it you don't care about anchoring +}; + +enum TextClipping { + /// Text flows freely outside the element. + kOverflow = 0, + /// Text gets clipped to be inside the element. + kClip = 1, +}; + +namespace_end + +#endif
\ No newline at end of file diff --git a/source/Asura.Editor/core/gui_state.h b/source/Asura.Editor/Core/GUIState.h index 9e7e91c..88c9891 100644 --- a/source/Asura.Editor/core/gui_state.h +++ b/source/Asura.Editor/Core/GUIState.h @@ -1,13 +1,23 @@ #ifndef _ASURA_EDITOR_GUI_STATE_H_ #define _ASURA_EDITOR_GUI_STATE_H_ -#include <asura-utils/classes.h> +#include <asura-utils/Classes.h> namespace_begin(AsuraEditor) /// GUI widgets uniqueID +class GUIState +{ +public: + inline int GetDepth() { return m_Depth; }; +private: + + int m_Depth; + bool m_Changed; + +}; namespace_end diff --git a/source/Asura.Editor/Editor.cpp b/source/Asura.Editor/Editor.cpp new file mode 100644 index 0000000..38e7c26 --- /dev/null +++ b/source/Asura.Editor/Editor.cpp @@ -0,0 +1,5 @@ + +int main(int argc, char *argv[]) +{ + +}
\ No newline at end of file diff --git a/source/Asura.Editor/Editor.h b/source/Asura.Editor/Editor.h new file mode 100644 index 0000000..2f5f8ca --- /dev/null +++ b/source/Asura.Editor/Editor.h @@ -0,0 +1,37 @@ +#ifndef _ASURA_EDITOR_H_ +#define _ASURA_EDITOR_H_ + +#include <asura-utils/Scripting/Portable.hpp> + +namespace AsuraEditor +{ + + /// + /// ༭ʵ + /// + class Editor + { + public: + + /// + /// ýlua State + /// + Luax::LuaxState& GetLuaxState(); + + private: + + /// + /// е + /// + Luax::LuaxVM* mEditorVM; + + /// + /// Ϸʱ + /// + Luax::LuaxVM* mRunnerVM; + + }; + +} + +#endif
\ No newline at end of file diff --git a/bin/win64/asura-lib-utils.lib.lastcodeanalysissucceeded b/source/Asura.Editor/Editor/asset_view.lua index e69de29..e69de29 100644 --- a/bin/win64/asura-lib-utils.lib.lastcodeanalysissucceeded +++ b/source/Asura.Editor/Editor/asset_view.lua diff --git a/source/Asura.Editor/graphics/draw_info.cpp b/source/Asura.Editor/Editor/compile.bat index e69de29..e69de29 100644 --- a/source/Asura.Editor/graphics/draw_info.cpp +++ b/source/Asura.Editor/Editor/compile.bat diff --git a/source/Asura.Editor/graphics/slider.cpp b/source/Asura.Editor/Editor/compile.sh index e69de29..e69de29 100644 --- a/source/Asura.Editor/graphics/slider.cpp +++ b/source/Asura.Editor/Editor/compile.sh diff --git a/source/Asura.Editor/layout/horizontal_layout.cpp b/source/Asura.Editor/Editor/idea.txt index e69de29..e69de29 100644 --- a/source/Asura.Editor/layout/horizontal_layout.cpp +++ b/source/Asura.Editor/Editor/idea.txt diff --git a/source/Asura.Editor/Editor/main.lua b/source/Asura.Editor/Editor/main.lua new file mode 100644 index 0000000..76fab7a --- /dev/null +++ b/source/Asura.Editor/Editor/main.lua @@ -0,0 +1,4 @@ + +--༭ +--༭Asura.Editor/scriptsʵ + diff --git a/source/Asura.Editor/Editor/scene_view.lua b/source/Asura.Editor/Editor/scene_view.lua new file mode 100644 index 0000000..b6097f3 --- /dev/null +++ b/source/Asura.Editor/Editor/scene_view.lua @@ -0,0 +1,4 @@ +-- 场景窗口 +local scene = AsuraEditor.Window.New("Window/Scene View") + + diff --git a/source/Asura.Editor/layout/horizontal_layout.h b/source/Asura.Editor/Graphics/Brush.cpp index e69de29..e69de29 100644 --- a/source/Asura.Editor/layout/horizontal_layout.h +++ b/source/Asura.Editor/Graphics/Brush.cpp diff --git a/source/Asura.Editor/Graphics/Brush.h b/source/Asura.Editor/Graphics/Brush.h new file mode 100644 index 0000000..4290926 --- /dev/null +++ b/source/Asura.Editor/Graphics/Brush.h @@ -0,0 +1,20 @@ +#ifndef _ASURA_EDITOR_BRUSH_H_ +#define _ASURA_EDITOR_BRUSH_H_ + +namespace AsuraEditor +{ + namespace Graphics + { + + /// + /// ˢָģʽ + /// + class Brush + { + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/source/Asura.Editor/layout/vertical_layout.cpp b/source/Asura.Editor/Graphics/DrawInfo.cpp index e69de29..e69de29 100644 --- a/source/Asura.Editor/layout/vertical_layout.cpp +++ b/source/Asura.Editor/Graphics/DrawInfo.cpp diff --git a/source/Asura.Editor/Graphics/DrawInfo.h b/source/Asura.Editor/Graphics/DrawInfo.h new file mode 100644 index 0000000..ee38319 --- /dev/null +++ b/source/Asura.Editor/Graphics/DrawInfo.h @@ -0,0 +1,16 @@ +#ifndef _ASURA_EDITOR_DRAW_INFO_H_ +#define _ASURA_EDITOR_DRAW_INFO_H_ + +#include <asura-utils/Classes.h> + +namespace_begin(AsuraEditor) + +class DrawInfo +{ + +}; + + +namespace_end + +#endif
\ No newline at end of file diff --git a/source/Asura.Editor/Graphics/Drawer.cpp b/source/Asura.Editor/Graphics/Drawer.cpp new file mode 100644 index 0000000..6482aeb --- /dev/null +++ b/source/Asura.Editor/Graphics/Drawer.cpp @@ -0,0 +1,16 @@ +#include "Drawer.h" + +using namespace AEGraphics; + +namespace AsuraEditor +{ + namespace Graphics + { + + void Drawer::DrawImage(Image* img) + { + + } + + } +}
\ No newline at end of file diff --git a/source/Asura.Editor/Graphics/Drawer.h b/source/Asura.Editor/Graphics/Drawer.h new file mode 100644 index 0000000..638ce08 --- /dev/null +++ b/source/Asura.Editor/Graphics/Drawer.h @@ -0,0 +1,40 @@ +#ifndef _ASURA_EDITOR_PAINTER_H_ +#define _ASURA_EDITOR_PAINTER_H_ + +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Singleton.hpp> +#include <asura-core/Graphics/Image.h> + +namespace AsuraEditor +{ + namespace Graphics + { + + /// + /// AsuraEngineȾֵĻ滭࣬ڻƿؼ֮֡Բֱ沿ֵȾ + /// ΪȾframeworkʵ֣иijؼȾҪӵpass + /// ༭£Ⱦͱ༭ȾԻࡣ + /// + class Drawer + : public AsuraEngine::Singleton<Drawer> + , public AEScripting::Portable<Drawer> + { + public: + + void DrawLine(int x1, int y1, int x2, int y2); + void DrawImage(AEGraphics::Image* img, int x, int y, float sx, float sy, float r, int ox, int oy); + void DrawTexts(); + void DrawCircle(int x, int y, float d); + void DrawPoint(int x, int y); + void DrawPolyline(); + + private: + + LUAX_DECL_SINGLETON(Drawer); + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/source/Asura.Editor/layout/vertical_layout.h b/source/Asura.Editor/Graphics/Pen.cpp index e69de29..e69de29 100644 --- a/source/Asura.Editor/layout/vertical_layout.h +++ b/source/Asura.Editor/Graphics/Pen.cpp diff --git a/source/Asura.Editor/Graphics/Pen.h b/source/Asura.Editor/Graphics/Pen.h new file mode 100644 index 0000000..b949d14 --- /dev/null +++ b/source/Asura.Editor/Graphics/Pen.h @@ -0,0 +1,7 @@ +#ifndef _ASURA_EDITOR_PEN_H_ +#define _ASURA_EDITOR_PEN_H_ + + + + +#endif
\ No newline at end of file diff --git a/source/Asura.Editor/Graphics/Shader.h b/source/Asura.Editor/Graphics/Shader.h new file mode 100644 index 0000000..a3abec1 --- /dev/null +++ b/source/Asura.Editor/Graphics/Shader.h @@ -0,0 +1,18 @@ +#ifndef _ASURA_EDITOR_SHADER_H_ +#define _ASURA_EDITOR_SHADER_H_ + +namespace AsuraEditor +{ + namespace Graphics + { + + struct ShaderProgram + { + const char* vert; + const char* frag; + }; + + } +} + +#endif
\ No newline at end of file diff --git a/source/Asura.Editor/system/file_watcher.cpp b/source/Asura.Editor/Graphics/Style.cpp index e69de29..e69de29 100644 --- a/source/Asura.Editor/system/file_watcher.cpp +++ b/source/Asura.Editor/Graphics/Style.cpp diff --git a/source/Asura.Editor/Graphics/Style.h b/source/Asura.Editor/Graphics/Style.h new file mode 100644 index 0000000..b6ed2c5 --- /dev/null +++ b/source/Asura.Editor/Graphics/Style.h @@ -0,0 +1,15 @@ +#ifndef _ASURA_EDITOR_GUI_STYLE_H_ +#define _ASURA_EDITOR_GUI_STYLE_H_ + +#include <asura-utils/Classes.h> + +namespace_begin(AsuraEditor) + +class GUIStyle +{ + +}; + +namespace_end + +#endif
\ No newline at end of file diff --git a/source/Asura.Editor/Graphics/shaders/image.shader.h b/source/Asura.Editor/Graphics/shaders/image.shader.h new file mode 100644 index 0000000..cbdd542 --- /dev/null +++ b/source/Asura.Editor/Graphics/shaders/image.shader.h @@ -0,0 +1,35 @@ +#ifndef _ASURA_EDITOR_SHADER_H_ +#include "../shader.h" +#endif + +// +static AsuraEditor::Graphics::ShaderProgram image_shader = +{ +R"( +in vec2 asura_position; +in vec2 asura_texcoord0; + +uniform mat4 asura_model_matrix; +uniform mat4 asura_view_matrix; +uniform mat4 asura_projection_matrix; + +void main() +{ + gl_Position = asura_projection_matrix * asura_view_matrix * asura_model_matrix * vec4(asura_position, 0, 1); + uv = asura_texcoord0; +} + +)", + +R"( +in vec2 uv; + +uniform sampler2D asura_maintex; + +void main() +{ + +} + +)" +};
\ No newline at end of file diff --git a/source/Asura.Editor/Graphics/shaders/polygon.shader.h b/source/Asura.Editor/Graphics/shaders/polygon.shader.h new file mode 100644 index 0000000..a92e9a6 --- /dev/null +++ b/source/Asura.Editor/Graphics/shaders/polygon.shader.h @@ -0,0 +1,29 @@ +#ifndef _ASURA_EDITOR_SHADER_H_ +#include "../shader.h" +#endif + +// +static AsuraEditor::Graphics::ShaderProgram polygon_shader = +{ + R"( +in vec2 position; + +uniform mat4 mvp_matrix; + +void main() +{ + gl_Position = mvp_matrix * vec4(position, 0, 1); +} + +)", + +R"( +uniform vec4 color; + +void main() +{ + gl_FragColor = color; +} + +)" +};
\ No newline at end of file diff --git a/source/modules/asura-box2d/box2d_module.cpp b/source/Asura.Editor/Layout/HorizontalLayout.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-box2d/box2d_module.cpp +++ b/source/Asura.Editor/Layout/HorizontalLayout.cpp diff --git a/source/modules/asura-box2d/physics/circle_shape.h b/source/Asura.Editor/Layout/HorizontalLayout.h index e69de29..e69de29 100644 --- a/source/modules/asura-box2d/physics/circle_shape.h +++ b/source/Asura.Editor/Layout/HorizontalLayout.h diff --git a/source/modules/asura-box2d/physics/distance_joint.h b/source/Asura.Editor/Layout/VerticalLayout.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-box2d/physics/distance_joint.h +++ b/source/Asura.Editor/Layout/VerticalLayout.cpp diff --git a/source/modules/asura-box2d/physics/edge_shape.h b/source/Asura.Editor/Layout/VerticalLayout.h index e69de29..e69de29 100644 --- a/source/modules/asura-box2d/physics/edge_shape.h +++ b/source/Asura.Editor/Layout/VerticalLayout.h diff --git a/source/Asura.Editor/Main.cpp b/source/Asura.Editor/Main.cpp new file mode 100644 index 0000000..207474b --- /dev/null +++ b/source/Asura.Editor/Main.cpp @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2018-2019 AsuraEngine Team + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software m_ust not be m_isrepresented; you m_ust not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions m_ust be plainly m_arked as such, and m_ust not be + * m_isrepresented as being the original software. + * 3. This notice m_ay not be removed or altered from any source distribution. + **/ + +/// +/// ༭ĽͨdirectUIʵ֣Ⱦasura-libϣ¼Ӧͨwin32APIʵ֡ +/// + +int main(int argn, char* args[]) +{ + + + +}
\ No newline at end of file diff --git a/source/modules/asura-box2d/physics/friction_joint.h b/source/Asura.Editor/System/ContainerWindow.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-box2d/physics/friction_joint.h +++ b/source/Asura.Editor/System/ContainerWindow.cpp diff --git a/source/Asura.Editor/System/ContainerWindow.h b/source/Asura.Editor/System/ContainerWindow.h new file mode 100644 index 0000000..ee72b72 --- /dev/null +++ b/source/Asura.Editor/System/ContainerWindow.h @@ -0,0 +1,62 @@ +#ifndef _ASURA_EDITOR_WINDOW_H_ +#define _ASURA_EDITOR_WINDOW_H_ + +#include <windows.h> +#include <string.h> + +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Classes.h> + +#include "../Type.h" + +namespace_begin(AsuraEditor) + +/// +/// ༭ڵnative +/// +class ContainerWindow : public AEScripting::Portable<ContainerWindow> +{ +public: + + enum WindowStyle + { + WINDOW_STYLE_BASIC, ///< + WINDOW_STYLE_TOOL, ///< + WINDOW_STYLE_CONFIRM, ///< ȷϴ + }; + + struct WindowConfig + { + std::string title; ///< + uint x, y; ///< + uint width, height; ///< С + WindowStyle style; ///< + }; + + ContainerWindow(); + ~ContainerWindow(); + + bool Init(WindowConfig& config); + +private: + + ContainerWindow* mParent; + WindowStyle mStyle; + HWND mHWND; + HDC mHDC; + +luaxport: + + LUAX_DECL_FACTORY(ContainerWindow); + + LUAX_DECL_ENUM(WindowStyle); + + LUAX_DECL_METHOD(_New); + LUAX_DECL_METHOD(_Init); + LUAX_DECL_METHOD(_SetPosition); + +}; + +namespace_end + +#endif
\ No newline at end of file diff --git a/source/modules/asura-box2d/physics/gear_joint.h b/source/Asura.Editor/System/FileWatcher.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-box2d/physics/gear_joint.h +++ b/source/Asura.Editor/System/FileWatcher.cpp diff --git a/source/Asura.Editor/system/file_watcher.h b/source/Asura.Editor/System/FileWatcher.h index 43821da..43821da 100644 --- a/source/Asura.Editor/system/file_watcher.h +++ b/source/Asura.Editor/System/FileWatcher.h diff --git a/source/modules/asura-box2d/physics/motor_joint.h b/source/Asura.Editor/System/MenuController.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-box2d/physics/motor_joint.h +++ b/source/Asura.Editor/System/MenuController.cpp diff --git a/source/Asura.Editor/System/MenuController.h b/source/Asura.Editor/System/MenuController.h new file mode 100644 index 0000000..591cbd9 --- /dev/null +++ b/source/Asura.Editor/System/MenuController.h @@ -0,0 +1,15 @@ +#ifndef _ASURA_EDITOR_MENU_CONTROLLER_H_ +#define _ASURA_EDITOR_MENU_CONTROLLER_H_ + +#include <asura-utils/Classes.h> + +namespace_begin(AsuraEditor) + +struct MenuItem; + + + + +namespace_end + +#endif diff --git a/source/Asura.Editor/Type.h b/source/Asura.Editor/Type.h new file mode 100644 index 0000000..f21b376 --- /dev/null +++ b/source/Asura.Editor/Type.h @@ -0,0 +1,30 @@ +#ifndef _ASURA_EDITOR_TYPE_H_ +#define _ASURA_EDITOR_TYPE_H_ + +#include <cstdlib> +#include <stdint.h> + +namespace AsuraEditor +{ + + typedef int8_t int8; + typedef uint8_t uint8; + //typedef uint8 byte; + typedef char byte; + typedef int16_t int16; + typedef uint16_t uint16; + typedef int32_t int32; + typedef uint32_t uint32; + typedef int64_t int64; + typedef uint64_t uint64; + + typedef uint32_t uint; + typedef int32_t sint; + + typedef std::size_t size_t; + + typedef const char cc8; + +} + +#endif
\ No newline at end of file diff --git a/source/Asura.Editor/controls/button.h b/source/Asura.Editor/controls/button.h deleted file mode 100644 index edfa7b7..0000000 --- a/source/Asura.Editor/controls/button.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __ASURA_EDITOR_GUI_BUTTON_H__ -#define __ASURA_EDITOR_GUI_BUTTON_H__ - -#include <asura-utils/classes.h> - -namespace_begin(AsuraEditor) - -bool Button(); - - - -namespace_end - -#endif diff --git a/source/Asura.Editor/controls/content.h b/source/Asura.Editor/controls/content.h deleted file mode 100644 index 230bfa9..0000000 --- a/source/Asura.Editor/controls/content.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __ASURA_EDITOR_GUI_BUTTON_H__ -#define __ASURA_EDITOR_GUI_BUTTON_H__ - -#include <asura-utils/classes.h> - -namespace_begin(AsuraEditor) - -/// IMGUI content -class Content -{ - -}; - - -namespace_end - -#endif diff --git a/source/Asura.Editor/controls/label.h b/source/Asura.Editor/controls/label.h deleted file mode 100644 index 7cc6e3d..0000000 --- a/source/Asura.Editor/controls/label.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __ASURA_EDITOR_GUI_BUTTON_H__ -#define __ASURA_EDITOR_GUI_BUTTON_H__ - -#include <asura-utils/classes.h> - -namespace_begin(AsuraEditor) - -bool Label(); - - - -namespace_end - -#endif diff --git a/source/Asura.Editor/controls/panel.cpp b/source/Asura.Editor/controls/panel.cpp deleted file mode 100644 index 2e6e2cc..0000000 --- a/source/Asura.Editor/controls/panel.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "gui_button.h" - -namespace_begin(AsuraEditor) - -class GUIWindow -{ -public: - - GUIWindow(); - ~GUIWindow(); - -}; - - - -namespace_end diff --git a/source/Asura.Editor/controls/panel.h b/source/Asura.Editor/controls/panel.h deleted file mode 100644 index b485635..0000000 --- a/source/Asura.Editor/controls/panel.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __ASURA_EDITOR_GUI_BUTTON_H__ -#define __ASURA_EDITOR_GUI_BUTTON_H__ - -#include <asura-utils/classes.h> - -namespace_begin(AsuraEditor) - -/// IMGUI panel -class Panel -{ - -}; - -namespace_end - -#endif diff --git a/source/Asura.Editor/controls/toggle.h b/source/Asura.Editor/controls/toggle.h deleted file mode 100644 index 19e9379..0000000 --- a/source/Asura.Editor/controls/toggle.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __ASURA_EDITOR_GUI_BUTTON_H__ -#define __ASURA_EDITOR_GUI_BUTTON_H__ - -#include <asura-utils/classes.h> - -namespace_begin(AsuraEditor) - -bool Toggle(); - - - -namespace_end - -#endif diff --git a/source/Asura.Editor/editor.h b/source/Asura.Editor/editor.h index fbcfb62..2f5f8ca 100644 --- a/source/Asura.Editor/editor.h +++ b/source/Asura.Editor/editor.h @@ -1,7 +1,7 @@ -#ifndef __ASURA_EDITOR_H__ -#define __ASURA_EDITOR_H__ +#ifndef _ASURA_EDITOR_H_ +#define _ASURA_EDITOR_H_ -#include <asura-utils/scripting/portable.hpp> +#include <asura-utils/Scripting/Portable.hpp> namespace AsuraEditor { diff --git a/source/Asura.Editor/graphics/brush.h b/source/Asura.Editor/graphics/brush.h index 5ffdba4..4290926 100644 --- a/source/Asura.Editor/graphics/brush.h +++ b/source/Asura.Editor/graphics/brush.h @@ -1,5 +1,5 @@ -#ifndef __ASURA_EDITOR_BRUSH_H__ -#define __ASURA_EDITOR_BRUSH_H__ +#ifndef _ASURA_EDITOR_BRUSH_H_ +#define _ASURA_EDITOR_BRUSH_H_ namespace AsuraEditor { diff --git a/source/Asura.Editor/graphics/draw_info.h b/source/Asura.Editor/graphics/draw_info.h deleted file mode 100644 index 442b92d..0000000 --- a/source/Asura.Editor/graphics/draw_info.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __ASURA_EDITOR_DRAW_INFO_H__ -#define __ASURA_EDITOR_DRAW_INFO_H__ - -namespace AsuraEditor -{ - namespace Graphics - { - - - - } -} - -#endif
\ No newline at end of file diff --git a/source/Asura.Editor/graphics/drawer.cpp b/source/Asura.Editor/graphics/drawer.cpp index f2fca31..6482aeb 100644 --- a/source/Asura.Editor/graphics/drawer.cpp +++ b/source/Asura.Editor/graphics/drawer.cpp @@ -1,4 +1,4 @@ -#include "drawer.h" +#include "Drawer.h" using namespace AEGraphics; diff --git a/source/Asura.Editor/graphics/drawer.h b/source/Asura.Editor/graphics/drawer.h index 85cc88a..638ce08 100644 --- a/source/Asura.Editor/graphics/drawer.h +++ b/source/Asura.Editor/graphics/drawer.h @@ -1,9 +1,9 @@ -#ifndef __ASURA_EDITOR_PAINTER_H__ -#define __ASURA_EDITOR_PAINTER_H__ +#ifndef _ASURA_EDITOR_PAINTER_H_ +#define _ASURA_EDITOR_PAINTER_H_ -#include <asura-utils/scripting/portable.hpp> -#include <asura-utils/singleton.hpp> -#include <asura-core/graphics/image.h> +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Singleton.hpp> +#include <asura-core/Graphics/Image.h> namespace AsuraEditor { diff --git a/source/Asura.Editor/graphics/pen.h b/source/Asura.Editor/graphics/pen.h index 87a031c..b949d14 100644 --- a/source/Asura.Editor/graphics/pen.h +++ b/source/Asura.Editor/graphics/pen.h @@ -1,20 +1,7 @@ -#ifndef __ASURA_EDITOR_PEN_H__ -#define __ASURA_EDITOR_PEN_H__ +#ifndef _ASURA_EDITOR_PEN_H_ +#define _ASURA_EDITOR_PEN_H_ -namespace AsuraEditor -{ - namespace Graphics - { - /// - /// ʣָƵʽ - /// - class Pen - { - }; - - } -} #endif
\ No newline at end of file diff --git a/source/Asura.Editor/graphics/shader.h b/source/Asura.Editor/graphics/shader.h index 6f5a8cc..a3abec1 100644 --- a/source/Asura.Editor/graphics/shader.h +++ b/source/Asura.Editor/graphics/shader.h @@ -1,5 +1,5 @@ -#ifndef __ASURA_EDITOR_SHADER_H__ -#define __ASURA_EDITOR_SHADER_H__ +#ifndef _ASURA_EDITOR_SHADER_H_ +#define _ASURA_EDITOR_SHADER_H_ namespace AsuraEditor { diff --git a/source/Asura.Editor/graphics/shaders/image.shader.h b/source/Asura.Editor/graphics/shaders/image.shader.h index ee6be43..cbdd542 100644 --- a/source/Asura.Editor/graphics/shaders/image.shader.h +++ b/source/Asura.Editor/graphics/shaders/image.shader.h @@ -1,4 +1,4 @@ -#ifndef __ASURA_EDITOR_SHADER_H__ +#ifndef _ASURA_EDITOR_SHADER_H_ #include "../shader.h" #endif diff --git a/source/Asura.Editor/graphics/shaders/polygon.shader.h b/source/Asura.Editor/graphics/shaders/polygon.shader.h index eed4f5a..a92e9a6 100644 --- a/source/Asura.Editor/graphics/shaders/polygon.shader.h +++ b/source/Asura.Editor/graphics/shaders/polygon.shader.h @@ -1,4 +1,4 @@ -#ifndef __ASURA_EDITOR_SHADER_H__ +#ifndef _ASURA_EDITOR_SHADER_H_ #include "../shader.h" #endif diff --git a/source/Asura.Editor/graphics/slider.h b/source/Asura.Editor/graphics/slider.h deleted file mode 100644 index 28ea77f..0000000 --- a/source/Asura.Editor/graphics/slider.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __ASURA_EDITOR_GUI_SLIDER_H__ -#define __ASURA_EDITOR_GUI_SLIDER_H__ - -#include <asura-utils/classes.h> - -namespace_begin(AsuraEditor) - -void Slider(); - - -namespace_end - - -#endif diff --git a/source/Asura.Editor/graphics/style.h b/source/Asura.Editor/graphics/style.h index fca3c37..b6ed2c5 100644 --- a/source/Asura.Editor/graphics/style.h +++ b/source/Asura.Editor/graphics/style.h @@ -1,11 +1,11 @@ -#ifndef __ASURA_EDITOR_GUI_STYLE_H__ -#define __ASURA_EDITOR_GUI_STYLE_H__ +#ifndef _ASURA_EDITOR_GUI_STYLE_H_ +#define _ASURA_EDITOR_GUI_STYLE_H_ -#include <asura-utils/classes.h> +#include <asura-utils/Classes.h> namespace_begin(AsuraEditor) -class Style +class GUIStyle { }; diff --git a/source/Asura.Editor/main.cpp b/source/Asura.Editor/main.cpp index ed055cf..207474b 100644 --- a/source/Asura.Editor/main.cpp +++ b/source/Asura.Editor/main.cpp @@ -9,13 +9,13 @@ * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * - * 1. The origin of this software must not be misrepresented; you must not + * 1. The origin of this software m_ust not be m_isrepresented; you m_ust not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. + * 2. Altered source versions m_ust be plainly m_arked as such, and m_ust not be + * m_isrepresented as being the original software. + * 3. This notice m_ay not be removed or altered from any source distribution. **/ /// diff --git a/source/Asura.Editor/system/editor_window.cpp b/source/Asura.Editor/system/editor_window.cpp deleted file mode 100644 index 0e2d4f4..0000000 --- a/source/Asura.Editor/system/editor_window.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "editor_window.h" - -namespace AsuraEditor -{ - -} // AsruaEditor
\ No newline at end of file diff --git a/source/Asura.Editor/system/editor_window.h b/source/Asura.Editor/system/editor_window.h deleted file mode 100644 index 50c9cb3..0000000 --- a/source/Asura.Editor/system/editor_window.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef __ASURA_EDITOR_WINDOW_H__ -#define __ASURA_EDITOR_WINDOW_H__ - -#include <windows.h> -#include <string.h> - -#include <asura-utils/scripting/portable.hpp> - -#include "../type.h" - -namespace AsuraEditor -{ - - /// - /// ༭ڵnative - /// - class ContainerWindow : public AEScripting::Portable<ContainerWindow> - { - public: - - enum WindowStyle - { - WINDOW_STYLE_BASIC, ///< - WINDOW_STYLE_TOOL, ///< - WINDOW_STYLE_CONFIRM, ///< ȷϴ - }; - - struct WindowConfig - { - std::string title; ///< - uint x, y; ///< - uint width, height; ///< С - WindowStyle style; ///< - }; - - ContainerWindow(); - ~ContainerWindow(); - - bool Init(WindowConfig& config); - - private: - - ContainerWindow* mParent; - WindowStyle mStyle; - HWND mHWND; - HDC mHDC; - - luaxport: - - LUAX_DECL_FACTORY(ContainerWindow); - - LUAX_DECL_ENUM(WindowStyle); - - LUAX_DECL_METHOD(_New); - LUAX_DECL_METHOD(_Init); - LUAX_DECL_METHOD(_SetPosition); - - }; - -} // AsuraEditor - -#endif
\ No newline at end of file diff --git a/source/Asura.Editor/type.h b/source/Asura.Editor/type.h index d58cf87..f21b376 100644 --- a/source/Asura.Editor/type.h +++ b/source/Asura.Editor/type.h @@ -1,5 +1,5 @@ -#ifndef __ASURA_EDITOR_TYPE_H__ -#define __ASURA_EDITOR_TYPE_H__ +#ifndef _ASURA_EDITOR_TYPE_H_ +#define _ASURA_EDITOR_TYPE_H_ #include <cstdlib> #include <stdint.h> diff --git a/source/external/Luax/luax.h b/source/external/Luax/luax.h index 7a0dcd6..1980f41 100644 --- a/source/external/Luax/luax.h +++ b/source/external/Luax/luax.h @@ -12,7 +12,7 @@ #include "luax_enum.h" #include "luax_class.hpp" #include "luax_memberref.h" -#include "luax_class.inl" -#include "luax_state.inl" +#include "luax_class.inc" +#include "luax_state.inc" #endif
\ No newline at end of file diff --git a/source/external/Luax/luax_class.inl b/source/external/Luax/luax_class.inc index 1d6a89f..1d6a89f 100644 --- a/source/external/Luax/luax_class.inl +++ b/source/external/Luax/luax_class.inc diff --git a/source/external/Luax/luax_state.inl b/source/external/Luax/luax_state.inc index 6671bb5..6671bb5 100644 --- a/source/external/Luax/luax_state.inl +++ b/source/external/Luax/luax_state.inc diff --git a/source/modules/asura-base/Config.h b/source/modules/asura-base/Config.h new file mode 100644 index 0000000..024ac79 --- /dev/null +++ b/source/modules/asura-base/Config.h @@ -0,0 +1,69 @@ +#ifndef __ASURA_BASE_CONFIG_H__ +#define __ASURA_BASE_CONFIG_H__ + +// ڱ༭»Ĵ +#define ASURA_EDITOR 1 + +// ʱеĴ +#define ASURA_RUNTIME 1 + +//--------------------------------------------------------------------------------// + +#ifndef ASSERT +#ifdef NDEBUG +#define ASSERT(x) { false ? (void)(x) : (void)0; } +#else +#ifdef _WIN32 +#define ASURA_DEBUG_BREAK() __debugbreak() +#else +#define ASURA_DEBUG_BREAK() raise(SIGTRAP) +#endif +#define ASSERT(x) do { const volatile bool asura_assert_b____ = !(x); if(asura_assert_b____) ASURA_DEBUG_BREAK(); } while (false) +#endif +#endif + +//--------------------------------------------------------------------------------// + +#ifdef _WIN32 + #define ASURA_FINAL final + #define ASURA_EXPORT __declspec(dllexport) + #define ASURA_IMPORT __declspec(dllimport) + #define ASURA_FORCE_INLINE __forceinline + #define ASURA_RESTRICT __restrict + #define ASURA_API ASURA_EXPORT + #define ASURA_ATTRIBUTE_USED + #define ASURA_ABSTRACT + #define ASURA_WINDOWS 1 +#else + #define ASURA_FINAL final + #define ASURA_EXPORT __attribute__((visibility("default"))) + #define ASURA_IMPORT + #define ASURA_FORCE_INLINE __attribute__((always_inline)) inline + #define ASURA_RESTRICT __restrict__ + #define ASURA_ATTRIBUTE_USED __attribute__((used)) + #define ASURA_ABSTRACT + #define ASURA_API ASURA_EXPORT +#endif + +/// +/// ƶָȨ +/// +#define ASURA_MOVE + +#define ASURA_DEBUG 0 + +//--------------------------------------------------------------------------------// + +#define ASURA_SDL_HOST 1 + +#define ASURA_LITTLE_ENDIAN 1 + +//--------------------------------------------------------------------------------// +// չؼ + +#define ASURA_THROW(ex) throw(ex) // ʾ׳쳣 + +#define ASURA_OUT +#define ASURA_REF + +#endif
\ No newline at end of file diff --git a/source/modules/asura-box2d/physics/mouse_joint.h b/source/modules/asura-box2d/Box2DModule.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-box2d/physics/mouse_joint.h +++ b/source/modules/asura-box2d/Box2DModule.cpp diff --git a/source/modules/asura-box2d/box2d_module.h b/source/modules/asura-box2d/Box2DModule.h index 052078a..1a00608 100644 --- a/source/modules/asura-box2d/box2d_module.h +++ b/source/modules/asura-box2d/Box2DModule.h @@ -1,7 +1,7 @@ #ifndef __ASURA_BOX2D_MODULE_H__ #define __ASURA_BOX2D_MODULE_H__ -#include <asura-utils/module.h> +#include <asura-utils/Module.h> namespace AsuraEngine { diff --git a/source/modules/asura-box2d/Physics/Body.h b/source/modules/asura-box2d/Physics/Body.h new file mode 100644 index 0000000..e5af76a --- /dev/null +++ b/source/modules/asura-box2d/Physics/Body.h @@ -0,0 +1,67 @@ +#ifndef __ASURA_BOX2D_BODY_H__ +#define __ASURA_BOX2D_BODY_H__ + +#include <Box2D/Box2D.h> + +#include <asura-utils/Scripting/Portable.hpp> + +namespace AsuraEngine +{ + namespace Physics + { + + class World; + class Joint; + + enum BodyType + { + BODY_TYPE_INVALID, + BODY_TYPE_STATIC, + BODY_TYPE_DYNAMIC, + BODY_TYPE_KINEMATIC + }; + + class Body + : public AEScripting::Portable<Body> + { + public: + + private: + + friend class Joint; + + //----------------------------------------------------------------------------// + + LUAX_DECL_FACTORY(Body); + + LUAX_DECL_ENUM(BodyType, 1); + + LUAX_DECL_METHOD(_GetType); + LUAX_DECL_METHOD(_GetX); + LUAX_DECL_METHOD(_GetY); + LUAX_DECL_METHOD(_GetAngle); + LUAX_DECL_METHOD(_GetPosition); + LUAX_DECL_METHOD(_GetLinearVelocity); + LUAX_DECL_METHOD(_GetWorldCenter); + LUAX_DECL_METHOD(_GetLocalCenter); + LUAX_DECL_METHOD(_GetAngularVelocity); + LUAX_DECL_METHOD(_GetMass); + LUAX_DECL_METHOD(_GetInertia); + LUAX_DECL_METHOD(_GetMassData); + LUAX_DECL_METHOD(_GetAngularDamping); + LUAX_DECL_METHOD(_GetLinearDamping); + LUAX_DECL_METHOD(_GetGravityScale); + LUAX_DECL_METHOD(_GetGravityScale); + + //----------------------------------------------------------------------------// + + b2Body *body; + + World* mWorld; + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-box2d/Physics/ChainShape.h b/source/modules/asura-box2d/Physics/ChainShape.h new file mode 100644 index 0000000..2ce19fb --- /dev/null +++ b/source/modules/asura-box2d/Physics/ChainShape.h @@ -0,0 +1,29 @@ +#ifndef __ASURA_CHAIN_SHAPE_H__ +#define __ASURA_CHAIN_SHAPE_H__ + +#include <Box2D/Collision/Shapes/b2ChainShape.h> + +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Classes.h> + +namespace_begin(AsuraEngine) +namespace_begin(Physics) + +class ChainShape + : AEScripting::Portable<ChainShape> +{ +public: + + ChainShape(); + ~ChainShape(); + +private: + + b2ChainShape* mShape; + +}; + +namespace_end +namespace_end + +#endif
\ No newline at end of file diff --git a/source/modules/asura-box2d/physics/polygon_shape.h b/source/modules/asura-box2d/Physics/CircleShape.h index e69de29..e69de29 100644 --- a/source/modules/asura-box2d/physics/polygon_shape.h +++ b/source/modules/asura-box2d/Physics/CircleShape.h diff --git a/source/modules/asura-box2d/physics/prismatic_joint.h b/source/modules/asura-box2d/Physics/Contact.h index e69de29..e69de29 100644 --- a/source/modules/asura-box2d/physics/prismatic_joint.h +++ b/source/modules/asura-box2d/Physics/Contact.h diff --git a/source/modules/asura-box2d/Physics/DebugDraw.h b/source/modules/asura-box2d/Physics/DebugDraw.h new file mode 100644 index 0000000..a92be43 --- /dev/null +++ b/source/modules/asura-box2d/Physics/DebugDraw.h @@ -0,0 +1,9 @@ +#ifndef _ASURA_BOX2D_DEBUG_DRAW_H_ +#define _ASURA_BOX2D_DEBUG_DRAW_H_ + +namespace AsuraEngine +{ + +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-box2d/physics/pulley_joint.h b/source/modules/asura-box2d/Physics/DistanceJoint.h index e69de29..e69de29 100644 --- a/source/modules/asura-box2d/physics/pulley_joint.h +++ b/source/modules/asura-box2d/Physics/DistanceJoint.h diff --git a/source/modules/asura-box2d/physics/revolute_joint.h b/source/modules/asura-box2d/Physics/EdgeShape.h index e69de29..e69de29 100644 --- a/source/modules/asura-box2d/physics/revolute_joint.h +++ b/source/modules/asura-box2d/Physics/EdgeShape.h diff --git a/source/modules/asura-box2d/physics/rope_joint.h b/source/modules/asura-box2d/Physics/Fixture.h index e69de29..e69de29 100644 --- a/source/modules/asura-box2d/physics/rope_joint.h +++ b/source/modules/asura-box2d/Physics/Fixture.h diff --git a/source/modules/asura-box2d/physics/weld_joint.h b/source/modules/asura-box2d/Physics/FrictionJoint.h index e69de29..e69de29 100644 --- a/source/modules/asura-box2d/physics/weld_joint.h +++ b/source/modules/asura-box2d/Physics/FrictionJoint.h diff --git a/source/modules/asura-box2d/physics/wheel_joint.h b/source/modules/asura-box2d/Physics/GearJoint.h index e69de29..e69de29 100644 --- a/source/modules/asura-box2d/physics/wheel_joint.h +++ b/source/modules/asura-box2d/Physics/GearJoint.h diff --git a/source/modules/asura-core/graphics/color_palette.h b/source/modules/asura-box2d/Physics/Joint.h index e69de29..e69de29 100644 --- a/source/modules/asura-core/graphics/color_palette.h +++ b/source/modules/asura-box2d/Physics/Joint.h diff --git a/source/modules/asura-core/graphics/render_target.cpp b/source/modules/asura-box2d/Physics/MotorJoint.h index e69de29..e69de29 100644 --- a/source/modules/asura-core/graphics/render_target.cpp +++ b/source/modules/asura-box2d/Physics/MotorJoint.h diff --git a/source/modules/asura-core/graphics/sprite_batch.cpp b/source/modules/asura-box2d/Physics/MouseJoint.h index e69de29..e69de29 100644 --- a/source/modules/asura-core/graphics/sprite_batch.cpp +++ b/source/modules/asura-box2d/Physics/MouseJoint.h diff --git a/source/modules/asura-core/input/input_device.cpp b/source/modules/asura-box2d/Physics/PolygonShape.h index e69de29..e69de29 100644 --- a/source/modules/asura-core/input/input_device.cpp +++ b/source/modules/asura-box2d/Physics/PolygonShape.h diff --git a/source/modules/asura-core/input/input_manager.cpp b/source/modules/asura-box2d/Physics/PrismaticJoint.h index e69de29..e69de29 100644 --- a/source/modules/asura-core/input/input_manager.cpp +++ b/source/modules/asura-box2d/Physics/PrismaticJoint.h diff --git a/source/modules/asura-core/input/joystick_state.h b/source/modules/asura-box2d/Physics/PulleyJoint.h index e69de29..e69de29 100644 --- a/source/modules/asura-core/input/joystick_state.h +++ b/source/modules/asura-box2d/Physics/PulleyJoint.h diff --git a/source/modules/asura-core/input/mouse_state.h b/source/modules/asura-box2d/Physics/RevoluteJoint.h index e69de29..e69de29 100644 --- a/source/modules/asura-core/input/mouse_state.h +++ b/source/modules/asura-box2d/Physics/RevoluteJoint.h diff --git a/source/modules/asura-core/mesh/mesh2d_data.cpp b/source/modules/asura-box2d/Physics/RopeJoint.h index e69de29..e69de29 100644 --- a/source/modules/asura-core/mesh/mesh2d_data.cpp +++ b/source/modules/asura-box2d/Physics/RopeJoint.h diff --git a/source/modules/asura-core/mesh/mesh2d_handler.cpp b/source/modules/asura-box2d/Physics/Shape.h index e69de29..e69de29 100644 --- a/source/modules/asura-core/mesh/mesh2d_handler.cpp +++ b/source/modules/asura-box2d/Physics/Shape.h diff --git a/source/modules/asura-core/mesh/obj_handler.cpp b/source/modules/asura-box2d/Physics/WeldJoint.h index e69de29..e69de29 100644 --- a/source/modules/asura-core/mesh/obj_handler.cpp +++ b/source/modules/asura-box2d/Physics/WeldJoint.h diff --git a/source/modules/asura-core/mesh/obj_handler.h b/source/modules/asura-box2d/Physics/WheelJoint.h index e69de29..e69de29 100644 --- a/source/modules/asura-core/mesh/obj_handler.h +++ b/source/modules/asura-box2d/Physics/WheelJoint.h diff --git a/source/modules/asura-box2d/Physics/World.h b/source/modules/asura-box2d/Physics/World.h new file mode 100644 index 0000000..b6d00ca --- /dev/null +++ b/source/modules/asura-box2d/Physics/World.h @@ -0,0 +1,19 @@ +#ifndef __ASURA_BOX2D_WORLD_H__ +#define __ASURA_BOX2D_WORLD_H__ + +#include <asura-utils/Scripting/Portable.hpp> + +namespace AsuraEngine +{ + namespace Physics + { + + class World : public AEScripting::Portable<World> + { + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-box2d/Physics/binding/_body.cpp b/source/modules/asura-box2d/Physics/binding/_body.cpp new file mode 100644 index 0000000..0c9e3e8 --- /dev/null +++ b/source/modules/asura-box2d/Physics/binding/_body.cpp @@ -0,0 +1,171 @@ +#include "../Body.h" + +using namespace std; + +namespace AsuraEngine +{ + namespace Physics + { + + LUAX_REGISTRY(Body) + { + LUAX_REGISTER_METHODS(state, + { "GetType", _GetType }, + { "GetX", _GetX }, + { "GetY", _GetY }, + { "GetAngle", _GetAngle }, + { "GetPosition", _GetPosition }, + { "GetLinearVelocity", _GetLinearVelocity }, + { "GetWorldCenter", _GetWorldCenter }, + { "GetLocalCenter", _GetLocalCenter }, + { "GetAngularVelocity", _GetAngularVelocity }, + { "GetMass", _GetMass }, + { "GetInertia", _GetInertia }, + { "GetMassData", _GetMassData }, + { "GetAngularDamping", _GetAngularDamping }, + { "GetLinearDamping", _GetLinearDamping }, + { "GetGravityScale", _GetGravityScale }, + { "GetGravityScale", _GetGravityScale } + ); + } + + LUAX_POSTPROCESS(Body) + { + LUAX_REGISTER_ENUM(state, "EBodyType", + { "INVALID", BODY_TYPE_INVALID }, + { "STATIC", BODY_TYPE_STATIC }, + { "DYNAMIC", BODY_TYPE_DYNAMIC }, + { "KINEMATIC", BODY_TYPE_KINEMATIC } + ); + + } + + // body:GetType() + LUAX_IMPL_METHOD(Body, _GetType) + { + LUAX_PREPARE(L, Body); + return 0; + } + + // body:GetX() + LUAX_IMPL_METHOD(Body, _GetX) + { + LUAX_PREPARE(L, Body); + + return 0; + } + + // body:GetY() + LUAX_IMPL_METHOD(Body, _GetY) + { + LUAX_PREPARE(L, Body); + + return 0; + } + + // body:GetAngle() + LUAX_IMPL_METHOD(Body, _GetAngle) + { + LUAX_PREPARE(L, Body); + + return 0; + } + + // body:GetPosition() + LUAX_IMPL_METHOD(Body, _GetPosition) + { + LUAX_PREPARE(L, Body); + + return 0; + } + + // body:GetLinearVelocity() + LUAX_IMPL_METHOD(Body, _GetLinearVelocity) + { + LUAX_PREPARE(L, Body); + + return 0; + } + + // body:GetWorldCenter() + LUAX_IMPL_METHOD(Body, _GetWorldCenter) + { + LUAX_PREPARE(L, Body); + + return 0; + } + + // body:GetLocalCenter() + LUAX_IMPL_METHOD(Body, _GetLocalCenter) + { + LUAX_PREPARE(L, Body); + + return 0; + } + + // body:GetAngularVelocity() + LUAX_IMPL_METHOD(Body, _GetAngularVelocity) + { + LUAX_PREPARE(L, Body); + + return 0; + } + + // body:GetMass() + LUAX_IMPL_METHOD(Body, _GetMass) + { + LUAX_PREPARE(L, Body); + + return 0; + } + + // body:GetInertia() + LUAX_IMPL_METHOD(Body, _GetInertia) + { + LUAX_PREPARE(L, Body); + + return 0; + } + + // body:GetMassData() + LUAX_IMPL_METHOD(Body, _GetMassData) + { + LUAX_PREPARE(L, Body); + + return 0; + } + + // body:GetAngularDamping() + LUAX_IMPL_METHOD(Body, _GetAngularDamping) + { + LUAX_PREPARE(L, Body); + + return 0; + } + + // body:GetLinearDamping() + LUAX_IMPL_METHOD(Body, _GetLinearDamping) + { + LUAX_PREPARE(L, Body); + + return 0; + } + + // body:GetGravityScale() + LUAX_IMPL_METHOD(Body, _GetGravityScale) + { + LUAX_PREPARE(L, Body); + + return 0; + } + + // body:GetGravityScale() + LUAX_IMPL_METHOD(Body, _GetGravityScale) + { + LUAX_PREPARE(L, Body); + + return 0; + } + + } +} diff --git a/source/modules/asura-box2d/Physics/binding/_world.cpp b/source/modules/asura-box2d/Physics/binding/_world.cpp new file mode 100644 index 0000000..0940959 --- /dev/null +++ b/source/modules/asura-box2d/Physics/binding/_world.cpp @@ -0,0 +1,21 @@ +#include "../World.h" + +using namespace std; + +namespace AsuraEngine +{ + namespace Physics + { + /* + LUAX_REGISTRY(World) + { + + } + + LUAX_POSTPROCESS(World) + { + + } +*/ + } +} diff --git a/source/modules/asura-box2d/physics/binding/_body.cpp b/source/modules/asura-box2d/physics/binding/_body.cpp index 0dbd292..0c9e3e8 100644 --- a/source/modules/asura-box2d/physics/binding/_body.cpp +++ b/source/modules/asura-box2d/physics/binding/_body.cpp @@ -1,4 +1,4 @@ -#include "../body.h" +#include "../Body.h" using namespace std; diff --git a/source/modules/asura-box2d/physics/binding/_world.cpp b/source/modules/asura-box2d/physics/binding/_world.cpp index 1ebcbd1..0940959 100644 --- a/source/modules/asura-box2d/physics/binding/_world.cpp +++ b/source/modules/asura-box2d/physics/binding/_world.cpp @@ -1,4 +1,4 @@ -#include "../world.h" +#include "../World.h" using namespace std; diff --git a/source/modules/asura-box2d/physics/body.h b/source/modules/asura-box2d/physics/body.h index 3a4aa5f..e5af76a 100644 --- a/source/modules/asura-box2d/physics/body.h +++ b/source/modules/asura-box2d/physics/body.h @@ -3,7 +3,7 @@ #include <Box2D/Box2D.h> -#include <asura-utils/scripting/portable.hpp> +#include <asura-utils/Scripting/Portable.hpp> namespace AsuraEngine { diff --git a/source/modules/asura-box2d/physics/chain_shape.h b/source/modules/asura-box2d/physics/chain_shape.h deleted file mode 100644 index dd03ddf..0000000 --- a/source/modules/asura-box2d/physics/chain_shape.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef __ASURA_CHAIN_SHAPE_H__ -#define __ASURA_CHAIN_SHAPE_H__ - -// 3rd-party -#include <Box2D/Collision/Shapes/b2ChainShape.h> - -// asura modules -#include <asura-utils/scripting/portable.hpp> - -namespace AsuraEngine -{ - namespace Physics - { - - class ChainShape - : AEScripting::Portable<ChainShape> - { - public: - - ChainShape(); - ~ChainShape(); - - private: - - b2ChainShape* mShape; - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/source/modules/asura-box2d/physics/debug_draw.h b/source/modules/asura-box2d/physics/debug_draw.h deleted file mode 100644 index cff682b..0000000 --- a/source/modules/asura-box2d/physics/debug_draw.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __ASURA_BOX2D_DEBUG_DRAW_H__ -#define __ASURA_BOX2D_DEBUG_DRAW_H__ - -namespace AsuraEngine -{ - -} - -#endif
\ No newline at end of file diff --git a/source/modules/asura-box2d/physics/world.h b/source/modules/asura-box2d/physics/world.h index 0aac0c8..b6d00ca 100644 --- a/source/modules/asura-box2d/physics/world.h +++ b/source/modules/asura-box2d/physics/world.h @@ -1,7 +1,7 @@ #ifndef __ASURA_BOX2D_WORLD_H__ #define __ASURA_BOX2D_WORLD_H__ -#include <asura-utils/scripting/portable.hpp> +#include <asura-utils/Scripting/Portable.hpp> namespace AsuraEngine { diff --git a/source/modules/asura-core/Application.cpp b/source/modules/asura-core/Application.cpp new file mode 100644 index 0000000..2f20e45 --- /dev/null +++ b/source/modules/asura-core/Application.cpp @@ -0,0 +1,23 @@ +#include "Application.h" + +using namespace Luax; + +namespace AsuraEngine +{ + +Application::Application() +{ + +} + +Application::~Application() +{ + +} + +bool Application::InitSubModules(uint flag) +{ + return false; +} + +}
\ No newline at end of file diff --git a/source/modules/asura-core/Application.h b/source/modules/asura-core/Application.h new file mode 100644 index 0000000..ea5faa7 --- /dev/null +++ b/source/modules/asura-core/Application.h @@ -0,0 +1,81 @@ +#ifndef _ASURA_ENGINE_APPLICATION_H_ +#define _ASURA_ENGINE_APPLICATION_H_ + +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Module.h> +#include <asura-utils/Classes.h> +#include <queue> + +#include "CoreConfig.h" + +namespace_begin(AsuraEngine) + +/// ģ +enum SubModules +{ + ASURA_MODULE_NONE = 0X00000000U, + + ASURA_MODULE_GRAPHICS = 1 << 1, + ASURA_MODULE_AUDIO = 1 << 2, + ASURA_MODULE_FONT = 1 << 3, + ASURA_MODULE_INPUT = 1 << 4, + ASURA_MODULE_MATH = 1 << 5, + ASURA_MODULE_PHYSICS = 1 << 6, + ASURA_MODULE_TIME = 1 << 7, + ASURA_MODULE_WINDOW = 1 << 8, + + ASURA_MODULE_ALL = 0XFFFFFFFFU +}; + +/// +/// ѭ +/// +class Application +{ +public: + + Application(); + + virtual ~Application(); + + /// + /// ʼǰϵͳ + /// + bool InitSubModules(uint flag = ASURA_MODULE_ALL); + + /// + /// + /// + virtual void Run(int argc, char* args[]); + + /// + /// ˳runʱĴ + /// + virtual void OnExit(); + +protected: + + /// + /// moduleapplicationӵmoduleȨ + /// + void EnqueueModule(Module* module); + +private: + + /// + /// ̵߳lua state handleӦѭСһ˵ֻҪ߳һlua_State̲߳Ҫ̼߳ + /// lua̫ʹˡC++дȻעһصһ̴߳lua_Stateעắִк + /// ̵߳lua_Stateֻ֤һnativeʵ֮һlua_State + /// + Luax::LuaxVM* m_VM; + + /// + /// Asura libsᰴն˳ʼ˳ʱִ˳ + /// + std::queue<Module*> m_Modules; + +}; + +namespace_end + +#endif
\ No newline at end of file diff --git a/source/modules/asura-core/core_config.h b/source/modules/asura-core/CoreConfig.h index 8a0e8c7..2dd0b03 100644 --- a/source/modules/asura-core/core_config.h +++ b/source/modules/asura-core/CoreConfig.h @@ -1,5 +1,5 @@ -#ifndef __ASURA_CORE_CONFIG_H__ -#define __ASURA_CORE_CONFIG_H__ +#ifndef _ASURA_CORE_CONFIG_H_ +#define _ASURA_CORE_CONFIG_H_ #define ASURA_WINDOW_SDL 1 diff --git a/source/modules/asura-core/core_module.cpp b/source/modules/asura-core/CoreModule.cpp index e91dd8f..93f8ca0 100644 --- a/source/modules/asura-core/core_module.cpp +++ b/source/modules/asura-core/CoreModule.cpp @@ -1,4 +1,4 @@ -#include "core_module.h" +#include "CoreModule.h" using namespace AEThreading; using namespace AEGraphics; @@ -13,7 +13,7 @@ namespace AsuraEngine LUAX_REGISTER_FACTORY(state, AEGraphics::Image); // Wnd LUAX_REGISTER_SINGLETON(state, AEWindow::Window); - // Threading + // Threads //LUAX_REGISTER_FACTORY(state, ThreadEx); } diff --git a/source/modules/asura-core/CoreModule.h b/source/modules/asura-core/CoreModule.h new file mode 100644 index 0000000..1781885 --- /dev/null +++ b/source/modules/asura-core/CoreModule.h @@ -0,0 +1,26 @@ +#ifndef _ASURA_CORE_MODULE_H_ +#define _ASURA_CORE_MODULE_H_ + +#include <asura-utils/Module.h> +#include <asura-utils/Classes.h> + +#include "graphics/image.h" +#include "graphics/texture.h" +#include "window/window.h" +#include "Threads/ThreadEx.h" + +namespace_begin(AsuraEngine) + +class CoreModule : public Module +{ +public: + + void Initialize(Luax::LuaxState& state) override; + + void Finalize(Luax::LuaxState& state) override; + +}; + +namespace_end + +#endif
\ No newline at end of file diff --git a/source/modules/asura-core/profiler/gpu_profiler.cpp b/source/modules/asura-core/Font/Glyph.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-core/profiler/gpu_profiler.cpp +++ b/source/modules/asura-core/Font/Glyph.cpp diff --git a/source/modules/asura-core/profiler/gpu_profiler.h b/source/modules/asura-core/Font/Glyph.h index e69de29..e69de29 100644 --- a/source/modules/asura-core/profiler/gpu_profiler.h +++ b/source/modules/asura-core/Font/Glyph.h diff --git a/source/modules/asura-core/Font/String.cpp b/source/modules/asura-core/Font/String.cpp new file mode 100644 index 0000000..1731338 --- /dev/null +++ b/source/modules/asura-core/Font/String.cpp @@ -0,0 +1,376 @@ +//#include "String.hpp" +//#include "Utf.hpp" +// +//namespace AsuraEngine +//{ +// namespace Text +// { +// +// +// //////////////////////////////////////////////////////////// +// const std::size_t String::InvalidPos = std::basic_string<uint32>::npos; +// +// +// //////////////////////////////////////////////////////////// +// String::String() +// { +// } +// +// +// //////////////////////////////////////////////////////////// +// String::String(char ansiChar, const std::locale& locale) +// { +// m_String += Utf32::DecodeAnsi(ansiChar, locale); +// } +// +// +// //////////////////////////////////////////////////////////// +// String::String(wchar_t wideChar) +// { +// m_String += Utf32::DecodeWide(wideChar); +// } +// +// +// //////////////////////////////////////////////////////////// +// String::String(uint32 utf32Char) +// { +// m_String += utf32Char; +// } +// +// +// //////////////////////////////////////////////////////////// +// String::String(const char* ansiString, const std::locale& locale) +// { +// if (ansiString) +// { +// std::size_t length = strlen(ansiString); +// if (length > 0) +// { +// m_String.reserve(length + 1); +// Utf32::FromAnsi(ansiString, ansiString + length, std::back_inserter(m_String), locale); +// } +// } +// } +// +// +// //////////////////////////////////////////////////////////// +// String::String(const std::string& ansiString, const std::locale& locale) +// { +// m_String.reserve(ansiString.length() + 1); +// Utf32::FromAnsi(ansiString.begin(), ansiString.end(), std::back_inserter(m_String), locale); +// } +// +// +// //////////////////////////////////////////////////////////// +// String::String(const wchar_t* wideString) +// { +// if (wideString) +// { +// std::size_t length = std::wcslen(wideString); +// if (length > 0) +// { +// m_String.reserve(length + 1); +// Utf32::FromWide(wideString, wideString + length, std::back_inserter(m_String)); +// } +// } +// } +// +// +// //////////////////////////////////////////////////////////// +// String::String(const std::wstring& wideString) +// { +// m_String.reserve(wideString.length() + 1); +// Utf32::FromWide(wideString.begin(), wideString.end(), std::back_inserter(m_String)); +// } +// +// +// //////////////////////////////////////////////////////////// +// String::String(const uint32* utf32String) +// { +// if (utf32String) +// m_String = utf32String; +// } +// +// +// //////////////////////////////////////////////////////////// +// String::String(const std::basic_string<uint32>& utf32String) : +// m_String(utf32String) +// { +// } +// +// +// //////////////////////////////////////////////////////////// +// String::String(const String& copy) : +// m_String(copy.mString) +// { +// } +// +// +// //////////////////////////////////////////////////////////// +// String::operator std::string() const +// { +// return ToAnsiString(); +// } +// +// +// //////////////////////////////////////////////////////////// +// String::operator std::wstring() const +// { +// return ToWideString(); +// } +// +// +// //////////////////////////////////////////////////////////// +// std::string String::ToAnsiString(const std::locale& locale) const +// { +// // Prepare the output string +// std::string output; +// output.reserve(m_String.length() + 1); +// +// // Convert +// Utf32::ToAnsi(m_String.begin(), m_String.end(), std::back_inserter(output), 0, locale); +// +// return output; +// } +// +// +// //////////////////////////////////////////////////////////// +// std::wstring String::ToWideString() const +// { +// // Prepare the output string +// std::wstring output; +// output.reserve(m_String.length() + 1); +// +// // Convert +// Utf32::ToWide(m_String.begin(), m_String.end(), std::back_inserter(output), 0); +// +// return output; +// } +// +// +// //////////////////////////////////////////////////////////// +// std::basic_string<uint8> String::ToUtf8() const +// { +// // Prepare the output string +// std::basic_string<uint8> output; +// output.reserve(m_String.length()); +// +// // Convert +// Utf32::ToUtf8(m_String.begin(), m_String.end(), std::back_inserter(output)); +// +// return output; +// } +// +// +// //////////////////////////////////////////////////////////// +// std::basic_string<uint16> String::ToUtf16() const +// { +// // Prepare the output string +// std::basic_string<uint16> output; +// output.reserve(m_String.length()); +// +// // Convert +// Utf32::ToUtf16(m_String.begin(), m_String.end(), std::back_inserter(output)); +// +// return output; +// } +// +// +// //////////////////////////////////////////////////////////// +// std::basic_string<uint32> String::ToUtf32() const +// { +// return m_String; +// } +// +// +// //////////////////////////////////////////////////////////// +// String& String::operator =(const String& right) +// { +// m_String = right.mString; +// return *this; +// } +// +// +// //////////////////////////////////////////////////////////// +// String& String::operator +=(const String& right) +// { +// m_String += right.mString; +// return *this; +// } +// +// +// //////////////////////////////////////////////////////////// +// uint32 String::operator [](std::size_t index) const +// { +// return m_String[index]; +// } +// +// +// //////////////////////////////////////////////////////////// +// uint32& String::operator [](std::size_t index) +// { +// return m_String[index]; +// } +// +// +// //////////////////////////////////////////////////////////// +// void String::Clear() +// { +// m_String.clear(); +// } +// +// +// //////////////////////////////////////////////////////////// +// std::size_t String::GetSize() const +// { +// return m_String.size(); +// } +// +// +// //////////////////////////////////////////////////////////// +// bool String::IsEmpty() const +// { +// return m_String.empty(); +// } +// +// +// //////////////////////////////////////////////////////////// +// void String::Erase(std::size_t position, std::size_t count) +// { +// m_String.erase(position, count); +// } +// +// +// //////////////////////////////////////////////////////////// +// void String::Insert(std::size_t position, const String& str) +// { +// m_String.insert(position, str.mString); +// } +// +// +// //////////////////////////////////////////////////////////// +// std::size_t String::Find(const String& str, std::size_t start) const +// { +// return m_String.find(str.mString, start); +// } +// +// +// //////////////////////////////////////////////////////////// +// void String::Replace(std::size_t position, std::size_t length, const String& replaceWith) +// { +// m_String.replace(position, length, replaceWith.mString); +// } +// +// +// //////////////////////////////////////////////////////////// +// void String::Replace(const String& searchFor, const String& replaceWith) +// { +// std::size_t step = replaceWith.GetSize(); +// std::size_t len = searchFor.GetSize(); +// std::size_t pos = Find(searchFor); +// +// // Replace each occurrence of search +// while (pos != InvalidPos) +// { +// Replace(pos, len, replaceWith); +// pos = Find(searchFor, pos + step); +// } +// } +// +// +// //////////////////////////////////////////////////////////// +// String String::Substring(std::size_t position, std::size_t length) const +// { +// return m_String.substr(position, length); +// } +// +// +// //////////////////////////////////////////////////////////// +// const uint32* String::GetData() const +// { +// return m_String.c_str(); +// } +// +// +// //////////////////////////////////////////////////////////// +// String::Iterator String::Begin() +// { +// return m_String.begin(); +// } +// +// +// //////////////////////////////////////////////////////////// +// String::ConstIterator String::Begin() const +// { +// return m_String.begin(); +// } +// +// +// //////////////////////////////////////////////////////////// +// String::Iterator String::End() +// { +// return m_String.end(); +// } +// +// +// //////////////////////////////////////////////////////////// +// String::ConstIterator String::End() const +// { +// return m_String.end(); +// } +// +// +// //////////////////////////////////////////////////////////// +// bool operator ==(const String& left, const String& right) +// { +// return left.mString == right.mString; +// } +// +// +// //////////////////////////////////////////////////////////// +// bool operator !=(const String& left, const String& right) +// { +// return !(left == right); +// } +// +// +// //////////////////////////////////////////////////////////// +// bool operator <(const String& left, const String& right) +// { +// return left.mString < right.mString; +// } +// +// +// //////////////////////////////////////////////////////////// +// bool operator >(const String& left, const String& right) +// { +// return right < left; +// } +// +// +// //////////////////////////////////////////////////////////// +// bool operator <=(const String& left, const String& right) +// { +// return !(right < left); +// } +// +// +// //////////////////////////////////////////////////////////// +// bool operator >=(const String& left, const String& right) +// { +// return !(left < right); +// } +// +// +// //////////////////////////////////////////////////////////// +// String operator +(const String& left, const String& right) +// { +// String string = left; +// string += right; +// +// return string; +// } +// +// +// } +//} diff --git a/source/modules/asura-core/Font/String.hpp b/source/modules/asura-core/Font/String.hpp new file mode 100644 index 0000000..13a8b2d --- /dev/null +++ b/source/modules/asura-core/Font/String.hpp @@ -0,0 +1,595 @@ +//#ifndef _ASURA_ENGINE_STRING_H_ +//#define _ASURA_ENGINE_STRING_H_ +// +//#include <asura-utils/type.h> +// +//#include <iterator> +//#include <locale> +//#include <string> +// +//namespace AsuraEngine +//{ +// namespace Text +// { +// +// +// //////////////////////////////////////////////////////////// +// /// \brief Utility string class that automatically handles +// /// conversions between types and encodings +// /// +// //////////////////////////////////////////////////////////// +// class String +// { +// public: +// +// //////////////////////////////////////////////////////////// +// // Types +// //////////////////////////////////////////////////////////// +// typedef std::basic_string<uint32>::iterator Iterator; ///< Iterator type +// typedef std::basic_string<uint32>::const_iterator ConstIterator; ///< Read-only iterator type +// +// //////////////////////////////////////////////////////////// +// // Static member data +// //////////////////////////////////////////////////////////// +// static const std::size_t InvalidPos; ///< Represents an invalid position in the string +// +// //////////////////////////////////////////////////////////// +// /// \brief Default constructor +// /// +// /// This constructor creates an empty string. +// /// +// //////////////////////////////////////////////////////////// +// String(); +// +// //////////////////////////////////////////////////////////// +// /// \brief Construct from a single ANSI character and a locale +// /// +// /// The source character is converted to UTF-32 according +// /// to the given locale. +// /// +// /// \param ansiChar ANSI character to convert +// /// \param locale Locale to use for conversion +// /// +// //////////////////////////////////////////////////////////// +// String(char ansiChar, const std::locale& locale = std::locale()); +// +// //////////////////////////////////////////////////////////// +// /// \brief Construct from single wide character +// /// +// /// \param wideChar Wide character to convert +// /// +// //////////////////////////////////////////////////////////// +// String(wchar_t wideChar); +// +// //////////////////////////////////////////////////////////// +// /// \brief Construct from single UTF-32 character +// /// +// /// \param utf32Char UTF-32 character to convert +// /// +// //////////////////////////////////////////////////////////// +// String(uint utf32Char); +// +// //////////////////////////////////////////////////////////// +// /// \brief Construct from a null-terminated C-style ANSI string and a locale +// /// +// /// The source string is converted to UTF-32 according +// /// to the given locale. +// /// +// /// \param ansiString ANSI string to convert +// /// \param locale Locale to use for conversion +// /// +// //////////////////////////////////////////////////////////// +// String(const char* ansiString, const std::locale& locale = std::locale()); +// +// //////////////////////////////////////////////////////////// +// /// \brief Construct from an ANSI string and a locale +// /// +// /// The source string is converted to UTF-32 according +// /// to the given locale. +// /// +// /// \param ansiString ANSI string to convert +// /// \param locale Locale to use for conversion +// /// +// //////////////////////////////////////////////////////////// +// String(const std::string& ansiString, const std::locale& locale = std::locale()); +// +// //////////////////////////////////////////////////////////// +// /// \brief Construct from null-terminated C-style wide string +// /// +// /// \param wideString Wide string to convert +// /// +// //////////////////////////////////////////////////////////// +// String(const wchar_t* wideString); +// +// //////////////////////////////////////////////////////////// +// /// \brief Construct from a wide string +// /// +// /// \param wideString Wide string to convert +// /// +// //////////////////////////////////////////////////////////// +// String(const std::wstring& wideString); +// +// //////////////////////////////////////////////////////////// +// /// \brief Construct from a null-terminated C-style UTF-32 string +// /// +// /// \param utf32String UTF-32 string to assign +// /// +// //////////////////////////////////////////////////////////// +// String(const uint* utf32String); +// +// //////////////////////////////////////////////////////////// +// /// \brief Construct from an UTF-32 string +// /// +// /// \param utf32String UTF-32 string to assign +// /// +// //////////////////////////////////////////////////////////// +// String(const std::basic_string<uint>& utf32String); +// +// //////////////////////////////////////////////////////////// +// /// \brief Copy constructor +// /// +// /// \param copy Instance to copy +// /// +// //////////////////////////////////////////////////////////// +// String(const String& copy); +// +// //////////////////////////////////////////////////////////// +// /// \brief Create a new sf::String from a UTF-8 encoded string +// /// +// /// \param begin Forward iterator to the beginning of the UTF-8 sequence +// /// \param end Forward iterator to the end of the UTF-8 sequence +// /// +// /// \return A sf::String containing the source string +// /// +// /// \see fromUtf16, fromUtf32 +// /// +// //////////////////////////////////////////////////////////// +// template <typename T> +// static String FromUtf8(T begin, T end); +// +// //////////////////////////////////////////////////////////// +// /// \brief Create a new sf::String from a UTF-16 encoded string +// /// +// /// \param begin Forward iterator to the beginning of the UTF-16 sequence +// /// \param end Forward iterator to the end of the UTF-16 sequence +// /// +// /// \return A sf::String containing the source string +// /// +// /// \see fromUtf8, fromUtf32 +// /// +// //////////////////////////////////////////////////////////// +// template <typename T> +// static String FromUtf16(T begin, T end); +// +// //////////////////////////////////////////////////////////// +// /// \brief Create a new sf::String from a UTF-32 encoded string +// /// +// /// This function is provided for consistency, it is equivalent to +// /// using the constructors that takes a const sf::uint* or +// /// a std::basic_string<sf::uint>. +// /// +// /// \param begin Forward iterator to the beginning of the UTF-32 sequence +// /// \param end Forward iterator to the end of the UTF-32 sequence +// /// +// /// \return A sf::String containing the source string +// /// +// /// \see fromUtf8, fromUtf16 +// /// +// //////////////////////////////////////////////////////////// +// template <typename T> +// static String FromUtf32(T begin, T end); +// +// //////////////////////////////////////////////////////////// +// /// \brief Implicit conversion operator to std::string (ANSI string) +// /// +// /// The current global locale is used for conversion. If you +// /// want to explicitly specify a locale, see toAnsiString. +// /// Characters that do not fit in the target encoding are +// /// discarded from the returned string. +// /// This operator is defined for convenience, and is equivalent +// /// to calling toAnsiString(). +// /// +// /// \return Converted ANSI string +// /// +// /// \see toAnsiString, operator std::wstring +// /// +// //////////////////////////////////////////////////////////// +// operator std::string() const; +// +// //////////////////////////////////////////////////////////// +// /// \brief Implicit conversion operator to std::wstring (wide string) +// /// +// /// Characters that do not fit in the target encoding are +// /// discarded from the returned string. +// /// This operator is defined for convenience, and is equivalent +// /// to calling toWideString(). +// /// +// /// \return Converted wide string +// /// +// /// \see toWideString, operator std::string +// /// +// //////////////////////////////////////////////////////////// +// operator std::wstring() const; +// +// //////////////////////////////////////////////////////////// +// /// \brief Convert the Unicode string to an ANSI string +// /// +// /// The UTF-32 string is converted to an ANSI string in +// /// the encoding defined by \a locale. +// /// Characters that do not fit in the target encoding are +// /// discarded from the returned string. +// /// +// /// \param locale Locale to use for conversion +// /// +// /// \return Converted ANSI string +// /// +// /// \see toWideString, operator std::string +// /// +// //////////////////////////////////////////////////////////// +// std::string ToAnsiString(const std::locale& locale = std::locale()) const; +// +// //////////////////////////////////////////////////////////// +// /// \brief Convert the Unicode string to a wide string +// /// +// /// Characters that do not fit in the target encoding are +// /// discarded from the returned string. +// /// +// /// \return Converted wide string +// /// +// /// \see toAnsiString, operator std::wstring +// /// +// //////////////////////////////////////////////////////////// +// std::wstring ToWideString() const; +// +// //////////////////////////////////////////////////////////// +// /// \brief Convert the Unicode string to a UTF-8 string +// /// +// /// \return Converted UTF-8 string +// /// +// /// \see toUtf16, toUtf32 +// /// +// //////////////////////////////////////////////////////////// +// std::basic_string<uint8> ToUtf8() const; +// +// //////////////////////////////////////////////////////////// +// /// \brief Convert the Unicode string to a UTF-16 string +// /// +// /// \return Converted UTF-16 string +// /// +// /// \see toUtf8, toUtf32 +// /// +// //////////////////////////////////////////////////////////// +// std::basic_string<uint16> ToUtf16() const; +// +// //////////////////////////////////////////////////////////// +// /// \brief Convert the Unicode string to a UTF-32 string +// /// +// /// This function doesn't perform any conversion, since the +// /// string is already stored as UTF-32 internally. +// /// +// /// \return Converted UTF-32 string +// /// +// /// \see toUtf8, toUtf16 +// /// +// //////////////////////////////////////////////////////////// +// std::basic_string<uint> ToUtf32() const; +// +// //////////////////////////////////////////////////////////// +// /// \brief Overload of assignment operator +// /// +// /// \param right Instance to assign +// /// +// /// \return Reference to self +// /// +// //////////////////////////////////////////////////////////// +// String& operator =(const String& right); +// +// //////////////////////////////////////////////////////////// +// /// \brief Overload of += operator to append an UTF-32 string +// /// +// /// \param right String to append +// /// +// /// \return Reference to self +// /// +// //////////////////////////////////////////////////////////// +// String& operator +=(const String& right); +// +// //////////////////////////////////////////////////////////// +// /// \brief Overload of [] operator to access a character by its position +// /// +// /// This function provides read-only access to characters. +// /// Note: the behavior is undefined if \a index is out of range. +// /// +// /// \param index Index of the character to get +// /// +// /// \return Character at position \a index +// /// +// //////////////////////////////////////////////////////////// +// uint operator [](std::size_t index) const; +// +// //////////////////////////////////////////////////////////// +// /// \brief Overload of [] operator to access a character by its position +// /// +// /// This function provides read and write access to characters. +// /// Note: the behavior is undefined if \a index is out of range. +// /// +// /// \param index Index of the character to get +// /// +// /// \return Reference to the character at position \a index +// /// +// //////////////////////////////////////////////////////////// +// uint& operator [](std::size_t index); +// +// //////////////////////////////////////////////////////////// +// /// \brief Clear the string +// /// +// /// This function removes all the characters from the string. +// /// +// /// \see isEmpty, erase +// /// +// //////////////////////////////////////////////////////////// +// void Clear(); +// +// //////////////////////////////////////////////////////////// +// /// \brief Get the size of the string +// /// +// /// \return Number of characters in the string +// /// +// /// \see isEmpty +// /// +// //////////////////////////////////////////////////////////// +// std::size_t GetSize() const; +// +// //////////////////////////////////////////////////////////// +// /// \brief Check whether the string is empty or not +// /// +// /// \return True if the string is empty (i.e. contains no character) +// /// +// /// \see clear, getSize +// /// +// //////////////////////////////////////////////////////////// +// bool IsEmpty() const; +// +// //////////////////////////////////////////////////////////// +// /// \brief Erase one or more characters from the string +// /// +// /// This function removes a sequence of \a count characters +// /// starting from \a position. +// /// +// /// \param position Position of the first character to erase +// /// \param count Number of characters to erase +// /// +// //////////////////////////////////////////////////////////// +// void Erase(std::size_t position, std::size_t count = 1); +// +// //////////////////////////////////////////////////////////// +// /// \brief Insert one or more characters into the string +// /// +// /// This function inserts the characters of \a str +// /// into the string, starting from \a position. +// /// +// /// \param position Position of insertion +// /// \param str Characters to insert +// /// +// //////////////////////////////////////////////////////////// +// void Insert(std::size_t position, const String& str); +// +// //////////////////////////////////////////////////////////// +// /// \brief Find a sequence of one or more characters in the string +// /// +// /// This function searches for the characters of \a str +// /// in the string, starting from \a start. +// /// +// /// \param str Characters to find +// /// \param start Where to begin searching +// /// +// /// \return Position of \a str in the string, or String::InvalidPos if not found +// /// +// //////////////////////////////////////////////////////////// +// std::size_t Find(const String& str, std::size_t start = 0) const; +// +// //////////////////////////////////////////////////////////// +// /// \brief Replace a substring with another string +// /// +// /// This function replaces the substring that starts at index \a position +// /// and spans \a length characters with the string \a replaceWith. +// /// +// /// \param position Index of the first character to be replaced +// /// \param length Number of characters to replace. You can pass InvalidPos to +// /// replace all characters until the end of the string. +// /// \param replaceWith String that replaces the given substring. +// /// +// //////////////////////////////////////////////////////////// +// void Replace(std::size_t position, std::size_t length, const String& replaceWith); +// +// //////////////////////////////////////////////////////////// +// /// \brief Replace all occurrences of a substring with a replacement string +// /// +// /// This function replaces all occurrences of \a searchFor in this string +// /// with the string \a replaceWith. +// /// +// /// \param searchFor The value being searched for +// /// \param replaceWith The value that replaces found \a searchFor values +// /// +// //////////////////////////////////////////////////////////// +// void Replace(const String& searchFor, const String& replaceWith); +// +// //////////////////////////////////////////////////////////// +// /// \brief Return a part of the string +// /// +// /// This function returns the substring that starts at index \a position +// /// and spans \a length characters. +// /// +// /// \param position Index of the first character +// /// \param length Number of characters to include in the substring (if +// /// the string is shorter, as many characters as possible +// /// are included). \ref InvalidPos can be used to include all +// /// characters until the end of the string. +// /// +// /// \return String object containing a substring of this object +// /// +// //////////////////////////////////////////////////////////// +// String Substring(std::size_t position, std::size_t length = InvalidPos) const; +// +// //////////////////////////////////////////////////////////// +// /// \brief Get a pointer to the C-style array of characters +// /// +// /// This functions provides a read-only access to a +// /// null-terminated C-style representation of the string. +// /// The returned pointer is temporary and is meant only for +// /// immediate use, thus it is not recommended to store it. +// /// +// /// \return Read-only pointer to the array of characters +// /// +// //////////////////////////////////////////////////////////// +// const uint* GetData() const; +// +// //////////////////////////////////////////////////////////// +// /// \brief Return an iterator to the beginning of the string +// /// +// /// \return Read-write iterator to the beginning of the string characters +// /// +// /// \see end +// /// +// //////////////////////////////////////////////////////////// +// Iterator Begin(); +// +// //////////////////////////////////////////////////////////// +// /// \brief Return an iterator to the beginning of the string +// /// +// /// \return Read-only iterator to the beginning of the string characters +// /// +// /// \see end +// /// +// //////////////////////////////////////////////////////////// +// ConstIterator Begin() const; +// +// //////////////////////////////////////////////////////////// +// /// \brief Return an iterator to the end of the string +// /// +// /// The end iterator refers to 1 position past the last character; +// /// thus it represents an invalid character and should never be +// /// accessed. +// /// +// /// \return Read-write iterator to the end of the string characters +// /// +// /// \see begin +// /// +// //////////////////////////////////////////////////////////// +// Iterator End(); +// +// //////////////////////////////////////////////////////////// +// /// \brief Return an iterator to the end of the string +// /// +// /// The end iterator refers to 1 position past the last character; +// /// thus it represents an invalid character and should never be +// /// accessed. +// /// +// /// \return Read-only iterator to the end of the string characters +// /// +// /// \see begin +// /// +// //////////////////////////////////////////////////////////// +// ConstIterator End() const; +// +// private: +// +// friend bool operator ==(const String& left, const String& right); +// friend bool operator <(const String& left, const String& right); +// +// //////////////////////////////////////////////////////////// +// // Member data +// //////////////////////////////////////////////////////////// +// std::basic_string<uint> m_String; ///< Internal string of UTF-32 characters +// }; +// +// //////////////////////////////////////////////////////////// +// /// \relates String +// /// \brief Overload of == operator to compare two UTF-32 strings +// /// +// /// \param left Left operand (a string) +// /// \param right Right operand (a string) +// /// +// /// \return True if both strings are equal +// /// +// //////////////////////////////////////////////////////////// +// bool operator ==(const String& left, const String& right); +// +// //////////////////////////////////////////////////////////// +// /// \relates String +// /// \brief Overload of != operator to compare two UTF-32 strings +// /// +// /// \param left Left operand (a string) +// /// \param right Right operand (a string) +// /// +// /// \return True if both strings are different +// /// +// //////////////////////////////////////////////////////////// +// bool operator !=(const String& left, const String& right); +// +// //////////////////////////////////////////////////////////// +// /// \relates String +// /// \brief Overload of < operator to compare two UTF-32 strings +// /// +// /// \param left Left operand (a string) +// /// \param right Right operand (a string) +// /// +// /// \return True if \a left is lexicographically before \a right +// /// +// //////////////////////////////////////////////////////////// +// bool operator <(const String& left, const String& right); +// +// //////////////////////////////////////////////////////////// +// /// \relates String +// /// \brief Overload of > operator to compare two UTF-32 strings +// /// +// /// \param left Left operand (a string) +// /// \param right Right operand (a string) +// /// +// /// \return True if \a left is lexicographically after \a right +// /// +// //////////////////////////////////////////////////////////// +// bool operator >(const String& left, const String& right); +// +// //////////////////////////////////////////////////////////// +// /// \relates String +// /// \brief Overload of <= operator to compare two UTF-32 strings +// /// +// /// \param left Left operand (a string) +// /// \param right Right operand (a string) +// /// +// /// \return True if \a left is lexicographically before or equivalent to \a right +// /// +// //////////////////////////////////////////////////////////// +// bool operator <=(const String& left, const String& right); +// +// //////////////////////////////////////////////////////////// +// /// \relates String +// /// \brief Overload of >= operator to compare two UTF-32 strings +// /// +// /// \param left Left operand (a string) +// /// \param right Right operand (a string) +// /// +// /// \return True if \a left is lexicographically after or equivalent to \a right +// /// +// //////////////////////////////////////////////////////////// +// bool operator >=(const String& left, const String& right); +// +// //////////////////////////////////////////////////////////// +// /// \relates String +// /// \brief Overload of binary + operator to concatenate two strings +// /// +// /// \param left Left operand (a string) +// /// \param right Right operand (a string) +// /// +// /// \return Concatenated string +// /// +// //////////////////////////////////////////////////////////// +// String operator +(const String& left, const String& right); +// +// #include "String.inc" +// +// } +//} +// +//#endif
\ No newline at end of file diff --git a/source/modules/asura-core/font/string.inl b/source/modules/asura-core/Font/String.inc index ef18228..ef18228 100644 --- a/source/modules/asura-core/font/string.inl +++ b/source/modules/asura-core/Font/String.inc diff --git a/source/modules/asura-core/threading/channel.cpp b/source/modules/asura-core/Font/TTF.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-core/threading/channel.cpp +++ b/source/modules/asura-core/Font/TTF.cpp diff --git a/source/modules/asura-core/Font/TTF.h b/source/modules/asura-core/Font/TTF.h new file mode 100644 index 0000000..b83cf76 --- /dev/null +++ b/source/modules/asura-core/Font/TTF.h @@ -0,0 +1,17 @@ +#ifndef _ASURA_TTF_H_ +#define _ASURA_TTF_H_ + +namespace AsuraEngine +{ + namespace Text + { + + class TTF + { + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-core/Font/Utf.hpp b/source/modules/asura-core/Font/Utf.hpp new file mode 100644 index 0000000..59f62ed --- /dev/null +++ b/source/modules/asura-core/Font/Utf.hpp @@ -0,0 +1,720 @@ +#ifndef _ASURA_UTF_HPP_ +#define _ASURA_UTF_HPP_ + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include <algorithm> +#include <locale> +#include <string> +#include <cstdlib> + +namespace AsuraEngine +{ + namespace Text + { + + template <unsigned int N> + class Utf; + + //////////////////////////////////////////////////////////// + /// \brief Specialization of the Utf template for UTF-8 + /// + //////////////////////////////////////////////////////////// + template <> + class Utf<8> + { + public: + + //////////////////////////////////////////////////////////// + /// \brief Decode a single UTF-8 character + /// + /// Decoding a character means finding its unique 32-bits + /// code (called the codepoint) in the Unicode standard. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Codepoint of the decoded UTF-8 character + /// \param replacement Replacement character to use in case the UTF-8 sequence is invalid + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template <typename In> + static In Decode(In begin, In end, Uint32& output, Uint32 replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Encode a single UTF-8 character + /// + /// Encoding a character means converting a unique 32-bits + /// code (called the codepoint) in the target encoding, UTF-8. + /// + /// \param input Codepoint to encode as UTF-8 + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to UTF-8 (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename Out> + static Out Encode(Uint32 input, Out output, Uint8 replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Advance to the next UTF-8 character + /// + /// This function is necessary for multi-elements encodings, as + /// a single character may use more than 1 storage element. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template <typename In> + static In Next(In begin, In end); + + //////////////////////////////////////////////////////////// + /// \brief Count the number of characters of a UTF-8 sequence + /// + /// This function is necessary for multi-elements encodings, as + /// a single character may use more than 1 storage element, thus the + /// total size can be different from (begin - end). + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template <typename In> + static std::size_t Count(In begin, In end); + + //////////////////////////////////////////////////////////// + /// \brief Convert an ANSI characters range to UTF-8 + /// + /// The current global locale will be used by default, unless you + /// pass a custom one in the \a locale parameter. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out FromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Convert a wide characters range to UTF-8 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out FromWide(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a latin-1 (ISO-5589-1) characters range to UTF-8 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out FromLatin1(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-8 characters range to ANSI characters + /// + /// The current global locale will be used by default, unless you + /// pass a custom one in the \a locale parameter. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to ANSI (use 0 to skip them) + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out ToAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-8 characters range to wide characters + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out ToWide(In begin, In end, Out output, wchar_t replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-8 characters range to latin-1 (ISO-5589-1) characters + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out ToLatin1(In begin, In end, Out output, char replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-8 characters range to UTF-8 + /// + /// This functions does nothing more than a direct copy; + /// it is defined only to provide the same interface as other + /// specializations of the sf::Utf<> template, and allow + /// generic code to be written on top of it. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out ToUtf8(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-8 characters range to UTF-16 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out ToUtf16(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-8 characters range to UTF-32 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out ToUtf32(In begin, In end, Out output); + }; + + //////////////////////////////////////////////////////////// + /// \brief Specialization of the Utf template for UTF-16 + /// + //////////////////////////////////////////////////////////// + template <> + class Utf<16> + { + public: + + //////////////////////////////////////////////////////////// + /// \brief Decode a single UTF-16 character + /// + /// Decoding a character means finding its unique 32-bits + /// code (called the codepoint) in the Unicode standard. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Codepoint of the decoded UTF-16 character + /// \param replacement Replacement character to use in case the UTF-8 sequence is invalid + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template <typename In> + static In Decode(In begin, In end, Uint32& output, Uint32 replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Encode a single UTF-16 character + /// + /// Encoding a character means converting a unique 32-bits + /// code (called the codepoint) in the target encoding, UTF-16. + /// + /// \param input Codepoint to encode as UTF-16 + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to UTF-16 (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename Out> + static Out Encode(Uint32 input, Out output, Uint16 replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Advance to the next UTF-16 character + /// + /// This function is necessary for multi-elements encodings, as + /// a single character may use more than 1 storage element. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template <typename In> + static In Next(In begin, In end); + + //////////////////////////////////////////////////////////// + /// \brief Count the number of characters of a UTF-16 sequence + /// + /// This function is necessary for multi-elements encodings, as + /// a single character may use more than 1 storage element, thus the + /// total size can be different from (begin - end). + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template <typename In> + static std::size_t Count(In begin, In end); + + //////////////////////////////////////////////////////////// + /// \brief Convert an ANSI characters range to UTF-16 + /// + /// The current global locale will be used by default, unless you + /// pass a custom one in the \a locale parameter. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out FromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Convert a wide characters range to UTF-16 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out FromWide(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a latin-1 (ISO-5589-1) characters range to UTF-16 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out FromLatin1(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-16 characters range to ANSI characters + /// + /// The current global locale will be used by default, unless you + /// pass a custom one in the \a locale parameter. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to ANSI (use 0 to skip them) + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out ToAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-16 characters range to wide characters + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out ToWide(In begin, In end, Out output, wchar_t replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-16 characters range to latin-1 (ISO-5589-1) characters + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out ToLatin1(In begin, In end, Out output, char replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-16 characters range to UTF-8 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out ToUtf8(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-16 characters range to UTF-16 + /// + /// This functions does nothing more than a direct copy; + /// it is defined only to provide the same interface as other + /// specializations of the sf::Utf<> template, and allow + /// generic code to be written on top of it. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out ToUtf16(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-16 characters range to UTF-32 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out ToUtf32(In begin, In end, Out output); + }; + + //////////////////////////////////////////////////////////// + /// \brief Specialization of the Utf template for UTF-32 + /// + //////////////////////////////////////////////////////////// + template <> + class Utf<32> + { + public: + + //////////////////////////////////////////////////////////// + /// \brief Decode a single UTF-32 character + /// + /// Decoding a character means finding its unique 32-bits + /// code (called the codepoint) in the Unicode standard. + /// For UTF-32, the character value is the same as the codepoint. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Codepoint of the decoded UTF-32 character + /// \param replacement Replacement character to use in case the UTF-8 sequence is invalid + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template <typename In> + static In Decode(In begin, In end, Uint32& output, Uint32 replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Encode a single UTF-32 character + /// + /// Encoding a character means converting a unique 32-bits + /// code (called the codepoint) in the target encoding, UTF-32. + /// For UTF-32, the codepoint is the same as the character value. + /// + /// \param input Codepoint to encode as UTF-32 + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to UTF-32 (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename Out> + static Out Encode(Uint32 input, Out output, Uint32 replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Advance to the next UTF-32 character + /// + /// This function is trivial for UTF-32, which can store + /// every character in a single storage element. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template <typename In> + static In Next(In begin, In end); + + //////////////////////////////////////////////////////////// + /// \brief Count the number of characters of a UTF-32 sequence + /// + /// This function is trivial for UTF-32, which can store + /// every character in a single storage element. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// + /// \return Iterator pointing to one past the last read element of the input sequence + /// + //////////////////////////////////////////////////////////// + template <typename In> + static std::size_t Count(In begin, In end); + + //////////////////////////////////////////////////////////// + /// \brief Convert an ANSI characters range to UTF-32 + /// + /// The current global locale will be used by default, unless you + /// pass a custom one in the \a locale parameter. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out FromAnsi(In begin, In end, Out output, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Convert a wide characters range to UTF-32 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out FromWide(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a latin-1 (ISO-5589-1) characters range to UTF-32 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out FromLatin1(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-32 characters range to ANSI characters + /// + /// The current global locale will be used by default, unless you + /// pass a custom one in the \a locale parameter. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to ANSI (use 0 to skip them) + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out ToAnsi(In begin, In end, Out output, char replacement = 0, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-32 characters range to wide characters + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out ToWide(In begin, In end, Out output, wchar_t replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Convert an UTF-16 characters range to latin-1 (ISO-5589-1) characters + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement for characters not convertible to wide (use 0 to skip them) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out ToLatin1(In begin, In end, Out output, char replacement = 0); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-32 characters range to UTF-8 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out ToUtf8(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-32 characters range to UTF-16 + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out ToUtf16(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Convert a UTF-32 characters range to UTF-32 + /// + /// This functions does nothing more than a direct copy; + /// it is defined only to provide the same interface as other + /// specializations of the sf::Utf<> template, and allow + /// generic code to be written on top of it. + /// + /// \param begin Iterator pointing to the beginning of the input sequence + /// \param end Iterator pointing to the end of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename In, typename Out> + static Out ToUtf32(In begin, In end, Out output); + + //////////////////////////////////////////////////////////// + /// \brief Decode a single ANSI character to UTF-32 + /// + /// This function does not exist in other specializations + /// of sf::Utf<>, it is defined for convenience (it is used by + /// several other conversion functions). + /// + /// \param input Input ANSI character + /// \param locale Locale to use for conversion + /// + /// \return Converted character + /// + //////////////////////////////////////////////////////////// + template <typename In> + static Uint32 DecodeAnsi(In input, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Decode a single wide character to UTF-32 + /// + /// This function does not exist in other specializations + /// of sf::Utf<>, it is defined for convenience (it is used by + /// several other conversion functions). + /// + /// \param input Input wide character + /// + /// \return Converted character + /// + //////////////////////////////////////////////////////////// + template <typename In> + static Uint32 DecodeWide(In input); + + //////////////////////////////////////////////////////////// + /// \brief Encode a single UTF-32 character to ANSI + /// + /// This function does not exist in other specializations + /// of sf::Utf<>, it is defined for convenience (it is used by + /// several other conversion functions). + /// + /// \param codepoint Iterator pointing to the beginning of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement if the input character is not convertible to ANSI (use 0 to skip it) + /// \param locale Locale to use for conversion + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename Out> + static Out EncodeAnsi(Uint32 codepoint, Out output, char replacement = 0, const std::locale& locale = std::locale()); + + //////////////////////////////////////////////////////////// + /// \brief Encode a single UTF-32 character to wide + /// + /// This function does not exist in other specializations + /// of sf::Utf<>, it is defined for convenience (it is used by + /// several other conversion functions). + /// + /// \param codepoint Iterator pointing to the beginning of the input sequence + /// \param output Iterator pointing to the beginning of the output sequence + /// \param replacement Replacement if the input character is not convertible to wide (use 0 to skip it) + /// + /// \return Iterator to the end of the output sequence which has been written + /// + //////////////////////////////////////////////////////////// + template <typename Out> + static Out EncodeWide(Uint32 codepoint, Out output, wchar_t replacement = 0); + }; + +#include "Utf.inc" + + // Make typedefs to get rid of the template syntax + typedef Utf<8> Utf8; + typedef Utf<16> Utf16; + typedef Utf<32> Utf32; + + } // namespace sf + +} + + +#endif // SFML_UTF_HPP diff --git a/source/modules/asura-core/font/utf.inl b/source/modules/asura-core/Font/Utf.inc index 69a523b..69a523b 100644 --- a/source/modules/asura-core/font/utf.inl +++ b/source/modules/asura-core/Font/Utf.inc diff --git a/source/modules/asura-core/Graphics/BlendMode.h b/source/modules/asura-core/Graphics/BlendMode.h new file mode 100644 index 0000000..7a31eed --- /dev/null +++ b/source/modules/asura-core/Graphics/BlendMode.h @@ -0,0 +1,17 @@ +#ifndef _ASURA_ENGINE_BLEND_MODE_H_ +#define _ASURA_ENGINE_BLEND_MODE_H_ + +#include <asura-utils/Classes.h> + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + +enum BlendMode +{ + +}; + +namespace_end +namespace_end + +#endif
\ No newline at end of file diff --git a/source/modules/asura-core/Graphics/Canvas.cpp b/source/modules/asura-core/Graphics/Canvas.cpp new file mode 100644 index 0000000..60c8f87 --- /dev/null +++ b/source/modules/asura-core/Graphics/Canvas.cpp @@ -0,0 +1,49 @@ +#include "Canvas.h" + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + +Canvas::Canvas() + : m_Width(0) + , m_Height(0) + , m_FBO(0) +{ + // Fix: ôСʼʱframebufferԴ + //glGenFramebuffers(1, &m_FBO); + //GLint current_fbo; + //glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, ¤t_fbo); + //glBindFramebuffer(GL_FRAMEBUFFER, m_FBO); + //glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_TexID, 0); + //glBindFramebuffer(GL_FRAMEBUFFER, current_fbo); +} + +void Canvas::SetSize(uint w, uint h) +{ + if (m_FBO == 0) + { + glGenFramebuffers(1, &m_FBO); + if (m_FBO == 0) + throw Exception("OpenGL glGenFramebuffers cannot generate frame buffer object."); + // + if (m_TexID == 0) + { + glGenTextures(1, &m_TexID); + if (m_TexID == 0) + throw Exception("OpenGL glGenTextures cannot generate texture."); + } + GLint current_fbo; + glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, ¤t_fbo); + glBindFramebuffer(GL_FRAMEBUFFER, m_FBO); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_TexID, 0); + glBindFramebuffer(GL_FRAMEBUFFER, current_fbo); + } + GLint current_tex; + glGetIntegerv(GL_TEXTURE_BINDING_2D, ¤t_tex); + glBindTexture(GL_TEXTURE_2D, m_TexID); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glBindTexture(GL_TEXTURE_2D, current_tex); +} + +namespace_end + +namespace_end
\ No newline at end of file diff --git a/source/modules/asura-core/Graphics/Canvas.h b/source/modules/asura-core/Graphics/Canvas.h new file mode 100644 index 0000000..0ec55bc --- /dev/null +++ b/source/modules/asura-core/Graphics/Canvas.h @@ -0,0 +1,73 @@ +#ifndef _ASURA_ENGINE_CANVAS_H_ +#define _ASURA_ENGINE_CANVAS_H_ + +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Math/Rect.hpp> +#include <asura-utils/Math/Vector2.hpp> +#include <asura-utils/Exceptions/Exception.h> + +#include "GfxDevice.h" +#include "Texture.h" +#include "RenderTarget.h" +#include "RenderState.h" + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + +/// +/// CanvasҲԳΪrender textureҲΪtextureȾ +/// +class Canvas ASURA_FINAL + : public Scripting::Portable<Canvas, RenderTarget> +{ +public: + + Canvas(); + + ~Canvas(); + + /// + /// render textureĴС + /// + void SetSize(uint w, uint h) ASURA_THROW(Exception); + + void Clear(const Color& col = Color::Black) override; +/* + void Clear(const Math::Recti& quad, const Color& col = Color::Black) override; +*/ + void Render(const RenderTarget* rt, const Math::Vector2i& pos, const Math::Vector2i& scale, const Math::Vector2i& center, float rot); + + void Render(const RenderTarget* rt, const Math::Rectf& quad, const Math::Vector2i& pos, const Math::Vector2i& scale, const Math::Vector2i& center, float rot); + + void Draw(const Drawable* texture, const RenderState& state); + + void Draw(const Drawable* texture, const Math::Recti& quad, const RenderState& state); + +private: + + GLuint m_FBO; + + GLuint m_TexID; + + uint m_Width, m_Height; + +luaxport: + + LUAX_DECL_FACTORY(Canvas, RenderTarget); + + LUAX_DECL_METHOD(_SetSize); + LUAX_DECL_METHOD(_Bind); + LUAX_DECL_METHOD(_Unbind); + +}; + +/// +/// CanvasΪRenderTexture +/// +typedef Canvas RenderTexture; + +} // Graphics +} // AsuraEngine + +#endif
\ No newline at end of file diff --git a/source/modules/asura-core/Graphics/Color.cpp b/source/modules/asura-core/Graphics/Color.cpp new file mode 100644 index 0000000..5a66291 --- /dev/null +++ b/source/modules/asura-core/Graphics/Color.cpp @@ -0,0 +1,58 @@ +#include "Color.h" +#include "Color32.h" + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + +Color::Color() +{ + r = g = b = a = 0; +} + +Color::Color(const Color& c) +{ + r = c.r; + g = c.g; + b = c.b; + a = c.a; +} + +Color::Color(float r, float g, float b, float a) +{ + this->r = r; + this->g = g; + this->b = b; + this->a = a; +} + +Color::Color(const Color32& c) +{ + r = c.r / 255.f; + g = c.g / 255.f; + b = c.b / 255.f; + a = c.a / 255.f; +} + +Color::~Color() +{ +} + +void Color::Set(float r, float g, float b, float a) +{ + this->r = r; + this->g = g; + this->b = b; + this->a = a; +} + +//Color Color::operator *(const Color& c) +//{ +// r *= c.r; +// g *= c.g; +// b *= c.b; +// a *= c.a; + +//} + +namespace_end +namespace_end diff --git a/source/modules/asura-core/Graphics/Color.h b/source/modules/asura-core/Graphics/Color.h new file mode 100644 index 0000000..a16f17d --- /dev/null +++ b/source/modules/asura-core/Graphics/Color.h @@ -0,0 +1,75 @@ +#ifndef _ASURA_ENGINE_COLOR_H_ +#define _ASURA_ENGINE_COLOR_H_ + +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Classes.h> + +#include "../CoreConfig.h" + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + +class Color32; + +/// +/// 淶ɫColor32иIJԡ +/// +class Color ASURA_FINAL + : public Scripting::Portable<Color> +{ +public: + + static Color Black; + static Color White; + static Color Red; + static Color Green; + static Color Blue; + + Color(); + + Color(const Color& c); + + Color(float r, float g, float b, float a); + + Color(const Color32& c); + + ~Color(); + + Color operator *(const Color& c); + + void Set(float r, float g, float b, float a); + + GET_SET(float, Red, r); + GET_SET(float, Green, g); + GET_SET(float, Blue, b); + GET_SET(float, Alpha, a); + + float r, g, b, a; + +luaxport: + + LUAX_DECL_FACTORY(Color); + + LUAX_DECL_METHOD(_ToColor32); + LUAX_DECL_METHOD(_SetColor); + LUAX_DECL_METHOD(_GetColor); + LUAX_DECL_METHOD(_GetR); + LUAX_DECL_METHOD(_GetG); + LUAX_DECL_METHOD(_GetB); + LUAX_DECL_METHOD(_GetA); + + // Ԫ + LUAX_DECL_METHOD(___eq); // __eq + LUAX_DECL_METHOD(___add); // __add + LUAX_DECL_METHOD(___sub); // __sub + LUAX_DECL_METHOD(___mul); // __mul + LUAX_DECL_METHOD(___div); // __div + +}; + +namespace_end +namespace_end + +namespace AEGraphics = AsuraEngine::Graphics; + +#endif
\ No newline at end of file diff --git a/source/modules/asura-core/Graphics/Color32.cpp b/source/modules/asura-core/Graphics/Color32.cpp new file mode 100644 index 0000000..f1f0b74 --- /dev/null +++ b/source/modules/asura-core/Graphics/Color32.cpp @@ -0,0 +1,53 @@ +#include "Color.h" +#include "Color32.h" + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + +#if ASURA_LITTLE_ENDIAN +// СˣֽڵAlphaڸߵַ +const uint32 Color32::RMASK = 0x000000ff; +const uint32 Color32::GMASK = 0x0000ff00; +const uint32 Color32::BMASK = 0x00ff0000; +const uint32 Color32::AMASK = 0xff000000; +#endif + +Color32::Color32() +{ + r = g = b = a = 0; +} + +Color32::Color32(const Color32& c) +{ + r = c.r; + g = c.g; + b = c.b; + a = c.a; +} + +Color32::Color32(const Color& c) +{ + r = 255.f * c.r; + g = 255.f * c.g; + b = 255.f * c.b; + a = 255.f * c.a; +} + +Color32::Color32(byte r, byte g, byte b, byte a) +{ + this->r = r; + this->g = g; + this->b = b; + this->a = a; +} + +void Color32::Set(const Color32& c32) +{ + r = c32.r; + g = c32.g; + b = c32.b; + a = c32.a; +} + +namespace_end +namespace_end
\ No newline at end of file diff --git a/source/modules/asura-core/Graphics/Color32.h b/source/modules/asura-core/Graphics/Color32.h new file mode 100644 index 0000000..aa445fe --- /dev/null +++ b/source/modules/asura-core/Graphics/Color32.h @@ -0,0 +1,58 @@ +#ifndef _ASURA_ENGINE_COLOR32_H__ +#define _ASURA_ENGINE_COLOR32_H__ + +#include <asura-utils/Classes.h> +#include <asura-utils/Scripting/Portable.hpp> + +#include "../CoreConfig.h" + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + +class Color; + +/// +/// 32bitsɫ +/// +class Color32 ASURA_FINAL + : public Scripting::Portable<Color32> +{ +public: + + static const uint32 RMASK; + static const uint32 GMASK; + static const uint32 BMASK; + static const uint32 AMASK; + + Color32(); + + ~Color32(); + + Color32(const Color32& c); + + Color32(const Color& c); + + Color32(byte r, byte g, byte b, byte a); + + void Set(const Color32& c32); + + byte r, g, b, a; + +luaxport: + + LUAX_DECL_FACTORY(Color32); + + LUAX_DECL_METHOD(_ToColor); + LUAX_DECL_METHOD(_SetColor); + LUAX_DECL_METHOD(_GetColor); + LUAX_DECL_METHOD(_GetRed); + LUAX_DECL_METHOD(_GetGreen); + LUAX_DECL_METHOD(_GetBlue); + LUAX_DECL_METHOD(_GetAlpha); + +}; + +namespace_end +namespace_end + +#endif
\ No newline at end of file diff --git a/source/modules/asura-core/window/window_impl_glew.cpp b/source/modules/asura-core/Graphics/ColorPalette.h index e69de29..e69de29 100644 --- a/source/modules/asura-core/window/window_impl_glew.cpp +++ b/source/modules/asura-core/Graphics/ColorPalette.h diff --git a/source/modules/asura-core/Graphics/DrawInfo.cpp b/source/modules/asura-core/Graphics/DrawInfo.cpp new file mode 100644 index 0000000..c7a6912 --- /dev/null +++ b/source/modules/asura-core/Graphics/DrawInfo.cpp @@ -0,0 +1,10 @@ +#include "DrawInfo.h" + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + + +namespace_end +namespace_end diff --git a/source/modules/asura-core/Graphics/DrawInfo.h b/source/modules/asura-core/Graphics/DrawInfo.h new file mode 100644 index 0000000..f0e375b --- /dev/null +++ b/source/modules/asura-core/Graphics/DrawInfo.h @@ -0,0 +1,18 @@ +#ifndef _ASURA_ENGINE_DRAWINFO_H_ +#define _ASURA_ENGINE_DRAWINFO_H_ + +#include <asura-utils/Classes.h> + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + +struct DrawInfo +{ + +}; + + +namespace_end +namespace_end + +#endif
\ No newline at end of file diff --git a/source/modules/asura-core/graphics/gpu_buffer.cpp b/source/modules/asura-core/Graphics/GPUBuffer.cpp index 4271b70..f28b914 100644 --- a/source/modules/asura-core/graphics/gpu_buffer.cpp +++ b/source/modules/asura-core/Graphics/GPUBuffer.cpp @@ -1,4 +1,4 @@ -#include "gpu_buffer.h" +#include "GPUBuffer.h" namespace_begin(AsuraEngine) namespace_begin(Graphics) diff --git a/source/modules/asura-core/graphics/gpu_buffer.h b/source/modules/asura-core/Graphics/GPUBuffer.h index 3153904..bb40055 100644 --- a/source/modules/asura-core/graphics/gpu_buffer.h +++ b/source/modules/asura-core/Graphics/GPUBuffer.h @@ -1,11 +1,11 @@ -#ifndef __ASURA_GPU_BUFFER_H__ -#define __ASURA_GPU_BUFFER_H__ +#ifndef _ASURA_GPU_BUFFER_H_ +#define _ASURA_GPU_BUFFER_H_ -#include <asura-utils/scripting/portable.hpp> -#include <asura-utils/exceptions/exception.h> +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Exceptions/Exception.h> #include <asura-utils/type.h> -#include "gfx_device.h" +#include "GfxDevice.h" namespace_begin(AsuraEngine) namespace_begin(Graphics) diff --git a/source/modules/asura-core/graphics/gfx_device.cpp b/source/modules/asura-core/Graphics/GfxDevice.cpp index 2751a9d..ef324e3 100644 --- a/source/modules/asura-core/graphics/gfx_device.cpp +++ b/source/modules/asura-core/Graphics/GfxDevice.cpp @@ -1,11 +1,11 @@ #include <asura-utils/type.h> -#include "../core_config.h" +#include "../CoreConfig.h" -#include "gfx_device.h" -#include "shader.h" -#include "matrix_stack.h" -#include "color.h" +#include "GfxDevice.h" +#include "Shader.h" +#include "MatrixStack.h" +#include "Color.h" using namespace AEMath; diff --git a/source/modules/asura-core/graphics/gfx_device.h b/source/modules/asura-core/Graphics/GfxDevice.h index fa22dd4..1f50b57 100644 --- a/source/modules/asura-core/graphics/gfx_device.h +++ b/source/modules/asura-core/Graphics/GfxDevice.h @@ -1,17 +1,17 @@ -#ifndef __ASURA_ENGINE_GFX_DEVICE_H__ -#define __ASURA_ENGINE_GFX_DEVICE_H__ +#ifndef _ASURA_ENGINE_GFX_DEVICE_H_ +#define _ASURA_ENGINE_GFX_DEVICE_H_ #include <stack> #include <glad/glad.h> -#include <asura-utils/scripting/portable.hpp> -#include <asura-utils/math/rect.hpp> -#include <asura-utils/math/matrix44.h> -#include <asura-utils/math/vector4.h> +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Math/Rect.hpp> +#include <asura-utils/Math/matrix44.h> +#include <asura-utils/Math/vector4.h> -#include "color.h" -#include "matrix_stack.h" +#include "Color.h" +#include "MatrixStack.h" namespace_begin(AsuraEngine) namespace_begin(Graphics) @@ -42,47 +42,47 @@ public: static GfxDevice& Get(); - int GetParam(GLParams param); + int GetParam(GLParams param); - bool Init(const AEMath::Recti& viewport); - bool Inited(); + bool Init(const AEMath::Recti& viewport); + bool Inited(); - void SetViewport(const AEMath::Recti viewport); + void SetViewport(const AEMath::Recti viewport); const AEMath::Recti& GetViewport(); - void SetMatrixMode(MatrixMode mode); + void SetMatrixMode(MatrixMode mode); MatrixMode GetMatrixMode(); - void PushMatrix(); - void PopMatrix(); + void PushMatrix(); + void PopMatrix(); - void LoadIdentity(); - void Rotate(float angle); - void Translate(float x, float y); - void Scale(float x, float y); - void Ortho(float l, float r, float b, float t, float n, float f); + void LoadIdentity(); + void Rotate(float angle); + void Translate(float x, float y); + void Scale(float x, float y); + void Ortho(float l, float r, float b, float t, float n, float f); - uint GetMatrixDepth(); - uint GetMatrixIndex(); + uint GetMatrixDepth(); + uint GetMatrixIndex(); AEMath::Matrix44& GetMatrix(MatrixMode mode); AEMath::Matrix44 GetMVPMatrix(); - void SetDrawColor(float r, float g, float b, float a); - Color& GetDrawColor(); + void SetDrawColor(float r, float g, float b, float a); + Color& GetDrawColor(); - void SetActiveCanvas(Canvas* = NULL); - Canvas* GetActiveCanvas() const; + void SetActiveCanvas(Canvas* = NULL); + Canvas* GetActiveCanvas() const; - void SetActiveShader(Shader* = NULL); - Shader* GetActiveShader() const; + void SetActiveShader(Shader* = NULL); + Shader* GetActiveShader() const; - void DrawArrays(GLenum mode, GLint first, GLsizei count); + void DrawArrays(GLenum mode, GLint first, GLsizei count); - void WipeError(); - bool HasError(); - GLenum GetError(); + void WipeError(); + bool HasError(); + GLenum GetError(); private: diff --git a/source/modules/asura-core/Graphics/Image.cpp b/source/modules/asura-core/Graphics/Image.cpp new file mode 100644 index 0000000..d2b2ec9 --- /dev/null +++ b/source/modules/asura-core/Graphics/Image.cpp @@ -0,0 +1,103 @@ +#include <asura-utils/Exceptions/Exception.h> + +#include "../CoreConfig.h" + +#include "Shader.h" +#include "Image.h" +#include "GfxDevice.h" + +using namespace AEIO; +using namespace AEImage; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + +Image::Image() + : m_Width(0) + , m_Height(0) +{ +} + +Image::~Image() +{ +} + +bool Image::Load(ImageData* imgData) +{ + if (!imgData) return false; + + if (m_TexID == 0) + { + glGenTextures(1, &m_TexID); + if (m_TexID == 0) + throw Exception("OpenGL glGenTextures failed."); + } + + glBindTexture(GL_TEXTURE_2D, m_TexID); + imgData->Lock(); + int width = imgData->width; + int height = imgData->height; + TextureFormat tf = ConvertColorFormat(imgData->format); + glTexImage2D( + GL_TEXTURE_2D + , 0 + , tf.internalformat + , width, height + , 0 + , tf.externalformat + , tf.type + , imgData->pixels + ); + + m_Width = imgData->width; + m_Height = imgData->height; + imgData->Unlock(); + GLenum err = glGetError(); + if (err != GL_NO_ERROR) + throw Exception("OpenGL glTexImage2D cause error, error code=%d", err); + glBindTexture(GL_TEXTURE_2D, 0); + + return true; +} + +bool Image::Load(ImageData* imgData, const AEMath::Vector2i& pos) +{ + if (!imgData) return false; + + glBindTexture(GL_TEXTURE_2D, m_TexID); + imgData->Lock(); + int width = imgData->width; + int height = imgData->height; + TextureFormat tf = ConvertColorFormat(imgData->format); + glTexSubImage2D( + GL_TEXTURE_2D + , 0 + , pos.x + , pos.y + , imgData->width + , imgData->height + , tf.externalformat + , tf.type + , imgData->pixels + ); + imgData->Unlock(); + GLenum err = glGetError(); + if (err != GL_NO_ERROR) + throw Exception("OpenGL glTexSubImage2D cause error, error code=%d", err); + glBindTexture(GL_TEXTURE_2D, 0); + + return true; +} + +uint32 Image::GetWidth() +{ + return m_Width; +} + +uint32 Image::GetHeight() +{ + return m_Height; +} + +namespace_end +namespace_end
\ No newline at end of file diff --git a/source/modules/asura-core/Graphics/Image.h b/source/modules/asura-core/Graphics/Image.h new file mode 100644 index 0000000..5cbfe23 --- /dev/null +++ b/source/modules/asura-core/Graphics/Image.h @@ -0,0 +1,63 @@ +#ifndef _ASURA_ENGINE_IMAGE_H_ +#define _ASURA_ENGINE_IMAGE_H_ + +// asura modules +#include <asura-utils/Math/Rect.hpp> +#include <asura-utils/Math/Vector2.hpp> +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/IO/Renewable.h> +#include <asura-utils/Stringmap.hpp> +#include <asura-utils/Manager.hpp> + +// module +#include "../Image/ImageData.h" + +// folder +#include "Color.h" +#include "Color32.h" +#include "RenderState.h" +#include "GPUBuffer.h" +#include "Texture.h" + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + +class Image ASURA_FINAL : public AEScripting::Portable<Image, Texture> +{ +public: + + Image(); + ~Image(); + + bool Load(AEImage::ImageData* decodeData); + bool Load(AEImage::ImageData* decodeData, const AEMath::Vector2i& pos); + + uint GetWidth(); + uint GetHeight(); + + GPUBuffer* GenGPUBuffer(); + +private: + + uint32 m_Width, m_Height; + +luaxport: + + LUAX_DECL_FACTORY(Image, Texture); + + LUAX_DECL_METHOD(_New); + LUAX_DECL_METHOD(_Load); + LUAX_DECL_METHOD(_GetWidth); + LUAX_DECL_METHOD(_GetHeight); + LUAX_DECL_METHOD(_GetSize); + LUAX_DECL_METHOD(_GetPixel); + LUAX_DECL_METHOD(_Render); + +}; + +namespace_end +namespace_end + +namespace AEGraphics = AsuraEngine::Graphics; + +#endif
\ No newline at end of file diff --git a/source/modules/asura-core/graphics/index_buffer.cpp b/source/modules/asura-core/Graphics/IndexBuffer.cpp index 9d7416f..bb3eea7 100644 --- a/source/modules/asura-core/graphics/index_buffer.cpp +++ b/source/modules/asura-core/Graphics/IndexBuffer.cpp @@ -1,4 +1,4 @@ -#include "index_buffer.h" +#include "IndexBuffer.h" namespace_begin(AsuraEngine) namespace_begin(Graphics) diff --git a/source/modules/asura-core/graphics/index_buffer.h b/source/modules/asura-core/Graphics/IndexBuffer.h index 538b43b..73a6f9b 100644 --- a/source/modules/asura-core/graphics/index_buffer.h +++ b/source/modules/asura-core/Graphics/IndexBuffer.h @@ -1,9 +1,9 @@ -#ifndef __ASURA_INDEX_BUFFER_H__ -#define __ASURA_INDEX_BUFFER_H__ +#ifndef _ASURA_INDEX_BUFFER_H_ +#define _ASURA_INDEX_BUFFER_H_ -#include <asura-utils/scripting/portable.hpp> +#include <asura-utils/Scripting/Portable.hpp> -#include "gpu_buffer.h" +#include "GPUBuffer.h" namespace_begin(AsuraEngine) namespace_begin(Graphics) diff --git a/source/modules/asura-core/graphics/matrix_stack.cpp b/source/modules/asura-core/Graphics/MatrixStack.cpp index eaa686f..987d29c 100644 --- a/source/modules/asura-core/graphics/matrix_stack.cpp +++ b/source/modules/asura-core/Graphics/MatrixStack.cpp @@ -1,4 +1,4 @@ -#include "matrix_stack.h" +#include "MatrixStack.h" namespace_begin(AsuraEngine) namespace_begin(Graphics) diff --git a/source/modules/asura-core/graphics/matrix_stack.h b/source/modules/asura-core/Graphics/MatrixStack.h index ad32bb4..867011e 100644 --- a/source/modules/asura-core/graphics/matrix_stack.h +++ b/source/modules/asura-core/Graphics/MatrixStack.h @@ -1,9 +1,9 @@ -#ifndef __ASURA_MATRIX_STACK_H__ -#define __ASURA_MATRIX_STACK_H__ +#ifndef _ASURA_MATRIX_STACK_H_ +#define _ASURA_MATRIX_STACK_H_ -#include <asura-utils/type.h> -#include <asura-utils/math/matrix44.h> -#include <asura-utils/classes.h> +#include <asura-utils/Type.h> +#include <asura-utils/Math/Matrix44.h> +#include <asura-utils/Classes.h> namespace_begin(AsuraEngine) namespace_begin(Graphics) diff --git a/source/modules/asura-core/window/window_impl_glew.h b/source/modules/asura-core/Graphics/Mesh2D.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-core/window/window_impl_glew.h +++ b/source/modules/asura-core/Graphics/Mesh2D.cpp diff --git a/source/modules/asura-core/Graphics/Mesh2D.h b/source/modules/asura-core/Graphics/Mesh2D.h new file mode 100644 index 0000000..1546765 --- /dev/null +++ b/source/modules/asura-core/Graphics/Mesh2D.h @@ -0,0 +1,52 @@ +#ifndef _ASURA_ENGINE_MESH2D_H__ +#define _ASURA_ENGINE_MESH2D_H__ + +// cpp +#include <vector> + +// asura modules +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Math/Vector2.hpp> + +// module +#include "../Mesh/Mesh2dData.h" + +// folder +#include "Color.h" +#include "VertexBuffer.h" +#include "IndexBuffer.h" + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + +/// +/// 2D meshһЩ㶯 +/// https://en.wikipedia.org/wiki/Polygon_mesh +/// +class Mesh2D ASURA_FINAL + : public Scripting::Portable<Mesh2D> +{ +public: + + Mesh2D(); + ~Mesh2D(); + + bool Load(AEMesh::Mesh2DData* data); + +private: + + VertexBuffer* m_VBO; ///< vertex buffer + IndexBuffer* m_IBO; ///< index buffer + +luaxport: + + LUAX_DECL_FACTORY(Mesh2D); + + LUAX_DECL_METHOD(_SetVertex); + +}; + +namespace_end +namespace_end + +#endif
\ No newline at end of file diff --git a/source/modules/asura-core/window/window_impl_glut.cpp b/source/modules/asura-core/Graphics/Quad.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-core/window/window_impl_glut.cpp +++ b/source/modules/asura-core/Graphics/Quad.cpp diff --git a/source/modules/asura-core/Graphics/Quad.h b/source/modules/asura-core/Graphics/Quad.h new file mode 100644 index 0000000..b7dd3d9 --- /dev/null +++ b/source/modules/asura-core/Graphics/Quad.h @@ -0,0 +1 @@ +// Quadrectڣrectǵıƫᣬquadһ diff --git a/source/modules/asura-core/graphics/render_state.h b/source/modules/asura-core/Graphics/RenderState.h index 9f138c0..5dcf12d 100644 --- a/source/modules/asura-core/graphics/render_state.h +++ b/source/modules/asura-core/Graphics/RenderState.h @@ -1,10 +1,10 @@ -#ifndef __ASURA_ENGINE_RENDER_STATE_H__ -#define __ASURA_ENGINE_RENDER_STATE_H__ +#ifndef _ASURA_ENGINE_RENDER_STATE_H_ +#define _ASURA_ENGINE_RENDER_STATE_H_ -#include <asura-utils/math/vector2.hpp> -#include <asura-utils/math/transform.h> +#include <asura-utils/Math/Vector2.hpp> +#include <asura-utils/Math/Transform.h> -#include "blend_mode.h" +#include "BlendMode.h" namespace_begin(AsuraEngine) namespace_begin(Graphics) diff --git a/source/modules/asura-core/window/window_impl_glut.h b/source/modules/asura-core/Graphics/RenderTarget.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-core/window/window_impl_glut.h +++ b/source/modules/asura-core/Graphics/RenderTarget.cpp diff --git a/source/modules/asura-core/graphics/render_target.h b/source/modules/asura-core/Graphics/RenderTarget.h index a52e7b0..bcd7276 100644 --- a/source/modules/asura-core/graphics/render_target.h +++ b/source/modules/asura-core/Graphics/RenderTarget.h @@ -1,12 +1,12 @@ -#ifndef __ASURA_ENGINE_RENDERTARGET_H__ -#define __ASURA_ENGINE_RENDERTARGET_H__ +#ifndef _ASURA_ENGINE_RENDERTARGET_H_ +#define _ASURA_ENGINE_RENDERTARGET_H_ -#include <asura-utils/math/vector2.hpp> -#include <asura-utils/math/rect.hpp> -#include <asura-utils/scripting/portable.hpp> +#include <asura-utils/Math/Vector2.hpp> +#include <asura-utils/Math/Rect.hpp> +#include <asura-utils/Scripting/Portable.hpp> -#include "texture.h" -#include "color.h" +#include "Texture.h" +#include "Color.h" namespace_begin(AsuraEngine) namespace_begin(Graphics) diff --git a/source/modules/asura-core/Graphics/Shader.cpp b/source/modules/asura-core/Graphics/Shader.cpp new file mode 100644 index 0000000..30e0161 --- /dev/null +++ b/source/modules/asura-core/Graphics/Shader.cpp @@ -0,0 +1,282 @@ +#include <asura-utils/Exceptions/Exception.h> + +#include "GfxDevice.h" +#include "Shader.h" + +using namespace std; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + +// texture unit +static uint8 texUnit = 0; + +Shader::Shader() +{ +} + +Shader::~Shader() +{ + if(m_VertShader) glDeleteShader(m_VertShader); + if(m_FragShader) glDeleteShader(m_FragShader); + if(m_Program) glDeleteProgram(m_Program); +} + +void Shader::SetActive(Shader* shader) +{ + g_Device.SetActiveShader(shader); +} + +Shader* Shader::GetActive() +{ + return g_Device.GetActiveShader(); +} + +bool Shader::Load(const string& vert, const string& frag) +{ + string warnning = ""; + + if (!m_Program) + { + m_Program = glCreateProgram(); + if (!m_Program) + throw Exception("Cannot create OpenGL shader program."); + } + + if (!CompileVertexShader(vert, warnning)) + { + throw Exception("Compile vertex shader failed:%s", warnning); + } + + if (!CompileFragementShader(frag, warnning)) + { + throw Exception("Compile fragment shader failed:%s", warnning); + } + + glAttachShader(m_Program, m_VertShader); + glAttachShader(m_Program, m_FragShader); + + glLinkProgram(m_Program); + GLint success; + glGetProgramiv(m_Program, GL_LINK_STATUS, &success); + if (success == GL_FALSE) + { + warnning = GetProgramWarnings(); + throw Exception("Link shader program failed:\n%s", warnning.c_str()); + } + + return true; +} + +bool Shader::CompileVertexShader(const string& vert, string& outError) +{ + if (!m_VertShader) + { + m_VertShader = glCreateShader(GL_VERTEX_SHADER); + if (!m_VertShader) + { + outError = "Cannot create OpenGL Vertex shader."; + return false; + } + } + + const GLchar* source = vert.c_str(); + GLint success; + + glShaderSource(m_VertShader, 1, &source, NULL); + glCompileShader(m_VertShader); + glGetShaderiv(m_VertShader, GL_COMPILE_STATUS, &success); + if (success == GL_FALSE) + { + outError = GetShaderWarnings(m_VertShader); + return false; + } + + return true; +} + +bool Shader::CompileFragementShader(const string& frag, string& outError) +{ + if (!m_FragShader) + { + m_FragShader = glCreateShader(GL_FRAGMENT_SHADER); + if (!m_FragShader) + { + outError = "Cannot create OpenGL fragment shader."; + return false; + } + } + + const GLchar* source = frag.c_str(); + GLint success; + + source = frag.c_str(); + glShaderSource(m_FragShader, 1, &source, NULL); + glCompileShader(m_FragShader); + glGetShaderiv(m_FragShader, GL_COMPILE_STATUS, &success); + if (success == GL_FALSE) + { + outError = GetShaderWarnings(m_FragShader); + return false; + } + + return true; +} + +void Shader::OnEnable() +{ + texUnit = 0; +} + +void Shader::OnDisable() +{ + texUnit = 0; +} + +void Shader::OnUsed() +{ + texUnit = 0; +} + +uint Shader::GetUniformLocation(const std::string& uniform) +{ + GLint loc = glGetUniformLocation(m_Program, uniform.c_str()); + return loc; +} + +bool Shader::HasUniform(const std::string& uniform) +{ + GLint loc = glGetUniformLocation(m_Program, uniform.c_str()); + return loc != -1; +} + +GLuint Shader::GetGLProgram() +{ + return m_Program; +} + +void Shader::SetUniformFloat(uint loc, float value) +{ + if(g_Device.GetActiveShader() == this) + glUniform1f(loc, value); +} + +bool Shader::SetUniformTexture(uint loc, const Texture& texture) +{ + if (g_Device.GetActiveShader() != this) + return false; + + g_Device.WipeError(); + glActiveTexture(GL_TEXTURE0 + texUnit); + if (g_Device.HasError()) + return false; + GLint tex = texture.GetGLTexture(); + glBindTexture(GL_TEXTURE_2D, tex); + if (g_Device.HasError()) + return false; + glUniform1i(loc, texUnit); + if (g_Device.HasError()) + return false; + ++texUnit; +} + +void Shader::SetUniformVector2(uint loc, const Math::Vector2f& vec2) +{ + if (g_Device.GetActiveShader() == this) + glUniform2f(loc, vec2.x, vec2.y); +} + +void Shader::SetUniformVector3(uint loc, const Math::Vector3f& vec3) +{ + if (g_Device.GetActiveShader() == this) + glUniform3f(loc, vec3.x, vec3.y, vec3.z); +} + +void Shader::SetUniformVector4(uint loc, const Math::Vector4f& vec4) +{ + if (g_Device.GetActiveShader() == this) + glUniform4f(loc, vec4.x, vec4.y, vec4.z, vec4.w); +} + +void Shader::SetUniformMatrix44(uint loc, const Math::Matrix44& mat) +{ + if (g_Device.GetActiveShader() == this) + glUniformMatrix4fv(loc, 1, GL_FALSE, mat.GetElements()); +} + +void Shader::SetUniformColor(uint loc, const Color& color) +{ + if (g_Device.GetActiveShader() == this) + glUniform4f(loc, color.r, color.g, color.b, color.a); +} + +uint Shader::GetGLTextureUnitCount() +{ + GLint maxTextureUnits; + glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &maxTextureUnits); + return (uint)maxTextureUnits; +} + +std::string Shader::GetProgramWarnings() +{ + GLint strsize, nullpos; + glGetProgramiv(m_Program, GL_INFO_LOG_LENGTH, &strsize); + + if (strsize == 0) + return ""; + + char *tempstr = new char[strsize]; + + memset(tempstr, '\0', strsize); + glGetProgramInfoLog(m_Program, strsize, &nullpos, tempstr); + tempstr[nullpos] = '\0'; + + std::string warnings(tempstr); + delete[] tempstr; + + return warnings; +} + +std::string Shader::GetShaderWarnings(GLuint shader) +{ + GLint strsize, nullpos; + glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &strsize); + + if (strsize == 0) + return ""; + + char *tempstr = new char[strsize]; + + memset(tempstr, '\0', strsize); + glGetShaderInfoLog(shader, strsize, &nullpos, tempstr); + tempstr[nullpos] = '\0'; + + std::string warnings(tempstr); + delete[] tempstr; + + return warnings; +} + +void Shader::SetAttribute(int loc, VertexBuffer* vbo, uint offseti, uint stridei, bool normalized) +{ + GLsizei offset = offseti * vbo->GetDataTypeSize(); + GLsizei stride = stridei * vbo->GetDataTypeSize(); + glEnableVertexAttribArray(loc); + vbo->Bind(); + glVertexAttribPointer(loc, 2, vbo->GetDataType(), normalized, stride, (GLvoid*)offset); + vbo->UnBind(); +} + +int Shader::GetAttributeLocation(const std::string& attribute) +{ + int loc = glGetAttribLocation(m_Program, attribute.c_str()); + return loc; +} + +void Shader::DisableAttribute(int loc) +{ + glDisableVertexAttribArray(loc); +} + +namespace_end +namespace_end
\ No newline at end of file diff --git a/source/modules/asura-core/Graphics/Shader.h b/source/modules/asura-core/Graphics/Shader.h new file mode 100644 index 0000000..c96b99f --- /dev/null +++ b/source/modules/asura-core/Graphics/Shader.h @@ -0,0 +1,117 @@ +#ifndef _ASURA_ENGINE_SHADER_H_ +#define _ASURA_ENGINE_SHADER_H_ + +#include <map> +#include <string> + +#include <asura-utils/Exceptions/Exception.h> +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/IO/Renewable.h> +#include <asura-utils/Math/Vector2.hpp> +#include <asura-utils/Math/vector3.hpp> +#include <asura-utils/Math/vector4.h> +#include <asura-utils/Math/matrix44.h> +#include <asura-utils/Stringmap.hpp> +#include <asura-utils/Manager.hpp> + +#include "GfxDevice.h" +#include "Color.h" +#include "Texture.h" +#include "VertexBuffer.h" +#include "IndexBuffer.h" + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + +/// +/// һshaderһڲʼ乲ijShaderuniformsͶݣֻṩ uniformsuseɫ +/// ķ༭ÿshaderͨshaderҵuniforms¶frameworkmaterial +/// á +/// +class Shader ASURA_FINAL + : public Scripting::Portable<Shader> + , public AEIO::Renewable +{ +public: + + Shader(); + + ~Shader(); + + static void SetActive(Shader* shader); + static Shader* GetActive(); + + bool Load(const std::string& vert, const std::string& frag) ASURA_THROW(Exception); + + // ʹSetActiveлshaderʱ + void OnEnable(); + void OnDisable(); + // Draw call֮ + void OnUsed(); + + void SetAttribute(int loc, VertexBuffer* vbo, uint offseti = 0, uint stridei = 0, bool normalized = false); + int GetAttributeLocation(const std::string& attribute); + void DisableAttribute(int loc); + + bool HasUniform(const std::string& uniform); + uint GetUniformLocation(const std::string& uniform); + void SetUniformFloat(uint loc, float value); + void SetUniformVector2(uint loc, const Math::Vector2f& vec2); + void SetUniformVector3(uint loc, const Math::Vector3f& vec3); + void SetUniformVector4(uint loc, const Math::Vector4f& vec4); + void SetUniformColor(uint loc, const Color& color); + void SetUniformMatrix44(uint loc, const Math::Matrix44& mat44); + bool SetUniformTexture(uint loc, const Texture& texture); + + float GetUniformFloat(uint loc); + AEMath::Vector2f GetUniformVector2(uint loc); + AEMath::Vector3f GetUniformVector3(uint loc); + AEMath::Vector4f GetUniformVector4s(uint loc); + AEMath::Matrix44 GetUniformMatrix44(uint loc); + + GLuint GetGLProgram(); + + static uint GetGLTextureUnitCount(); + +private: + + bool CompileVertexShader(const std::string& vert, std::string& outError); + bool CompileFragementShader(const std::string& frag, std::string& outError); + + std::string GetProgramWarnings(); + std::string GetShaderWarnings(GLuint shader); + + GLuint m_Program; + GLuint m_VertShader; + GLuint m_FragShader; + +luaxport: + + LUAX_DECL_FACTORY(Shader); + + LUAX_DECL_METHOD(_New); + LUAX_DECL_METHOD(_Load); + LUAX_DECL_METHOD(_Update); + LUAX_DECL_METHOD(_HasUniform); + LUAX_DECL_METHOD(_GetUniformLocation); + LUAX_DECL_METHOD(_SetUniformFloat); + LUAX_DECL_METHOD(_SetUniformTexture); + LUAX_DECL_METHOD(_SetUniformVector2); + LUAX_DECL_METHOD(_SetUniformVector3); + LUAX_DECL_METHOD(_SetUniformVector4); + LUAX_DECL_METHOD(_SetUniformColor); + + LUAX_DECL_METHOD(_GetAttributeLocation); + LUAX_DECL_METHOD(_SetAttribute); + LUAX_DECL_METHOD(_DisableAttribute); + + LUAX_DECL_METHOD(_SetBuiltInUniforms); + +}; + +typedef Shader GpuProgram; + +namespace_end +namespace_end + +#endif
\ No newline at end of file diff --git a/source/modules/asura-json/json_module.cpp b/source/modules/asura-core/Graphics/Shape.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-json/json_module.cpp +++ b/source/modules/asura-core/Graphics/Shape.cpp diff --git a/source/modules/asura-json/json_module.h b/source/modules/asura-core/Graphics/Shape.h index e69de29..e69de29 100644 --- a/source/modules/asura-json/json_module.h +++ b/source/modules/asura-core/Graphics/Shape.h diff --git a/source/modules/asura-network/network_module.h b/source/modules/asura-core/Graphics/SpriteBatch.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-network/network_module.h +++ b/source/modules/asura-core/Graphics/SpriteBatch.cpp diff --git a/source/modules/asura-core/graphics/sprite_batch.h b/source/modules/asura-core/Graphics/SpriteBatch.h index 7f22da0..a98d1f4 100644 --- a/source/modules/asura-core/graphics/sprite_batch.h +++ b/source/modules/asura-core/Graphics/SpriteBatch.h @@ -1,9 +1,9 @@ -#ifndef __ASURA_ENGINE_SPRITE_BATCH_H__ -#define __ASURA_ENGINE_SPRITE_BATCH_H__ +#ifndef _ASURA_ENGINE_SPRITE_BATCH_H_ +#define _ASURA_ENGINE_SPRITE_BATCH_H_ -#include <asura-utils/scripting/portable.hpp> +#include <asura-utils/Scripting/Portable.hpp> -#include "gpu_buffer.h" +#include "GPUBuffer.h" namespace_begin(AsuraEngine) namespace_begin(Graphics) diff --git a/source/modules/asura-core/Graphics/Texture.cpp b/source/modules/asura-core/Graphics/Texture.cpp new file mode 100644 index 0000000..bae0f7c --- /dev/null +++ b/source/modules/asura-core/Graphics/Texture.cpp @@ -0,0 +1,47 @@ +#include <asura-utils/Exceptions/Exception.h> + +#include "Texture.h" + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + +Texture::Texture() + : m_TexID(0) +{ +} + +Texture::~Texture() +{ + // ͷԴ + if(m_TexID != 0) + glDeleteTextures(1, &m_TexID); +} + +GLuint Texture::GetGLTexture() const +{ + return m_TexID; +} + +TextureFormat Texture::ConvertColorFormat(const ColorFormat& colorformat) +{ + TextureFormat t; + switch (colorformat) + { + case COLOR_FORMAT_RGBA8: + t.internalformat = GL_RGBA8; // 4*sizeof(byte) ~= 4 bytes + t.externalformat = GL_RGBA; + t.type = GL_UNSIGNED_BYTE; + break; + case COLOR_FORMAT_RGBA32F: + t.internalformat = GL_RGBA32F; // 4*sizeof(float) = 16 bytes + t.externalformat = GL_RGBA; + t.type = GL_FLOAT; + break; + default: + ASSERT(false); + } + return t; +} + +namespace_end +namespace_end
\ No newline at end of file diff --git a/source/modules/asura-core/Graphics/Texture.h b/source/modules/asura-core/Graphics/Texture.h new file mode 100644 index 0000000..7d37c31 --- /dev/null +++ b/source/modules/asura-core/Graphics/Texture.h @@ -0,0 +1,101 @@ +#ifndef _ASURA_TEXTURE_H_ +#define _ASURA_TEXTURE_H_ + +#include <asura-utils/Math/Vector2.hpp> +#include <asura-utils/Math/Rect.hpp> + +#include "../CoreConfig.h" + +#include "RenderState.h" +#include "GfxDevice.h" + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + +class RenderTarget; + +/// UVʽ +enum WrapMode +{ + WRAP_MODE_REPEAT, + WRAP_MODE_MIRROR, + WRAP_MODE_CLAMPTOEDGE, + WRAP_MODE_CLAMPTOBORDER, +}; + +/// ˲ģʽ +enum FilterMode +{ + FILTER_MODE_NEAREST, + FILTER_MODE_LINEAR, +}; + +/// ͼݵɫʽ +enum ColorFormat +{ + COLOR_FORMAT_UNKNOWN, + COLOR_FORMAT_RGBA8, ///< RGBA8bits int + COLOR_FORMAT_RGBA32F, ///< RGBA32bits float +}; + +/// ʽGPUڲCPUⲿʽ +struct TextureFormat +{ + GLenum internalformat; ///< GPUڲʽ + GLenum externalformat; ///< CPUⲿʽ + GLenum type; ///< ⲿʽÿchannelֵ +}; + +/// +/// 2D࣬2d meshrender targetбʹáTextureȾԭϽǣϷϲԵѿ +/// ϵΪEditorҲϽΪԭ㣬Ϊ˷㡣 +/// +ASURA_ABSTRACT class Texture : public AEScripting::Object +{ +public: + + LUAX_DECL_ABSTRACT_FACTORY(Texture); + + Texture(); + virtual ~Texture(); + + GLuint GetGLTexture() const; + + void SetFilterMode(FilterMode min, FilterMode mag); + void SetWrapMode(WrapMode wrapMode); + + void GetFilterMode(); + void GetWrapMode(); + + /// UVfilterΪ + bool IsGenMipmap(); + +protected: + + /// תcolor formatΪtexture format + TextureFormat ConvertColorFormat(const ColorFormat& colorformat); + + GLuint m_TexID; + FilterMode m_MinFilter; + FilterMode m_MagFilter; + WrapMode m_WrapMode; + bool m_IsGenMipmap; + + LUAX_DECL_ENUM(ColorFormat, 1); + LUAX_DECL_ENUM(FilterMode, 1); + LUAX_DECL_ENUM(WrapMode, 1); + + LUAX_DECL_METHOD(_SetFilterMode); + LUAX_DECL_METHOD(_SetWrapMode); + LUAX_DECL_METHOD(_GetFilterMode); + LUAX_DECL_METHOD(_GetWrapMode); + LUAX_DECL_METHOD(_IsGenMipmap); + +}; + +typedef Texture Drawable; + +namespace_end +namespace_end + +#endif
\ No newline at end of file diff --git a/source/modules/asura-core/graphics/vertex_buffer.cpp b/source/modules/asura-core/Graphics/VertexBuffer.cpp index 7fcd3d4..c44e9be 100644 --- a/source/modules/asura-core/graphics/vertex_buffer.cpp +++ b/source/modules/asura-core/Graphics/VertexBuffer.cpp @@ -1,4 +1,4 @@ -#include "vertex_buffer.h" +#include "VertexBuffer.h" namespace_begin(AsuraEngine) namespace_begin(Graphics) diff --git a/source/modules/asura-core/graphics/vertex_buffer.h b/source/modules/asura-core/Graphics/VertexBuffer.h index f0bfb9e..83e9b09 100644 --- a/source/modules/asura-core/graphics/vertex_buffer.h +++ b/source/modules/asura-core/Graphics/VertexBuffer.h @@ -1,9 +1,9 @@ -#ifndef __ASURA_VERTEX_BUFFER_H__ -#define __ASURA_VERTEX_BUFFER_H__ +#ifndef _ASURA_VERTEX_BUFFER_H_ +#define _ASURA_VERTEX_BUFFER_H_ -#include <asura-utils/scripting/portable.hpp> +#include <asura-utils/Scripting/Portable.hpp> -#include "gpu_buffer.h" +#include "GPUBuffer.h" namespace_begin(AsuraEngine) namespace_begin(Graphics) diff --git a/source/modules/asura-core/Graphics/binding/_canvas.cpp b/source/modules/asura-core/Graphics/binding/_canvas.cpp new file mode 100644 index 0000000..44841f5 --- /dev/null +++ b/source/modules/asura-core/Graphics/binding/_canvas.cpp @@ -0,0 +1,48 @@ +#include "../Canvas.h" + +using namespace std; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + LUAX_REGISTRY(Canvas) + { + LUAX_REGISTER_METHODS(state, + { "SetSize", _SetSize }, + { "Bind", _Bind }, + { "Unbind", _Unbind } + ); + } + + LUAX_POSTPROCESS(Canvas) + { + + } + + // canvas:SetSize() + LUAX_IMPL_METHOD(Canvas, _SetSize) + { + LUAX_PREPARE(L, Canvas); + return 0; + + } + + // canvas:Bind() + LUAX_IMPL_METHOD(Canvas, _Bind) + { + LUAX_PREPARE(L, Canvas); + + return 0; + } + + // canvas:Unbind() + LUAX_IMPL_METHOD(Canvas, _Unbind) + { + LUAX_PREPARE(L, Canvas); + return 0; + + } + + } +} diff --git a/source/modules/asura-core/Graphics/binding/_color.cpp b/source/modules/asura-core/Graphics/binding/_color.cpp new file mode 100644 index 0000000..008d9c2 --- /dev/null +++ b/source/modules/asura-core/Graphics/binding/_color.cpp @@ -0,0 +1,130 @@ +#include "../Color.h" + +using namespace std; +using namespace Luax; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + +LUAX_REGISTRY(Color) +{ + LUAX_REGISTER_METHODS(state, + { "ToColor32", _ToColor32 }, + { "SetColor", _SetColor }, + { "GetColor", _GetColor }, + { "GetR", _GetR }, + { "GetG", _GetG }, + { "GetB", _GetB }, + { "GetA", _GetA }, + { "__eq", ___eq }, + { "__add", ___add }, + { "__sub", ___sub }, + { "__mul", ___mul }, + { "__div", ___div } + ); +} + +LUAX_POSTPROCESS(Color) +{ + +} + +// color:ToColor32() +LUAX_IMPL_METHOD(Color, _ToColor32) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:SetColor() +LUAX_IMPL_METHOD(Color, _SetColor) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:GetColor() +LUAX_IMPL_METHOD(Color, _GetColor) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:GetR() +LUAX_IMPL_METHOD(Color, _GetR) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:GetG() +LUAX_IMPL_METHOD(Color, _GetG) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:GetB() +LUAX_IMPL_METHOD(Color, _GetB) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:GetA() +LUAX_IMPL_METHOD(Color, _GetA) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:__eq() +LUAX_IMPL_METHOD(Color, ___eq) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:__add() +LUAX_IMPL_METHOD(Color, ___add) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:__sub() +LUAX_IMPL_METHOD(Color, ___sub) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:__mul() +LUAX_IMPL_METHOD(Color, ___mul) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +// color:__div() +LUAX_IMPL_METHOD(Color, ___div) +{ + LUAX_PREPARE(L, Color); + + return 0; +} + +} +}
\ No newline at end of file diff --git a/source/modules/asura-core/Graphics/binding/_color32.cpp b/source/modules/asura-core/Graphics/binding/_color32.cpp new file mode 100644 index 0000000..7613361 --- /dev/null +++ b/source/modules/asura-core/Graphics/binding/_color32.cpp @@ -0,0 +1,66 @@ +#include "../Color32.h" + +using namespace std; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + LUAX_REGISTRY(Color32) + { + LUAX_REGISTER_METHODS(state, + { "ToColor", _ToColor }, + { "GetRed", _GetRed }, + { "GetGreen", _GetGreen }, + { "GetBlue", _GetBlue }, + { "GetAlpha", _GetAlpha } + ); + } + + LUAX_POSTPROCESS(Color32) + { + + } + + // color32:ToColor() + LUAX_IMPL_METHOD(Color32, _ToColor) + { + LUAX_PREPARE(L, Color32); + return 0; + + } + + // color32:GetRed() + LUAX_IMPL_METHOD(Color32, _GetRed) + { + LUAX_PREPARE(L, Color32); + return 0; + } + + // color32:GetGreen() + LUAX_IMPL_METHOD(Color32, _GetGreen) + { + LUAX_PREPARE(L, Color32); + + return 0; + } + + // color32:GetBlue() + LUAX_IMPL_METHOD(Color32, _GetBlue) + { + LUAX_PREPARE(L, Color32); + + return 0; + } + + // color32:GetAlpha() + LUAX_IMPL_METHOD(Color32, _GetAlpha) + { + LUAX_PREPARE(L, Color32); + + return 0; + } + + } +} +
\ No newline at end of file diff --git a/source/modules/asura-core/Graphics/binding/_gfx_device.cpp b/source/modules/asura-core/Graphics/binding/_gfx_device.cpp new file mode 100644 index 0000000..f6c2004 --- /dev/null +++ b/source/modules/asura-core/Graphics/binding/_gfx_device.cpp @@ -0,0 +1,151 @@ +#include "../GfxDevice.h" + +using namespace std; +using namespace Luax; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + LUAX_REGISTRY(GfxDevice) + { + LUAX_REGISTER_METHODS(state, + { "SetMatrixMode", _SetMatrixMode }, + { "GetMatrixMode", _GetMatrixMode }, + { "PushMatrix", _PushMatrix }, + { "PopMatrix", _PopMatrix }, + { "LoadIdentity", _LoadIdentity }, + { "Rotate", _Rotate }, + { "Translate", _Translate }, + { "Scale", _Scale }, + { "Ortho", _Ortho }, + { "GetMatrixDepth", _GetMatrixDepth }, + { "GetMatrixIndex", _GetMatrixIndex }, + { "UseShader", _UseShader }, + { "UnuseShader", _UnuseShader } + ); + } + + LUAX_POSTPROCESS(GfxDevice) + { + LUAX_REGISTER_ENUM(state, "EMatrixMode", + { "PROJECTION", MATRIX_MODE_PROJECTION }, + { "0", 0 }, + { "MODEL", MATRIX_MODE_MODEL }, + { "1", 1 }, + { "VIEW", MATRIX_MODE_VIEW }, + { "2", 2 } + ); + LUAX_REGISTER_ENUM(state, "EGLParams", + { "MAX_TEXTURE_UNIT", GL_PARAM_MAX_TEXTURE_UNIT }, + { "1", 1 } + ); + + } + + // gfxdevice:SetMatrixMode() + LUAX_IMPL_METHOD(GfxDevice, _SetMatrixMode) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:GetMatrixMode() + LUAX_IMPL_METHOD(GfxDevice, _GetMatrixMode) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:PushMatrix() + LUAX_IMPL_METHOD(GfxDevice, _PushMatrix) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:PopMatrix() + LUAX_IMPL_METHOD(GfxDevice, _PopMatrix) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:LoadIdentity() + LUAX_IMPL_METHOD(GfxDevice, _LoadIdentity) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:Rotate() + LUAX_IMPL_METHOD(GfxDevice, _Rotate) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:Translate() + LUAX_IMPL_METHOD(GfxDevice, _Translate) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:Scale() + LUAX_IMPL_METHOD(GfxDevice, _Scale) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:Ortho() + LUAX_IMPL_METHOD(GfxDevice, _Ortho) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:GetMatrixDepth() + LUAX_IMPL_METHOD(GfxDevice, _GetMatrixDepth) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:GetMatrixIndex() + LUAX_IMPL_METHOD(GfxDevice, _GetMatrixIndex) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:UseShader() + LUAX_IMPL_METHOD(GfxDevice, _UseShader) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + // gfxdevice:UnuseShader() + LUAX_IMPL_METHOD(GfxDevice, _UnuseShader) + { + LUAX_PREPARE(L, GfxDevice); + + return 0; + } + + } +} diff --git a/source/modules/asura-core/Graphics/binding/_gpu_buffer.cpp b/source/modules/asura-core/Graphics/binding/_gpu_buffer.cpp new file mode 100644 index 0000000..8c39a59 --- /dev/null +++ b/source/modules/asura-core/Graphics/binding/_gpu_buffer.cpp @@ -0,0 +1,118 @@ +#include <stdlib.h> + +#include "../image.h" +#include "../GPUBuffer.h" + +using namespace std; +using namespace Luax; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + LUAX_REGISTRY(GPUBuffer) + { + LUAX_REGISTER_METHODS(state, + { "Fill", _Fill }, + { "GetSize", _GetSize }, + { "GetCount", _GetCount } + ); + } + + LUAX_POSTPROCESS(GPUBuffer) + { + LUAX_REGISTER_ENUM(state, "EBufferType", + { "VERTEX", BUFFER_TYPE_VERTEX }, + { "INDEX", BUFFER_TYPE_INDEX } + ); + LUAX_REGISTER_ENUM(state, "EBufferUsage", + { "STREAM", BUFFER_USAGE_STREAM }, + { "DYNAMIC", BUFFER_USAGE_DYNAMIC }, + { "STATIC", BUFFER_USAGE_STATIC } + ); + LUAX_REGISTER_ENUM(state, "EBufferDataType", + { "INT", BUFFER_DATA_TYPE_INT }, + { "FLOAT", BUFFER_DATA_TYPE_FLOAT }, + { "UNSIGNED_BYTE", BUFFER_DATA_TYPE_UNSIGNED_BYTE } + ); + + } + + // buffer = GPUBuffer.New(bufferType, bufferUsage, bufferDataType, size) + // buffer = GPUBuffer.New(image) + // buffer = GPUBuffer.New(mesh2d) + // buffer = GPUBuffer.New(canvas) + // buffer = GPUBuffer.New(shape) + //LUAX_IMPL_METHOD(GPUBuffer, _New) + //{ + // LUAX_STATE(L); + + // return 0; + //} + + // gpubuffer:Fill({data_unit_list}, offseti) + // data_unit_list ݵtable + // offseti : ʼǵĵطڵ(0ʼ + LUAX_IMPL_METHOD(GPUBuffer, _Fill) + { + LUAX_PREPARE(L, GPUBuffer); + + // ʹbufferӦbufferڵһεʱʼsizeСbufferȻ䡣 + int offset = state.GetValue(3, 0); + int count = lua_objlen(L, 2); + int size = count * self->GetDataTypeSize(); + byte* data = (byte*)malloc(size); + int unit = self->GetDataTypeSize(); + int i = 1; + lua_rawgeti(L, 2, i); + while (!lua_isnil(L, -1)) + { + switch (self->m_DataType) + { + case GL_INT: + { + int n = state.CheckValue<int>(-1); + memcpy(data + (i - 1)*unit, &n, unit); + break; + } + case GL_FLOAT: + { + float n = state.CheckValue<float>(-1); + memcpy(data + (i - 1)*unit, &n, unit); + break; + } + case GL_UNSIGNED_BYTE: + { + unsigned char n = state.CheckValue<unsigned char>(-1); + memcpy(data + (i - 1)*unit, &n, unit); + break; + } + } + state.Pop(1); // value + lua_rawgeti(L, 2, ++i); + } + state.Pop(); // nil + + self->Fill(data, size, offset * unit); + + free(data); + return 0; + } + + // gpubuffer:GetSize() + LUAX_IMPL_METHOD(GPUBuffer, _GetSize) + { + LUAX_PREPARE(L, GPUBuffer); + state.Push(self->m_Size); + return 0; + } + + LUAX_IMPL_METHOD(GPUBuffer, _GetCount) + { + LUAX_PREPARE(L, GPUBuffer); + state.Push(self->m_Size / self->GetDataTypeSize()); + return 0; + } + + } +} diff --git a/source/modules/asura-core/Graphics/binding/_image.cpp b/source/modules/asura-core/Graphics/binding/_image.cpp new file mode 100644 index 0000000..0e4cb16 --- /dev/null +++ b/source/modules/asura-core/Graphics/binding/_image.cpp @@ -0,0 +1,71 @@ +#include "../image.h" + +using namespace std; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + LUAX_REGISTRY(Image) + { + LUAX_INHERIT(state, Texture); + + LUAX_REGISTER_METHODS(state, + { "New", _New }, + { "GetWidth", _GetWidth }, + { "GetHeight", _GetHeight }, + { "GetSize", _GetSize }, + { "Render", _Render } + ); + } + + LUAX_POSTPROCESS(Image) + { + } + + // image = Image.New() + LUAX_IMPL_METHOD(Image, _New) + { + LUAX_STATE(L); + Image* img = new Image(); + img->PushLuaxUserdata(state); + return 1; + } + + // width = image:GetWidth() + LUAX_IMPL_METHOD(Image, _GetWidth) + { + LUAX_PREPARE(L, Image); + state.Push(self->GetWidth()); + return 1; + } + + // height = image:GetHeight() + LUAX_IMPL_METHOD(Image, _GetHeight) + { + LUAX_PREPARE(L, Image); + state.Push(self->GetHeight()); + return 1; + } + + // width, height = image:GetSize() + LUAX_IMPL_METHOD(Image, _GetSize) + { + LUAX_PREPARE(L, Image); + int width = self->GetWidth(); + int height = self->GetHeight(); + state.Push(width); + state.Push(height); + return 2; + } + + // image:Render() + LUAX_IMPL_METHOD(Image, _Render) + { + LUAX_PREPARE(L, Image); + + return 0; + } + + } +} diff --git a/source/modules/asura-core/Graphics/binding/_index_buffer.cpp b/source/modules/asura-core/Graphics/binding/_index_buffer.cpp new file mode 100644 index 0000000..151dc98 --- /dev/null +++ b/source/modules/asura-core/Graphics/binding/_index_buffer.cpp @@ -0,0 +1,31 @@ +#include "../IndexBuffer.h" + +using namespace std; +using namespace Luax; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + LUAX_REGISTRY(IndexBuffer) + { + LUAX_REGISTER_METHODS(state, + { "New", _New } + ); + } + + LUAX_POSTPROCESS(IndexBuffer) + { + + } + + // IndexBuffer.New() + LUAX_IMPL_METHOD(IndexBuffer, _New) + { + LUAX_STATE(L); + + return 0; + } + + } +} diff --git a/source/modules/asura-core/Graphics/binding/_mesh2d.cpp b/source/modules/asura-core/Graphics/binding/_mesh2d.cpp new file mode 100644 index 0000000..4e3f426 --- /dev/null +++ b/source/modules/asura-core/Graphics/binding/_mesh2d.cpp @@ -0,0 +1,20 @@ +#include "../mesh2d.h" + +using namespace std; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + LUAX_REGISTRY(Mesh2D) + { + + } + + LUAX_POSTPROCESS(Mesh2D) + { + + } + + } +} diff --git a/source/modules/asura-core/Graphics/binding/_shader.cpp b/source/modules/asura-core/Graphics/binding/_shader.cpp new file mode 100644 index 0000000..85fd388 --- /dev/null +++ b/source/modules/asura-core/Graphics/binding/_shader.cpp @@ -0,0 +1,131 @@ +#include "../shader.h" + +using namespace std; +using namespace Luax; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + LUAX_REGISTRY(Shader) + { + LUAX_REGISTER_METHODS(state, + { "New", _New }, + { "Load", _Load }, + { "Update", _Update }, + { "HasUniform", _HasUniform }, + { "GetUniformLocation", _GetUniformLocation }, + { "SetBuiltInUniforms", _SetBuiltInUniforms }, + { "SetUniformFloat", _SetUniformFloat }, + { "SetUniformTexture", _SetUniformTexture }, + { "SetUniformVector2", _SetUniformVector2 }, + { "SetUniformVector3", _SetUniformVector3 }, + { "SetUniformVector4", _SetUniformVector4 }, + { "SetUniformColor", _SetUniformColor }, + { "SetBuiltInUniforms", _SetBuiltInUniforms } + ); + } + + LUAX_POSTPROCESS(Shader) + { + + } + + // Shader.New() + LUAX_IMPL_METHOD(Shader, _New) + { + LUAX_STATE(L); + + return 0; + } + + // shader:Load() + LUAX_IMPL_METHOD(Shader, _Load) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + // shader:Update() + LUAX_IMPL_METHOD(Shader, _Update) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + // shader:HasUniform() + LUAX_IMPL_METHOD(Shader, _HasUniform) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + // shader:GetUniformLocation() + LUAX_IMPL_METHOD(Shader, _GetUniformLocation) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + // shader:SetBuiltInUniforms() + LUAX_IMPL_METHOD(Shader, _SetBuiltInUniforms) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + // shader:SetUniformFloat() + LUAX_IMPL_METHOD(Shader, _SetUniformFloat) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + // shader:SetUniformTexture() + LUAX_IMPL_METHOD(Shader, _SetUniformTexture) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + // shader:SetUniformVector2() + LUAX_IMPL_METHOD(Shader, _SetUniformVector2) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + // shader:SetUniformVector3() + LUAX_IMPL_METHOD(Shader, _SetUniformVector3) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + // shader:SetUniformVector4() + LUAX_IMPL_METHOD(Shader, _SetUniformVector4) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + // shader:SetUniformColor() + LUAX_IMPL_METHOD(Shader, _SetUniformColor) + { + LUAX_PREPARE(L, Shader); + + return 0; + } + + } +} diff --git a/source/modules/asura-core/Graphics/binding/_sprite_batch.cpp b/source/modules/asura-core/Graphics/binding/_sprite_batch.cpp new file mode 100644 index 0000000..6b7d25c --- /dev/null +++ b/source/modules/asura-core/Graphics/binding/_sprite_batch.cpp @@ -0,0 +1,20 @@ +#include "../SpriteBatch.h" + +using namespace std; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + LUAX_REGISTRY(SpriteBatch) + { + + } + + LUAX_POSTPROCESS(SpriteBatch) + { + + } + + } +} diff --git a/source/modules/asura-core/Graphics/binding/_texture.cpp b/source/modules/asura-core/Graphics/binding/_texture.cpp new file mode 100644 index 0000000..f5e5f17 --- /dev/null +++ b/source/modules/asura-core/Graphics/binding/_texture.cpp @@ -0,0 +1,85 @@ +#include "../texture.h" + +using namespace std; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + LUAX_REGISTRY(Texture) + { + LUAX_REGISTER_METHODS(state, + { "SetFilterMode", _SetFilterMode }, + { "SetWrapMode", _SetWrapMode }, + { "GetFilterMode", _GetFilterMode }, + { "GetWrapMode", _GetWrapMode }, + { "IsGenMipmap", _IsGenMipmap } + ); + } + + LUAX_POSTPROCESS(Texture) + { + LUAX_REGISTER_ENUM(state, "EColorFormat", + { "UNKNOWN", COLOR_FORMAT_UNKNOWN }, + { "RGBA8", COLOR_FORMAT_RGBA8 }, + { "RGBA32F", COLOR_FORMAT_RGBA32F } + ); + LUAX_REGISTER_ENUM(state, "EFilterMode", + { "NEAREST", FILTER_MODE_NEAREST }, + { "LINEAR", FILTER_MODE_LINEAR } + ); + LUAX_REGISTER_ENUM(state, "EWrapMode", + { "REPEAT", WRAP_MODE_REPEAT }, + { "MIRROR", WRAP_MODE_MIRROR }, + { "CLAMPTOEDGE", WRAP_MODE_CLAMPTOEDGE }, + { "CLAMPTOBORDER", WRAP_MODE_CLAMPTOBORDER } + ); + + } + + // texture:SetFilterMode(minFilter, magFilter) + LUAX_IMPL_METHOD(Texture, _SetFilterMode) + { + LUAX_PREPARE(L, Texture); + FilterMode min = (FilterMode)state.CheckValue<int>(2); + FilterMode mag = (FilterMode)state.CheckValue<int>(3); + self->SetFilterMode(min, mag); + return 0; + } + + // texture:SetWrapMode(wrap_mode) + LUAX_IMPL_METHOD(Texture, _SetWrapMode) + { + LUAX_PREPARE(L, Texture); + WrapMode wrap_mode = (WrapMode)state.CheckValue<int>(2); + self->SetWrapMode(wrap_mode); + return 0; + } + + // min, mag = texture:GetFilterMode() + LUAX_IMPL_METHOD(Texture, _GetFilterMode) + { + LUAX_PREPARE(L, Texture); + state.Push((int)self->m_MinFilter); + state.Push((int)self->m_MagFilter); + return 2; + } + + // wrapmode= texture:GetWrapMode() + LUAX_IMPL_METHOD(Texture, _GetWrapMode) + { + LUAX_PREPARE(L, Texture); + state.Push((int)self->m_WrapMode); + return 1; + } + + // texture:IsGenMipmap() + LUAX_IMPL_METHOD(Texture, _IsGenMipmap) + { + LUAX_PREPARE(L, Texture); + state.Push(self->IsGenMipmap()); + return 1; + } + + } +}
\ No newline at end of file diff --git a/source/modules/asura-core/Graphics/binding/_vertex_buffer.cpp b/source/modules/asura-core/Graphics/binding/_vertex_buffer.cpp new file mode 100644 index 0000000..8ed487b --- /dev/null +++ b/source/modules/asura-core/Graphics/binding/_vertex_buffer.cpp @@ -0,0 +1,38 @@ +#include "../VertexBuffer.h" + +using namespace std; +using namespace Luax; + +namespace_begin(AsuraEngine) +namespace_begin(Graphics) + + + LUAX_REGISTRY(VertexBuffer) + { + LUAX_REGISTER_METHODS(state, + { "New", _New } + ); + } + + LUAX_POSTPROCESS(VertexBuffer) + { + + } + + // vbo = VertexBuffer.New(usage, data_type, count) + LUAX_IMPL_METHOD(VertexBuffer, _New) + { + LUAX_STATE(L); + + BufferUsage usage = (BufferUsage)state.CheckValue<uint>(1); + BufferDataType datatype = (BufferDataType)state.CheckValue<uint>(2); + uint count = state.CheckValue<uint>(3); + + VertexBuffer* vbo = new VertexBuffer(usage, datatype, count * GPUBuffer::GetDataTypeSize(datatype)); + vbo->PushLuaxUserdata(state); + + return 1; + } + + } +} diff --git a/source/modules/asura-core/image/image_data.cpp b/source/modules/asura-core/Image/ImageData.cpp index 1de70cd..c75166f 100644 --- a/source/modules/asura-core/image/image_data.cpp +++ b/source/modules/asura-core/Image/ImageData.cpp @@ -1,7 +1,7 @@ -#include "image_data.h" -#include "png_decoder.h" -#include "stb_decoder.h" -#include "image_decoder.h" +#include "ImageData.h" +#include "PngDecoder.h" +#include "StbDecoder.h" +#include "ImageDecoder.h" using namespace std; diff --git a/source/modules/asura-core/image/image_data.h b/source/modules/asura-core/Image/ImageData.h index 93e3448..cd2fe1a 100644 --- a/source/modules/asura-core/image/image_data.h +++ b/source/modules/asura-core/Image/ImageData.h @@ -1,16 +1,16 @@ -#ifndef __ASURA_ENGINE_IMAGEDATA_H__ -#define __ASURA_ENGINE_IMAGEDATA_H__ +#ifndef _ASURA_ENGINE_IMAGEDATA_H_ +#define _ASURA_ENGINE_IMAGEDATA_H_ #include <list> -#include <asura-utils/scripting/portable.hpp> -#include <asura-utils/io/decoded_data.h> -#include <asura-utils/io/data_buffer.h> -#include <asura-utils/threading/thread.h> -#include <asura-utils/threading/mutex.h> +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/IO/DecodedData.h> +#include <asura-utils/IO/DataBuffer.h> +#include <asura-utils/Threads/Thread.h> +#include <asura-utils/Threads/Mutex.h> -#include "../graphics/texture.h" -#include "../graphics/color.h" +#include "../Graphics/Texture.h" +#include "../Graphics/Color.h" namespace_begin(AsuraEngine) namespace_begin(Image) diff --git a/source/modules/asura-core/image/image_decode_task.cpp b/source/modules/asura-core/Image/ImageDecodeTask.cpp index 3cadb43..16c166e 100644 --- a/source/modules/asura-core/image/image_decode_task.cpp +++ b/source/modules/asura-core/Image/ImageDecodeTask.cpp @@ -1,4 +1,4 @@ -#include "image_decode_task.h" +#include "ImageDecodeTask.h" namespace_begin(AsuraEngine) namespace_begin(Image) diff --git a/source/modules/asura-core/image/image_decode_task.h b/source/modules/asura-core/Image/ImageDecodeTask.h index 3726514..74ecf24 100644 --- a/source/modules/asura-core/image/image_decode_task.h +++ b/source/modules/asura-core/Image/ImageDecodeTask.h @@ -1,9 +1,9 @@ -#ifndef __ASURA_IMAGE_DECODE_TASK_H__ -#define __ASURA_IMAGE_DECODE_TASK_H__ +#ifndef _ASURA_IMAGE_DECODE_TASK_H_ +#define _ASURA_IMAGE_DECODE_TASK_H_ -#include <asura-utils/threading/task.h> -#include <asura-utils/scripting/portable.hpp> -#include <asura-utils/classes.h> +#include <asura-utils/Threads/task.h> +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Classes.h> namespace_begin(AsuraEngine) namespace_begin(Image) diff --git a/source/modules/asura-core/image/image_decoder.h b/source/modules/asura-core/Image/ImageDecoder.h index 30e65d3..7de92d6 100644 --- a/source/modules/asura-core/image/image_decoder.h +++ b/source/modules/asura-core/Image/ImageDecoder.h @@ -1,9 +1,9 @@ -#ifndef __ASURA_ENGINE_IMAGE_DECODER_H__ -#define __ASURA_ENGINE_IMAGE_DECODER_H__ +#ifndef _ASURA_ENGINE_IMAGE_DECODER_H_ +#define _ASURA_ENGINE_IMAGE_DECODER_H_ -#include <asura-utils/io/data_buffer.h> +#include <asura-utils/IO/DataBuffer.h> -#include "image_data.h" +#include "ImageData.h" namespace_begin(AsuraEngine) namespace_begin(Image) diff --git a/source/modules/asura-core/image/png_decoder.cpp b/source/modules/asura-core/Image/PngDecoder.cpp index bf33959..618c16e 100644 --- a/source/modules/asura-core/image/png_decoder.cpp +++ b/source/modules/asura-core/Image/PngDecoder.cpp @@ -1,4 +1,4 @@ -#include "png_decoder.h" +#include "PngDecoder.h" namespace_begin(AsuraEngine) namespace_begin(Image) diff --git a/source/modules/asura-core/image/png_decoder.h b/source/modules/asura-core/Image/PngDecoder.h index af67186..b6ea3ba 100644 --- a/source/modules/asura-core/image/png_decoder.h +++ b/source/modules/asura-core/Image/PngDecoder.h @@ -1,7 +1,7 @@ -#ifndef __ASURA_ENGINE_PNGDECODER_H__ -#define __ASURA_ENGINE_PNGDECODER_H__ +#ifndef _ASURA_ENGINE_PNGDECODER_H_ +#define _ASURA_ENGINE_PNGDECODER_H_ -#include "image_decoder.h" +#include "ImageDecoder.h" namespace_begin(AsuraEngine) namespace_begin(Image) diff --git a/source/modules/asura-core/image/stb_decoder.cpp b/source/modules/asura-core/Image/StbDecoder.cpp index ed61aa4..8d3537c 100644 --- a/source/modules/asura-core/image/stb_decoder.cpp +++ b/source/modules/asura-core/Image/StbDecoder.cpp @@ -1,6 +1,6 @@ -#include <asura-utils/exceptions/exception.h> +#include <asura-utils/Exceptions/Exception.h> -#include "stb_decoder.h" +#include "StbDecoder.h" #define STB_IMAGE_IMPLEMENTATION #include <stb/stb_image.h> diff --git a/source/modules/asura-core/image/stb_decoder.h b/source/modules/asura-core/Image/StbDecoder.h index 6158b21..a86073a 100644 --- a/source/modules/asura-core/image/stb_decoder.h +++ b/source/modules/asura-core/Image/StbDecoder.h @@ -1,7 +1,7 @@ -#ifndef __ASURA_ENGINE_STBDECODER_H__ -#define __ASURA_ENGINE_STBDECODER_H__ +#ifndef _ASURA_ENGINE_STBDECODER_H_ +#define _ASURA_ENGINE_STBDECODER_H_ -#include "image_decoder.h" +#include "ImageDecoder.h" namespace_begin(AsuraEngine) namespace_begin(Image) diff --git a/source/modules/asura-core/Image/binding/_image_data.cpp b/source/modules/asura-core/Image/binding/_image_data.cpp new file mode 100644 index 0000000..77f3a96 --- /dev/null +++ b/source/modules/asura-core/Image/binding/_image_data.cpp @@ -0,0 +1,108 @@ +#include <asura-utils/Threads/Thread.h> +#include <asura-utils/IO/DataBuffer.h> + +#include "../ImageData.h" + +using namespace std; +using namespace AEThreading; +using namespace AEIO; + +namespace_begin(AsuraEngine) +namespace_begin(Image) +LUAX_REGISTRY(ImageData) + { + LUAX_REGISTER_METHODS(state, + { "New", _New }, + { "GetPixel", _GetPixel }, + { "GetSize", _GetSize }, + { "GetWidth", _GetWidth }, + { "GetHeight", _GetHeight }, + { "GetPixelFormat", _GetPixelFormat }, + { "Decode", _Decode }, + { "DecodeAsync", _DecodeAsync }, + { "IsAvailable", _IsAvailable } + ); + } + + LUAX_POSTPROCESS(ImageData) + { + + } + + // ImageData.New() + LUAX_IMPL_METHOD(ImageData, _New) + { + LUAX_STATE(L); + + return 0; + } + + // imagedata:GetPixel() + LUAX_IMPL_METHOD(ImageData, _GetPixel) + { + LUAX_PREPARE(L, ImageData); + + return 0; + } + + // imagedata:GetSize() + LUAX_IMPL_METHOD(ImageData, _GetSize) + { + LUAX_PREPARE(L, ImageData); + + return 0; + } + + // imagedata:GetWidth() + LUAX_IMPL_METHOD(ImageData, _GetWidth) + { + LUAX_PREPARE(L, ImageData); + + return 0; + } + + // imagedata:GetHeight() + LUAX_IMPL_METHOD(ImageData, _GetHeight) + { + LUAX_PREPARE(L, ImageData); + + return 0; + } + + // imagedata:GetPixelFormat() + LUAX_IMPL_METHOD(ImageData, _GetPixelFormat) + { + LUAX_PREPARE(L, ImageData); + + return 0; + } + + // imagedata:Decode() + LUAX_IMPL_METHOD(ImageData, _Decode) + { + LUAX_PREPARE(L, ImageData); + + return 0; + } + + // imagedata:DecodeAsync(thread, databuffer, callback) + LUAX_IMPL_METHOD(ImageData, _DecodeAsync) + { + LUAX_PREPARE(L, ImageData); + + Thread* thread = state.CheckUserdata<Thread>(2); + DataBuffer* buffer = state.CheckUserdata<DataBuffer>(3); + + return 0; + } + + // imagedata:IsAvailable() + LUAX_IMPL_METHOD(ImageData, _IsAvailable) + { + LUAX_PREPARE(L, ImageData); + + return 0; + } + + } +} diff --git a/source/modules/asura-core/Image/binding/_image_decode_task.cpp b/source/modules/asura-core/Image/binding/_image_decode_task.cpp new file mode 100644 index 0000000..3c8ed4b --- /dev/null +++ b/source/modules/asura-core/Image/binding/_image_decode_task.cpp @@ -0,0 +1,19 @@ +#include "../ImageDecodeTask.h" + +using namespace std; + +namespace_begin(AsuraEngine) +namespace_begin(Image) + +LUAX_REGISTRY(ImageDecodeTask) +{ + +} + +LUAX_POSTPROCESS(ImageDecodeTask) +{ + +} + +} +} diff --git a/source/modules/asura-core/Input/Button.h b/source/modules/asura-core/Input/Button.h new file mode 100644 index 0000000..5c3c0de --- /dev/null +++ b/source/modules/asura-core/Input/Button.h @@ -0,0 +1,31 @@ +#ifndef __BUTTON_H__ +#define __BUTTON_H__ + +#include <asura-utils/Classes.h> + +namespace_begin(AsuraEngine) +namespace_begin(Input) + +/// keyboard button \ mouse button \ joystick button +class Button +{ +public: + inline Button(int key, bool state) : + key(key), + state(state) + { + } + + inline int GetKey(void) const { return this->key; } + inline bool GetState(void) const { return this->state; } + +private: + int key; + bool state; + +}; + +namespace_end +namespace_end + +#endif
\ No newline at end of file diff --git a/source/modules/asura-openal/audio/mpg123_decoder.cpp b/source/modules/asura-core/Input/ClipBoard.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-openal/audio/mpg123_decoder.cpp +++ b/source/modules/asura-core/Input/ClipBoard.cpp diff --git a/source/modules/asura-openal/audio/mpg123_decoder.h b/source/modules/asura-core/Input/ClipBoard.h index e69de29..e69de29 100644 --- a/source/modules/asura-openal/audio/mpg123_decoder.h +++ b/source/modules/asura-core/Input/ClipBoard.h diff --git a/source/modules/asura-openal/audio/sound_data.cpp b/source/modules/asura-core/Input/InputDevice.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-openal/audio/sound_data.cpp +++ b/source/modules/asura-core/Input/InputDevice.cpp diff --git a/source/modules/asura-core/input/input_device.h b/source/modules/asura-core/Input/InputDevice.h index 1c116e6..39f3d37 100644 --- a/source/modules/asura-core/input/input_device.h +++ b/source/modules/asura-core/Input/InputDevice.h @@ -1,13 +1,13 @@ -#ifndef __ASURA_ENGINE_INPUT_BASE_H__ -#define __ASURA_ENGINE_INPUT_BASE_H__ +#ifndef _ASURA_ENGINE_INPUT_BASE_H_ +#define _ASURA_ENGINE_INPUT_BASE_H_ -#include <asura-utils/math/vector2.hpp> -#include <asura-utils/scripting/portable.hpp> -#include <asura-utils/singleton.hpp> +#include <asura-utils/Math/Vector2.hpp> +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Singleton.hpp> -#include "../core_config.h" +#include "../CoreConfig.h" -#include "keyboard_state.h" +#include "KeyboardState.h" namespace_begin(AsuraEngine) namespace_begin(Input) diff --git a/source/modules/asura-openal/audio/sound_data.h b/source/modules/asura-core/Input/InputManager.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-openal/audio/sound_data.h +++ b/source/modules/asura-core/Input/InputManager.cpp diff --git a/source/modules/asura-core/input/input_manager.h b/source/modules/asura-core/Input/InputManager.h index 7e24b4e..dd11b2f 100644 --- a/source/modules/asura-core/input/input_manager.h +++ b/source/modules/asura-core/Input/InputManager.h @@ -1,9 +1,9 @@ #ifndef __INPUT_MAMANGER_H__ #define __INPUT_MAMANGER_H__ -#include <asura-utils/scripting/portable.hpp> -#include <asura-utils/singleton.hpp> -#include <asura-utils/classes.h> +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Singleton.hpp> +#include <asura-utils/Classes.h> namespace_begin(AsuraEngine) namespace_begin(Input) diff --git a/source/modules/asura-openal/audio/sound_decode_task.cpp b/source/modules/asura-core/Input/JoystickState.h index e69de29..e69de29 100644 --- a/source/modules/asura-openal/audio/sound_decode_task.cpp +++ b/source/modules/asura-core/Input/JoystickState.h diff --git a/source/modules/asura-core/input/keyboard_state.h b/source/modules/asura-core/Input/KeyboardState.h index 5c43dff..96d22e7 100644 --- a/source/modules/asura-core/input/keyboard_state.h +++ b/source/modules/asura-core/Input/KeyboardState.h @@ -3,7 +3,7 @@ #include <vector> -#include "button.h" +#include "Button.h" namespace_begin(AsuraEngine) namespace_begin(Input) diff --git a/source/modules/asura-core/Input/Keys.h b/source/modules/asura-core/Input/Keys.h new file mode 100644 index 0000000..8f04dc2 --- /dev/null +++ b/source/modules/asura-core/Input/Keys.h @@ -0,0 +1,482 @@ + +/** +* Keyboard keys. They are dependent on the current layout of the keyboard. +**/ +enum Key +{ + KEY_UNKNOWN, + + KEY_RETURN, + KEY_ESCAPE, + KEY_BACKSPACE, + KEY_TAB, + KEY_SPACE, + KEY_EXCLAIM, + KEY_QUOTEDBL, + KEY_HASH, + KEY_PERCENT, + KEY_DOLLAR, + KEY_AMPERSAND, + KEY_QUOTE, + KEY_LEFTPAREN, + KEY_RIGHTPAREN, + KEY_ASTERISK, + KEY_PLUS, + KEY_COMMA, + KEY_MINUS, + KEY_PERIOD, + KEY_SLASH, + KEY_0, + KEY_1, + KEY_2, + KEY_3, + KEY_4, + KEY_5, + KEY_6, + KEY_7, + KEY_8, + KEY_9, + KEY_COLON, + KEY_SEMICOLON, + KEY_LESS, + KEY_EQUALS, + KEY_GREATER, + KEY_QUESTION, + KEY_AT, + + KEY_LEFTBRACKET, + KEY_BACKSLASH, + KEY_RIGHTBRACKET, + KEY_CARET, + KEY_UNDERSCORE, + KEY_BACKQUOTE, + KEY_A, + KEY_B, + KEY_C, + KEY_D, + KEY_E, + KEY_F, + KEY_G, + KEY_H, + KEY_I, + KEY_J, + KEY_K, + KEY_L, + KEY_M, + KEY_N, + KEY_O, + KEY_P, + KEY_Q, + KEY_R, + KEY_S, + KEY_T, + KEY_U, + KEY_V, + KEY_W, + KEY_X, + KEY_Y, + KEY_Z, + + KEY_CAPSLOCK, + + KEY_F1, + KEY_F2, + KEY_F3, + KEY_F4, + KEY_F5, + KEY_F6, + KEY_F7, + KEY_F8, + KEY_F9, + KEY_F10, + KEY_F11, + KEY_F12, + + KEY_PRINTSCREEN, + KEY_SCROLLLOCK, + KEY_PAUSE, + KEY_INSERT, + KEY_HOME, + KEY_PAGEUP, + KEY_DELETE, + KEY_END, + KEY_PAGEDOWN, + KEY_RIGHT, + KEY_LEFT, + KEY_DOWN, + KEY_UP, + + KEY_NUMLOCKCLEAR, + KEY_KP_DIVIDE, + KEY_KP_MULTIPLY, + KEY_KP_MINUS, + KEY_KP_PLUS, + KEY_KP_ENTER, + KEY_KP_1, + KEY_KP_2, + KEY_KP_3, + KEY_KP_4, + KEY_KP_5, + KEY_KP_6, + KEY_KP_7, + KEY_KP_8, + KEY_KP_9, + KEY_KP_0, + KEY_KP_PERIOD, + KEY_KP_COMMA, + KEY_KP_EQUALS, + + KEY_APPLICATION, + KEY_POWER, + KEY_F13, + KEY_F14, + KEY_F15, + KEY_F16, + KEY_F17, + KEY_F18, + KEY_F19, + KEY_F20, + KEY_F21, + KEY_F22, + KEY_F23, + KEY_F24, + KEY_EXECUTE, + KEY_HELP, + KEY_MENU, + KEY_SELECT, + KEY_STOP, + KEY_AGAIN, + KEY_UNDO, + KEY_CUT, + KEY_COPY, + KEY_PASTE, + KEY_FIND, + KEY_MUTE, + KEY_VOLUMEUP, + KEY_VOLUMEDOWN, + + KEY_ALTERASE, + KEY_SYSREQ, + KEY_CANCEL, + KEY_CLEAR, + KEY_PRIOR, + KEY_RETURN2, + KEY_SEPARATOR, + KEY_OUT, + KEY_OPER, + KEY_CLEARAGAIN, + + KEY_THOUSANDSSEPARATOR, + KEY_DECIMALSEPARATOR, + KEY_CURRENCYUNIT, + KEY_CURRENCYSUBUNIT, + + KEY_LCTRL, + KEY_LSHIFT, + KEY_LALT, + KEY_LGUI, + KEY_RCTRL, + KEY_RSHIFT, + KEY_RALT, + KEY_RGUI, + + KEY_MODE, + + KEY_AUDIONEXT, + KEY_AUDIOPREV, + KEY_AUDIOSTOP, + KEY_AUDIOPLAY, + KEY_AUDIOMUTE, + KEY_MEDIASELECT, + KEY_WWW, + KEY_MAIL, + KEY_CALCULATOR, + KEY_COMPUTER, + KEY_APP_SEARCH, + KEY_APP_HOME, + KEY_APP_BACK, + KEY_APP_FORWARD, + KEY_APP_STOP, + KEY_APP_REFRESH, + KEY_APP_BOOKMARKS, + + KEY_BRIGHTNESSDOWN, + KEY_BRIGHTNESSUP, + KEY_DISPLAYSWITCH, + KEY_KBDILLUMTOGGLE, + KEY_KBDILLUMDOWN, + KEY_KBDILLUMUP, + KEY_EJECT, + KEY_SLEEP, + + KEY_MAX_ENUM +}; + +/** +* Scancodes represent physical keys independent of the current layout. +* Their names may not match the names of the keys printed on the keyboard. +* Some of them are very esoteric... +**/ +enum Scancode +{ + SCANCODE_UNKNOWN, + + SCANCODE_A, + SCANCODE_B, + SCANCODE_C, + SCANCODE_D, + SCANCODE_E, + SCANCODE_F, + SCANCODE_G, + SCANCODE_H, + SCANCODE_I, + SCANCODE_J, + SCANCODE_K, + SCANCODE_L, + SCANCODE_M, + SCANCODE_N, + SCANCODE_O, + SCANCODE_P, + SCANCODE_Q, + SCANCODE_R, + SCANCODE_S, + SCANCODE_T, + SCANCODE_U, + SCANCODE_V, + SCANCODE_W, + SCANCODE_X, + SCANCODE_Y, + SCANCODE_Z, + + SCANCODE_1, + SCANCODE_2, + SCANCODE_3, + SCANCODE_4, + SCANCODE_5, + SCANCODE_6, + SCANCODE_7, + SCANCODE_8, + SCANCODE_9, + SCANCODE_0, + + SCANCODE_RETURN, + SCANCODE_ESCAPE, + SCANCODE_BACKSPACE, + SCANCODE_TAB, + SCANCODE_SPACE, + + SCANCODE_MINUS, + SCANCODE_EQUALS, + SCANCODE_LEFTBRACKET, + SCANCODE_RIGHTBRACKET, + SCANCODE_BACKSLASH, + SCANCODE_NONUSHASH, + SCANCODE_SEMICOLON, + SCANCODE_APOSTROPHE, + SCANCODE_GRAVE, + SCANCODE_COMMA, + SCANCODE_PERIOD, + SCANCODE_SLASH, + + SCANCODE_CAPSLOCK, + + SCANCODE_F1, + SCANCODE_F2, + SCANCODE_F3, + SCANCODE_F4, + SCANCODE_F5, + SCANCODE_F6, + SCANCODE_F7, + SCANCODE_F8, + SCANCODE_F9, + SCANCODE_F10, + SCANCODE_F11, + SCANCODE_F12, + + SCANCODE_PRINTSCREEN, + SCANCODE_SCROLLLOCK, + SCANCODE_PAUSE, + SCANCODE_INSERT, + SCANCODE_HOME, + SCANCODE_PAGEUP, + SCANCODE_DELETE, + SCANCODE_END, + SCANCODE_PAGEDOWN, + SCANCODE_RIGHT, + SCANCODE_LEFT, + SCANCODE_DOWN, + SCANCODE_UP, + + SCANCODE_NUMLOCKCLEAR, + SCANCODE_KP_DIVIDE, + SCANCODE_KP_MULTIPLY, + SCANCODE_KP_MINUS, + SCANCODE_KP_PLUS, + SCANCODE_KP_ENTER, + SCANCODE_KP_1, + SCANCODE_KP_2, + SCANCODE_KP_3, + SCANCODE_KP_4, + SCANCODE_KP_5, + SCANCODE_KP_6, + SCANCODE_KP_7, + SCANCODE_KP_8, + SCANCODE_KP_9, + SCANCODE_KP_0, + SCANCODE_KP_PERIOD, + + SCANCODE_NONUSBACKSLASH, + SCANCODE_APPLICATION, + SCANCODE_POWER, + SCANCODE_KP_EQUALS, + SCANCODE_F13, + SCANCODE_F14, + SCANCODE_F15, + SCANCODE_F16, + SCANCODE_F17, + SCANCODE_F18, + SCANCODE_F19, + SCANCODE_F20, + SCANCODE_F21, + SCANCODE_F22, + SCANCODE_F23, + SCANCODE_F24, + SCANCODE_EXECUTE, + SCANCODE_HELP, + SCANCODE_MENU, + SCANCODE_SELECT, + SCANCODE_STOP, + SCANCODE_AGAIN, + SCANCODE_UNDO, + SCANCODE_CUT, + SCANCODE_COPY, + SCANCODE_PASTE, + SCANCODE_FIND, + SCANCODE_MUTE, + SCANCODE_VOLUMEUP, + SCANCODE_VOLUMEDOWN, + SCANCODE_KP_COMMA, + SCANCODE_KP_EQUALSAS400, + + SCANCODE_INTERNATIONAL1, + SCANCODE_INTERNATIONAL2, + SCANCODE_INTERNATIONAL3, + SCANCODE_INTERNATIONAL4, + SCANCODE_INTERNATIONAL5, + SCANCODE_INTERNATIONAL6, + SCANCODE_INTERNATIONAL7, + SCANCODE_INTERNATIONAL8, + SCANCODE_INTERNATIONAL9, + SCANCODE_LANG1, + SCANCODE_LANG2, + SCANCODE_LANG3, + SCANCODE_LANG4, + SCANCODE_LANG5, + SCANCODE_LANG6, + SCANCODE_LANG7, + SCANCODE_LANG8, + SCANCODE_LANG9, + + SCANCODE_ALTERASE, + SCANCODE_SYSREQ, + SCANCODE_CANCEL, + SCANCODE_CLEAR, + SCANCODE_PRIOR, + SCANCODE_RETURN2, + SCANCODE_SEPARATOR, + SCANCODE_OUT, + SCANCODE_OPER, + SCANCODE_CLEARAGAIN, + SCANCODE_CRSEL, + SCANCODE_EXSEL, + + SCANCODE_KP_00, + SCANCODE_KP_000, + SCANCODE_THOUSANDSSEPARATOR, + SCANCODE_DECIMALSEPARATOR, + SCANCODE_CURRENCYUNIT, + SCANCODE_CURRENCYSUBUNIT, + SCANCODE_KP_LEFTPAREN, + SCANCODE_KP_RIGHTPAREN, + SCANCODE_KP_LEFTBRACE, + SCANCODE_KP_RIGHTBRACE, + SCANCODE_KP_TAB, + SCANCODE_KP_BACKSPACE, + SCANCODE_KP_A, + SCANCODE_KP_B, + SCANCODE_KP_C, + SCANCODE_KP_D, + SCANCODE_KP_E, + SCANCODE_KP_F, + SCANCODE_KP_XOR, + SCANCODE_KP_POWER, + SCANCODE_KP_PERCENT, + SCANCODE_KP_LESS, + SCANCODE_KP_GREATER, + SCANCODE_KP_AMPERSAND, + SCANCODE_KP_DBLAMPERSAND, + SCANCODE_KP_VERTICALBAR, + SCANCODE_KP_DBLVERTICALBAR, + SCANCODE_KP_COLON, + SCANCODE_KP_HASH, + SCANCODE_KP_SPACE, + SCANCODE_KP_AT, + SCANCODE_KP_EXCLAM, + SCANCODE_KP_MEMSTORE, + SCANCODE_KP_MEMRECALL, + SCANCODE_KP_MEMCLEAR, + SCANCODE_KP_MEMADD, + SCANCODE_KP_MEMSUBTRACT, + SCANCODE_KP_MEMMULTIPLY, + SCANCODE_KP_MEMDIVIDE, + SCANCODE_KP_PLUSMINUS, + SCANCODE_KP_CLEAR, + SCANCODE_KP_CLEARENTRY, + SCANCODE_KP_BINARY, + SCANCODE_KP_OCTAL, + SCANCODE_KP_DECIMAL, + SCANCODE_KP_HEXADECIMAL, + + SCANCODE_LCTRL, + SCANCODE_LSHIFT, + SCANCODE_LALT, + SCANCODE_LGUI, + SCANCODE_RCTRL, + SCANCODE_RSHIFT, + SCANCODE_RALT, + SCANCODE_RGUI, + + SCANCODE_MODE, + + SCANCODE_AUDIONEXT, + SCANCODE_AUDIOPREV, + SCANCODE_AUDIOSTOP, + SCANCODE_AUDIOPLAY, + SCANCODE_AUDIOMUTE, + SCANCODE_MEDIASELECT, + SCANCODE_WWW, + SCANCODE_MAIL, + SCANCODE_CALCULATOR, + SCANCODE_COMPUTER, + SCANCODE_AC_SEARCH, + SCANCODE_AC_HOME, + SCANCODE_AC_BACK, + SCANCODE_AC_FORWARD, + SCANCODE_AC_STOP, + SCANCODE_AC_REFRESH, + SCANCODE_AC_BOOKMARKS, + + SCANCODE_BRIGHTNESSDOWN, + SCANCODE_BRIGHTNESSUP, + SCANCODE_DISPLAYSWITCH, + SCANCODE_KBDILLUMTOGGLE, + SCANCODE_KBDILLUMDOWN, + SCANCODE_KBDILLUMUP, + SCANCODE_EJECT, + SCANCODE_SLEEP, + + SCANCODE_APP1, + SCANCODE_APP2, + + SCANCODE_MAX_ENUM +}; diff --git a/source/modules/asura-openal/audio/vorbis_decoder.cpp b/source/modules/asura-core/Input/MouseState.h index e69de29..e69de29 100644 --- a/source/modules/asura-openal/audio/vorbis_decoder.cpp +++ b/source/modules/asura-core/Input/MouseState.h diff --git a/source/modules/asura-core/mesh/am2_handler.cpp b/source/modules/asura-core/Mesh/Am2Handler.cpp index d0b9252..115797f 100644 --- a/source/modules/asura-core/mesh/am2_handler.cpp +++ b/source/modules/asura-core/Mesh/Am2Handler.cpp @@ -1,4 +1,4 @@ -#include "am2_handler.h" +#include "Am2Handler.h" namespace_begin(AsuraEngine) namespace_begin(Mesh) diff --git a/source/modules/asura-core/mesh/am2_handler.h b/source/modules/asura-core/Mesh/Am2Handler.h index 4fa8ba5..8bd0612 100644 --- a/source/modules/asura-core/mesh/am2_handler.h +++ b/source/modules/asura-core/Mesh/Am2Handler.h @@ -1,7 +1,7 @@ -#ifndef __ASURA_MESH2D_AM2_HANDLER_H__ -#define __ASURA_MESH2D_AM2_HANDLER_H__ +#ifndef _ASURA_MESH2D_AM2_HANDLER_H__ +#define _ASURA_MESH2D_AM2_HANDLER_H__ -#include "mesh2d_handler.h" +#include "Mesh2dHandler.h" namespace_begin(AsuraEngine) namespace_begin(Mesh) diff --git a/source/modules/asura-openal/audio/vorbis_decoder.h b/source/modules/asura-core/Mesh/Mesh2DData.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-openal/audio/vorbis_decoder.h +++ b/source/modules/asura-core/Mesh/Mesh2DData.cpp diff --git a/source/modules/asura-core/mesh/mesh2d_data.h b/source/modules/asura-core/Mesh/Mesh2DData.h index 024ba02..1144846 100644 --- a/source/modules/asura-core/mesh/mesh2d_data.h +++ b/source/modules/asura-core/Mesh/Mesh2DData.h @@ -1,17 +1,17 @@ -#ifndef __ASURA_MESH2D_DATA_H__ -#define __ASURA_MESH2D_DATA_H__ +#ifndef _ASURA_MESH2D_DATA_H__ +#define _ASURA_MESH2D_DATA_H__ // cpp #include <vector> // asura modules -#include <asura-utils/scripting/portable.hpp> -#include <asura-utils/math/vector2.hpp> -#include <asura-utils/io/decoded_data.h> +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Math/Vector2.hpp> +#include <asura-utils/IO/DecodedData.h> // module -#include "../graphics/color.h" -#include "../graphics/gpu_buffer.h" +#include "../Graphics/Color.h" +#include "../Graphics/GPUBuffer.h" namespace_begin(AsuraEngine) namespace_begin(Mesh) diff --git a/source/modules/asura-utils/io/io_batch_task.cpp b/source/modules/asura-core/Mesh/Mesh2DHandler.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-utils/io/io_batch_task.cpp +++ b/source/modules/asura-core/Mesh/Mesh2DHandler.cpp diff --git a/source/modules/asura-core/mesh/mesh2d_handler.h b/source/modules/asura-core/Mesh/Mesh2DHandler.h index c8ae32e..e50ace8 100644 --- a/source/modules/asura-core/mesh/mesh2d_handler.h +++ b/source/modules/asura-core/Mesh/Mesh2DHandler.h @@ -1,10 +1,10 @@ -#ifndef __ASURA_MESH2D_HANDLER_H__ -#define __ASURA_MESH2D_HANDLER_H__ +#ifndef _ASURA_MESH2D_HANDLER_H__ +#define _ASURA_MESH2D_HANDLER_H__ -#include <asura-utils/io/data_buffer.h> -#include <asura-utils/type.h> +#include <asura-utils/IO/DataBuffer.h> +#include <asura-utils/Type.h> -#include "mesh2d_data.h" +#include "Mesh2dData.h" namespace_begin(AsuraEngine) namespace_begin(Mesh) diff --git a/source/modules/asura-utils/math/ranged_value.cpp b/source/modules/asura-core/Mesh/ObjHandler.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-utils/math/ranged_value.cpp +++ b/source/modules/asura-core/Mesh/ObjHandler.cpp diff --git a/source/modules/asura-utils/math/ranged_value.h b/source/modules/asura-core/Mesh/ObjHandler.h index e69de29..e69de29 100644 --- a/source/modules/asura-utils/math/ranged_value.h +++ b/source/modules/asura-core/Mesh/ObjHandler.h diff --git a/source/modules/asura-utils/threading/thread_impl_sdl.cpp b/source/modules/asura-core/Profiler/GPUProfiler.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-utils/threading/thread_impl_sdl.cpp +++ b/source/modules/asura-core/Profiler/GPUProfiler.cpp diff --git a/source/modules/asura-utils/threading/thread_impl_sdl.h b/source/modules/asura-core/Profiler/GPUProfiler.h index e69de29..e69de29 100644 --- a/source/modules/asura-utils/threading/thread_impl_sdl.h +++ b/source/modules/asura-core/Profiler/GPUProfiler.h diff --git a/source/modules/asura-utils/threading/thread_impl_std.cpp b/source/modules/asura-core/Profiler/Stats.cpp index e69de29..e69de29 100644 --- a/source/modules/asura-utils/threading/thread_impl_std.cpp +++ b/source/modules/asura-core/Profiler/Stats.cpp diff --git a/source/modules/asura-core/Profiler/Stats.h b/source/modules/asura-core/Profiler/Stats.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-core/Profiler/Stats.h diff --git a/source/modules/asura-core/Threads/Channel.cpp b/source/modules/asura-core/Threads/Channel.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-core/Threads/Channel.cpp diff --git a/source/modules/asura-core/Threads/Channel.h b/source/modules/asura-core/Threads/Channel.h new file mode 100644 index 0000000..01b9ded --- /dev/null +++ b/source/modules/asura-core/Threads/Channel.h @@ -0,0 +1,18 @@ +#ifndef _ASURA_THREAD_CHANNEL_H_ +#define _ASURA_THREAD_CHANNEL_H_ + +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Classes.h> + +namespace_begin(AsuraEngine) +namespace_begin(Threads) + +class Channel +{ + +}; + +namespace_end +namespace_end + +#endif
\ No newline at end of file diff --git a/source/modules/asura-core/threading/thread_ex.cpp b/source/modules/asura-core/Threads/ThreadEx.cpp index da806f4..cc8107c 100644 --- a/source/modules/asura-core/threading/thread_ex.cpp +++ b/source/modules/asura-core/Threads/ThreadEx.cpp @@ -1,9 +1,9 @@ -#include <asura-utils/classes.h> +#include <asura-utils/Classes.h> -#include "thread_ex.h" +#include "ThreadEx.h" namespace_begin(AsuraEngine) -namespace_begin(Threading) +namespace_begin(Threads) int ThreadEx::Process() { diff --git a/source/modules/asura-core/threading/thread_ex.h b/source/modules/asura-core/Threads/ThreadEx.h index 0015f61..53600a6 100644 --- a/source/modules/asura-core/threading/thread_ex.h +++ b/source/modules/asura-core/Threads/ThreadEx.h @@ -1,11 +1,11 @@ -#ifndef __ASURA_THREAD_EX_H__ -#define __ASURA_THREAD_EX_H__ +#ifndef _ASURA_THREAD_EX_H_ +#define _ASURA_THREAD_EX_H_ -#include <asura-utils/scripting/portable.hpp> -#include <asura-utils/threading/thread.h> +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Threads/Thread.h> namespace_begin(AsuraEngine) -namespace_begin(Threading) +namespace_begin(Threads) /// /// ThreadExеͬͨ˶ͨݡ diff --git a/source/modules/asura-core/Time/Timer.cpp b/source/modules/asura-core/Time/Timer.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-core/Time/Timer.cpp diff --git a/source/modules/asura-core/Time/Timer.h b/source/modules/asura-core/Time/Timer.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-core/Time/Timer.h diff --git a/source/modules/asura-core/Type.h b/source/modules/asura-core/Type.h new file mode 100644 index 0000000..39880e2 --- /dev/null +++ b/source/modules/asura-core/Type.h @@ -0,0 +1,11 @@ +#ifndef _ASURA_ENGINE_TYPE_H_ +#define _ASURA_ENGINE_TYPE_H_ + +#include <stdint.h> + +namespace AsuraEngine +{ + +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-core/Window/Window.cpp b/source/modules/asura-core/Window/Window.cpp new file mode 100644 index 0000000..adba7c9 --- /dev/null +++ b/source/modules/asura-core/Window/Window.cpp @@ -0,0 +1,104 @@ +#include <asura-utils/Exceptions/Exception.h> + +#include "window.h" + +#include "WindowImplSDL.h" +#include "WindowImplGlew.h" +#include "WindowImplGlut.h" + +namespace_begin(AsuraEngine) +namespace_begin(Window) + + Window::Window() + : m_Impl(nullptr) + { + } + + Window::~Window() + { + if (m_Impl) + delete m_Impl; + } + +#define try_init_window(impl) \ + if (!m_Impl) \ + { \ + m_Impl = new impl(); \ + if (!m_Impl->Init(config)) \ + { \ + delete m_Impl; \ + m_Impl = nullptr; \ + } \ + } + + bool Window::Init(const WindowConfig& config) + { + ASSERT(!m_Impl); +#if ASURA_WINDOW_SDL + try_init_window(WindowImplSDL); +#endif + return m_Impl != nullptr; + } + + void Window::Exit() + { + if (m_Impl) + delete m_Impl; + } + + void Window::SetPosition(int x, int y) + { + ASSERT(m_Impl); + m_Impl->SetPosition(x, y); + } + + void Window::SetTitle(const std::string& title) + { + ASSERT(m_Impl); + m_Impl->SetTitils(title); + } + + void Window::Show() + { + ASSERT(m_Impl); + m_Impl->Show(); + } + + void Window::Hide() + { + ASSERT(m_Impl); + m_Impl->Hide(); + } + + void Window::SwapRenderBuffer() + { + ASSERT(m_Impl); + m_Impl->SwapRenderBuffer(); + } + + void Window::Clear(const AEGraphics::Color& col /*= AEGraphics::Color::Black*/) + { + ASSERT(m_Impl); + glClearColor(col.r, col.g, col.b, col.a); + } + + //void Window::Clear(const Math::Recti& quad, const AEGraphics::Color& col /*= AEGraphics::Color::Black*/) + //{ + // ASSERT(m_Impl); + + //} + + void Window::Draw(const AEGraphics::Drawable* texture, const AEGraphics::RenderState& state) + { + ASSERT(m_Impl); + + } +/* + void Window::Draw(const AEGraphics::Drawable* texture, const Math::Recti& quad, const AEGraphics::RenderState& state) + { + ASSERT(m_Impl); + + } +*/ + } +} diff --git a/source/modules/asura-core/Window/Window.h b/source/modules/asura-core/Window/Window.h new file mode 100644 index 0000000..f5498c1 --- /dev/null +++ b/source/modules/asura-core/Window/Window.h @@ -0,0 +1,138 @@ +#ifndef _ASURA_ENGINE_WINDOW_H_ +#define _ASURA_ENGINE_WINDOW_H_ + +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Math/Vector2.hpp> +#include <asura-utils/Singleton.hpp> + +#include "../Graphics/Image.h" +#include "../Graphics/RenderState.h" +#include "../Graphics/RenderTarget.h" + +namespace_begin(AsuraEngine) +namespace_begin(Window) + +class WindowImpl; + +/// +/// SDLģһЩõġ +/// +enum WindowFlag +{ + WINDOW_FULLSCREEN = 1 << 1, ///< fullscreen window + WINDOW_OPENGL = 1 << 2, ///< window usable with OpenGL context + WINDOW_SHOWN = 1 << 3, ///< window is visible + WINDOW_HIDDEN = 1 << 4, ///< window is not visible + WINDOW_BORDERLESS = 1 << 5, ///< no window decoration + WINDOW_RESIZABLE = 1 << 6, ///< window can be resized + WINDOW_MINIMIZED = 1 << 7, ///< window is minimized + WINDOW_MAXIMIZED = 1 << 8, ///< window is maximized + WINDOW_INPUT_GRABBED = 1 << 9, ///< window has grabbed input focus + WINDOW_INPUT_FOCUS = 1 << 10, ///< window has input focus + WINDOW_MOUSE_FOCUS = 1 << 11, ///< window has mouse focus + WINDOW_ALLOW_HIGHDPI = 1 << 12, ///< window should be created in high-DPI mode if supported. + ///< On macOS NSHighResolutionCapable must be set true in the + ///< application's Info.plist for this to have any effect. + WINDOW_MOUSE_CAPTURE = 1 << 13, ///< window has mouse captured (unrelated to INPUT_GRABBED) + WINDOW_ALWAYS_ON_TOP = 1 << 14, ///< window should always be above others +}; + +/// Windowʼ +struct WindowConfig +{ + uint width, height; ///< ߴ + int x, y; ///< ڳʼ + std::string title; ///< + bool vsync; ///< ֱͬ + AEImage::ImageData* icon; ///< ͼ + bool show; ///< Ƿʾ + int flag; ///< ڱ +}; + +/// +/// ϷĵڣrunnerֻҪһڡͬĿͻʵִ˽ӿڲֶעᵽlua༭ +/// ᵼ࣬ӵ༭ⴰϡ +/// +class Window ASURA_FINAL + : public AEScripting::Portable<Window, AEGraphics::RenderTarget> + , public Singleton<Window> +{ +public: + + /// ϷʱĴΨһģ༭õࡣ + LUAX_DECL_SINGLETON(Window); + + Window(); + ~Window(); + + /// ڡ + bool Init(const WindowConfig& config); + void Exit(); + + void SetSize(uint width, uint height); + void SetPosition(int x, int y); + void SetTitle(const std::string& title); + void SetIcon(AEImage::ImageData* imgData); + + void Show(); + void Hide(); + + /// ǿ˫ĴڣҪչʾǰ̨ + void SwapRenderBuffer(); + + void Clear(const AEGraphics::Color& col = AEGraphics::Color::Black) override; + void Clear(const Math::Recti& quad, const AEGraphics::Color& col = AEGraphics::Color::Black) override; + + void Draw(const AEGraphics::Drawable* texture, const AEGraphics::RenderState& state) override; + void Draw(const AEGraphics::Drawable* texture, const Math::Recti& quad, const AEGraphics::RenderState& state) override; + +private: + + WindowImpl* m_Impl; + +luaxport: + + LUAX_DECL_ENUM(WindowFlag, 0); + + LUAX_DECL_METHOD(_Init); + LUAX_DECL_METHOD(_Exit); + LUAX_DECL_METHOD(_Show); + LUAX_DECL_METHOD(_Hide); + LUAX_DECL_METHOD(_SetSize); + LUAX_DECL_METHOD(_SetPosition); + LUAX_DECL_METHOD(_SetTitle); + LUAX_DECL_METHOD(_SetIcon); + LUAX_DECL_METHOD(_SwapRenderBuffer); + LUAX_DECL_METHOD(_Clear); + LUAX_DECL_METHOD(_Draw); + +}; + +using RenderWindow = Window; + +ASURA_ABSTRACT class WindowImpl +{ +public: + + WindowImpl() {}; + virtual ~WindowImpl() {}; + + virtual bool Init(const WindowConfig& config); + + virtual void SetSize(uint width, uint height) = 0; + virtual void SetPosition(int x, int y) = 0; + virtual void SetTitils(const std::string& title) = 0; + + virtual void Show() = 0; + virtual void Hide() = 0; + + virtual void SwapRenderBuffer() = 0; + +}; + +namespace_end +namespace_end + +namespace AEWindow = AsuraEngine::Window; + +#endif
\ No newline at end of file diff --git a/source/modules/asura-core/Window/WindowImplGlew.cpp b/source/modules/asura-core/Window/WindowImplGlew.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-core/Window/WindowImplGlew.cpp diff --git a/source/modules/asura-core/Window/WindowImplGlew.h b/source/modules/asura-core/Window/WindowImplGlew.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-core/Window/WindowImplGlew.h diff --git a/source/modules/asura-core/Window/WindowImplGlut.h b/source/modules/asura-core/Window/WindowImplGlut.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-core/Window/WindowImplGlut.h diff --git a/source/modules/asura-core/window/window_impl_sdl.cpp b/source/modules/asura-core/Window/WindowImplSDL.cpp index 59562a4..3cbad70 100644 --- a/source/modules/asura-core/window/window_impl_sdl.cpp +++ b/source/modules/asura-core/Window/WindowImplSDL.cpp @@ -1,12 +1,12 @@ -#include "../core_config.h" +#include "../CoreConfig.h" #if ASURA_WINDOW_SDL #include <SDL2/SDL.h> -#include <asura-utils/exceptions/exception.h> +#include <asura-utils/Exceptions/Exception.h> -#include "window_impl_sdl.h" +#include "WindowImplSDL.h" using namespace AEGraphics; using namespace AEImage; diff --git a/source/modules/asura-core/window/window_impl_sdl.h b/source/modules/asura-core/Window/WindowImplSDL.h index 20f5c95..5971351 100644 --- a/source/modules/asura-core/window/window_impl_sdl.h +++ b/source/modules/asura-core/Window/WindowImplSDL.h @@ -1,13 +1,13 @@ -#ifndef __ASURA_WINDOW_SDL_H_ -#define __ASURA_WINDOW_SDL_H_ +#ifndef _ASURA_WINDOW_SDL_H_ +#define _ASURA_WINDOW_SDL_H_ -#include "../core_config.h" +#include "../CoreConfig.h" #if ASURA_WINDOW_SDL #include <SDL2/SDL.h> -#include "window.h" +#include "Window.h" namespace_begin(AsuraEngine) namespace_begin(Window) diff --git a/source/modules/asura-core/Window/WinodwImplGlut.cpp b/source/modules/asura-core/Window/WinodwImplGlut.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-core/Window/WinodwImplGlut.cpp diff --git a/source/modules/asura-core/Window/binding/_window.cpp b/source/modules/asura-core/Window/binding/_window.cpp new file mode 100644 index 0000000..1e14a3a --- /dev/null +++ b/source/modules/asura-core/Window/binding/_window.cpp @@ -0,0 +1,179 @@ +#include "../../Image/ImageData.h" + +#include "../Window.h" + +using namespace std; +using namespace AEGraphics; +using namespace AEImage; + +namespace_begin(AsuraEngine) +namespace_begin(Window) + + LUAX_REGISTRY(Window) + { + LUAX_REGISTER_METHODS(state, + { "Init", _Init }, + { "Exit", _Exit }, + { "Show", _Show }, + { "Hide", _Hide }, + { "SetSize", _SetSize }, + { "SetPosition", _SetPosition }, + { "SetTitle", _SetTitle }, + { "SetIcon", _SetIcon }, + { "SwapRenderBuffer", _SwapRenderBuffer }, + { "Clear", _Clear }, + { "Draw", _Draw } + ); + } + + LUAX_POSTPROCESS(Window) + { + LUAX_REGISTER_ENUM(state, "EWindowFlag", + { "FULLSCREEN", WINDOW_FULLSCREEN }, + { "OPENGL", WINDOW_OPENGL }, + { "SHOWN", WINDOW_SHOWN }, + { "HIDDEN", WINDOW_HIDDEN }, + { "BORDERLESS", WINDOW_BORDERLESS }, + { "RESIZABLE", WINDOW_RESIZABLE }, + { "MINIMIZED", WINDOW_MINIMIZED }, + { "MAXIMIZED", WINDOW_MAXIMIZED }, + { "INPUT_GRABBED", WINDOW_INPUT_GRABBED }, + { "INPUT_FOCUS", WINDOW_INPUT_FOCUS }, + { "MOUSE_FOCUS", WINDOW_MOUSE_FOCUS }, + { "ALLOW_HIGHDPI", WINDOW_ALLOW_HIGHDPI }, + { "MOUSE_CAPTURE", WINDOW_MOUSE_CAPTURE }, + { "ALWAYS_ON_TOP", WINDOW_ALWAYS_ON_TOP } + ); + + } + + // Window.Init(config_table) + LUAX_IMPL_METHOD(Window, _Init) + { + LUAX_PREPARE(L, Window); + + WindowConfig config; + + if (!state.IsType(1, LUA_TTABLE)) + return state.ErrorType(1, "window config table"); + + config.width = state.GetField(1, "width", 0); + config.height = state.GetField(1, "height", 0); + config.x = state.GetField(1, "x", 0); + config.y = state.GetField(1, "y", 0); + config.flag = state.GetField(1, "flag", WINDOW_OPENGL); + config.title = state.GetField(1, "title", ""); + config.vsync = state.GetField(1, "vsync", true); + config.show = state.GetField(1, "show", true); + + // try set window icon + state.GetField(1, "icon"); + if (state.IsType(1, LUA_TUSERDATA)) + { + ImageData* data = state.CheckUserdata<ImageData>(-1); + if (data) + { + data->Lock(); + config.icon = data; + Window::Get()->Init(config); + data->Unlock(); + return 0; + } + } + else + state.Pop(); + + Window::Get()->Init(config); + + return 0; + } + + // Window.Exit() + LUAX_IMPL_METHOD(Window, _Exit) + { + LUAX_PREPARE(L, Window); + Window::Get()->Exit(); + return 0; + } + + // Window.Show() + LUAX_IMPL_METHOD(Window, _Show) + { + LUAX_PREPARE(L, Window); + Window::Get()->Show(); + return 0; + } + + // Window.Hide() + LUAX_IMPL_METHOD(Window, _Hide) + { + LUAX_PREPARE(L, Window); + Window::Get()->Hide(); + return 0; + } + + // Window.SetSize(w, h) + LUAX_IMPL_METHOD(Window, _SetSize) + { + LUAX_PREPARE(L, Window); + uint w = state.CheckValue<uint>(1); + uint h = state.CheckValue<uint>(2); + Window::Get()->SetSize(w, h); + return 0; + } + + // Window.SetPosition(x, y) + LUAX_IMPL_METHOD(Window, _SetPosition) + { + LUAX_PREPARE(L, Window); + int x = state.CheckValue<int>(1); + int y = state.CheckValue<int>(2); + Window::Get()->SetPosition(x, y); + return 0; + } + + // Window.SetTitle(title) + LUAX_IMPL_METHOD(Window, _SetTitle) + { + LUAX_PREPARE(L, Window); + std::string title = state.CheckValue<string>(1); + Window::Get()->SetTitle(title); + return 0; + } + + // Window.SetIcon(imageData) + LUAX_IMPL_METHOD(Window, _SetIcon) + { + LUAX_PREPARE(L, Window); + ImageData* imgData = state.CheckUserdata<ImageData>(1); + imgData->Lock(); + Window::Get()->SetIcon(imgData); + imgData->Unlock(); + return 0; + } + + // Window.SwapRenderBuffer() + LUAX_IMPL_METHOD(Window, _SwapRenderBuffer) + { + LUAX_PREPARE(L, Window); + Window::Get()->SwapRenderBuffer(); + return 0; + } + + // Window.Clear() + LUAX_IMPL_METHOD(Window, _Clear) + { + LUAX_PREPARE(L, Window); + Window::Get()->Clear(); + return 0; + } + + // Window.Draw() + LUAX_IMPL_METHOD(Window, _Draw) + { + LUAX_PREPARE(L, Window); + return 0; + } + + } +}
\ No newline at end of file diff --git a/source/modules/asura-core/application.h b/source/modules/asura-core/application.h index 62eefe7..ea5faa7 100644 --- a/source/modules/asura-core/application.h +++ b/source/modules/asura-core/application.h @@ -1,18 +1,16 @@ -#ifndef __ASURA_ENGINE_APPLICATION_H__ -#define __ASURA_ENGINE_APPLICATION_H__ +#ifndef _ASURA_ENGINE_APPLICATION_H_ +#define _ASURA_ENGINE_APPLICATION_H_ -#include <asura-utils/scripting/portable.hpp> -#include <asura-utils/module.h> -#include <asura-utils/classes.h> +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Module.h> +#include <asura-utils/Classes.h> #include <queue> -#include "core_config.h" +#include "CoreConfig.h" namespace_begin(AsuraEngine) -/// /// ģ -/// enum SubModules { ASURA_MODULE_NONE = 0X00000000U, diff --git a/source/modules/asura-core/core_module.h b/source/modules/asura-core/core_module.h deleted file mode 100644 index 443aea4..0000000 --- a/source/modules/asura-core/core_module.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __ASURA_CORE_MODULE_H__ -#define __ASURA_CORE_MODULE_H__ - -#include <asura-utils/module.h> - -#include "graphics/image.h" -#include "graphics/texture.h" - -#include "window/window.h" - -#include "threading/thread_ex.h" - -namespace AsuraEngine -{ - - class CoreModule : public 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/modules/asura-core/font/string.hpp b/source/modules/asura-core/font/string.hpp index 2c6c845..13a8b2d 100644 --- a/source/modules/asura-core/font/string.hpp +++ b/source/modules/asura-core/font/string.hpp @@ -1,5 +1,5 @@ -//#ifndef __ASURA_ENGINE_STRING_H__ -//#define __ASURA_ENGINE_STRING_H__ +//#ifndef _ASURA_ENGINE_STRING_H_ +//#define _ASURA_ENGINE_STRING_H_ // //#include <asura-utils/type.h> // @@ -587,7 +587,7 @@ // //////////////////////////////////////////////////////////// // String operator +(const String& left, const String& right); // -// #include "String.inl" +// #include "String.inc" // // } //} diff --git a/source/modules/asura-core/font/ttf.h b/source/modules/asura-core/font/ttf.h index 840b63e..b83cf76 100644 --- a/source/modules/asura-core/font/ttf.h +++ b/source/modules/asura-core/font/ttf.h @@ -1,5 +1,5 @@ -#ifndef __ASURA_TTF_H__ -#define __ASURA_TTF_H__ +#ifndef _ASURA_TTF_H_ +#define _ASURA_TTF_H_ namespace AsuraEngine { diff --git a/source/modules/asura-core/font/utf.hpp b/source/modules/asura-core/font/utf.hpp index 2e04ee4..59f62ed 100644 --- a/source/modules/asura-core/font/utf.hpp +++ b/source/modules/asura-core/font/utf.hpp @@ -1,5 +1,5 @@ -#ifndef __ASURA_UTF_HPP__ -#define __ASURA_UTF_HPP__ +#ifndef _ASURA_UTF_HPP_ +#define _ASURA_UTF_HPP_ //////////////////////////////////////////////////////////// // Headers @@ -705,7 +705,7 @@ namespace AsuraEngine static Out EncodeWide(Uint32 codepoint, Out output, wchar_t replacement = 0); }; -#include "Utf.inl" +#include "Utf.inc" // Make typedefs to get rid of the template syntax typedef Utf<8> Utf8; diff --git a/source/modules/asura-core/graphics/binding/_canvas.cpp b/source/modules/asura-core/graphics/binding/_canvas.cpp index 6dda773..44841f5 100644 --- a/source/modules/asura-core/graphics/binding/_canvas.cpp +++ b/source/modules/asura-core/graphics/binding/_canvas.cpp @@ -1,4 +1,4 @@ -#include "../canvas.h" +#include "../Canvas.h" using namespace std; diff --git a/source/modules/asura-core/graphics/binding/_color.cpp b/source/modules/asura-core/graphics/binding/_color.cpp index c990d8b..008d9c2 100644 --- a/source/modules/asura-core/graphics/binding/_color.cpp +++ b/source/modules/asura-core/graphics/binding/_color.cpp @@ -1,4 +1,4 @@ -#include "../color.h" +#include "../Color.h" using namespace std; using namespace Luax; diff --git a/source/modules/asura-core/graphics/binding/_color32.cpp b/source/modules/asura-core/graphics/binding/_color32.cpp index 96c63af..7613361 100644 --- a/source/modules/asura-core/graphics/binding/_color32.cpp +++ b/source/modules/asura-core/graphics/binding/_color32.cpp @@ -1,4 +1,4 @@ -#include "../color32.h" +#include "../Color32.h" using namespace std; diff --git a/source/modules/asura-core/graphics/binding/_gfx_device.cpp b/source/modules/asura-core/graphics/binding/_gfx_device.cpp index 60a0b0b..f6c2004 100644 --- a/source/modules/asura-core/graphics/binding/_gfx_device.cpp +++ b/source/modules/asura-core/graphics/binding/_gfx_device.cpp @@ -1,4 +1,4 @@ -#include "../gfx_device.h" +#include "../GfxDevice.h" using namespace std; using namespace Luax; diff --git a/source/modules/asura-core/graphics/binding/_gpu_buffer.cpp b/source/modules/asura-core/graphics/binding/_gpu_buffer.cpp index 479901e..8c39a59 100644 --- a/source/modules/asura-core/graphics/binding/_gpu_buffer.cpp +++ b/source/modules/asura-core/graphics/binding/_gpu_buffer.cpp @@ -1,7 +1,7 @@ #include <stdlib.h> #include "../image.h" -#include "../gpu_buffer.h" +#include "../GPUBuffer.h" using namespace std; using namespace Luax; diff --git a/source/modules/asura-core/graphics/binding/_index_buffer.cpp b/source/modules/asura-core/graphics/binding/_index_buffer.cpp index eb81699..151dc98 100644 --- a/source/modules/asura-core/graphics/binding/_index_buffer.cpp +++ b/source/modules/asura-core/graphics/binding/_index_buffer.cpp @@ -1,4 +1,4 @@ -#include "../index_buffer.h" +#include "../IndexBuffer.h" using namespace std; using namespace Luax; diff --git a/source/modules/asura-core/graphics/binding/_sprite_batch.cpp b/source/modules/asura-core/graphics/binding/_sprite_batch.cpp index 7795d26..6b7d25c 100644 --- a/source/modules/asura-core/graphics/binding/_sprite_batch.cpp +++ b/source/modules/asura-core/graphics/binding/_sprite_batch.cpp @@ -1,4 +1,4 @@ -#include "../sprite_batch.h" +#include "../SpriteBatch.h" using namespace std; diff --git a/source/modules/asura-core/graphics/binding/_vertex_buffer.cpp b/source/modules/asura-core/graphics/binding/_vertex_buffer.cpp index b181df3..8ed487b 100644 --- a/source/modules/asura-core/graphics/binding/_vertex_buffer.cpp +++ b/source/modules/asura-core/graphics/binding/_vertex_buffer.cpp @@ -1,4 +1,4 @@ -#include "../vertex_buffer.h" +#include "../VertexBuffer.h" using namespace std; using namespace Luax; diff --git a/source/modules/asura-core/graphics/blend_mode.h b/source/modules/asura-core/graphics/blend_mode.h deleted file mode 100644 index 73e1a41..0000000 --- a/source/modules/asura-core/graphics/blend_mode.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __ASURA_ENGINE_BLEND_MODE_H__ -#define __ASURA_ENGINE_BLEND_MODE_H__ - -#include <asura-utils/classes.h> - -namespace_begin(AsuraEngine) -namespace_begin(Graphics) - -enum BlendMode -{ - -}; - -namespace_end -namespace_end - -#endif
\ No newline at end of file diff --git a/source/modules/asura-core/graphics/canvas.h b/source/modules/asura-core/graphics/canvas.h index bbd098a..0ec55bc 100644 --- a/source/modules/asura-core/graphics/canvas.h +++ b/source/modules/asura-core/graphics/canvas.h @@ -1,15 +1,15 @@ -#ifndef __ASURA_ENGINE_CANVAS_H__ -#define __ASURA_ENGINE_CANVAS_H__ - -#include <asura-utils/scripting/portable.hpp> -#include <asura-utils/math/rect.hpp> -#include <asura-utils/math/vector2.hpp> -#include <asura-utils/exceptions/exception.h> - -#include "gfx_device.h" -#include "texture.h" -#include "render_target.h" -#include "render_state.h" +#ifndef _ASURA_ENGINE_CANVAS_H_ +#define _ASURA_ENGINE_CANVAS_H_ + +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Math/Rect.hpp> +#include <asura-utils/Math/Vector2.hpp> +#include <asura-utils/Exceptions/Exception.h> + +#include "GfxDevice.h" +#include "Texture.h" +#include "RenderTarget.h" +#include "RenderState.h" namespace_begin(AsuraEngine) namespace_begin(Graphics) diff --git a/source/modules/asura-core/graphics/color.cpp b/source/modules/asura-core/graphics/color.cpp index 47e039f..5a66291 100644 --- a/source/modules/asura-core/graphics/color.cpp +++ b/source/modules/asura-core/graphics/color.cpp @@ -1,5 +1,5 @@ -#include "color.h" -#include "color32.h" +#include "Color.h" +#include "Color32.h" namespace_begin(AsuraEngine) namespace_begin(Graphics) diff --git a/source/modules/asura-core/graphics/color.h b/source/modules/asura-core/graphics/color.h index 99a9b00..a16f17d 100644 --- a/source/modules/asura-core/graphics/color.h +++ b/source/modules/asura-core/graphics/color.h @@ -1,10 +1,10 @@ -#ifndef __ASURA_ENGINE_COLOR_H__ -#define __ASURA_ENGINE_COLOR_H__ +#ifndef _ASURA_ENGINE_COLOR_H_ +#define _ASURA_ENGINE_COLOR_H_ -#include <asura-utils/scripting/portable.hpp> -#include <asura-utils/classes.h> +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Classes.h> -#include "../core_config.h" +#include "../CoreConfig.h" namespace_begin(AsuraEngine) namespace_begin(Graphics) diff --git a/source/modules/asura-core/graphics/color32.cpp b/source/modules/asura-core/graphics/color32.cpp index 11239c8..f1f0b74 100644 --- a/source/modules/asura-core/graphics/color32.cpp +++ b/source/modules/asura-core/graphics/color32.cpp @@ -1,5 +1,5 @@ -#include "color.h" -#include "color32.h" +#include "Color.h" +#include "Color32.h" namespace_begin(AsuraEngine) namespace_begin(Graphics) diff --git a/source/modules/asura-core/graphics/color32.h b/source/modules/asura-core/graphics/color32.h index 52405e9..aa445fe 100644 --- a/source/modules/asura-core/graphics/color32.h +++ b/source/modules/asura-core/graphics/color32.h @@ -1,10 +1,10 @@ -#ifndef __ASURA_ENGINE_COLOR32_H__ -#define __ASURA_ENGINE_COLOR32_H__ +#ifndef _ASURA_ENGINE_COLOR32_H__ +#define _ASURA_ENGINE_COLOR32_H__ -#include <asura-utils/classes.h> -#include <asura-utils/scripting/portable.hpp> +#include <asura-utils/Classes.h> +#include <asura-utils/Scripting/Portable.hpp> -#include "../core_config.h" +#include "../CoreConfig.h" namespace_begin(AsuraEngine) namespace_begin(Graphics) diff --git a/source/modules/asura-core/graphics/image.cpp b/source/modules/asura-core/graphics/image.cpp index 32fa870..d2b2ec9 100644 --- a/source/modules/asura-core/graphics/image.cpp +++ b/source/modules/asura-core/graphics/image.cpp @@ -1,10 +1,10 @@ -#include <asura-utils/exceptions/exception.h> +#include <asura-utils/Exceptions/Exception.h> -#include "../core_config.h" +#include "../CoreConfig.h" -#include "shader.h" -#include "image.h" -#include "gfx_device.h" +#include "Shader.h" +#include "Image.h" +#include "GfxDevice.h" using namespace AEIO; using namespace AEImage; diff --git a/source/modules/asura-core/graphics/image.h b/source/modules/asura-core/graphics/image.h index 72f1281..5cbfe23 100644 --- a/source/modules/asura-core/graphics/image.h +++ b/source/modules/asura-core/graphics/image.h @@ -1,23 +1,23 @@ -#ifndef __ASURA_ENGINE_IMAGE_H__ -#define __ASURA_ENGINE_IMAGE_H__ +#ifndef _ASURA_ENGINE_IMAGE_H_ +#define _ASURA_ENGINE_IMAGE_H_ // asura modules -#include <asura-utils/math/rect.hpp> -#include <asura-utils/math/vector2.hpp> -#include <asura-utils/scripting/portable.hpp> -#include <asura-utils/io/renewable.h> -#include <asura-utils/stringmap.hpp> -#include <asura-utils/manager.hpp> +#include <asura-utils/Math/Rect.hpp> +#include <asura-utils/Math/Vector2.hpp> +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/IO/Renewable.h> +#include <asura-utils/Stringmap.hpp> +#include <asura-utils/Manager.hpp> // module -#include "../image/image_data.h" +#include "../Image/ImageData.h" // folder -#include "color.h" -#include "color32.h" -#include "render_state.h" -#include "gpu_buffer.h" -#include "texture.h" +#include "Color.h" +#include "Color32.h" +#include "RenderState.h" +#include "GPUBuffer.h" +#include "Texture.h" namespace_begin(AsuraEngine) namespace_begin(Graphics) diff --git a/source/modules/asura-core/graphics/mesh2d.h b/source/modules/asura-core/graphics/mesh2d.h index d2d7d3b..1546765 100644 --- a/source/modules/asura-core/graphics/mesh2d.h +++ b/source/modules/asura-core/graphics/mesh2d.h @@ -1,20 +1,20 @@ -#ifndef __ASURA_ENGINE_MESH2D_H__ -#define __ASURA_ENGINE_MESH2D_H__ +#ifndef _ASURA_ENGINE_MESH2D_H__ +#define _ASURA_ENGINE_MESH2D_H__ // cpp #include <vector> // asura modules -#include <asura-utils/scripting/portable.hpp> -#include <asura-utils/math/vector2.hpp> +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Math/Vector2.hpp> // module -#include "../mesh/mesh2d_data.h" +#include "../Mesh/Mesh2dData.h" // folder -#include "color.h" -#include "vertex_buffer.h" -#include "index_buffer.h" +#include "Color.h" +#include "VertexBuffer.h" +#include "IndexBuffer.h" namespace_begin(AsuraEngine) namespace_begin(Graphics) diff --git a/source/modules/asura-core/graphics/shader.cpp b/source/modules/asura-core/graphics/shader.cpp index 74bf7a8..30e0161 100644 --- a/source/modules/asura-core/graphics/shader.cpp +++ b/source/modules/asura-core/graphics/shader.cpp @@ -1,7 +1,7 @@ -#include <asura-utils/exceptions/exception.h> +#include <asura-utils/Exceptions/Exception.h> -#include "gfx_device.h" -#include "shader.h" +#include "GfxDevice.h" +#include "Shader.h" using namespace std; diff --git a/source/modules/asura-core/graphics/shader.h b/source/modules/asura-core/graphics/shader.h index c535570..c96b99f 100644 --- a/source/modules/asura-core/graphics/shader.h +++ b/source/modules/asura-core/graphics/shader.h @@ -1,24 +1,24 @@ -#ifndef __ASURA_ENGINE_SHADER_H__ -#define __ASURA_ENGINE_SHADER_H__ +#ifndef _ASURA_ENGINE_SHADER_H_ +#define _ASURA_ENGINE_SHADER_H_ #include <map> #include <string> -#include <asura-utils/exceptions/exception.h> -#include <asura-utils/scripting/portable.hpp> -#include <asura-utils/io/renewable.h> -#include <asura-utils/math/vector2.hpp> -#include <asura-utils/math/vector3.hpp> -#include <asura-utils/math/vector4.h> -#include <asura-utils/math/matrix44.h> -#include <asura-utils/stringmap.hpp> -#include <asura-utils/manager.hpp> - -#include "gfx_device.h" -#include "color.h" -#include "texture.h" -#include "vertex_buffer.h" -#include "index_buffer.h" +#include <asura-utils/Exceptions/Exception.h> +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/IO/Renewable.h> +#include <asura-utils/Math/Vector2.hpp> +#include <asura-utils/Math/vector3.hpp> +#include <asura-utils/Math/vector4.h> +#include <asura-utils/Math/matrix44.h> +#include <asura-utils/Stringmap.hpp> +#include <asura-utils/Manager.hpp> + +#include "GfxDevice.h" +#include "Color.h" +#include "Texture.h" +#include "VertexBuffer.h" +#include "IndexBuffer.h" namespace_begin(AsuraEngine) namespace_begin(Graphics) diff --git a/source/modules/asura-core/graphics/texture.cpp b/source/modules/asura-core/graphics/texture.cpp index 42e3851..bae0f7c 100644 --- a/source/modules/asura-core/graphics/texture.cpp +++ b/source/modules/asura-core/graphics/texture.cpp @@ -1,4 +1,4 @@ -#include <asura-utils/exceptions/exception.h> +#include <asura-utils/Exceptions/Exception.h> #include "Texture.h" diff --git a/source/modules/asura-core/graphics/texture.h b/source/modules/asura-core/graphics/texture.h index 458e35a..7d37c31 100644 --- a/source/modules/asura-core/graphics/texture.h +++ b/source/modules/asura-core/graphics/texture.h @@ -1,13 +1,13 @@ -#ifndef __ASURA_TEXTURE_H__ -#define __ASURA_TEXTURE_H__ +#ifndef _ASURA_TEXTURE_H_ +#define _ASURA_TEXTURE_H_ -#include <asura-utils/math/vector2.hpp> -#include <asura-utils/math/rect.hpp> +#include <asura-utils/Math/Vector2.hpp> +#include <asura-utils/Math/Rect.hpp> -#include "../core_config.h" +#include "../CoreConfig.h" -#include "render_state.h" -#include "gfx_device.h" +#include "RenderState.h" +#include "GfxDevice.h" namespace_begin(AsuraEngine) namespace_begin(Graphics) diff --git a/source/modules/asura-core/image/binding/_image_data.cpp b/source/modules/asura-core/image/binding/_image_data.cpp index 93e63ce..77f3a96 100644 --- a/source/modules/asura-core/image/binding/_image_data.cpp +++ b/source/modules/asura-core/image/binding/_image_data.cpp @@ -1,7 +1,7 @@ -#include <asura-utils/threading/thread.h> -#include <asura-utils/io/data_buffer.h> +#include <asura-utils/Threads/Thread.h> +#include <asura-utils/IO/DataBuffer.h> -#include "../image_data.h" +#include "../ImageData.h" using namespace std; using namespace AEThreading; diff --git a/source/modules/asura-core/image/binding/_image_decode_task.cpp b/source/modules/asura-core/image/binding/_image_decode_task.cpp index 0181628..3c8ed4b 100644 --- a/source/modules/asura-core/image/binding/_image_decode_task.cpp +++ b/source/modules/asura-core/image/binding/_image_decode_task.cpp @@ -1,18 +1,19 @@ -#include "../image_decode_task.h" +#include "../ImageDecodeTask.h" using namespace std; namespace_begin(AsuraEngine) namespace_begin(Image) + LUAX_REGISTRY(ImageDecodeTask) - { +{ - } +} - LUAX_POSTPROCESS(ImageDecodeTask) - { +LUAX_POSTPROCESS(ImageDecodeTask) +{ - } +} - } +} } diff --git a/source/modules/asura-core/input/button.h b/source/modules/asura-core/input/button.h index 78f9b6d..5c3c0de 100644 --- a/source/modules/asura-core/input/button.h +++ b/source/modules/asura-core/input/button.h @@ -1,7 +1,7 @@ #ifndef __BUTTON_H__ #define __BUTTON_H__ -#include <asura-utils/classes.h> +#include <asura-utils/Classes.h> namespace_begin(AsuraEngine) namespace_begin(Input) diff --git a/source/modules/asura-core/threading/channel.h b/source/modules/asura-core/threading/channel.h deleted file mode 100644 index ede43e4..0000000 --- a/source/modules/asura-core/threading/channel.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __ASURA_THREAD_CHANNEL_H__ -#define __ASURA_THREAD_CHANNEL_H__ - -#include <asura-utils/scripting/portable.hpp> -#include <asura-utils/classes.h> - -namespace_begin(AsuraEngine) -namespace_begin(Threading) - -class Channel -{ - -}; - -namespace_end -namespace_end - -#endif
\ No newline at end of file diff --git a/source/modules/asura-core/type.h b/source/modules/asura-core/type.h index 88848d5..39880e2 100644 --- a/source/modules/asura-core/type.h +++ b/source/modules/asura-core/type.h @@ -1,5 +1,5 @@ -#ifndef __ASURA_ENGINE_TYPE_H__ -#define __ASURA_ENGINE_TYPE_H__ +#ifndef _ASURA_ENGINE_TYPE_H_ +#define _ASURA_ENGINE_TYPE_H_ #include <stdint.h> diff --git a/source/modules/asura-core/window/binding/_window.cpp b/source/modules/asura-core/window/binding/_window.cpp index 7119cd2..1e14a3a 100644 --- a/source/modules/asura-core/window/binding/_window.cpp +++ b/source/modules/asura-core/window/binding/_window.cpp @@ -1,6 +1,6 @@ -#include "../../image/image_data.h" +#include "../../Image/ImageData.h" -#include "../window.h" +#include "../Window.h" using namespace std; using namespace AEGraphics; diff --git a/source/modules/asura-core/window/window.cpp b/source/modules/asura-core/window/window.cpp index bbcb949..adba7c9 100644 --- a/source/modules/asura-core/window/window.cpp +++ b/source/modules/asura-core/window/window.cpp @@ -1,10 +1,10 @@ -#include <asura-utils/exceptions/exception.h> +#include <asura-utils/Exceptions/Exception.h> #include "window.h" -#include "window_impl_sdl.h" -#include "window_impl_glew.h" -#include "window_impl_glut.h" +#include "WindowImplSDL.h" +#include "WindowImplGlew.h" +#include "WindowImplGlut.h" namespace_begin(AsuraEngine) namespace_begin(Window) diff --git a/source/modules/asura-core/window/window.h b/source/modules/asura-core/window/window.h index 872c40f..f5498c1 100644 --- a/source/modules/asura-core/window/window.h +++ b/source/modules/asura-core/window/window.h @@ -1,13 +1,13 @@ -#ifndef __ASURA_ENGINE_WINDOW_H__ -#define __ASURA_ENGINE_WINDOW_H__ +#ifndef _ASURA_ENGINE_WINDOW_H_ +#define _ASURA_ENGINE_WINDOW_H_ -#include <asura-utils/scripting/portable.hpp> -#include <asura-utils/math/vector2.hpp> -#include <asura-utils/singleton.hpp> +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Math/Vector2.hpp> +#include <asura-utils/Singleton.hpp> -#include "../graphics/image.h" -#include "../graphics/render_state.h" -#include "../graphics/render_target.h" +#include "../Graphics/Image.h" +#include "../Graphics/RenderState.h" +#include "../Graphics/RenderTarget.h" namespace_begin(AsuraEngine) namespace_begin(Window) diff --git a/source/modules/asura-fmod/Audio/Source.h b/source/modules/asura-fmod/Audio/Source.h new file mode 100644 index 0000000..4585415 --- /dev/null +++ b/source/modules/asura-fmod/Audio/Source.h @@ -0,0 +1,20 @@ +#ifndef __ASURA_FMOD_SOURCE_H__ +#define __ASURA_FMOD_SOURCE_H__ + +namespace AsruaEngine +{ + namespace Audio + { + + /// + /// fmod + /// + class Source + { + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-fmod/fmod_module.h b/source/modules/asura-fmod/FMODModule.h index 67b8618..67b8618 100644 --- a/source/modules/asura-fmod/fmod_module.h +++ b/source/modules/asura-fmod/FMODModule.h diff --git a/source/modules/asura-json/Json/Json.cpp b/source/modules/asura-json/Json/Json.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-json/Json/Json.cpp diff --git a/source/modules/asura-json/Json/Json.h b/source/modules/asura-json/Json/Json.h new file mode 100644 index 0000000..2bdaf53 --- /dev/null +++ b/source/modules/asura-json/Json/Json.h @@ -0,0 +1,14 @@ +#ifndef __ASURA_JSON_H__ +#define __ASURA_JSON_H__ + +namespace AsuraEngine +{ + namespace Json + { + + + + } +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-json/JsonModule.cpp b/source/modules/asura-json/JsonModule.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-json/JsonModule.cpp diff --git a/source/modules/asura-json/JsonModule.h b/source/modules/asura-json/JsonModule.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-json/JsonModule.h diff --git a/source/modules/asura-network/NetworkModule.h b/source/modules/asura-network/NetworkModule.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-network/NetworkModule.h diff --git a/source/modules/asura-openal/Audio/Audio.cpp b/source/modules/asura-openal/Audio/Audio.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-openal/Audio/Audio.cpp diff --git a/source/modules/asura-openal/Audio/Audio.h b/source/modules/asura-openal/Audio/Audio.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-openal/Audio/Audio.h diff --git a/source/modules/asura-openal/Audio/MPG123Decoder.cpp b/source/modules/asura-openal/Audio/MPG123Decoder.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-openal/Audio/MPG123Decoder.cpp diff --git a/source/modules/asura-openal/Audio/MPG123Decoder.h b/source/modules/asura-openal/Audio/MPG123Decoder.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-openal/Audio/MPG123Decoder.h diff --git a/source/modules/asura-openal/Audio/Sound.cpp b/source/modules/asura-openal/Audio/Sound.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-openal/Audio/Sound.cpp diff --git a/source/modules/asura-openal/Audio/Sound.h b/source/modules/asura-openal/Audio/Sound.h new file mode 100644 index 0000000..ab309f3 --- /dev/null +++ b/source/modules/asura-openal/Audio/Sound.h @@ -0,0 +1,31 @@ +#ifndef __ASURA_ENGINE_SOUND_H__ +#define __ASURA_ENGINE_SOUND_H__ + +#include <asura-utils/Scripting/Portable.hpp> + +namespace AsuraEngine +{ + namespace Audio + { + + /// + /// Ƶļ + /// + class Sound ASURA_FINAL + : public AEScripting::Portable<Sound> + { + public: + + Sound(); + ~Sound(); + + private: + + + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-openal/Audio/SoundData.cpp b/source/modules/asura-openal/Audio/SoundData.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-openal/Audio/SoundData.cpp diff --git a/source/modules/asura-openal/Audio/SoundData.h b/source/modules/asura-openal/Audio/SoundData.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-openal/Audio/SoundData.h diff --git a/source/modules/asura-openal/Audio/SoundDecodeTask.cpp b/source/modules/asura-openal/Audio/SoundDecodeTask.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-openal/Audio/SoundDecodeTask.cpp diff --git a/source/modules/asura-openal/Audio/SoundDecodeTask.h b/source/modules/asura-openal/Audio/SoundDecodeTask.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-openal/Audio/SoundDecodeTask.h diff --git a/source/modules/asura-openal/Audio/SoundDecoder.cpp b/source/modules/asura-openal/Audio/SoundDecoder.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-openal/Audio/SoundDecoder.cpp diff --git a/source/modules/asura-openal/audio/sound_decoder.h b/source/modules/asura-openal/Audio/SoundDecoder.h index e28a5a9..c149d6f 100644 --- a/source/modules/asura-openal/audio/sound_decoder.h +++ b/source/modules/asura-openal/Audio/SoundDecoder.h @@ -1,7 +1,7 @@ #ifndef __ASURA_ENGINE_SOUND_DECODER_H__ #define __ASURA_ENGINE_SOUND_DECODER_H__ -#include <asura-utils/io/data_buffer.h> +#include <asura-utils/IO/DataBuffer.h> #include "sound.h" diff --git a/source/modules/asura-openal/Audio/Source.cpp b/source/modules/asura-openal/Audio/Source.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-openal/Audio/Source.cpp diff --git a/source/modules/asura-openal/Audio/Source.h b/source/modules/asura-openal/Audio/Source.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-openal/Audio/Source.h diff --git a/source/modules/asura-openal/Audio/VorbisDecoder.cpp b/source/modules/asura-openal/Audio/VorbisDecoder.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-openal/Audio/VorbisDecoder.cpp diff --git a/source/modules/asura-openal/Audio/VorbisDecoder.h b/source/modules/asura-openal/Audio/VorbisDecoder.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-openal/Audio/VorbisDecoder.h diff --git a/source/modules/asura-openal/audio/sound.h b/source/modules/asura-openal/audio/sound.h index 2b0eab0..ab309f3 100644 --- a/source/modules/asura-openal/audio/sound.h +++ b/source/modules/asura-openal/audio/sound.h @@ -1,7 +1,7 @@ #ifndef __ASURA_ENGINE_SOUND_H__ #define __ASURA_ENGINE_SOUND_H__ -#include <asura-utils/scripting/portable.hpp> +#include <asura-utils/Scripting/Portable.hpp> namespace AsuraEngine { diff --git a/source/modules/asura-openal/audio/sound_decode_task.h b/source/modules/asura-openal/audio/sound_decode_task.h deleted file mode 100644 index 9587276..0000000 --- a/source/modules/asura-openal/audio/sound_decode_task.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __ASURA_OPENAL_SOUND_DECODER_TASK_H__ -#define __ASURA_OPENAL_SOUND_DECODER_TASK_H__ - -#include <asura-utils/threading/thread_task.h> - -namespace AsuraEngine -{ - namespace OpenAL - { - - /// - /// Ƶļ - /// - class SoundDecodeTask : public AEThreading::ThreadTask - { - public: - - private: - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/source/modules/asura-openal/audio/sound_decoder.cpp b/source/modules/asura-openal/audio/sound_decoder.cpp deleted file mode 100644 index ad9f761..0000000 --- a/source/modules/asura-openal/audio/sound_decoder.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __ASURA_ENGINE_SOUND_DECODER_H__ -#define __ASURA_ENGINE_SOUND_DECODER_H__ - -#include "Sound.h" -#include "FileSystem/DataBuffer.h" - -namespace AsuraEngine -{ - namespace Audio - { - - /// - /// Ƶļ - /// - class SoundDecoder - { - public: - - SoundDecoder(); - virtual ~SoundDecoder(); - - virtual Sound* Decode(const Filesystem::DataBuffer* db); - - }; - - } -} - -#endif
\ No newline at end of file diff --git a/source/modules/asura-utils/Classes.h b/source/modules/asura-utils/Classes.h new file mode 100644 index 0000000..d92c3d4 --- /dev/null +++ b/source/modules/asura-utils/Classes.h @@ -0,0 +1,9 @@ +#ifndef _ASURAENGINE_CLASSES_H_ +#define _ASURAENGINE_CLASSES_H_ + +#define GET_SET(TYPE,PROP_NAME,VAR_NAME) void Set##PROP_NAME (TYPE val) { VAR_NAME = val; } const TYPE Get##PROP_NAME () const {return (const TYPE)VAR_NAME; } + +#define namespace_begin(NAMESPACE) namespace NAMESPACE { +#define namespace_end } + +#endif diff --git a/source/modules/asura-utils/Exceptions/Exception.cpp b/source/modules/asura-utils/Exceptions/Exception.cpp new file mode 100644 index 0000000..5240c49 --- /dev/null +++ b/source/modules/asura-utils/Exceptions/Exception.cpp @@ -0,0 +1,40 @@ +#include "Exception.h" + +#include <cstdarg> +#include <iostream> + +namespace AsuraEngine +{ + + Exception::Exception(const char *fmt, ...) + { + va_list args; + int size_buffer = 256, size_out; + char *buffer; + while (true) + { + buffer = new char[size_buffer]; + memset(buffer, 0, size_buffer); + + va_start(args, fmt); + size_out = vsnprintf(buffer, size_buffer, fmt, args); + va_end(args); + + if (size_out == size_buffer || size_out == -1 || size_out == size_buffer - 1) + size_buffer *= 2; + else if (size_out > size_buffer) + size_buffer = size_out + 2; + else + break; + + delete[] buffer; + } + message = std::string(buffer); + delete[] buffer; + } + + Exception::~Exception() throw() + { + } + +} diff --git a/source/modules/asura-utils/Exceptions/Exception.h b/source/modules/asura-utils/Exceptions/Exception.h new file mode 100644 index 0000000..73c0861 --- /dev/null +++ b/source/modules/asura-utils/Exceptions/Exception.h @@ -0,0 +1,30 @@ +#ifndef _ASURA_ENGINE_EXCEPTION_H_ +#define _ASURA_ENGINE_EXCEPTION_H_ + +#include <string> +#include <exception> + +namespace AsuraEngine +{ + +class Exception : public std::exception +{ +public: + + Exception(const char *fmt, ...); + virtual ~Exception() throw(); + + inline virtual const char *what() const throw() + { + return message.c_str(); + } + +private: + + std::string message; + +}; // Exception + +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-utils/IO/Compressor.cpp b/source/modules/asura-utils/IO/Compressor.cpp new file mode 100644 index 0000000..4202263 --- /dev/null +++ b/source/modules/asura-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/modules/asura-utils/IO/Compressor.h b/source/modules/asura-utils/IO/Compressor.h new file mode 100644 index 0000000..dc25e2a --- /dev/null +++ b/source/modules/asura-utils/IO/Compressor.h @@ -0,0 +1,28 @@ +#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/modules/asura-utils/io/data_buffer.cpp b/source/modules/asura-utils/IO/DataBuffer.cpp index 37f749c..6660a94 100644 --- a/source/modules/asura-utils/io/data_buffer.cpp +++ b/source/modules/asura-utils/IO/DataBuffer.cpp @@ -1,6 +1,6 @@ #include <cstdlib> #include <cstring> -#include "data_buffer.h" +#include "DataBuffer.h" using namespace AEThreading; diff --git a/source/modules/asura-utils/io/data_buffer.h b/source/modules/asura-utils/IO/DataBuffer.h index 53ed603..93fac6e 100644 --- a/source/modules/asura-utils/io/data_buffer.h +++ b/source/modules/asura-utils/IO/DataBuffer.h @@ -1,10 +1,10 @@ -#ifndef __ASURA_ENGINE_DATABUFFER_H__ -#define __ASURA_ENGINE_DATABUFFER_H__ +#ifndef _ASURA_ENGINE_DATABUFFER_H_ +#define _ASURA_ENGINE_DATABUFFER_H_ #include <cstdlib> -#include "../scripting/portable.hpp" -#include "../threading/mutex.h" +#include "../Scripting/Portable.hpp" +#include "../Threads/Mutex.h" namespace AsuraEngine { diff --git a/source/modules/asura-utils/io/decoded_data.h b/source/modules/asura-utils/IO/DecodedData.h index 882556c..73a2f74 100644 --- a/source/modules/asura-utils/io/decoded_data.h +++ b/source/modules/asura-utils/IO/DecodedData.h @@ -1,13 +1,13 @@ -#ifndef __ASURA_ENGINE_DATA_H__ -#define __ASURA_ENGINE_DATA_H__ +#ifndef _ASURA_ENGINE_DATA_H_ +#define _ASURA_ENGINE_DATA_H_ #include <cstdlib> -#include <asura-utils/threading/thread.h> +#include <asura-utils/Threads/Thread.h> -#include "../scripting/portable.hpp" +#include "../Scripting/Portable.hpp" -#include "data_buffer.h" +#include "DataBuffer.h" namespace AsuraEngine { diff --git a/source/modules/asura-utils/IO/File.cpp b/source/modules/asura-utils/IO/File.cpp new file mode 100644 index 0000000..6d5f4eb --- /dev/null +++ b/source/modules/asura-utils/IO/File.cpp @@ -0,0 +1,294 @@ +#include <physfs/physfs.h> + +#include <asura-utils/Exceptions/Exception.h> + +#include "File.h" + +namespace AsuraEngine +{ + namespace IO + { + + File::File(const std::string& filename) + : m_FileName(filename) + , m_FileHandle(nullptr) + , m_Mode(FILE_MODE_CLOSED) + , m_BufferMode(BUFFER_MODE_NONE) + , m_BufferSize(0) + { + size_t dot = filename.rfind('.'); + if (dot != std::string::npos) + { + m_Extension = filename.substr(dot + 1); + m_Name = filename.substr(0, dot); + } + else + m_Name = filename; + } + + File::~File() + { + if (m_Mode != FILE_MODE_CLOSED) + Close(); + } + + bool File::Open(FileMode mode) + { + if (!PHYSFS_isInit()) + throw Exception("Physfs is NOT initialized."); + + if (mode == FILE_MODE_CLOSED) + return false; + + if (mode == FILE_MODE_READ && !PHYSFS_exists(m_FileName.c_str())) + throw Exception("Could NOT open file %s. Does not exist.", m_FileName.c_str()); + + if (mode == FILE_MODE_APPEND || mode == FILE_MODE_WRITE) + { + if (!PHYSFS_getWriteDir()) + { + throw Exception("Could NOT set write directory."); + } + } + + // Ѿ֮ǰͲٴµhandle + if (m_FileHandle != nullptr) + return true; + + PHYSFS_getLastErrorCode(); + + PHYSFS_File* handle = nullptr; + + switch (mode) + { + case FILE_MODE_READ: + handle = PHYSFS_openRead(m_FileName.c_str()); + break; + case FILE_MODE_APPEND: + handle = PHYSFS_openAppend(m_FileName.c_str()); + break; + case FILE_MODE_WRITE: + handle = PHYSFS_openWrite(m_FileName.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)", m_FileName.c_str(), err); + } + + m_FileHandle = handle; + m_Mode = mode; + + if (m_FileHandle && !SetBuffer(m_BufferMode,m_BufferSize)) + { + m_BufferMode = BUFFER_MODE_NONE; + m_BufferSize = 0; + } + + return m_FileHandle != nullptr; + } + + bool File::Close() + { + if (m_FileHandle == nullptr || !PHYSFS_close(m_FileHandle)) + return false; + m_Mode = FILE_MODE_CLOSED; + m_FileHandle = nullptr; + return true; + } + + bool File::IsOpen() + { + return m_Mode != FILE_MODE_CLOSED && m_FileHandle != nullptr; + } + + size_t File::GetSize() + { + if (m_FileHandle == nullptr) + { + Open(FILE_MODE_READ); + size_t size = PHYSFS_fileLength(m_FileHandle); + Close(); + return size; + } + return PHYSFS_fileLength(m_FileHandle); + } + + size_t File::Read(ASURA_OUT DataBuffer* dst, size_t length) + { + ASSERT(dst); + + if (dst->GetCapacity() < length) + throw Exception("Data buffer is too small compares to read length."); + + if (!m_FileHandle || m_Mode != FILE_MODE_READ) + throw Exception("File \"%s\" is not opened for reading", m_FileName); + + size_t max = PHYSFS_fileLength(m_FileHandle); + length = (length > max) ? max : length; + + if (length < 0) + throw Exception("Invalid read size."); + + dst->Lock(); + size_t size = PHYSFS_readBytes(m_FileHandle, dst->GetData(), length); + dst->Unlock(); + return size; + } + + size_t File::ReadAll(ASURA_OUT DataBuffer* dst) + { + ASSERT(dst); + + if (!m_FileHandle || m_Mode != FILE_MODE_READ) + throw Exception("File \"%s\" is not opened for reading", m_FileName); + + size_t length = PHYSFS_fileLength(m_FileHandle); + + if (dst->GetCapacity() < length) + throw Exception("Data buffer is too small compares to file length."); + + dst->Lock(); + byte* data = dst->GetData(); + size_t size = PHYSFS_readBytes(m_FileHandle, data, length); + dst->Move(data, length); + dst->Unlock(); + return size; + } + +#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 m_FileHandle == nullptr || test_eof(this, m_FileHandle); + } + + size_t File::Tell() + { + if (!m_FileHandle) + return - 1; + + return PHYSFS_tell(m_FileHandle); + } + + bool File::Seek(size_t pos) + { + return m_FileHandle != nullptr && PHYSFS_seek(m_FileHandle, pos) != 0; + } + + bool File::Write(ASURA_REF DataBuffer* src) + { + if (!m_FileHandle || (m_Mode != FILE_MODE_APPEND && m_Mode != 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(m_FileHandle, data, size); + + if (written != src->GetSize()) + return false; + + // л + if (m_BufferSize == BUFFER_MODE_LINE && m_BufferSize > size) + { + if (memchr(data, '\n', size) != nullptr) + Flush(); + } + + return true; + } + + bool File::Flush() + { + if (!m_FileHandle || (m_Mode != FILE_MODE_WRITE && m_Mode != FILE_MODE_APPEND)) + throw Exception("File is not opened for writing."); + + return PHYSFS_flush(m_FileHandle) != 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()) + { + m_BufferMode = mode; + m_BufferSize = size; + return true; + } + + int ret = 1; + + switch (mode) + { + case BUFFER_MODE_NONE: + default: + ret = PHYSFS_setBuffer(m_FileHandle, 0); + size = 0; + break; + case BUFFER_MODE_LINE: + case BUFFER_MODE_FULL: + ret = PHYSFS_setBuffer(m_FileHandle, size); + break; + } + + if (ret == 0) + return false; + + m_BufferMode = mode; + m_BufferSize = size; + + return true; + } + + File::BufferMode File::GetBuffer(ASURA_OUT size_t& size) + { + size = m_BufferSize; + return m_BufferMode; + } + + const std::string& File::GetFileName() + { + return m_FileName; + } + + const std::string& File::GetName() + { + return m_Name; + } + + const std::string& File::GetExtension() + { + return m_Extension; + } + + File::FileMode File::GetMode() + { + return m_Mode; + } + + } +}
\ No newline at end of file diff --git a/source/modules/asura-utils/IO/File.h b/source/modules/asura-utils/IO/File.h new file mode 100644 index 0000000..d11fa4f --- /dev/null +++ b/source/modules/asura-utils/IO/File.h @@ -0,0 +1,146 @@ +#ifndef _ASURA_ENGINE_FILE_H_ +#define _ASURA_ENGINE_FILE_H_ + +#include "physfs/physfs.h" + +#include "../Scripting/Portable.hpp" +#include "../Threads/Thread.h" + +#include "FileData.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); + size_t ReadAsync(ASURA_OUT DataBuffer* dst); + + /// + /// Ƿļβ + /// + bool IsEOF(); + + /// + /// data bufferед룬Ƿɹ + /// + bool Write(ASURA_REF DataBuffer* src); + + /// + /// 첽дļдļtaskthreadĶС + /// + bool WriteAsync(ASURA_REF DataBuffer* src, AEThreading::Thread* thread); + + /// + /// ˻壬ǿջдļ + /// + 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* m_FileHandle; ///< physfs ļ + std::string m_FileName; ///< ļ + std::string m_Extension; ///< չ + std::string m_Name; ///< չļ + FileMode m_Mode; ///< ļģʽ + BufferMode m_BufferMode; ///< д뻺ģʽ + size_t m_BufferSize; ///< д뻺С + + LUAX_DECL_ENUM(FileMode); + LUAX_DECL_ENUM(BufferMode); + + 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(_Write); + LUAX_DECL_METHOD(_ReadAsync); + LUAX_DECL_METHOD(_WriteAsync); + LUAX_DECL_METHOD(_IsEOF); + LUAX_DECL_METHOD(_Flush); + LUAX_DECL_METHOD(_Tell); + LUAX_DECL_METHOD(_Seek); + LUAX_DECL_METHOD(_SetBuffer); + LUAX_DECL_METHOD(_GetBuffer); + LUAX_DECL_METHOD(_GetFileName); + LUAX_DECL_METHOD(_GetExtension); + LUAX_DECL_METHOD(_GetName); + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-utils/io/file_data.cpp b/source/modules/asura-utils/IO/FileData.cpp index 30fa5bf..ca1cce7 100644 --- a/source/modules/asura-utils/io/file_data.cpp +++ b/source/modules/asura-utils/IO/FileData.cpp @@ -1,4 +1,4 @@ -#include "file_data.h" +#include "FileData.h" namespace AsuraEngine { diff --git a/source/modules/asura-utils/io/file_data.h b/source/modules/asura-utils/IO/FileData.h index ecc072b..f93040c 100644 --- a/source/modules/asura-utils/io/file_data.h +++ b/source/modules/asura-utils/IO/FileData.h @@ -1,11 +1,11 @@ -#ifndef __ASURA_ENGINE_FILE_DATA_H__ -#define __ASURA_ENGINE_FILE_DATA_H__ +#ifndef _ASURA_ENGINE_FILE_DATA_H_ +#define _ASURA_ENGINE_FILE_DATA_H_ #include <string> -#include <asura-utils/scripting/portable.hpp> +#include <asura-utils/Scripting/Portable.hpp> -#include "data_buffer.h" +#include "DataBuffer.h" namespace AsuraEngine { diff --git a/source/modules/asura-utils/io/file_system.cpp b/source/modules/asura-utils/IO/FileSystem.cpp index f68bad6..9d0acf0 100644 --- a/source/modules/asura-utils/io/file_system.cpp +++ b/source/modules/asura-utils/IO/FileSystem.cpp @@ -2,9 +2,9 @@ #include "../exceptions/exception.h" -#include "file.h" -#include "file_data.h" -#include "file_system.h" +#include "File.h" +#include "FileData.h" +#include "FileSystem.h" using namespace std; diff --git a/source/modules/asura-utils/io/file_system.h b/source/modules/asura-utils/IO/FileSystem.h index 9b4c4be..f0ac6ba 100644 --- a/source/modules/asura-utils/io/file_system.h +++ b/source/modules/asura-utils/IO/FileSystem.h @@ -1,15 +1,15 @@ -#ifndef __ASURA_ENGINE_FILESYSTEM_H__ -#define __ASURA_ENGINE_FILESYSTEM_H__ +#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 "../Scripting/Portable.hpp" +#include "../Singleton.hpp" +#include "../Type.h" -#include "file_data.h" -#include "file.h" +#include "FileData.h" +#include "File.h" namespace AsuraEngine { diff --git a/source/modules/asura-utils/IO/IOBatchTask.cpp b/source/modules/asura-utils/IO/IOBatchTask.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-utils/IO/IOBatchTask.cpp diff --git a/source/modules/asura-utils/io/io_batch_task.h b/source/modules/asura-utils/IO/IOBatchTask.h index 0a551e8..a9355d5 100644 --- a/source/modules/asura-utils/io/io_batch_task.h +++ b/source/modules/asura-utils/IO/IOBatchTask.h @@ -1,7 +1,7 @@ -#ifndef __ASURA_IO_BATCH_TASK_H__ -#define __ASURA_IO_BATCH_TASK_H__ +#ifndef _ASURA_IO_BATCH_TASK_H_ +#define _ASURA_IO_BATCH_TASK_H_ -#include "io_task.h" +#include "IOTask.h" namespace AsuraEngine { diff --git a/source/modules/asura-utils/io/io_task.cpp b/source/modules/asura-utils/IO/IOTask.cpp index 6c323de..bfa6726 100644 --- a/source/modules/asura-utils/io/io_task.cpp +++ b/source/modules/asura-utils/IO/IOTask.cpp @@ -1,5 +1,5 @@ -#include "file_system.h" -#include "io_task.h" +#include "FileSystem.h" +#include "IOTask.h" #include <iostream> diff --git a/source/modules/asura-utils/io/io_task.h b/source/modules/asura-utils/IO/IOTask.h index 8026a24..a35fc54 100644 --- a/source/modules/asura-utils/io/io_task.h +++ b/source/modules/asura-utils/IO/IOTask.h @@ -1,12 +1,12 @@ -#ifndef __ASURA_IO_TASK_H__ -#define __ASURA_IO_TASK_H__ +#ifndef _ASURA_IO_TASK_H_ +#define _ASURA_IO_TASK_H_ #include <string> -#include "../scripting/portable.hpp" -#include "../threading/task.h" +#include "../Scripting/Portable.hpp" +#include "../Threads/Task.h" -#include "data_buffer.h" +#include "DataBuffer.h" namespace AsuraEngine { diff --git a/source/modules/asura-utils/IO/Renewable.h b/source/modules/asura-utils/IO/Renewable.h new file mode 100644 index 0000000..90867f2 --- /dev/null +++ b/source/modules/asura-utils/IO/Renewable.h @@ -0,0 +1,29 @@ +#ifndef __ASURA_ENGINE_RENEWABLE_H__ +#define __ASURA_ENGINE_RENEWABLE_H__ + +#include "../scripting/portable.hpp" + +#include "DecodedData.h" + +namespace AsuraEngine +{ + namespace IO + { + + /// + /// ¹ݽṹͼƬƵ֣ӽݿֱӹڱ༭ + /// ¹handleֵı䲻߱ƻԣڲıhandleԴ + /// + ASURA_ABSTRACT class Renewable + { + public: + Renewable() {}; + virtual ~Renewable() {}; + }; + + } +} + +namespace AEIO = AsuraEngine::IO; + +#endif
\ No newline at end of file diff --git a/source/modules/asura-utils/IO/binding/_compressor.cpp b/source/modules/asura-utils/IO/binding/_compressor.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-utils/IO/binding/_compressor.cpp diff --git a/source/modules/asura-utils/IO/binding/_data_buffer.cpp b/source/modules/asura-utils/IO/binding/_data_buffer.cpp new file mode 100644 index 0000000..9d3f3a0 --- /dev/null +++ b/source/modules/asura-utils/IO/binding/_data_buffer.cpp @@ -0,0 +1,132 @@ +#include "../DataBuffer.h" + +using namespace Luax; + +namespace AsuraEngine +{ + namespace IO + { + + LUAX_REGISTRY(DataBuffer) + { + LUAX_REGISTER_METHODS(state, + { "New", _New }, + { "GetData", _GetData }, + { "GetSize", _GetSize }, + { "GetCapacity", _GetCapacity }, + { "Refactor", _Refactor }, + { "Load", _Load }, + { "Clear", _Clear } + ); + } + + LUAX_POSTPROCESS(DataBuffer) + { + } + + // databuffer = DataBuffer.New(lstring) + // databuffer = DataBuffer.New(capacity) + LUAX_IMPL_METHOD(DataBuffer, _New) + { + LUAX_STATE(L); + + if (state.IsType(1, LUA_TSTRING)) + { + size_t size; + const byte* bytes = lua_tolstring(L, 1, &size); + DataBuffer* buffer = new DataBuffer(bytes, size); + buffer->PushLuaxUserdata(state); + return 1; + } + else if (state.IsType(1, LUA_TNUMBER)) + { + size_t capacity = lua_tonumber(L, 1); + DataBuffer* buffer = new DataBuffer(capacity); + buffer->PushLuaxUserdata(state); + return 1; + } + else + { + return state.ErrorType(1, "number or string"); + } + } + + // lsting, len = databuffer:GetData() + LUAX_IMPL_METHOD(DataBuffer, _GetData) + { + LUAX_SETUP(L, "U"); + + DataBuffer* self = state.GetUserdata<DataBuffer>(1); + lua_pushlstring(L, self->GetData(), self->GetSize()); + return 1; + } + + // length = databuffer:GetSize() + LUAX_IMPL_METHOD(DataBuffer, _GetSize) + { + LUAX_SETUP(L, "U"); + + DataBuffer* self = state.GetUserdata<DataBuffer>(1); + lua_pushinteger(L, self->GetSize()); + return 1; + } + + // capacity = databuffer:GetCapacity() + LUAX_IMPL_METHOD(DataBuffer, _GetCapacity) + { + LUAX_SETUP(L, "U"); + + DataBuffer* self = state.GetUserdata<DataBuffer>(1); + lua_pushinteger(L, self->GetCapacity()); + return 1; + } + + // databuffer:Refactor(capacity) + LUAX_IMPL_METHOD(DataBuffer, _Refactor) + { + LUAX_PREPARE(L, DataBuffer); + + size_t capacity = state.CheckValue<int>(2); + self->Refactor(capacity); + return 0; + } + + // size = databuffer:Load(lstring) + // size = databuffer:Load(src) + LUAX_IMPL_METHOD(DataBuffer, _Load) + { + LUAX_STATE(L); + + DataBuffer* buffer = state.GetUserdata<DataBuffer>(1); + const byte* data; + size_t size; + if (state.IsType(2, LUA_TSTRING)) + { + data = lua_tolstring(L, 2, &size); + buffer->Load(data, size); + return 0; + } + else if(state.IsType(2, LUA_TUSERDATA)) + { + DataBuffer* src = state.CheckUserdata<DataBuffer>(2); + buffer->Load(*src); + return 0; + } + else + { + return state.ErrorType(1, "lstring or DataBuffer"); + } + } + + // databuffer:Clear() + LUAX_IMPL_METHOD(DataBuffer, _Clear) + { + LUAX_SETUP(L, "U"); + + DataBuffer* self = state.GetUserdata<DataBuffer>(1); + self->Clear(); + return 0; + } + + } +}
\ No newline at end of file diff --git a/source/modules/asura-utils/IO/binding/_file.cpp b/source/modules/asura-utils/IO/binding/_file.cpp new file mode 100644 index 0000000..c44bc90 --- /dev/null +++ b/source/modules/asura-utils/IO/binding/_file.cpp @@ -0,0 +1,223 @@ +#include "../file.h" + +namespace AsuraEngine +{ + namespace IO + { + + LUAX_REGISTRY(File) + { + LUAX_REGISTER_METHODS(state, + { "New", _New }, + { "Open", _Open }, + { "Close", _Close }, + { "IsOpen", _IsOpen }, + { "GetMode", _GetMode }, + { "GetSize", _GetSize }, + { "Read", _Read }, + { "IsEOF", _IsEOF }, + { "Write", _Write }, + { "Flush", _Flush }, + { "Tell", _Tell }, + { "Seek", _Seek }, + { "SetBuffer", _SetBuffer }, + { "GetBuffer", _GetBuffer }, + { "GetFileName", _GetFileName }, + { "GetExtension", _GetExtension }, + { "GetName", _GetName } + ); + } + + 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.CheckValue<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.CheckValue<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.CheckValue<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[, size]) + 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.CheckValue<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.CheckValue<int>(2); + int size = state.CheckValue<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; + } + + // name = file:GetExtension() + LUAX_IMPL_METHOD(File, _GetExtension) + { + LUAX_PREPARE(L, File); + + state.Push(self->GetExtension()); + return 1; + } + + // name = file:GetName() + LUAX_IMPL_METHOD(File, _GetName) + { + LUAX_PREPARE(L, File); + + state.Push(self->GetName()); + return 1; + } + + } +}
\ No newline at end of file diff --git a/source/modules/asura-utils/IO/binding/_file_data.cpp b/source/modules/asura-utils/IO/binding/_file_data.cpp new file mode 100644 index 0000000..55cbc8b --- /dev/null +++ b/source/modules/asura-utils/IO/binding/_file_data.cpp @@ -0,0 +1,60 @@ +#include "../FileData.h" + +using namespace std; + +namespace AsuraEngine +{ + namespace IO + { + + 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) + { + LUAX_PREPARE(L, FileData); + string filename = self->GetFileName(); + state.Push(filename); + return 1; + } + + // extension = filedata:GetExtension() + LUAX_IMPL_METHOD(FileData, _GetExtension) + { + LUAX_PREPARE(L, FileData); + string extension = self->GetExtension(); + state.Push(extension); + return 1; + } + + // name = filedata:GetName() + LUAX_IMPL_METHOD(FileData, _GetName) + { + LUAX_PREPARE(L, FileData); + string extension = self->GetName(); + state.Push(extension); + return 1; + } + + // databuffer = filedata:GetDataBuffer() + LUAX_IMPL_METHOD(FileData, _GetDataBuffer) + { + LUAX_PREPARE(L, FileData); + self->PushLuaxMemberRef(state, self->m_DataRef); + return 1; + } + + } +}
\ No newline at end of file diff --git a/source/modules/asura-utils/IO/binding/_file_system.cpp b/source/modules/asura-utils/IO/binding/_file_system.cpp new file mode 100644 index 0000000..ace3c5f --- /dev/null +++ b/source/modules/asura-utils/IO/binding/_file_system.cpp @@ -0,0 +1,265 @@ +#include "../FileSystem.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.CheckValue<const char*>(1); + fs->Init(arg0); + return 0; + } + + // successed = Filesystem.Mount(path, mountpoint[, prepend = false]) + // successed = Filesystem.Mount(data buffer, archievename, mountpoint[, prepend = false]) + 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.CheckValue<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.CheckValue<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.CheckValue<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.CheckValue<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.CheckValue<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, _Append) + { + PREPARE(L); + + cc8* path = state.CheckValue<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.CheckValue<cc8*>(1); + state.Push(fs->Remove(path)); + return 1; + } + + // filedata = Filesystem.Read(path) + LUAX_IMPL_METHOD(Filesystem, _Read) + { + PREPARE(L); + + cc8* path = state.CheckValue<cc8*>(1); + FileData* fd = fs->Read(path); + if (fd) + { + fd->m_Data->PushLuaxUserdata(state); + fd->SetLuaxMemberRef(state, fd->m_DataRef, -1); // fd->m_DataRef = data buffer + state.Pop(1); // data buffer + fd->PushLuaxUserdata(state); + } + else + { + state.PushNil(); + } + return 1; + } + + // fileinfo = Filesystem.GetFileInfo(path) + LUAX_IMPL_METHOD(Filesystem, _GetFileInfo) + { + PREPARE(L); + + cc8* path = state.CheckValue<cc8*>(1); + FileInfo info; + if (fs->GetFileInfo(path, &info)) + { + lua_newtable(L); // info table + state.SetField(-1, "size", info.size); + state.SetField(-1, "modtime", 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.CheckValue<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; + } + + } +}
\ No newline at end of file diff --git a/source/modules/asura-utils/IO/binding/_io_task.cpp b/source/modules/asura-utils/IO/binding/_io_task.cpp new file mode 100644 index 0000000..058f4fd --- /dev/null +++ b/source/modules/asura-utils/IO/binding/_io_task.cpp @@ -0,0 +1,46 @@ +#include "../IOTask.h" + +using namespace std; + +namespace AsuraEngine +{ + namespace IO + { + + LUAX_REGISTRY(IOTask) + { + LUAX_REGISTER_METHODS(state, + { "New", _New } + ); + } + + LUAX_POSTPROCESS(IOTask) + { + LUAX_REGISTER_ENUM(state, "EIOTaskType", + { "READ", IOTASK_TYPE_READ }, + { "WRITE", IOTASK_TYPE_WRITE }, + { "APPEND", IOTASK_TYPE_APPEND } + ); + + } + + // task = IOTask.New(path, buffer, type, callback) + LUAX_IMPL_METHOD(IOTask, _New) + { + LUAX_STATE(L); + + cc8* path = state.CheckValue<cc8*>(1); + DataBuffer* db = state.CheckUserdata<DataBuffer>(2); + IOTaskType type = (IOTaskType)state.CheckValue<int>(3); + bool cbk = state.GetTop() >= 4 && state.IsType(4, LUA_TFUNCTION); + + IOTask* task = new IOTask(path, db, type); + task->SetLuaxMemberRef(state, task->m_BufferRef, 2); + if(cbk) + task->SetLuaxMemberRef(state, task->m_Callback, 4); + task->PushLuaxUserdata(state); + return 1; + } + + } +} diff --git a/source/modules/asura-utils/Manager.hpp b/source/modules/asura-utils/Manager.hpp new file mode 100644 index 0000000..c6817b1 --- /dev/null +++ b/source/modules/asura-utils/Manager.hpp @@ -0,0 +1,14 @@ +#ifndef _ASURA_ENGINE_MANAGER_H_ +#define _ASURA_ENGINE_MANAGER_H_ + +namespace AsuraEngine +{ + + class Manager + { + + }; + +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-utils/Math/Curve.cpp b/source/modules/asura-utils/Math/Curve.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-utils/Math/Curve.cpp diff --git a/source/modules/asura-utils/Math/Curve.h b/source/modules/asura-utils/Math/Curve.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-utils/Math/Curve.h diff --git a/source/modules/asura-utils/Math/Functions.cpp b/source/modules/asura-utils/Math/Functions.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-utils/Math/Functions.cpp diff --git a/source/modules/asura-utils/Math/Functions.h b/source/modules/asura-utils/Math/Functions.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-utils/Math/Functions.h diff --git a/source/modules/asura-utils/Math/Matrix44.cpp b/source/modules/asura-utils/Math/Matrix44.cpp new file mode 100644 index 0000000..9ecf448 --- /dev/null +++ b/source/modules/asura-utils/Math/Matrix44.cpp @@ -0,0 +1,217 @@ +#include "Matrix44.h" + +#include <cstring> // memcpy +#include <cmath> + +namespace AsuraEngine +{ + namespace Math + { + + const Matrix44 Matrix44::Identity; + + // | e0 e4 e8 e12 | + // | e1 e5 e9 e13 | + // | e2 e6 e10 e14 | + // | e3 e7 e11 e15 | + + Matrix44::Matrix44() + { + SetIdentity(); + } + + Matrix44::Matrix44(const Matrix44& m) + { + memcpy(&e, &m.e, 16 * sizeof(float)); + } + + Matrix44::~Matrix44() + { + } + + void Matrix44::operator = (const Matrix44& m) + { + memcpy(&e, &m.e, 16 * sizeof(float)); + } + + void Matrix44::SetOrtho(float l, float r, float b, float t, float n, float f) + { + SetIdentity(); + float w = r - l; + float h = t - b; + float z = f - n; + e[0] = 2 / w; + e[5] = 2 / h; + e[10] = -2 / z; + e[12] = -(r + l) / w; + e[13] = -(t + b) / h; + e[14] = -(f + n) / z; + e[15] = 1; + } + + // | e0 e4 e8 e12 | + // | e1 e5 e9 e13 | + // | e2 e6 e10 e14 | + // | e3 e7 e11 e15 | + // | e0 e4 e8 e12 | + // | e1 e5 e9 e13 | + // | e2 e6 e10 e14 | + // | e3 e7 e11 e15 | + + Matrix44 Matrix44::operator * (const Matrix44 & m) const + { + Matrix44 t; + + t.e[0] = (e[0] * m.e[0]) + (e[4] * m.e[1]) + (e[8] * m.e[2]) + (e[12] * m.e[3]); + t.e[4] = (e[0] * m.e[4]) + (e[4] * m.e[5]) + (e[8] * m.e[6]) + (e[12] * m.e[7]); + t.e[8] = (e[0] * m.e[8]) + (e[4] * m.e[9]) + (e[8] * m.e[10]) + (e[12] * m.e[11]); + t.e[12] = (e[0] * m.e[12]) + (e[4] * m.e[13]) + (e[8] * m.e[14]) + (e[12] * m.e[15]); + + t.e[1] = (e[1] * m.e[0]) + (e[5] * m.e[1]) + (e[9] * m.e[2]) + (e[13] * m.e[3]); + t.e[5] = (e[1] * m.e[4]) + (e[5] * m.e[5]) + (e[9] * m.e[6]) + (e[13] * m.e[7]); + t.e[9] = (e[1] * m.e[8]) + (e[5] * m.e[9]) + (e[9] * m.e[10]) + (e[13] * m.e[11]); + t.e[13] = (e[1] * m.e[12]) + (e[5] * m.e[13]) + (e[9] * m.e[14]) + (e[13] * m.e[15]); + + t.e[2] = (e[2] * m.e[0]) + (e[6] * m.e[1]) + (e[10] * m.e[2]) + (e[14] * m.e[3]); + t.e[6] = (e[2] * m.e[4]) + (e[6] * m.e[5]) + (e[10] * m.e[6]) + (e[14] * m.e[7]); + t.e[10] = (e[2] * m.e[8]) + (e[6] * m.e[9]) + (e[10] * m.e[10]) + (e[14] * m.e[11]); + t.e[14] = (e[2] * m.e[12]) + (e[6] * m.e[13]) + (e[10] * m.e[14]) + (e[14] * m.e[15]); + + t.e[3] = (e[3] * m.e[0]) + (e[7] * m.e[1]) + (e[11] * m.e[2]) + (e[15] * m.e[3]); + t.e[7] = (e[3] * m.e[4]) + (e[7] * m.e[5]) + (e[11] * m.e[6]) + (e[15] * m.e[7]); + t.e[11] = (e[3] * m.e[8]) + (e[7] * m.e[9]) + (e[11] * m.e[10]) + (e[15] * m.e[11]); + t.e[15] = (e[3] * m.e[12]) + (e[7] * m.e[13]) + (e[11] * m.e[14]) + (e[15] * m.e[15]); + + return t; + } + + void Matrix44::operator *= (const Matrix44 & m) + { + Matrix44 t = (*this) * m; + memcpy((void*)this->e, (void*)t.e, sizeof(float) * 16); + } + + const float * Matrix44::GetElements() const + { + return e; + } + + void Matrix44::SetIdentity() + { + memset(e, 0, sizeof(float) * 16); + e[0] = e[5] = e[10] = e[15] = 1; + } + + void Matrix44::SetTranslation(float x, float y) + { + SetIdentity(); + e[12] = x; + e[13] = y; + } + + void Matrix44::SetRotation(float rad) + { + SetIdentity(); + float c = cos(rad), s = sin(rad); + e[0] = c; e[4] = -s; + e[1] = s; e[5] = c; + } + + void Matrix44::SetScale(float sx, float sy) + { + SetIdentity(); + e[0] = sx; + e[5] = sy; + } + + void Matrix44::SetShear(float kx, float ky) + { + SetIdentity(); + e[1] = ky; + e[4] = kx; + } + + void Matrix44::SetTransformation(float x, float y, float angle, float sx, float sy, float ox, float oy) + { + memset(e, 0, sizeof(float) * 16); // zero out matrix + float c = cos(angle), s = sin(angle); + // matrix multiplication carried out on paper: + // |1 x| |c -s | |sx | |1 -ox| + // | 1 y| |s c | | sy | | 1 -oy| + // | 1 | | 1 | | 1 | | 1 | + // | 1| | 1| | 1| | 1 | + // move rotate scale origin + e[10] = e[15] = 1.0f; + e[0] = c * sx; // = a + e[1] = s * sx; // = b + e[4] = -s * sy; // = c + e[5] = c * sy; // = d + e[12] = x - ox * e[0] - oy * e[4]; + e[13] = y - ox * e[1] - oy * e[5]; + } + + void Matrix44::Translate(float x, float y) + { + Matrix44 t; + t.SetTranslation(x, y); + this->operator *=(t); + } + + void Matrix44::Rotate(float rad) + { + Matrix44 t; + t.SetRotation(rad); + this->operator *=(t); + } + + void Matrix44::Scale(float sx, float sy) + { + Matrix44 t; + t.SetScale(sx, sy); + this->operator *=(t); + } + + void Matrix44::Shear(float kx, float ky) + { + Matrix44 t; + t.SetShear(kx, ky); + this->operator *=(t); + } + + void Matrix44::Transform(float x, float y, float angle, float sx, float sy, float ox, float oy) + { + Matrix44 t; + t.SetTransformation(x, y, angle, sx, sy, ox, oy); + this->operator *=(t); + } + + void Matrix44::Ortho(float left, float right, float bottom, float top, float near, float far) + { + Matrix44 t; + t.SetOrtho(left, right, bottom, top, near, far); + this->operator *=(t); + } + + // | x | + // | y | + // | 0 | + // | 1 | + // | e0 e4 e8 e12 | + // | e1 e5 e9 e13 | + // | e2 e6 e10 e14 | + // | e3 e7 e11 e15 | + + //void Matrix44::transform(Graphics::Vertex* dst, const Graphics::Vertex* src, int size) const + //{ + // for (int i = 0; i<size; ++i) + // { + // // Store in temp variables in case src = dst + // float x = (e[0] * src[i].xy.x()) + (e[4] * src[i].xy.y()) + (0) + (e[12]); + // float y = (e[1] * src[i].xy.x()) + (e[5] * src[i].xy.y()) + (0) + (e[13]); + + // dst[i].xy.Set(x, y); + // } + //} + + } // namespace Math +} // namespace JinEngine
\ No newline at end of file diff --git a/source/modules/asura-utils/Math/Matrix44.h b/source/modules/asura-utils/Math/Matrix44.h new file mode 100644 index 0000000..7b66920 --- /dev/null +++ b/source/modules/asura-utils/Math/Matrix44.h @@ -0,0 +1,98 @@ +#ifndef _ASURA_MATRIX_H_ +#define _ASURA_MATRIX_H_ + +#include "../Scripting/Portable.hpp" + +namespace AsuraEngine +{ + namespace Math + { + + /// + /// ҪתõOpenGLglm::mat4 + /// https://blog.csdn.net/candycat1992/article/details/8830894 + /// + class Matrix44 + { + public: + + static const Matrix44 Identity; + + Matrix44(); + + Matrix44(const Matrix44& m); + + ~Matrix44(); + + void operator = (const Matrix44& m); + + void SetOrtho(float _left, float _right, float _bottom, float _top, float _near, float _far); + + Matrix44 operator * (const Matrix44 & m) const; + + void operator *= (const Matrix44 & m); + + const float* GetElements() const; + + void SetIdentity(); + + void SetTranslation(float x, float y); + + void SetRotation(float r); + + void SetScale(float sx, float sy); + + void SetShear(float kx, float ky); + + void SetTransformation(float x, float y, float angle, float sx, float sy, float ox, float oy); + + void Translate(float x, float y); + + void Rotate(float r); + + void Scale(float sx, float sy); + + void Transform(float x, float y, float angle, float sx, float sy, float ox, float oy); + + /// + /// Multiplies this Matrix44 with a shear transformation. + /// @param kx Shear along the x-axis. + /// @param ky Shear along the y-axis. + /// + void Shear(float kx, float ky); + + void Ortho(float left, float right, float bottom, float top, float near, float far); + + ///// + ///// Transforms an array of vertices by this Matrix44. The sources and + ///// destination arrays may be the same. + ///// + ///// @param dst Storage for the transformed vertices. + ///// @param src The source vertices. + ///// @param size The number of vertices. + ///// + //void transform(Graphics::Vertex* dst, const Graphics::Vertex * src, int size) const; + + /// + /// ʽ + /// + float Calculate(); + + private: + + /// + /// | e0 e4 e8 e12 | + /// | e1 e5 e9 e13 | + /// | e2 e6 e10 e14 | + /// | e3 e7 e11 e15 | + /// + float e[16]; + + }; + + } +} + +namespace AEMath = AsuraEngine::Math; + +#endif
\ No newline at end of file diff --git a/source/modules/asura-utils/Math/Quaternion.cpp b/source/modules/asura-utils/Math/Quaternion.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-utils/Math/Quaternion.cpp diff --git a/source/modules/asura-utils/Math/Quaternion.h b/source/modules/asura-utils/Math/Quaternion.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-utils/Math/Quaternion.h diff --git a/source/modules/asura-utils/Math/Rand/Rand.h b/source/modules/asura-utils/Math/Rand/Rand.h new file mode 100644 index 0000000..efda8db --- /dev/null +++ b/source/modules/asura-utils/Math/Rand/Rand.h @@ -0,0 +1,89 @@ +#ifndef RAND_H +#define RAND_H + +#include "../../Type.h" +#include "../../Classes.h" + +namespace_begin(AsuraEngine) +namespace_begin(Math) + +/* +Some random generator timings: +MacBook Pro w/ Core 2 Duo 2.4GHz. Times are for gcc 4.0.1 (OS X 10.6.2) / VS2008 SP1 (Win XP SP3), +in milliseconds for this loop (4915200 calls): + +for (int j = 0; j < 100; ++j) +for (int i = 0; i < 128*128*3; ++i) +data[i] = (rnd.get() & 0x3) << 6; + +gcc vs2008 Size +C's rand(): 57.0 109.3 ms 1 +Mersenne Twister: 56.0 37.4 ms 2500 +Unity 2.x LCG: 11.1 9.2 ms 4 +Xorshift 128: 15.0 17.8 ms 16 +Xorshift 32: 20.6 10.7 ms 4 +WELL 512: 43.6 55.1 ms 68 +*/ + + +// Xorshift 128 implementation +// Xorshift paper: http://www.jstatsoft.org/v08/i14/paper +// Wikipedia: http://en.wikipedia.org/wiki/Xorshift +class Rand { +public: + + Rand(uint32 seed = 0) + { + SetSeed(seed); + } + + uint32 Get() + { + uint32 t; + t = x ^ (x << 11); + x = y; y = z; z = w; + return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); + } + + inline static float GetFloatFromInt(uint32 value) + { + // take 23 bits of integer, and divide by 2^23-1 + return float(value & 0x007FFFFF) * (1.0f / 8388607.0f); + } + + inline static uint8 GetByteFromInt(uint32 value) + { + // take the most significant byte from the 23-bit value + return uint8(value >> (23 - 8)); + } + + // random number between 0.0 and 1.0 + float GetFloat() + { + return GetFloatFromInt(Get()); + } + + // random number between -1.0 and 1.0 + float GetSignedFloat() + { + return GetFloat() * 2.0f - 1.0f; + } + + void SetSeed(uint32 seed) + { + x = seed; + y = x * 1812433253U + 1; + z = y * 1812433253U + 1; + w = z * 1812433253U + 1; + } + + uint32 GetSeed() const { return x; } + +private: + uint32 x, y, z, w; +}; + +namespace_end +namespace_end + +#endif
\ No newline at end of file diff --git a/source/modules/asura-utils/Math/Rand/Random.h b/source/modules/asura-utils/Math/Rand/Random.h new file mode 100644 index 0000000..cf2fc54 --- /dev/null +++ b/source/modules/asura-utils/Math/Rand/Random.h @@ -0,0 +1,9 @@ +#include "Rand.h" + +namespace_begin(AsuraEngine) +namespace_begin(Math) + + + +namespace_end +namespace_end
\ No newline at end of file diff --git a/source/modules/asura-utils/Math/RangedValue.cpp b/source/modules/asura-utils/Math/RangedValue.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-utils/Math/RangedValue.cpp diff --git a/source/modules/asura-utils/Math/RangedValue.h b/source/modules/asura-utils/Math/RangedValue.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-utils/Math/RangedValue.h diff --git a/source/modules/asura-utils/Math/Rect.hpp b/source/modules/asura-utils/Math/Rect.hpp new file mode 100644 index 0000000..45bf1ba --- /dev/null +++ b/source/modules/asura-utils/Math/Rect.hpp @@ -0,0 +1,50 @@ +#ifndef _ASURA_ENGINE_RECT_H_ +#define _ASURA_ENGINE_RECT_H_ + +namespace AsuraEngine +{ + namespace Math + { + + template<typename T> + struct Rect + { + public: + Rect(); + Rect(T x, T y, T w, T h); + ~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); + + void Set(T x, T y, T w, T h); + + T x, y, w, h; + }; + +#include "Rect.inc" + + // Define the most common types + 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/modules/asura-utils/math/rect.inl b/source/modules/asura-utils/Math/Rect.inc index efafbf9..efafbf9 100644 --- a/source/modules/asura-utils/math/rect.inl +++ b/source/modules/asura-utils/Math/Rect.inc diff --git a/source/modules/asura-utils/Math/Transform.cpp b/source/modules/asura-utils/Math/Transform.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-utils/Math/Transform.cpp diff --git a/source/modules/asura-utils/Math/Transform.h b/source/modules/asura-utils/Math/Transform.h new file mode 100644 index 0000000..23d0709 --- /dev/null +++ b/source/modules/asura-utils/Math/Transform.h @@ -0,0 +1,30 @@ +#ifndef _ASURA_ENGINE_TRANSFORM_H_ +#define _ASURA_ENGINE_TRANSFORM_H_ + +#include "../scripting/Portable.hpp" + +namespace AsuraEngine +{ + namespace Math + { + + class Transform + { + public: + + void Set(float x, float y, float sx, float sy, float ox, float oy, float r); + + void LoadIdentity(); + + void Move(float dx = 0, float dy = 0); + void Rotate(float r); + void Scale(float sx, float sy); + + float m[16]; //4x4 matrix + + }; + + } +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-utils/Math/Vector2.hpp b/source/modules/asura-utils/Math/Vector2.hpp new file mode 100644 index 0000000..f2405eb --- /dev/null +++ b/source/modules/asura-utils/Math/Vector2.hpp @@ -0,0 +1,72 @@ +#ifndef _ASURA_ENGINE_VECTOR2_H__ +#define _ASURA_ENGINE_VECTOR2_H__ + +namespace AsuraEngine +{ + namespace Math + { + template <typename T> + class Vector2 + { + public: + Vector2(); + Vector2(T X, T Y); + + template <typename U> + explicit Vector2(const Vector2<U>& vector); + + void Set(T X, T Y); + + T x; ///< X coordinate of the vector + T y; ///< Y coordinate of the vector + }; + + template <typename T> + Vector2<T> operator -(const Vector2<T>& right); + + template <typename T> + Vector2<T>& operator +=(Vector2<T>& left, const Vector2<T>& right); + + template <typename T> + Vector2<T>& operator -=(Vector2<T>& left, const Vector2<T>& right); + + template <typename T> + Vector2<T> operator +(const Vector2<T>& left, const Vector2<T>& right); + + template <typename T> + Vector2<T> operator -(const Vector2<T>& left, const Vector2<T>& right); + + template <typename T> + Vector2<T> operator *(const Vector2<T>& left, T right); + + template <typename T> + Vector2<T> operator *(T left, const Vector2<T>& right); + + template <typename T> + Vector2<T>& operator *=(Vector2<T>& left, T right); + + template <typename T> + Vector2<T> operator /(const Vector2<T>& left, T right); + + template <typename T> + Vector2<T>& operator /=(Vector2<T>& left, T right); + + template <typename T> + bool operator ==(const Vector2<T>& left, const Vector2<T>& right); + + template <typename T> + bool operator !=(const Vector2<T>& left, const Vector2<T>& right); + +#include "Vector2.inc" + + // Define the most common types + typedef Vector2<int> Vector2i; + typedef Vector2<unsigned int> Vector2u; + typedef Vector2<float> Vector2f; + + } +} + +namespace AEMath = AsuraEngine::Math; + +#endif
\ No newline at end of file diff --git a/source/modules/asura-utils/math/vector2.inl b/source/modules/asura-utils/Math/Vector2.inc index 155432a..155432a 100644 --- a/source/modules/asura-utils/math/vector2.inl +++ b/source/modules/asura-utils/Math/Vector2.inc diff --git a/source/modules/asura-utils/Math/Vector3.hpp b/source/modules/asura-utils/Math/Vector3.hpp new file mode 100644 index 0000000..8da57cf --- /dev/null +++ b/source/modules/asura-utils/Math/Vector3.hpp @@ -0,0 +1,233 @@ +#ifndef _ASURA_ENGINE_VECTOR3_H__ +#define _ASURA_ENGINE_VECTOR3_H__ + +namespace AsuraEngine +{ + namespace Math + { + template <typename T> + class Vector3 + { + public: + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates a Vector3(0, 0, 0). + /// + //////////////////////////////////////////////////////////// + Vector3(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vector from its coordinates + /// + /// \param X X coordinate + /// \param Y Y coordinate + /// \param Z Z coordinate + /// + //////////////////////////////////////////////////////////// + Vector3(T X, T Y, T Z); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vector from another type of vector + /// + /// This constructor doesn't replace the copy constructor, + /// it's called only when U != T. + /// A call to this constructor will fail to compile if U + /// is not convertible to T. + /// + /// \param vector Vector to convert + /// + //////////////////////////////////////////////////////////// + template <typename U> + explicit Vector3(const Vector3<U>& vector); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + T x; ///< X coordinate of the vector + T y; ///< Y coordinate of the vector + T z; ///< Z coordinate of the vector + }; + + //////////////////////////////////////////////////////////// + /// \relates Vector3 + /// \brief Overload of unary operator - + /// + /// \param left Vector to negate + /// + /// \return Memberwise opposite of the vector + /// + //////////////////////////////////////////////////////////// + template <typename T> + Vector3<T> operator -(const Vector3<T>& left); + + //////////////////////////////////////////////////////////// + /// \relates Vector3 + /// \brief Overload of binary operator += + /// + /// This operator performs a memberwise addition of both vectors, + /// and assigns the result to \a left. + /// + /// \param left Left operand (a vector) + /// \param right Right operand (a vector) + /// + /// \return Reference to \a left + /// + //////////////////////////////////////////////////////////// + template <typename T> + Vector3<T>& operator +=(Vector3<T>& left, const Vector3<T>& right); + + //////////////////////////////////////////////////////////// + /// \relates Vector3 + /// \brief Overload of binary operator -= + /// + /// This operator performs a memberwise subtraction of both vectors, + /// and assigns the result to \a left. + /// + /// \param left Left operand (a vector) + /// \param right Right operand (a vector) + /// + /// \return Reference to \a left + /// + //////////////////////////////////////////////////////////// + template <typename T> + Vector3<T>& operator -=(Vector3<T>& left, const Vector3<T>& right); + + //////////////////////////////////////////////////////////// + /// \relates Vector3 + /// \brief Overload of binary operator + + /// + /// \param left Left operand (a vector) + /// \param right Right operand (a vector) + /// + /// \return Memberwise addition of both vectors + /// + //////////////////////////////////////////////////////////// + template <typename T> + Vector3<T> operator +(const Vector3<T>& left, const Vector3<T>& right); + + //////////////////////////////////////////////////////////// + /// \relates Vector3 + /// \brief Overload of binary operator - + /// + /// \param left Left operand (a vector) + /// \param right Right operand (a vector) + /// + /// \return Memberwise subtraction of both vectors + /// + //////////////////////////////////////////////////////////// + template <typename T> + Vector3<T> operator -(const Vector3<T>& left, const Vector3<T>& right); + + //////////////////////////////////////////////////////////// + /// \relates Vector3 + /// \brief Overload of binary operator * + /// + /// \param left Left operand (a vector) + /// \param right Right operand (a scalar value) + /// + /// \return Memberwise multiplication by \a right + /// + //////////////////////////////////////////////////////////// + template <typename T> + Vector3<T> operator *(const Vector3<T>& left, T right); + + //////////////////////////////////////////////////////////// + /// \relates Vector3 + /// \brief Overload of binary operator * + /// + /// \param left Left operand (a scalar value) + /// \param right Right operand (a vector) + /// + /// \return Memberwise multiplication by \a left + /// + //////////////////////////////////////////////////////////// + template <typename T> + Vector3<T> operator *(T left, const Vector3<T>& right); + + //////////////////////////////////////////////////////////// + /// \relates Vector3 + /// \brief Overload of binary operator *= + /// + /// This operator performs a memberwise multiplication by \a right, + /// and assigns the result to \a left. + /// + /// \param left Left operand (a vector) + /// \param right Right operand (a scalar value) + /// + /// \return Reference to \a left + /// + //////////////////////////////////////////////////////////// + template <typename T> + Vector3<T>& operator *=(Vector3<T>& left, T right); + + //////////////////////////////////////////////////////////// + /// \relates Vector3 + /// \brief Overload of binary operator / + /// + /// \param left Left operand (a vector) + /// \param right Right operand (a scalar value) + /// + /// \return Memberwise division by \a right + /// + //////////////////////////////////////////////////////////// + template <typename T> + Vector3<T> operator /(const Vector3<T>& left, T right); + + //////////////////////////////////////////////////////////// + /// \relates Vector3 + /// \brief Overload of binary operator /= + /// + /// This operator performs a memberwise division by \a right, + /// and assigns the result to \a left. + /// + /// \param left Left operand (a vector) + /// \param right Right operand (a scalar value) + /// + /// \return Reference to \a left + /// + //////////////////////////////////////////////////////////// + template <typename T> + Vector3<T>& operator /=(Vector3<T>& left, T right); + + //////////////////////////////////////////////////////////// + /// \relates Vector3 + /// \brief Overload of binary operator == + /// + /// This operator compares strict equality between two vectors. + /// + /// \param left Left operand (a vector) + /// \param right Right operand (a vector) + /// + /// \return True if \a left is equal to \a right + /// + //////////////////////////////////////////////////////////// + template <typename T> + bool operator ==(const Vector3<T>& left, const Vector3<T>& right); + + //////////////////////////////////////////////////////////// + /// \relates Vector3 + /// \brief Overload of binary operator != + /// + /// This operator compares strict difference between two vectors. + /// + /// \param left Left operand (a vector) + /// \param right Right operand (a vector) + /// + /// \return True if \a left is not equal to \a right + /// + //////////////////////////////////////////////////////////// + template <typename T> + bool operator !=(const Vector3<T>& left, const Vector3<T>& right); + +#include "Vector3.inc" + + // Define the most common types + typedef Vector3<int> Vector3i; + typedef Vector3<float> Vector3f; + + } +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-utils/math/vector3.inl b/source/modules/asura-utils/Math/Vector3.inc index 3a2aa93..3a2aa93 100644 --- a/source/modules/asura-utils/math/vector3.inl +++ b/source/modules/asura-utils/Math/Vector3.inc diff --git a/source/modules/asura-utils/Math/Vector4.h b/source/modules/asura-utils/Math/Vector4.h new file mode 100644 index 0000000..a5bf549 --- /dev/null +++ b/source/modules/asura-utils/Math/Vector4.h @@ -0,0 +1,234 @@ +#ifndef _ASURA_ENGINE_VECTOR4_H__ +#define _ASURA_ENGINE_VECTOR4_H__ + +namespace AsuraEngine +{ + namespace Math + { + template <typename T> + class Vector4 + { + public: + + //////////////////////////////////////////////////////////// + /// \brief Default constructor + /// + /// Creates a Vector4(0, 0, 0). + /// + //////////////////////////////////////////////////////////// + Vector4(); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vector from its coordinates + /// + /// \param X X coordinate + /// \param Y Y coordinate + /// \param Z Z coordinate + /// + //////////////////////////////////////////////////////////// + Vector4(T X, T Y, T Z, T W); + + //////////////////////////////////////////////////////////// + /// \brief Construct the vector from another type of vector + /// + /// This constructor doesn't replace the copy constructor, + /// it's called only when U != T. + /// A call to this constructor will fail to compile if U + /// is not convertible to T. + /// + /// \param vector Vector to convert + /// + //////////////////////////////////////////////////////////// + template <typename U> + explicit Vector4(const Vector4<U>& vector); + + //////////////////////////////////////////////////////////// + // Member data + //////////////////////////////////////////////////////////// + T x; ///< X coordinate of the vector + T y; ///< Y coordinate of the vector + T z; ///< Z coordinate of the vector + T w; ///< W coordinate of the vector + }; + + //////////////////////////////////////////////////////////// + /// \relates Vector4 + /// \brief Overload of unary operator - + /// + /// \param left Vector to negate + /// + /// \return Memberwise opposite of the vector + /// + //////////////////////////////////////////////////////////// + template <typename T> + Vector4<T> operator -(const Vector4<T>& left); + + //////////////////////////////////////////////////////////// + /// \relates Vector4 + /// \brief Overload of binary operator += + /// + /// This operator performs a memberwise addition of both vectors, + /// and assigns the result to \a left. + /// + /// \param left Left operand (a vector) + /// \param right Right operand (a vector) + /// + /// \return Reference to \a left + /// + //////////////////////////////////////////////////////////// + template <typename T> + Vector4<T>& operator +=(Vector4<T>& left, const Vector4<T>& right); + + //////////////////////////////////////////////////////////// + /// \relates Vector4 + /// \brief Overload of binary operator -= + /// + /// This operator performs a memberwise subtraction of both vectors, + /// and assigns the result to \a left. + /// + /// \param left Left operand (a vector) + /// \param right Right operand (a vector) + /// + /// \return Reference to \a left + /// + //////////////////////////////////////////////////////////// + template <typename T> + Vector4<T>& operator -=(Vector4<T>& left, const Vector4<T>& right); + + //////////////////////////////////////////////////////////// + /// \relates Vector4 + /// \brief Overload of binary operator + + /// + /// \param left Left operand (a vector) + /// \param right Right operand (a vector) + /// + /// \return Memberwise addition of both vectors + /// + //////////////////////////////////////////////////////////// + template <typename T> + Vector4<T> operator +(const Vector4<T>& left, const Vector4<T>& right); + + //////////////////////////////////////////////////////////// + /// \relates Vector4 + /// \brief Overload of binary operator - + /// + /// \param left Left operand (a vector) + /// \param right Right operand (a vector) + /// + /// \return Memberwise subtraction of both vectors + /// + //////////////////////////////////////////////////////////// + template <typename T> + Vector4<T> operator -(const Vector4<T>& left, const Vector4<T>& right); + + //////////////////////////////////////////////////////////// + /// \relates Vector4 + /// \brief Overload of binary operator * + /// + /// \param left Left operand (a vector) + /// \param right Right operand (a scalar value) + /// + /// \return Memberwise multiplication by \a right + /// + //////////////////////////////////////////////////////////// + template <typename T> + Vector4<T> operator *(const Vector4<T>& left, T right); + + //////////////////////////////////////////////////////////// + /// \relates Vector4 + /// \brief Overload of binary operator * + /// + /// \param left Left operand (a scalar value) + /// \param right Right operand (a vector) + /// + /// \return Memberwise multiplication by \a left + /// + //////////////////////////////////////////////////////////// + template <typename T> + Vector4<T> operator *(T left, const Vector4<T>& right); + + //////////////////////////////////////////////////////////// + /// \relates Vector4 + /// \brief Overload of binary operator *= + /// + /// This operator performs a memberwise multiplication by \a right, + /// and assigns the result to \a left. + /// + /// \param left Left operand (a vector) + /// \param right Right operand (a scalar value) + /// + /// \return Reference to \a left + /// + //////////////////////////////////////////////////////////// + template <typename T> + Vector4<T>& operator *=(Vector4<T>& left, T right); + + //////////////////////////////////////////////////////////// + /// \relates Vector4 + /// \brief Overload of binary operator / + /// + /// \param left Left operand (a vector) + /// \param right Right operand (a scalar value) + /// + /// \return Memberwise division by \a right + /// + //////////////////////////////////////////////////////////// + template <typename T> + Vector4<T> operator /(const Vector4<T>& left, T right); + + //////////////////////////////////////////////////////////// + /// \relates Vector4 + /// \brief Overload of binary operator /= + /// + /// This operator performs a memberwise division by \a right, + /// and assigns the result to \a left. + /// + /// \param left Left operand (a vector) + /// \param right Right operand (a scalar value) + /// + /// \return Reference to \a left + /// + //////////////////////////////////////////////////////////// + template <typename T> + Vector4<T>& operator /=(Vector4<T>& left, T right); + + //////////////////////////////////////////////////////////// + /// \relates Vector4 + /// \brief Overload of binary operator == + /// + /// This operator compares strict equality between two vectors. + /// + /// \param left Left operand (a vector) + /// \param right Right operand (a vector) + /// + /// \return True if \a left is equal to \a right + /// + //////////////////////////////////////////////////////////// + template <typename T> + bool operator ==(const Vector4<T>& left, const Vector4<T>& right); + + //////////////////////////////////////////////////////////// + /// \relates Vector4 + /// \brief Overload of binary operator != + /// + /// This operator compares strict difference between two vectors. + /// + /// \param left Left operand (a vector) + /// \param right Right operand (a vector) + /// + /// \return True if \a left is not equal to \a right + /// + //////////////////////////////////////////////////////////// + template <typename T> + bool operator !=(const Vector4<T>& left, const Vector4<T>& right); + +#include "Vector4.inc" + + // Define the most common types + typedef Vector4<int> Vector4i; + typedef Vector4<float> Vector4f; + + } +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-utils/math/vector4.inl b/source/modules/asura-utils/Math/Vector4.inc index 4b043a1..4b043a1 100644 --- a/source/modules/asura-utils/math/vector4.inl +++ b/source/modules/asura-utils/Math/Vector4.inc diff --git a/source/modules/asura-utils/Module.h b/source/modules/asura-utils/Module.h new file mode 100644 index 0000000..2cc91d6 --- /dev/null +++ b/source/modules/asura-utils/Module.h @@ -0,0 +1,32 @@ +#ifndef _ASURA_MODULE_H_ +#define _ASURA_MODULE_H_ + +#include "Type.h" +#include "Scripting/Portable.hpp" + +namespace AsuraEngine +{ + + /// + /// Asura libs Ҫ̳д࣬Կעᡣģа˳Щģ飬Ȼ˳InitializeFinalizeʼ + /// رЩģ顣 + /// + ASURA_ABSTRACT class Module + { + public: + + /// + /// ʼģ顣 + /// + virtual void Initialize(Luax::LuaxState& state) = 0; + + /// + /// رģ顣 + /// + virtual void Finalize(Luax::LuaxState& state) = 0; + + }; + +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-utils/Scripting/Portable.hpp b/source/modules/asura-utils/Scripting/Portable.hpp new file mode 100644 index 0000000..1eee123 --- /dev/null +++ b/source/modules/asura-utils/Scripting/Portable.hpp @@ -0,0 +1,31 @@ +#ifndef _ASURA_ENGINE_PORTABLE_H_ +#define _ASURA_ENGINE_PORTABLE_H_ + +extern "C" { +#include <lua51/lua.h> +#include <lua51/lualib.h> +#include <lua51/lauxlib.h> +} + +#include <luax/luax.h> + +#include "../Type.h" +#include "../Classes.h" + +namespace_begin(AsuraEngine) +namespace_begin(Scripting) + + +/// ҪΪ࣬userdatamember ref̳д࣬ע̳С +using Object = Luax::LuaxObject; + +/// ҪעluanativeҪ̳дģ塣BASEָ࣬ĬLuaxObjectָLuaxObjectࡢ +template<typename TYPE, typename BASE = Luax::LuaxObject> +using Portable = Luax::LuaxNativeClass<TYPE, BASE>; + +namespace_end +namespace_end + +namespace AEScripting = AsuraEngine::Scripting; + +#endif
\ No newline at end of file diff --git a/source/modules/asura-utils/Singleton.hpp b/source/modules/asura-utils/Singleton.hpp new file mode 100644 index 0000000..9bb7336 --- /dev/null +++ b/source/modules/asura-utils/Singleton.hpp @@ -0,0 +1,59 @@ +#ifndef _ASURA_SINGLETON_H_ +#define _ASURA_SINGLETON_H_ + +#include "UtilsConfig.h" + +namespace AsuraEngine +{ + + /// + /// ̳Singletonڵһʵʱʵ֮ٴʵᱨ + /// + template<class T> + class Singleton + { + public: + + static T* Get() + { + // ֮ǰûдһ + if (!instance) instance = new T; + // ʵ + return instance; + } + + static void Destroy() + { + delete instance; + instance = nullptr; + } + + protected: + + Singleton() + { + // instanceζִһʵǴġ + ASSERT(!instance); + // ʵΪʵ + instance = static_cast<T*>(this); + }; + + virtual ~Singleton() {}; + + static T* instance; + + private: + + Singleton(const Singleton& singleton); + + Singleton& operator = (const Singleton& singleton); + + }; + + // ʵʼΪ + template<class T> + T* Singleton<T>::instance = nullptr; + +} + +#endif // _ASURA_SINGLETON_H_
\ No newline at end of file diff --git a/source/modules/asura-utils/StringMap.cpp b/source/modules/asura-utils/StringMap.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-utils/StringMap.cpp diff --git a/source/modules/asura-utils/StringMap.hpp b/source/modules/asura-utils/StringMap.hpp new file mode 100644 index 0000000..15d28ee --- /dev/null +++ b/source/modules/asura-utils/StringMap.hpp @@ -0,0 +1,29 @@ +#ifndef _ASURA_ENGINE_STRINGMAP_H_ +#define _ASURA_ENGINE_STRINGMAP_H_ + +#include <string> + +namespace AsuraEngine +{ + + /// + /// һ˫һһӦӳ䣬shader uniformsstatemathine state parameterID + /// + template<typename key_type> + class StringMap + { + public: + + bool ContainsKey(const key_type& key); + + bool ContainsString(const std::string& str); + + std::string GetStringByKey(const key_type& key); + + key_type GetKeyByString(const std::string& str); + + }; + +} + +#endif
\ No newline at end of file diff --git a/source/modules/asura-utils/threading/conditional.cpp b/source/modules/asura-utils/Threads/Conditional.cpp index c4d32d9..f86a81e 100644 --- a/source/modules/asura-utils/threading/conditional.cpp +++ b/source/modules/asura-utils/Threads/Conditional.cpp @@ -1,7 +1,7 @@ -#include "conditional.h" +#include "Conditional.h" namespace_begin(AsuraEngine) -namespace_begin(Threading) +namespace_begin(Threads) Conditional::Conditional() : m_Waiting(0) diff --git a/source/modules/asura-utils/threading/conditional.h b/source/modules/asura-utils/Threads/Conditional.h index ff832ac..7a99ea1 100644 --- a/source/modules/asura-utils/threading/conditional.h +++ b/source/modules/asura-utils/Threads/Conditional.h @@ -1,13 +1,13 @@ -#ifndef __ASURA_CONDITIONAL_H__ -#define __ASURA_CONDITIONAL_H__ +#ifndef _ASURA_CONDITIONAL_H_ +#define _ASURA_CONDITIONAL_H_ -#include <asura-utils/classes.h> +#include <asura-utils/Classes.h> -#include "mutex.h" -#include "semaphore.h" +#include "Mutex.h" +#include "Semaphore.h" namespace_begin(AsuraEngine) -namespace_begin(Threading) +namespace_begin(Threads) /// /// diff --git a/source/modules/asura-utils/threading/coroutine.cpp b/source/modules/asura-utils/Threads/Coroutine.cpp index 552a415..5c4ab68 100644 --- a/source/modules/asura-utils/threading/coroutine.cpp +++ b/source/modules/asura-utils/Threads/Coroutine.cpp @@ -1,7 +1,7 @@ #include "coroutine.h" namespace_begin(AsuraEngine) -namespace_begin(Threading) +namespace_begin(Threads) /* Coroutine::Coroutine() diff --git a/source/modules/asura-utils/threading/coroutine.h b/source/modules/asura-utils/Threads/Coroutine.h index 830dcd2..cdb21f8 100644 --- a/source/modules/asura-utils/threading/coroutine.h +++ b/source/modules/asura-utils/Threads/Coroutine.h @@ -1,12 +1,12 @@ -#ifndef __ASURA_COROUTINE_H__ -#define __ASURA_COROUTINE_H__ +#ifndef _ASURA_COROUTINE_H_ +#define _ASURA_COROUTINE_H_ -#include <asura-utils/classes.h> +#include <asura-utils/Classes.h> -#include "../scripting/portable.hpp" +#include "../Scripting/Portable.hpp" namespace_begin(AsuraEngine) -namespace_begin(Threading) +namespace_begin(Threads) /// /// luaЭ̣һЩ @@ -35,6 +35,6 @@ private: namespace_end namespace_end -namespace AEThreading = AsuraEngine::Threading; +namespace AEThreading = AsuraEngine::Threads; #endif
\ No newline at end of file diff --git a/source/modules/asura-utils/threading/mutex.cpp b/source/modules/asura-utils/Threads/Mutex.cpp index ff0b3fa..501a0ed 100644 --- a/source/modules/asura-utils/threading/mutex.cpp +++ b/source/modules/asura-utils/Threads/Mutex.cpp @@ -1,9 +1,9 @@ -#include <asura-utils/exceptions/exception.h> +#include <asura-utils/Exceptions/Exception.h> -#include "mutex.h" +#include "Mutex.h" namespace_begin(AsuraEngine) -namespace_begin(Threading) +namespace_begin(Threads) #define try_create_mutex(impl)\ if (!m_Impl) \ diff --git a/source/modules/asura-utils/threading/mutex.h b/source/modules/asura-utils/Threads/Mutex.h index 623a3db..4269c05 100644 --- a/source/modules/asura-utils/threading/mutex.h +++ b/source/modules/asura-utils/Threads/Mutex.h @@ -1,17 +1,17 @@ -#ifndef __ASURA_MUTEX_H__ -#define __ASURA_MUTEX_H__ +#ifndef _ASURA_MUTEX_H_ +#define _ASURA_MUTEX_H_ -#include <asura-utils/type.h> -#include <asura-utils/classes.h> +#include <asura-utils/Type.h> +#include <asura-utils/Classes.h> -#include "../utils_config.h" +#include "../UtilsConfig.h" #if ASURA_THREAD_WIN32 #include <windows.h> #endif namespace_begin(AsuraEngine) -namespace_begin(Threading) +namespace_begin(Threads) #define ASURA_MUTEX_MAXWAIT (~(uint32)0) @@ -123,6 +123,6 @@ class MutexImplSTD ASURA_FINAL : public MutexImpl namespace_end namespace_end -namespace AEThreading = AsuraEngine::Threading; +namespace AEThreading = AsuraEngine::Threads; #endif
\ No newline at end of file diff --git a/source/modules/asura-utils/threading/semaphore.cpp b/source/modules/asura-utils/Threads/Semaphore.cpp index f9ffb35..a222f3d 100644 --- a/source/modules/asura-utils/threading/semaphore.cpp +++ b/source/modules/asura-utils/Threads/Semaphore.cpp @@ -1,11 +1,11 @@ -#include "../exceptions/exception.h" -#include "../type.h" +#include "../Exceptions/Exception.h" +#include "../Type.h" -#include "mutex.h" -#include "semaphore.h" +#include "Mutex.h" +#include "Semaphore.h" namespace_begin(AsuraEngine) -namespace_begin(Threading) +namespace_begin(Threads) #define try_create_semaphore(impl) \ if (!m_Impl) \ diff --git a/source/modules/asura-utils/threading/semaphore.h b/source/modules/asura-utils/Threads/Semaphore.h index ae7b10b..41b1fd2 100644 --- a/source/modules/asura-utils/threading/semaphore.h +++ b/source/modules/asura-utils/Threads/Semaphore.h @@ -1,14 +1,14 @@ -#ifndef __ASURA_SEMAPHORE_H__ -#define __ASURA_SEMAPHORE_H__ +#ifndef _ASURA_SEMAPHORE_H_ +#define _ASURA_SEMAPHORE_H_ -#include "../utils_config.h" +#include "../UtilsConfig.h" #if ASURA_THREAD_WIN32 #include <windows.h> #endif namespace_begin(AsuraEngine) -namespace_begin(Threading) +namespace_begin(Threads) class SemaphoreImpl; diff --git a/source/modules/asura-utils/threading/task.cpp b/source/modules/asura-utils/Threads/Task.cpp index ea3f68e..9666cc6 100644 --- a/source/modules/asura-utils/threading/task.cpp +++ b/source/modules/asura-utils/Threads/Task.cpp @@ -1,10 +1,10 @@ #include "task.h" -#include "../scripting/portable.hpp" +#include "../scripting/Portable.hpp" using namespace AEScripting; namespace_begin(AsuraEngine) -namespace_begin(Threading) +namespace_begin(Threads) namespace_end namespace_end diff --git a/source/modules/asura-utils/threading/task.h b/source/modules/asura-utils/Threads/Task.h index b959012..b871303 100644 --- a/source/modules/asura-utils/threading/task.h +++ b/source/modules/asura-utils/Threads/Task.h @@ -1,12 +1,12 @@ -#ifndef __ASURA_THRAD_TASK_H__ -#define __ASURA_THRAD_TASK_H__ +#ifndef _ASURA_THRAD_TASK_H_ +#define _ASURA_THRAD_TASK_H_ -#include <asura-utils/type.h> -#include <asura-utils/scripting/portable.hpp> -#include <asura-utils/classes.h> +#include <asura-utils/Type.h> +#include <asura-utils/Scripting/Portable.hpp> +#include <asura-utils/Classes.h> namespace_begin(AsuraEngine) -namespace_begin(Threading) +namespace_begin(Threads) /// /// ϣһ̴̳߳TaskдExecute @@ -38,6 +38,6 @@ protected: namespace_end namespace_end -namespace AEThreading = AsuraEngine::Threading; +namespace AEThreading = AsuraEngine::Threads; #endif
\ No newline at end of file diff --git a/source/modules/asura-utils/threading/thread.cpp b/source/modules/asura-utils/Threads/Thread.cpp index cb71d32..1153912 100644 --- a/source/modules/asura-utils/threading/thread.cpp +++ b/source/modules/asura-utils/Threads/Thread.cpp @@ -1,12 +1,12 @@ -#include "thread.h" +#include "Thread.h" -#include "thread_impl_win32.h" -#include "thread_impl_posix.h" -#include "thread_impl_sdl.h" -#include "thread_impl_std.h" +#include "ThreadImplWin32.h" +#include "ThreadImplPosix.h" +#include "ThreadImplSdl.h" +#include "ThreadImplStd.h" namespace_begin(AsuraEngine) -namespace_begin(Threading) +namespace_begin(Threads) Thread::Thread(lua_State* luaThread, ThreadType type /*= THREAD_TYPE_DEFERRED*/, uint sleepTime /*= 0*/, const std::string& name /*= ""*/) : m_Name(name) diff --git a/source/modules/asura-utils/threading/thread.h b/source/modules/asura-utils/Threads/Thread.h index 0235b6a..bc6f14e 100644 --- a/source/modules/asura-utils/threading/thread.h +++ b/source/modules/asura-utils/Threads/Thread.h @@ -1,18 +1,18 @@ -#ifndef __ASURA_THREAD_H__ -#define __ASURA_THREAD_H__ +#ifndef _ASURA_THREAD_H_ +#define _ASURA_THREAD_H_ #include <string> #include <queue> -#include <asura-utils/scripting/portable.hpp> +#include <asura-utils/Scripting/Portable.hpp> -#include "task.h" -#include "mutex.h" -#include "semaphore.h" -#include "threadable.h" +#include "Task.h" +#include "Mutex.h" +#include "Semaphore.h" +#include "Threadable.h" namespace_begin(AsuraEngine) -namespace_begin(Threading) +namespace_begin(Threads) class ThreadImpl; diff --git a/source/modules/asura-utils/Threads/ThreadImplPosix.cpp b/source/modules/asura-utils/Threads/ThreadImplPosix.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-utils/Threads/ThreadImplPosix.cpp diff --git a/source/modules/asura-utils/Threads/ThreadImplPosix.h b/source/modules/asura-utils/Threads/ThreadImplPosix.h new file mode 100644 index 0000000..3089f0a --- /dev/null +++ b/source/modules/asura-utils/Threads/ThreadImplPosix.h @@ -0,0 +1,2 @@ +#include <asura-utils/Classes.h> + diff --git a/source/modules/asura-utils/Threads/ThreadImplSDL.cpp b/source/modules/asura-utils/Threads/ThreadImplSDL.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-utils/Threads/ThreadImplSDL.cpp diff --git a/source/modules/asura-utils/Threads/ThreadImplSDL.h b/source/modules/asura-utils/Threads/ThreadImplSDL.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-utils/Threads/ThreadImplSDL.h diff --git a/source/modules/asura-utils/Threads/ThreadImplStd.cpp b/source/modules/asura-utils/Threads/ThreadImplStd.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/source/modules/asura-utils/Threads/ThreadImplStd.cpp diff --git a/source/modules/asura-utils/threading/thread_impl_std.h b/source/modules/asura-utils/Threads/ThreadImplStd.h index a2623ee..452f569 100644 --- a/source/modules/asura-utils/threading/thread_impl_std.h +++ b/source/modules/asura-utils/Threads/ThreadImplStd.h @@ -1,16 +1,16 @@ -#ifndef __ASURA_THREAD_STD_H__ -#define __ASURA_THREAD_STD_H__ +#ifndef _ASURA_THREAD_STD_H_ +#define _ASURA_THREAD_STD_H_ -#include "../utils_config.h" +#include "../UtilsConfig.h" #if ASURA_THREAD_STD #include <windows.h> -#include "thread.h" +#include "Thread.h" namespace_begin(AsuraEngine) -namespace_begin(Threading) +namespace_begin(Threads) /// /// Threadstd::threadʵ֡ @@ -38,4 +38,4 @@ namespace_end #endif // #if ASURA_THREAD_STD -#endif // __ASURA_THREAD_STD_H__
\ No newline at end of file +#endif // _ASURA_THREAD_STD_H_
\ No newline at end of file diff --git a/source/modules/asura-utils/threading/thread_impl_win32.cpp b/source/modules/asura-utils/Threads/ThreadImplWin32.cpp index c876be9..2467f87 100644 --- a/source/modules/asura-utils/threading/thread_impl_win32.cpp +++ b/source/modules/asura-utils/Threads/ThreadImplWin32.cpp @@ -1,12 +1,12 @@ -#include "thread_impl_win32.h" -#include "thread.h" +#include "ThreadImplWin32.h" +#include "Thread.h" #include <iostream> #if ASURA_THREAD_WIN32 namespace_begin(AsuraEngine) -namespace_begin(Threading) +namespace_begin(Threads) static DWORD WINAPI _thread_win32_runner(LPVOID param) { diff --git a/source/modules/asura-utils/threading/thread_impl_win32.h b/source/modules/asura-utils/Threads/ThreadImplWin32.h index 846670b..93ca477 100644 --- a/source/modules/asura-utils/threading/thread_impl_win32.h +++ b/source/modules/asura-utils/Threads/ThreadImplWin32.h @@ -1,7 +1,7 @@ -#ifndef __ASURA_THREAD_WIN32_H__ -#define __ASURA_THREAD_WIN32_H__ +#ifndef _ASURA_THREAD_WIN32_H__ +#define _ASURA_THREAD_WIN32_H__ -#include "../utils_config.h" +#include "../UtilsConfig.h" #if ASURA_THREAD_WIN32 @@ -10,7 +10,7 @@ #include "thread.h" namespace_begin(AsuraEngine) -namespace_begin(Threading) +namespace_begin(Threads) /// /// Threadwin32ʵ֡ @@ -41,4 +41,4 @@ namespace_end namespace_end #endif // #if ASURA_THREAD_WIN32 -#endif // __ASURA_THREAD_WIN32_H__
\ No newline at end of file +#endif // _ASURA_THREAD_WIN32_H__
\ No newline at end of file diff --git a/source/modules/asura-utils/threading/threadable.h b/source/modules/asura-utils/Threads/Threadable.h index 66973c5..fce7350 100644 --- a/source/modules/asura-utils/threading/threadable.h +++ b/source/modules/asura-utils/Threads/Threadable.h @@ -1,10 +1,10 @@ -#ifndef __ASURA_THREADABLE_H__ -#define __ASURA_THREADABLE_H__ +#ifndef _ASURA_THREADABLE_H_ +#define _ASURA_THREADABLE_H_ -#include "../type.h" +#include "../Type.h" namespace_begin(AsuraEngine) -namespace_begin(Threading) +namespace_begin(Threads) ASURA_ABSTRACT class Threadable { diff --git a/source/modules/asura-utils/threading/binding/_coroutine.cpp b/source/modules/asura-utils/Threads/binding/_coroutine.cpp index a710623..0656079 100644 --- a/source/modules/asura-utils/threading/binding/_coroutine.cpp +++ b/source/modules/asura-utils/Threads/binding/_coroutine.cpp @@ -1,9 +1,9 @@ -#include "../coroutine.h" +#include "../Coroutine.h" using namespace std; namespace_begin(AsuraEngine) -namespace_begin(Threading) +namespace_begin(Threads) LUAX_REGISTRY(Coroutine) { diff --git a/source/modules/asura-utils/threading/binding/_thread.cpp b/source/modules/asura-utils/Threads/binding/_thread.cpp index b835453..aaa9e8d 100644 --- a/source/modules/asura-utils/threading/binding/_thread.cpp +++ b/source/modules/asura-utils/Threads/binding/_thread.cpp @@ -1,9 +1,9 @@ -#include "../thread.h" +#include "../Thread.h" using namespace std; namespace_begin(AsuraEngine) -namespace_begin(Threading) +namespace_begin(Threads) LUAX_REGISTRY(Thread) { diff --git a/source/modules/asura-utils/Type.h b/source/modules/asura-utils/Type.h new file mode 100644 index 0000000..f7e54c6 --- /dev/null +++ b/source/modules/asura-utils/Type.h @@ -0,0 +1,34 @@ +#ifndef _ASURA_UTILS_TYPE_H_ +#define _ASURA_UTILS_TYPE_H_ + +#include <cstdlib> +#include <stdint.h> + +#include "asura-base/Config.h" + +namespace AsuraEngine +{ + + //--------------------------------------------------------------------------------// + + typedef int8_t int8; + typedef uint8_t uint8; + //typedef uint8 byte; + typedef char byte; + typedef int16_t int16; + typedef uint16_t uint16; + typedef int32_t int32; + typedef uint32_t uint32; + typedef int64_t int64; + typedef uint64_t uint64; + + typedef uint32_t uint; + typedef int32_t sint; + + typedef std::size_t size_t; + + typedef const char cc8; + +} // namespace AsuraEngine + +#endif // _ASURA_CONFIG_H_
\ No newline at end of file diff --git a/source/modules/asura-utils/Utils.h b/source/modules/asura-utils/Utils.h new file mode 100644 index 0000000..dfcd2a6 --- /dev/null +++ b/source/modules/asura-utils/Utils.h @@ -0,0 +1,6 @@ +#ifndef _ASURA_UTILS_H_ +#define _ASURA_UTILS_H_ + +#include "UtilsModule.h" + +#endif
\ No newline at end of file diff --git a/source/modules/asura-utils/utils_config.h b/source/modules/asura-utils/UtilsConfig.h index 7b120f0..89a605d 100644 --- a/source/modules/asura-utils/utils_config.h +++ b/source/modules/asura-utils/UtilsConfig.h @@ -1,8 +1,8 @@ -#ifndef __ASURA_UTILS_CONFIG_H__ -#define __ASURA_UTILS_CONFIG_H__ +#ifndef _ASURA_UTILS_CONFIG_H_ +#define _ASURA_UTILS_CONFIG_H_ // ı -#include "asura-base/config.h" +#include "asura-base/Config.h" #define ASURA_THREAD_WIN32 1 #define ASURA_THREAD_STD 1 diff --git a/source/modules/asura-utils/utils_module.cpp b/source/modules/asura-utils/UtilsModule.cpp index 5616be4..5735270 100644 --- a/source/modules/asura-utils/utils_module.cpp +++ b/source/modules/asura-utils/UtilsModule.cpp @@ -1,7 +1,7 @@ -#include "utils_module.h" +#include "UtilsModule.h" using namespace AsuraEngine::IO; -using namespace AsuraEngine::Threading; +using namespace AsuraEngine::Threads; namespace AsuraEngine { @@ -14,7 +14,7 @@ namespace AsuraEngine LUAX_REGISTER_FACTORY(state, DataBuffer); LUAX_REGISTER_FACTORY(state, FileData); LUAX_REGISTER_FACTORY(state, File); - // Threading + // Threads LUAX_REGISTER_FACTORY(state, Thread); } diff --git a/source/modules/asura-utils/UtilsModule.h b/source/modules/asura-utils/UtilsModule.h new file mode 100644 index 0000000..b61dca9 --- /dev/null +++ b/source/modules/asura-utils/UtilsModule.h @@ -0,0 +1,34 @@ +#ifndef _ASURA_LIBS_UTIL_MODULE_H_ +#define _ASURA_LIBS_UTIL_MODULE_H_ + +#include "IO/FileSystem.h" +#include "IO/DataBuffer.h" +#include "IO/FileData.h" +#include "IO/file.h" +#include "IO/IOTask.h" + +#include "Threads/Thread.h" + +#include "Module.h" + +#include "Classes.h" + +namespace AsuraEngine +{ + + /// + /// Asuraģ + /// + class UtilsModule ASURA_FINAL : public 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/modules/asura-utils/classes.h b/source/modules/asura-utils/classes.h index 8c89b6a..d92c3d4 100644 --- a/source/modules/asura-utils/classes.h +++ b/source/modules/asura-utils/classes.h @@ -1,5 +1,5 @@ -#ifndef __ASURAENGINE_CLASSES_H__ -#define __ASURAENGINE_CLASSES_H__ +#ifndef _ASURAENGINE_CLASSES_H_ +#define _ASURAENGINE_CLASSES_H_ #define GET_SET(TYPE,PROP_NAME,VAR_NAME) void Set##PROP_NAME (TYPE val) { VAR_NAME = val; } const TYPE Get##PROP_NAME () const {return (const TYPE)VAR_NAME; } diff --git a/source/modules/asura-utils/exceptions/exception.h b/source/modules/asura-utils/exceptions/exception.h index 4acbc1e..73c0861 100644 --- a/source/modules/asura-utils/exceptions/exception.h +++ b/source/modules/asura-utils/exceptions/exception.h @@ -1,5 +1,5 @@ -#ifndef __ASURA_ENGINE_EXCEPTION_H__ -#define __ASURA_ENGINE_EXCEPTION_H__ +#ifndef _ASURA_ENGINE_EXCEPTION_H_ +#define _ASURA_ENGINE_EXCEPTION_H_ #include <string> #include <exception> diff --git a/source/modules/asura-utils/io/binding/_data_buffer.cpp b/source/modules/asura-utils/io/binding/_data_buffer.cpp index ac240e5..9d3f3a0 100644 --- a/source/modules/asura-utils/io/binding/_data_buffer.cpp +++ b/source/modules/asura-utils/io/binding/_data_buffer.cpp @@ -1,4 +1,4 @@ -#include "../data_buffer.h" +#include "../DataBuffer.h" using namespace Luax; diff --git a/source/modules/asura-utils/io/binding/_file_data.cpp b/source/modules/asura-utils/io/binding/_file_data.cpp index f4f6584..55cbc8b 100644 --- a/source/modules/asura-utils/io/binding/_file_data.cpp +++ b/source/modules/asura-utils/io/binding/_file_data.cpp @@ -1,4 +1,4 @@ -#include "../file_data.h" +#include "../FileData.h" using namespace std; diff --git a/source/modules/asura-utils/io/binding/_file_system.cpp b/source/modules/asura-utils/io/binding/_file_system.cpp index 0dc24d0..ace3c5f 100644 --- a/source/modules/asura-utils/io/binding/_file_system.cpp +++ b/source/modules/asura-utils/io/binding/_file_system.cpp @@ -1,4 +1,4 @@ -#include "../file_system.h" +#include "../FileSystem.h" using namespace Luax; diff --git a/source/modules/asura-utils/io/binding/_io_task.cpp b/source/modules/asura-utils/io/binding/_io_task.cpp index 4da8dc3..058f4fd 100644 --- a/source/modules/asura-utils/io/binding/_io_task.cpp +++ b/source/modules/asura-utils/io/binding/_io_task.cpp @@ -1,4 +1,4 @@ -#include "../io_task.h" +#include "../IOTask.h" using namespace std; diff --git a/source/modules/asura-utils/io/compressor.cpp b/source/modules/asura-utils/io/compressor.cpp index 095eff4..4202263 100644 --- a/source/modules/asura-utils/io/compressor.cpp +++ b/source/modules/asura-utils/io/compressor.cpp @@ -1,4 +1,4 @@ -#include "compressor.h" +#include "Compressor.h" namespace AsuraEngine { diff --git a/source/modules/asura-utils/io/compressor.h b/source/modules/asura-utils/io/compressor.h index 65fd88a..dc25e2a 100644 --- a/source/modules/asura-utils/io/compressor.h +++ b/source/modules/asura-utils/io/compressor.h @@ -1,7 +1,7 @@ -#ifndef __ASURA_COMPRESSOR_H__ -#define __ASURA_COMPRESSOR_H__ +#ifndef _ASURA_COMPRESSOR_H_ +#define _ASURA_COMPRESSOR_H_ -#include "../scripting/portable.hpp" +#include "../Scripting/Portable.hpp" namespace AsuraEngine { diff --git a/source/modules/asura-utils/io/file.cpp b/source/modules/asura-utils/io/file.cpp index a2f7403..6d5f4eb 100644 --- a/source/modules/asura-utils/io/file.cpp +++ b/source/modules/asura-utils/io/file.cpp @@ -1,8 +1,8 @@ #include <physfs/physfs.h> -#include <asura-utils/exceptions/exception.h> +#include <asura-utils/Exceptions/Exception.h> -#include "file.h" +#include "File.h" namespace AsuraEngine { diff --git a/source/modules/asura-utils/io/file.h b/source/modules/asura-utils/io/file.h index 16de42b..d11fa4f 100644 --- a/source/modules/asura-utils/io/file.h +++ b/source/modules/asura-utils/io/file.h @@ -1,12 +1,12 @@ -#ifndef __ASURA_ENGINE_FILE_H__ -#define __ASURA_ENGINE_FILE_H__ +#ifndef _ASURA_ENGINE_FILE_H_ +#define _ASURA_ENGINE_FILE_H_ #include "physfs/physfs.h" -#include "../scripting/portable.hpp" -#include "../threading/thread.h" +#include "../Scripting/Portable.hpp" +#include "../Threads/Thread.h" -#include "file_data.h" +#include "FileData.h" namespace AsuraEngine { diff --git a/source/modules/asura-utils/io/renewable.h b/source/modules/asura-utils/io/renewable.h index fd6c638..90867f2 100644 --- a/source/modules/asura-utils/io/renewable.h +++ b/source/modules/asura-utils/io/renewable.h @@ -3,7 +3,7 @@ #include "../scripting/portable.hpp" -#include "decoded_data.h" +#include "DecodedData.h" namespace AsuraEngine { diff --git a/source/modules/asura-utils/manager.hpp b/source/modules/asura-utils/manager.hpp index 7b4e272..c6817b1 100644 --- a/source/modules/asura-utils/manager.hpp +++ b/source/modules/asura-utils/manager.hpp @@ -1,5 +1,5 @@ -#ifndef __ASURA_ENGINE_MANAGER_H__ -#define __ASURA_ENGINE_MANAGER_H__ +#ifndef _ASURA_ENGINE_MANAGER_H_ +#define _ASURA_ENGINE_MANAGER_H_ namespace AsuraEngine { diff --git a/source/modules/asura-utils/math/matrix44.cpp b/source/modules/asura-utils/math/matrix44.cpp index 4472cd8..9ecf448 100644 --- a/source/modules/asura-utils/math/matrix44.cpp +++ b/source/modules/asura-utils/math/matrix44.cpp @@ -1,4 +1,4 @@ -#include "matrix44.h" +#include "Matrix44.h" #include <cstring> // memcpy #include <cmath> diff --git a/source/modules/asura-utils/math/matrix44.h b/source/modules/asura-utils/math/matrix44.h index 30033c5..7b66920 100644 --- a/source/modules/asura-utils/math/matrix44.h +++ b/source/modules/asura-utils/math/matrix44.h @@ -1,7 +1,7 @@ -#ifndef __ASURA_MATRIX_H__ -#define __ASURA_MATRIX_H__ +#ifndef _ASURA_MATRIX_H_ +#define _ASURA_MATRIX_H_ -#include "../scripting/portable.hpp" +#include "../Scripting/Portable.hpp" namespace AsuraEngine { diff --git a/source/modules/asura-utils/math/rect.hpp b/source/modules/asura-utils/math/rect.hpp index 010a5db..45bf1ba 100644 --- a/source/modules/asura-utils/math/rect.hpp +++ b/source/modules/asura-utils/math/rect.hpp @@ -1,5 +1,5 @@ -#ifndef __ASURA_ENGINE_RECT_H__ -#define __ASURA_ENGINE_RECT_H__ +#ifndef _ASURA_ENGINE_RECT_H_ +#define _ASURA_ENGINE_RECT_H_ namespace AsuraEngine { @@ -34,7 +34,7 @@ namespace AsuraEngine T x, y, w, h; }; -#include "Rect.inl" +#include "Rect.inc" // Define the most common types typedef Rect<int> Recti; diff --git a/source/modules/asura-utils/math/transform.h b/source/modules/asura-utils/math/transform.h index be4c850..23d0709 100644 --- a/source/modules/asura-utils/math/transform.h +++ b/source/modules/asura-utils/math/transform.h @@ -1,7 +1,7 @@ -#ifndef __ASURA_ENGINE_TRANSFORM_H__ -#define __ASURA_ENGINE_TRANSFORM_H__ +#ifndef _ASURA_ENGINE_TRANSFORM_H_ +#define _ASURA_ENGINE_TRANSFORM_H_ -#include "../scripting/portable.hpp" +#include "../scripting/Portable.hpp" namespace AsuraEngine { diff --git a/source/modules/asura-utils/math/vector2.hpp b/source/modules/asura-utils/math/vector2.hpp index e18bbdf..f2405eb 100644 --- a/source/modules/asura-utils/math/vector2.hpp +++ b/source/modules/asura-utils/math/vector2.hpp @@ -1,5 +1,5 @@ -#ifndef __ASURA_ENGINE_VECTOR2_H__ -#define __ASURA_ENGINE_VECTOR2_H__ +#ifndef _ASURA_ENGINE_VECTOR2_H__ +#define _ASURA_ENGINE_VECTOR2_H__ namespace AsuraEngine { @@ -57,7 +57,7 @@ namespace AsuraEngine template <typename T> bool operator !=(const Vector2<T>& left, const Vector2<T>& right); -#include "Vector2.inl" +#include "Vector2.inc" // Define the most common types typedef Vector2<int> Vector2i; diff --git a/source/modules/asura-utils/math/vector3.hpp b/source/modules/asura-utils/math/vector3.hpp index 2b23406..8da57cf 100644 --- a/source/modules/asura-utils/math/vector3.hpp +++ b/source/modules/asura-utils/math/vector3.hpp @@ -1,5 +1,5 @@ -#ifndef __ASURA_ENGINE_VECTOR3_H__ -#define __ASURA_ENGINE_VECTOR3_H__ +#ifndef _ASURA_ENGINE_VECTOR3_H__ +#define _ASURA_ENGINE_VECTOR3_H__ namespace AsuraEngine { @@ -221,7 +221,7 @@ namespace AsuraEngine template <typename T> bool operator !=(const Vector3<T>& left, const Vector3<T>& right); -#include "Vector3.inl" +#include "Vector3.inc" // Define the most common types typedef Vector3<int> Vector3i; diff --git a/source/modules/asura-utils/math/vector4.h b/source/modules/asura-utils/math/vector4.h index 13a9d8a..a5bf549 100644 --- a/source/modules/asura-utils/math/vector4.h +++ b/source/modules/asura-utils/math/vector4.h @@ -1,5 +1,5 @@ -#ifndef __ASURA_ENGINE_VECTOR4_H__ -#define __ASURA_ENGINE_VECTOR4_H__ +#ifndef _ASURA_ENGINE_VECTOR4_H__ +#define _ASURA_ENGINE_VECTOR4_H__ namespace AsuraEngine { @@ -222,7 +222,7 @@ namespace AsuraEngine template <typename T> bool operator !=(const Vector4<T>& left, const Vector4<T>& right); -#include "Vector4.inl" +#include "Vector4.inc" // Define the most common types typedef Vector4<int> Vector4i; diff --git a/source/modules/asura-utils/module.h b/source/modules/asura-utils/module.h index b22c68c..2cc91d6 100644 --- a/source/modules/asura-utils/module.h +++ b/source/modules/asura-utils/module.h @@ -1,8 +1,8 @@ -#ifndef __ASURA_MODULE_H__ -#define __ASURA_MODULE_H__ +#ifndef _ASURA_MODULE_H_ +#define _ASURA_MODULE_H_ -#include "type.h" -#include "scripting/portable.hpp" +#include "Type.h" +#include "Scripting/Portable.hpp" namespace AsuraEngine { diff --git a/source/modules/asura-utils/scripting/portable.hpp b/source/modules/asura-utils/scripting/portable.hpp index d691455..1eee123 100644 --- a/source/modules/asura-utils/scripting/portable.hpp +++ b/source/modules/asura-utils/scripting/portable.hpp @@ -1,5 +1,5 @@ -#ifndef __ASURA_ENGINE_PORTABLE_H__ -#define __ASURA_ENGINE_PORTABLE_H__ +#ifndef _ASURA_ENGINE_PORTABLE_H_ +#define _ASURA_ENGINE_PORTABLE_H_ extern "C" { #include <lua51/lua.h> @@ -8,12 +8,12 @@ extern "C" { } #include <luax/luax.h> -#include "../type.h" -namespace AsuraEngine -{ -namespace Scripting -{ +#include "../Type.h" +#include "../Classes.h" + +namespace_begin(AsuraEngine) +namespace_begin(Scripting) /// ҪΪ࣬userdatamember ref̳д࣬ע̳С @@ -23,8 +23,8 @@ using Object = Luax::LuaxObject; template<typename TYPE, typename BASE = Luax::LuaxObject> using Portable = Luax::LuaxNativeClass<TYPE, BASE>; -} -} +namespace_end +namespace_end namespace AEScripting = AsuraEngine::Scripting; diff --git a/source/modules/asura-utils/singleton.hpp b/source/modules/asura-utils/singleton.hpp index 0d2777e..9bb7336 100644 --- a/source/modules/asura-utils/singleton.hpp +++ b/source/modules/asura-utils/singleton.hpp @@ -1,7 +1,7 @@ -#ifndef __ASURA_SINGLETON_H__ -#define __ASURA_SINGLETON_H__ +#ifndef _ASURA_SINGLETON_H_ +#define _ASURA_SINGLETON_H_ -#include "utils_config.h" +#include "UtilsConfig.h" namespace AsuraEngine { @@ -56,4 +56,4 @@ namespace AsuraEngine } -#endif // __ASURA_SINGLETON_H__
\ No newline at end of file +#endif // _ASURA_SINGLETON_H_
\ No newline at end of file diff --git a/source/modules/asura-utils/stringmap.hpp b/source/modules/asura-utils/stringmap.hpp index 8d8f231..15d28ee 100644 --- a/source/modules/asura-utils/stringmap.hpp +++ b/source/modules/asura-utils/stringmap.hpp @@ -1,5 +1,5 @@ -#ifndef __ASURA_ENGINE_STRINGMAP_H__ -#define __ASURA_ENGINE_STRINGMAP_H__ +#ifndef _ASURA_ENGINE_STRINGMAP_H_ +#define _ASURA_ENGINE_STRINGMAP_H_ #include <string> diff --git a/source/modules/asura-utils/threading/thread_impl_posix.cpp b/source/modules/asura-utils/threading/thread_impl_posix.cpp deleted file mode 100644 index d59bd8f..0000000 --- a/source/modules/asura-utils/threading/thread_impl_posix.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "thread_impl_posix.h" - -namespace_begin(AsuraEngine) -namespace_begin(Threading) - - - -namespace_end -namespace_end
\ No newline at end of file diff --git a/source/modules/asura-utils/threading/thread_impl_posix.h b/source/modules/asura-utils/threading/thread_impl_posix.h deleted file mode 100644 index a65a2ca..0000000 --- a/source/modules/asura-utils/threading/thread_impl_posix.h +++ /dev/null @@ -1,2 +0,0 @@ -#include <asura-utils/classes.h> - diff --git a/source/modules/asura-utils/type.h b/source/modules/asura-utils/type.h index 2976d3e..f7e54c6 100644 --- a/source/modules/asura-utils/type.h +++ b/source/modules/asura-utils/type.h @@ -1,10 +1,10 @@ -#ifndef __ASURA_UTILS_TYPE_H__ -#define __ASURA_UTILS_TYPE_H__ +#ifndef _ASURA_UTILS_TYPE_H_ +#define _ASURA_UTILS_TYPE_H_ #include <cstdlib> #include <stdint.h> -#include "asura-base/config.h" +#include "asura-base/Config.h" namespace AsuraEngine { @@ -31,4 +31,4 @@ namespace AsuraEngine } // namespace AsuraEngine -#endif // __ASURA_CONFIG_H__
\ No newline at end of file +#endif // _ASURA_CONFIG_H_
\ No newline at end of file diff --git a/source/modules/asura-utils/utils.h b/source/modules/asura-utils/utils.h index ce1c6a1..dfcd2a6 100644 --- a/source/modules/asura-utils/utils.h +++ b/source/modules/asura-utils/utils.h @@ -1,6 +1,6 @@ -#ifndef __ASURA_UTILS_H__ -#define __ASURA_UTILS_H__ +#ifndef _ASURA_UTILS_H_ +#define _ASURA_UTILS_H_ -#include "utils_module.h" +#include "UtilsModule.h" #endif
\ No newline at end of file diff --git a/source/modules/asura-utils/utils_module.h b/source/modules/asura-utils/utils_module.h deleted file mode 100644 index 479b052..0000000 --- a/source/modules/asura-utils/utils_module.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef __ASURA_LIBS_UTIL_MODULE_H__ -#define __ASURA_LIBS_UTIL_MODULE_H__ - -#include "io/file_system.h" -#include "io/data_buffer.h" -#include "io/file_data.h" -#include "io/file.h" -#include "io/io_task.h" - -#include "threading/thread.h" - -#include "module.h" - -#include "classes.h" - -namespace AsuraEngine -{ - - /// - /// Asuraģ - /// - class UtilsModule ASURA_FINAL : public 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/tests/win32/01-window/02_multi_window.cpp b/source/tests/win32/01-window/02_multi_window.cpp index a57c9d4..e83f1a3 100644 --- a/source/tests/win32/01-window/02_multi_window.cpp +++ b/source/tests/win32/01-window/02_multi_window.cpp @@ -3,7 +3,7 @@ #if _run_app == _multi_window #include <windows.h> -#include <GL/gfx_device.h> +#include <GL/GfxDevice.h> #include <GL/glu.h> #define MAX_LOADSTRING 100 HINSTANCE hInstance; diff --git a/source/tests/win32/01-window/03_sub_menu.cpp b/source/tests/win32/01-window/03_sub_menu.cpp index 86bcc76..ccf62c0 100644 --- a/source/tests/win32/01-window/03_sub_menu.cpp +++ b/source/tests/win32/01-window/03_sub_menu.cpp @@ -1,12 +1,12 @@ #include "config.h" #if _run_app == _sub_menu -#include <asura-utils/io/file_system.h> -#include <asura-utils/io/data_buffer.h> +#include <asura-utils/IO/FileSystem.h> +#include <asura-utils/IO/DataBuffer.h> #include <asura-core/graphics/image.h> #include <asura-core/graphics/shader.h> -#include <asura-core/image/image_data.h> -#include <asura-core/graphics/vertex_buffer.h> +#include <asura-core/image/ImageData.h> +#include <asura-core/graphics/VertexBuffer.h> #include <SDL2/SDL.h> #include <string> @@ -111,7 +111,11 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR lpCmdLin DWORD extendedStyle = 0; windowStyle = WS_POPUP | WS_CLIPCHILDREN | WS_THICKFRAME | WS_VISIBLE; extendedStyle = WS_EX_TOOLWINDOW; - //windowStyle = WS_OVERLAPPEDWINDOW | WS_VISIBLE; + + windowStyle = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_CLIPCHILDREN | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_VISIBLE; + extendedStyle = 0; + + //windowStyle = WS_OVERLAPPEDWINDOW | WS_VISIBLE;WS_VISIBLE RECT rect = { 100, 100, 500, 500 }; AdjustWindowRectEx(&rect, windowStyle, true, extendedStyle); @@ -332,7 +336,6 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, } void AddMenus(HWND hwnd) { - return; HMENU hMenubar = CreateMenu(); HMENU hMenu = CreateMenu(); HMENU hSubMenu = CreatePopupMenu(); |