├── .editorconfig ├── .gitattributes ├── .github ├── dependabot.yml └── workflows │ ├── arm64.yml │ ├── cpp-ci.yml │ ├── list-sdk.yml │ └── release.yml ├── .gitignore ├── .gitmodules ├── BUILD.md ├── CMakeLists.txt ├── CMakePresets.json ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── License.txt ├── LuaSTG ├── CMakeLists.txt ├── Configurer │ ├── CMakeLists.txt │ ├── Configurer.manifest │ ├── Main.cpp │ └── SharedHeaders.h ├── Core.cmake ├── Core │ ├── ApplicationModel.hpp │ ├── ApplicationModel_Win32.cpp │ ├── ApplicationModel_Win32.hpp │ ├── Audio │ │ ├── Decoder.hpp │ │ ├── Decoder_ALL.cpp │ │ ├── Decoder_FLAC.cpp │ │ ├── Decoder_FLAC.hpp │ │ ├── Decoder_VorbisOGG.cpp │ │ ├── Decoder_VorbisOGG.hpp │ │ ├── Decoder_WAV.cpp │ │ ├── Decoder_WAV.hpp │ │ ├── Device.hpp │ │ ├── Device_MM.cpp │ │ ├── Device_XAUDIO2.cpp │ │ └── Device_XAUDIO2.hpp │ ├── Graphics │ │ ├── Common │ │ │ ├── FreeTypeGlyphManager.cpp │ │ │ ├── FreeTypeGlyphManager.hpp │ │ │ ├── Sprite.cpp │ │ │ ├── Sprite.hpp │ │ │ ├── SpriteRenderer.cpp │ │ │ ├── SpriteRenderer.hpp │ │ │ ├── TextRenderer.cpp │ │ │ └── TextRenderer.hpp │ │ ├── Device.hpp │ │ ├── Direct3D11 │ │ │ ├── Buffer.cpp │ │ │ ├── Buffer.hpp │ │ │ ├── Constants.hpp │ │ │ ├── DepthStencilBuffer.cpp │ │ │ ├── DepthStencilBuffer.hpp │ │ │ ├── Device.cpp │ │ │ ├── Device.hpp │ │ │ ├── LetterBoxingRenderer.cpp │ │ │ ├── LetterBoxingRenderer.hpp │ │ │ ├── Mesh.cpp │ │ │ ├── Mesh.hpp │ │ │ ├── MeshRenderer.cpp │ │ │ ├── MeshRenderer.hpp │ │ │ ├── RenderTarget.cpp │ │ │ ├── RenderTarget.hpp │ │ │ ├── SamplerState.cpp │ │ │ ├── SamplerState.hpp │ │ │ ├── Texture2D.cpp │ │ │ └── Texture2D.hpp │ │ ├── Font.hpp │ │ ├── Format.hpp │ │ ├── Mesh.hpp │ │ ├── Model_D3D11.cpp │ │ ├── Model_D3D11.hpp │ │ ├── Model_Shader_D3D11.cpp │ │ ├── Renderer.hpp │ │ ├── Renderer_D3D11.cpp │ │ ├── Renderer_D3D11.hpp │ │ ├── Renderer_Shader_D3D11.cpp │ │ ├── Sprite.hpp │ │ ├── SwapChain.hpp │ │ ├── SwapChain_D3D11.cpp │ │ ├── SwapChain_D3D11.hpp │ │ ├── Window.hpp │ │ ├── Window_Win32.cpp │ │ └── Window_Win32.hpp │ ├── Type.hpp │ ├── framework.cpp │ ├── framework.hpp │ ├── i18n.cpp │ └── i18n.hpp ├── LuaSTG │ ├── AppFrame.cpp │ ├── AppFrame.h │ ├── AppFrameDisplayMode.cpp │ ├── AppFrameFontRenderer.cpp │ ├── AppFrameInput.cpp │ ├── AppFrameLua.cpp │ ├── AppFrameRender.cpp │ ├── AppFrameRenderEx.cpp │ ├── Custom │ │ ├── AppFrameLuaEx.cpp │ │ ├── Config.h │ │ ├── Custom.cmake │ │ ├── ResourcePassword.cpp │ │ ├── app.ico │ │ ├── resource.aps │ │ ├── resource.h │ │ └── resource.rc │ ├── Debugger │ │ ├── ImGuiExtension.cpp │ │ ├── ImGuiExtension.h │ │ ├── Logger.cpp │ │ └── Logger.hpp │ ├── GameObject │ │ ├── GameObject.cpp │ │ ├── GameObject.hpp │ │ ├── GameObjectBentLaser.cpp │ │ ├── GameObjectBentLaser.hpp │ │ ├── GameObjectIntersectDetect.cpp │ │ ├── GameObjectPool.cpp │ │ └── GameObjectPool.h │ ├── GameResource │ │ ├── Implement │ │ │ ├── ResourceAnimationImpl.cpp │ │ │ ├── ResourceAnimationImpl.hpp │ │ │ ├── ResourceBaseImpl.cpp │ │ │ ├── ResourceBaseImpl.hpp │ │ │ ├── ResourceFontImpl.cpp │ │ │ ├── ResourceFontImpl.hpp │ │ │ ├── ResourceModelImpl.cpp │ │ │ ├── ResourceModelImpl.hpp │ │ │ ├── ResourceMusicImpl.cpp │ │ │ ├── ResourceMusicImpl.hpp │ │ │ ├── ResourceParticleImpl.cpp │ │ │ ├── ResourceParticleImpl.hpp │ │ │ ├── ResourcePostEffectShaderImpl.cpp │ │ │ ├── ResourcePostEffectShaderImpl.hpp │ │ │ ├── ResourceSoundEffectImpl.cpp │ │ │ ├── ResourceSoundEffectImpl.hpp │ │ │ ├── ResourceSpriteImpl.cpp │ │ │ ├── ResourceSpriteImpl.hpp │ │ │ ├── ResourceTextureImpl.cpp │ │ │ └── ResourceTextureImpl.hpp │ │ ├── LegacyBlendStateHelper.hpp │ │ ├── ResourceAnimation.hpp │ │ ├── ResourceBase.hpp │ │ ├── ResourceDebug.cpp │ │ ├── ResourceFont.hpp │ │ ├── ResourceManager.cpp │ │ ├── ResourceManager.h │ │ ├── ResourceModel.cpp │ │ ├── ResourceModel.hpp │ │ ├── ResourceMusic.hpp │ │ ├── ResourceParticle.hpp │ │ ├── ResourcePassword.hpp │ │ ├── ResourcePool.cpp │ │ ├── ResourcePostEffectShader.hpp │ │ ├── ResourceSoundEffect.hpp │ │ ├── ResourceSprite.hpp │ │ └── ResourceTexture.hpp │ ├── LConfig.h │ ├── LMathConstant.hpp │ ├── LuaBinding │ │ ├── LW_Archive.cpp │ │ ├── LW_Audio.cpp │ │ ├── LW_BentLaser.cpp │ │ ├── LW_Color.cpp │ │ ├── LW_DInput.cpp │ │ ├── LW_FileManager.cpp │ │ ├── LW_GameObjectManager.cpp │ │ ├── LW_Input.cpp │ │ ├── LW_LuaSTG.cpp │ │ ├── LW_ParticleSystem.cpp │ │ ├── LW_Platform.cpp │ │ ├── LW_Render.cpp │ │ ├── LW_Renderer.cpp │ │ ├── LW_ResourceMgr.cpp │ │ ├── LW_StopWatch.cpp │ │ ├── LuaAppFrame.hpp │ │ ├── LuaCustomLoader.cpp │ │ ├── LuaCustomLoader.hpp │ │ ├── LuaWrapper.cpp │ │ ├── LuaWrapper.hpp │ │ ├── LuaWrapperMisc.hpp │ │ ├── PostEffectShader.cpp │ │ ├── PostEffectShader.hpp │ │ ├── Resource.cpp │ │ ├── Resource.hpp │ │ ├── external │ │ │ ├── HttpClient.cpp │ │ │ ├── HttpClient.hpp │ │ │ ├── lua_dwrite.cpp │ │ │ ├── lua_dwrite.hpp │ │ │ ├── lua_random.cpp │ │ │ ├── lua_random.hpp │ │ │ ├── lua_xinput.cpp │ │ │ └── lua_xinput.hpp │ │ ├── generated │ │ │ ├── BlendModeX.cpp │ │ │ ├── BlendModeX.hpp │ │ │ ├── ColorMember.cpp │ │ │ ├── ColorMember.hpp │ │ │ ├── GameObjectMember.cpp │ │ │ ├── GameObjectMember.hpp │ │ │ └── placeholder │ │ └── modern │ │ │ ├── Clipboard.cpp │ │ │ ├── Clipboard.hpp │ │ │ ├── Display.cpp │ │ │ ├── Display.hpp │ │ │ ├── FileSystemWatcher.cpp │ │ │ ├── FileSystemWatcher.hpp │ │ │ ├── GameObject.cpp │ │ │ ├── GameObject.hpp │ │ │ ├── Mesh.cpp │ │ │ ├── Mesh.hpp │ │ │ ├── MeshRenderer.cpp │ │ │ ├── MeshRenderer.hpp │ │ │ ├── Sprite.cpp │ │ │ ├── Sprite.hpp │ │ │ ├── SpriteRenderer.cpp │ │ │ ├── SpriteRenderer.hpp │ │ │ ├── SwapChain.cpp │ │ │ ├── SwapChain.hpp │ │ │ ├── Texture2D.cpp │ │ │ ├── Texture2D.hpp │ │ │ ├── Vector2.cpp │ │ │ ├── Vector2.hpp │ │ │ ├── Vector3.cpp │ │ │ ├── Vector3.hpp │ │ │ ├── Vector4.cpp │ │ │ ├── Vector4.hpp │ │ │ ├── Well512.cpp │ │ │ ├── Well512.hpp │ │ │ ├── Window.cpp │ │ │ └── Window.hpp │ ├── LuaSTG.manifest │ ├── Main.cpp │ ├── Main.h │ ├── RuntimeCheck.cpp │ ├── RuntimeCheck.hpp │ ├── SharedHeaders.cpp │ ├── SharedHeaders.h │ ├── SteamAPI │ │ ├── SteamAPI.cpp │ │ └── SteamAPI.hpp │ ├── Utility │ │ ├── ScopeObject.cpp │ │ ├── Utility.h │ │ ├── jsf.hpp │ │ ├── sfc.hpp │ │ ├── splitmix.hpp │ │ ├── well512.cpp │ │ ├── well512.hpp │ │ └── xorshift.hpp │ └── WindowsMain.cpp ├── Platform.cmake ├── Platform │ ├── AdapterPolicy.cpp │ ├── AdapterPolicy.hpp │ ├── All.cpp │ ├── ApplicationSingleInstance.hpp │ ├── CleanWindows.hpp │ ├── CommandLineArguments.hpp │ ├── DXGI.hpp │ ├── DesktopWindowManager.hpp │ ├── DetectCPU.cpp │ ├── DetectCPU.hpp │ ├── Direct3D11.hpp │ ├── DirectInput.cpp │ ├── DirectInput.hpp │ ├── HResultChecker.cpp │ ├── HResultChecker.hpp │ ├── ImmersiveTitleBarController.cpp │ ├── ImmersiveTitleBarController.hpp │ ├── Keyboard.cpp │ ├── Keyboard.hpp │ ├── KnownDirectory.cpp │ ├── KnownDirectory.hpp │ ├── MessageBox.cpp │ ├── MessageBox.hpp │ ├── ModuleLoader.hpp │ ├── ProcessorInfo.cpp │ ├── ProcessorInfo.hpp │ ├── RuntimeLoader │ │ ├── All.cpp │ │ ├── D3DKMT.cpp │ │ ├── D3DKMT.hpp │ │ ├── DXGI.hpp │ │ ├── DesktopWindowManager.hpp │ │ ├── Direct2D1.hpp │ │ ├── Direct3D11.hpp │ │ ├── Direct3DCompiler.hpp │ │ ├── DirectComposition.hpp │ │ ├── DirectWrite.hpp │ │ └── XAudio2.hpp │ ├── Shared.hpp │ ├── WindowSizeMoveController.cpp │ ├── WindowSizeMoveController.hpp │ ├── WindowTheme.cpp │ ├── WindowTheme.hpp │ ├── WindowsVersion.cpp │ ├── WindowsVersion.hpp │ ├── XInput.cpp │ └── XInput.hpp ├── Shader │ ├── CMakeLists.txt │ ├── ShaderCompiler.cpp │ ├── generated │ │ ├── imgui │ │ │ └── backend │ │ │ │ └── d3d11 │ │ │ │ ├── pixel_shader.hpp │ │ │ │ └── vertex_shader.hpp │ │ └── luastg │ │ │ └── sub │ │ │ └── renderer │ │ │ ├── pixel_shader_def_add_exp2_normal.hpp │ │ │ ├── pixel_shader_def_add_exp2_premul.hpp │ │ │ ├── pixel_shader_def_add_exp_normal.hpp │ │ │ ├── pixel_shader_def_add_exp_premul.hpp │ │ │ ├── pixel_shader_def_add_linear_normal.hpp │ │ │ ├── pixel_shader_def_add_linear_premul.hpp │ │ │ ├── pixel_shader_def_add_none_normal.hpp │ │ │ ├── pixel_shader_def_add_none_premul.hpp │ │ │ ├── pixel_shader_def_mul_exp2_normal.hpp │ │ │ ├── pixel_shader_def_mul_exp2_premul.hpp │ │ │ ├── pixel_shader_def_mul_exp_normal.hpp │ │ │ ├── pixel_shader_def_mul_exp_premul.hpp │ │ │ ├── pixel_shader_def_mul_linear_normal.hpp │ │ │ ├── pixel_shader_def_mul_linear_premul.hpp │ │ │ ├── pixel_shader_def_mul_none_normal.hpp │ │ │ ├── pixel_shader_def_mul_none_premul.hpp │ │ │ ├── pixel_shader_def_one_exp2_normal.hpp │ │ │ ├── pixel_shader_def_one_exp2_premul.hpp │ │ │ ├── pixel_shader_def_one_exp_normal.hpp │ │ │ ├── pixel_shader_def_one_exp_premul.hpp │ │ │ ├── pixel_shader_def_one_linear_normal.hpp │ │ │ ├── pixel_shader_def_one_linear_premul.hpp │ │ │ ├── pixel_shader_def_one_none_normal.hpp │ │ │ ├── pixel_shader_def_one_none_premul.hpp │ │ │ ├── pixel_shader_def_zero_exp2_normal.hpp │ │ │ ├── pixel_shader_def_zero_exp2_premul.hpp │ │ │ ├── pixel_shader_def_zero_exp_normal.hpp │ │ │ ├── pixel_shader_def_zero_exp_premul.hpp │ │ │ ├── pixel_shader_def_zero_linear_normal.hpp │ │ │ ├── pixel_shader_def_zero_linear_premul.hpp │ │ │ ├── pixel_shader_def_zero_none_normal.hpp │ │ │ ├── pixel_shader_def_zero_none_premul.hpp │ │ │ ├── vertex_shader_def_fog.hpp │ │ │ └── vertex_shader_def_none.hpp │ ├── imgui │ │ └── backend │ │ │ └── d3d11 │ │ │ ├── pixel_shader.hlsl │ │ │ └── vertex_shader.hlsl │ └── luastg │ │ └── sub │ │ └── renderer │ │ ├── gltf_2_0_shader.hlsl │ │ ├── pixel_shader.hlsl │ │ ├── screen_door.glsl │ │ └── vertex_shader.hlsl └── shaders.cmake ├── Readme.md ├── SECURITY.md ├── artwork ├── logo-pure.png └── logo.png ├── cmake ├── TargetCommonOptions.cmake ├── build │ ├── all.cmake │ ├── freetype.cmake │ ├── gtest.cmake │ ├── harfbuzz.cmake │ ├── xiph.cmake │ └── z.cmake ├── import │ ├── ada_url.cmake │ ├── all.cmake │ ├── cpm.cmake │ ├── d3dcompiler.cmake │ ├── directx_tex.cmake │ ├── directx_tk.cmake │ ├── dr_libs.cmake │ ├── json.cmake │ ├── pcg.cmake │ ├── pugixml.cmake │ ├── simdutf.cmake │ ├── spdlog.cmake │ ├── stb.cmake │ ├── tinygltf.cmake │ ├── tinyobjloader.cmake │ ├── tracy.cmake │ ├── wil.cmake │ ├── xaudio2.cmake │ ├── xxhash.cmake │ └── yy_thunks.cmake ├── msvc.crt.cmake ├── options.cmake └── packages.lua.cmake ├── data ├── example │ ├── .gitignore │ ├── .vscode │ │ └── settings.json │ ├── assets │ │ └── texture │ │ │ └── white.png │ ├── config.json │ ├── example.code-workspace │ ├── scripts │ │ ├── main.lua │ │ └── task │ │ │ ├── Manager.lua │ │ │ └── init.lua │ └── 使用说明.txt ├── license │ ├── CPM.cmake │ │ └── LICENSE │ ├── Dear_ImGui │ │ └── LICENSE.txt │ ├── DirectXTK │ │ └── LICENSE │ ├── DirectXTex │ │ └── LICENSE │ ├── LuaSTG_Sub │ │ └── License.txt │ ├── Microsoft.Windows.ImplementationLibrary │ │ └── LICENSE │ ├── Microsoft.XAudio2.Redist │ │ └── LICENSE.txt │ ├── dr_libs │ │ └── LICENSE │ ├── fmtlib │ │ └── LICENSE.rst │ ├── freetype │ │ └── FTL.TXT │ ├── imneme_pcg_cpp │ │ └── LICENSE-MIT.txt │ ├── implot │ │ └── LICENSE │ ├── libflac │ │ └── COPYING.Xiph │ ├── libogg │ │ └── COPYING │ ├── libvorbis │ │ └── COPYING │ ├── lstg_XMath │ │ └── LICENSE │ ├── lua_cjson │ │ └── LICENSE │ ├── luajit │ │ └── COPYRIGHT │ ├── luasocket │ │ └── LICENSE │ ├── minizip_ng │ │ └── LICENSE │ ├── nlohmann_json │ │ └── LICENSE.MIT │ ├── nothings_stb │ │ └── LICENSE │ ├── phoboslab_qoi │ │ └── LICENSE │ ├── pugixml │ │ └── LICENSE.md │ ├── simdutf │ │ └── LICENSE-MIT │ ├── spdlog │ │ └── LICENSE │ ├── tinygltf │ │ └── LICENSE │ ├── tracy │ │ └── LICENSE │ ├── xxhash │ │ └── LICENSE │ └── zlib_ng │ │ └── LICENSE.md └── test │ ├── .gitignore │ ├── assets │ ├── alpha.zip │ ├── alpha.zip.password.txt │ └── alpha │ │ └── alpha.lua │ ├── config.json │ ├── deep │ └── res │ │ ├── se_ok00.wav │ │ ├── se_ok00.wav.readme.md │ │ └── se_ok00_fixed.wav │ ├── res │ ├── audio │ │ └── 啊!.wav │ ├── blend_color_burn.hlsl │ ├── blend_color_dodge.hlsl │ ├── blend_shared.hlsli │ ├── block.png │ ├── block.qoi │ ├── f2dfont.png │ ├── f2dfont.xml │ ├── ghost_fire_1.psi │ ├── hgefont.fnt │ ├── hgefont.png │ ├── image_1.png │ ├── image_2.jpg │ ├── linear.png │ ├── mask_1.png │ ├── particles.png │ ├── rgb_select.hlsl │ ├── rgb_select_new.hlsl │ ├── sRGB.png │ ├── shader_mask.hlsl │ ├── shared.hlsli │ └── 素材备忘录.txt │ ├── sampler │ ├── core.lua │ ├── res │ │ └── white.png │ └── task.lua │ └── scripts │ ├── dwrite_ext_index.txt │ ├── keycode.lua │ ├── main.lua │ ├── mod │ └── test.lua │ ├── scripts │ └── bad.lua.txt │ ├── test.lua │ ├── test │ ├── audio │ │ ├── SoundEffect.lua │ │ └── init.lua │ ├── file │ │ ├── FileSystemArchive.lua │ │ ├── FileSystemWatcher.lua │ │ └── init.lua │ ├── gameplay │ │ ├── GameObjectUpdate.lua │ │ └── init.lua │ ├── graphics │ │ ├── Mesh.lua │ │ ├── MeshRenderer.lua │ │ ├── SpriteRenderer.lua │ │ ├── Texture2D.lua │ │ └── init.lua │ ├── imgui │ │ ├── ImVec2.lua │ │ ├── ImVec4.lua │ │ └── init.lua │ ├── input │ │ ├── Clipboard.lua │ │ ├── InputMethod.lua │ │ └── init.lua │ └── math │ │ ├── Vector.lua │ │ └── init.lua │ ├── test_bad_lua.lua │ ├── test_blend_alpha_bal.lua │ ├── test_blend_color_burn.lua │ ├── test_colli.lua │ ├── test_dwrite.lua │ ├── test_f2dfont.lua │ ├── test_filesys.lua │ ├── test_hgefont.lua │ ├── test_lfs.lua │ ├── test_log.lua │ ├── test_mesh.lua │ ├── test_model.lua │ ├── test_object_resource.lua │ ├── test_particle.lua │ ├── test_posteffect.lua │ ├── test_random.lua │ ├── test_rendertarget.lua │ ├── test_sampler.lua │ ├── test_se.lua │ ├── test_stringpack.lua │ ├── test_textrenderer.lua │ ├── test_texture.lua │ ├── test_ttf.lua │ ├── test_utf8api.lua │ └── test_window_and_display.lua ├── engine ├── CMakeLists.txt ├── clipboard │ ├── CMakeLists.txt │ ├── backend │ │ └── Clipboard.cpp │ └── core │ │ └── Clipboard.hpp ├── collection │ ├── CMakeLists.txt │ └── core │ │ ├── FixedCircularQueue.hpp │ │ ├── FixedObjectPool.hpp │ │ └── dummy.cpp ├── configuration │ ├── CMakeLists.txt │ └── core │ │ ├── Configuration.cpp │ │ ├── Configuration.hpp │ │ └── ConfigurationWindows.cpp ├── embedded-file-system │ ├── CMakeLists.txt │ ├── generated │ │ ├── scripts.cpp │ │ └── scripts.hpp │ └── luastg │ │ ├── EmbeddedFileSystem.cpp │ │ ├── EmbeddedFileSystem.hpp │ │ └── mask.hpp ├── embedded-script │ └── luastg │ │ ├── GameObject.lua │ │ ├── cjson.lua │ │ ├── ffi │ │ └── sample.lua │ │ ├── io.lua │ │ ├── main.lua │ │ ├── math.lua │ │ └── removed.lua ├── file-system │ ├── CMakeLists.txt │ ├── core │ │ ├── Data.cpp │ │ ├── Data.hpp │ │ ├── FileSystem.hpp │ │ ├── FileSystemArchive.cpp │ │ ├── FileSystemArchive.hpp │ │ ├── FileSystemCommon.cpp │ │ ├── FileSystemCommon.hpp │ │ ├── FileSystemManager.cpp │ │ ├── FileSystemOS.cpp │ │ ├── FileSystemOS.hpp │ │ ├── FileSystemWatcher.cpp │ │ ├── FileSystemWatcher.hpp │ │ ├── FileSystemWindows.cpp │ │ └── FileSystemWindows.hpp │ └── test │ │ └── Test.cpp ├── logging │ ├── CMakeLists.txt │ └── core │ │ ├── Logger.hpp │ │ └── spdlog │ │ └── Logger.cpp ├── lua │ ├── CMakeLists.txt │ └── lua │ │ ├── plus.cpp │ │ └── plus.hpp ├── reference-counted │ ├── CMakeLists.txt │ ├── core │ │ ├── ReferenceCounted.hpp │ │ ├── SmartReference.hpp │ │ ├── WeakReference.hpp │ │ ├── WeakReferenceSource.hpp │ │ └── implement │ │ │ ├── ReferenceCounted.hpp │ │ │ ├── ReferenceCountedDebugger.cpp │ │ │ ├── ReferenceCountedDebugger.hpp │ │ │ ├── WeakReference.hpp │ │ │ └── WeakReferenceSource.hpp │ └── test │ │ └── Test.cpp ├── string │ ├── CMakeLists.txt │ └── core │ │ ├── ImmutableString.cpp │ │ └── ImmutableString.hpp ├── utf8 │ ├── CMakeLists.txt │ ├── utf8.cpp │ └── utf8.hpp ├── utility │ ├── CMakeLists.txt │ └── utility │ │ ├── path.cpp │ │ ├── path.hpp │ │ └── utf.hpp └── uuid │ ├── CMakeLists.txt │ └── core │ ├── UUID.cpp │ └── UUID.hpp ├── external ├── .gitignore ├── CMakeLists.txt ├── image.qoi-patch │ ├── QOITextureLoader11.cpp │ ├── QOITextureLoader11.h │ └── qoi.c ├── lua-cjson-patch │ └── lua_cjson.h ├── lua-csv │ ├── lua_csv.cpp │ ├── lua_xlsx.cpp │ └── lua_xlsx_csv.h ├── lua-filesystem-lite │ ├── lfs.cpp │ └── lfs.h ├── steam_api │ ├── .gitignore │ ├── CMakeLists.txt │ ├── SteamworksSDK │ │ └── sdk │ │ │ └── Download.txt │ └── binding │ │ ├── lua_steam.cpp │ │ ├── lua_steam.h │ │ ├── lua_steam_SteamAPI.inl │ │ ├── lua_steam_SteamCallbackWrapper.inl │ │ ├── lua_steam_SteamInput.inl │ │ ├── lua_steam_SteamUserStats.inl │ │ ├── lua_steam_dll.cpp │ │ └── lua_steam_empty.cpp ├── tracy-patch │ ├── CMakeLists.txt │ └── tracy │ │ └── TracyAPI.hpp └── xmath-patch │ └── math │ ├── Vec2.cpp │ └── Vec2.h ├── imgui ├── CMakeLists.txt ├── backend │ ├── imgui_impl_dx11.cpp │ ├── imgui_impl_win32ex.cpp │ └── imgui_impl_win32ex.h └── binding │ ├── doc │ └── imgui.lua │ ├── include │ ├── lua_imgui.hpp │ └── lua_imgui_type.hpp │ └── src │ ├── ImVec2.cpp │ ├── ImVec4.cpp │ ├── generated │ ├── ImGuiStyleMember.cpp │ ├── ImGuiStyleMember.hpp │ ├── ImGuiTextBufferMember.cpp │ ├── ImGuiTextBufferMember.hpp │ └── placeholder │ ├── lua_imgui.cpp │ ├── lua_imgui_ImGui.cpp │ ├── lua_imgui_ImGui.hpp │ ├── lua_imgui_ImGuiTextBuffer.cpp │ ├── lua_imgui_ImGui_ColorX.inl │ ├── lua_imgui_ImGui_DragX.inl │ ├── lua_imgui_ImGui_InputX.inl │ ├── lua_imgui_ImGui_PlotX.inl │ ├── lua_imgui_ImGui_SliderX.inl │ ├── lua_imgui_ImGui_register.inl │ ├── lua_imgui_common.hpp │ ├── lua_imgui_enum.cpp │ ├── lua_imgui_enum.hpp │ └── lua_imgui_type.cpp └── tool ├── CMakeLists.txt ├── embedded-file-system-builder ├── CMakeLists.txt └── main.cpp ├── lua ├── license │ └── lua │ │ └── readme.txt ├── lua54.dll └── lua54.exe ├── luajit └── license │ ├── lua51.dll │ ├── luajit.exe │ └── luajit │ └── COPYRIGHT ├── package.ps1 ├── property_map ├── imgui.lua ├── logger.lua ├── luastg.lua ├── main.lua ├── property_map.lua └── update_property_map.ps1 ├── resharper └── LuaSTGSub.sln.DotSettings └── version-info-generator ├── config.json ├── json.lua ├── license └── json.lua │ ├── LICENSE.txt │ └── readme.txt ├── main.lua ├── template ├── LConfig.h ├── LuaSTG.manifest └── resource.rc └── update_version.ps1 /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.{h,c,hpp,cpp}] 4 | charset = utf-8 5 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/.gitattributes -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "github-actions" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "weekly" 12 | -------------------------------------------------------------------------------- /.github/workflows/arm64.yml: -------------------------------------------------------------------------------- 1 | name: ARM64 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | build: 8 | runs-on: windows-11-arm 9 | 10 | steps: 11 | - uses: actions/checkout@v4 12 | with: 13 | submodules: 'recursive' 14 | 15 | - name: Cache C++ packages 16 | id: cache-cpp 17 | uses: actions/cache@v4 18 | with: 19 | path: | 20 | build/packages 21 | key: cache-cpp-all 22 | restore-keys: | 23 | cache-cpp-all 24 | 25 | - if: ${{ steps.cache-cpp.outputs.cache-hit != 'true' }} 26 | name: Report cache state 27 | continue-on-error: true 28 | run: echo "Cache miss" 29 | 30 | - name: CMake configure 31 | run: cmake -S . -B build -G "Visual Studio 17 2022" -A ARM64,version=10.0.26100.0 -DCPM_SOURCE_CACHE=build/packages 32 | 33 | - name: CMake build 34 | run: cmake --build build --target LuaSTG --config Release 35 | 36 | - name: Archive artifacts 37 | uses: actions/upload-artifact@v4 38 | with: 39 | name: bin 40 | path: | 41 | build/bin 42 | retention-days: 7 43 | -------------------------------------------------------------------------------- /.github/workflows/list-sdk.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: List SDK 4 | 5 | # Controls when the workflow will run 6 | on: 7 | # Triggers the workflow on push or pull request events but only for the "master" branch 8 | #push: 9 | # branches: [ "master" ] 10 | #pull_request: 11 | # branches: [ "master" ] 12 | 13 | # Allows you to run this workflow manually from the Actions tab 14 | workflow_dispatch: 15 | 16 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 17 | jobs: 18 | # This workflow contains a single job called "build" 19 | build: 20 | # The type of runner that the job will run on 21 | runs-on: windows-2022 22 | 23 | # Steps represent a sequence of tasks that will be executed as part of the job 24 | steps: 25 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 26 | #- uses: actions/checkout@v3 27 | 28 | # Runs a single command using the runners shell 29 | - name: Run a one-line script 30 | run: | 31 | cd "C:\Program Files (x86)\Windows Kits\10\bin" 32 | dir 33 | cmake --version 34 | 35 | # Runs a set of commands using the runners shell 36 | #- name: Run a multi-line script 37 | # run: | 38 | # echo Add other actions to build, 39 | # echo test, and deploy your project. 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # IDE 2 | .idea/* 3 | .vscode/* 4 | .vs/* 5 | 6 | # build 7 | build/* 8 | out/* 9 | install/* 10 | cmake-build-*/* 11 | packages/* 12 | 13 | # publish 14 | .backup/* 15 | 16 | # cache 17 | LuaSTG/backup/* 18 | LuaSTG/custom/* 19 | DirectX/DirectXSDK/backup/* 20 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "imgui/imgui"] 2 | path = imgui/imgui 3 | url = https://github.com/ocornut/imgui.git 4 | [submodule "imgui/implot"] 5 | path = imgui/implot 6 | url = https://github.com/epezent/implot.git 7 | [submodule "external/xmath"] 8 | path = external/xmath 9 | url = https://github.com/Legacy-LuaSTG-Engine/lstgx_Math.git 10 | [submodule "external/lua-cjson"] 11 | path = external/lua-cjson 12 | url = https://github.com/openresty/lua-cjson.git 13 | [submodule "doc"] 14 | path = doc 15 | url = https://github.com/Legacy-LuaSTG-Engine/LuaSTG-Sub-Documentation.git 16 | [submodule "external/image.qoi"] 17 | path = external/image.qoi 18 | url = https://github.com/phoboslab/qoi.git 19 | [submodule "external/luajit2"] 20 | path = external/luajit2 21 | url = https://github.com/Legacy-LuaSTG-Engine/LuaSTG-Sub-LuaJIT.git 22 | [submodule "external/beautiful-win32-api"] 23 | path = external/beautiful-win32-api 24 | url = https://github.com/Demonese/beautiful-win32-api 25 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.22) 2 | project(LuaSTGSub) 3 | 4 | #option(LUASTG_RESDIR "Custom configurations" "res") 5 | 6 | option(LUASTG_SUPPORTS_WINDOWS_7 "LuaSTG Sub Windows compatibility: Windows 7" ON) 7 | option(LUASTG_LINK_YY_THUNKS "Link to YY_Thunks for older Windows version (not recommended)" OFF) 8 | option(LUASTG_LINK_LUASOCKET "Link to luasocket" OFF) 9 | option(LUASTG_LINK_TRACY_CLIENT "Link to Tracy client" OFF) 10 | option(LUASTG_LINK_STEAM_API "Link to Steam API" OFF) 11 | 12 | if(LUASTG_SUPPORTS_WINDOWS_7) 13 | message(STATUS "[LuaSTG] Windows compatibility: Windows 7") 14 | add_compile_definitions(LUASTG_SUPPORTS_WINDOWS_7) 15 | endif() 16 | 17 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 18 | include(cmake/TargetCommonOptions.cmake) 19 | include(cmake/options.cmake) 20 | include(cmake/msvc.crt.cmake) 21 | #msvc_hybrid_runtime_library() 22 | msvc_static_runtime_library() 23 | 24 | include(cmake/import/all.cmake) 25 | include(cmake/build/all.cmake) 26 | add_subdirectory(external) 27 | include(cmake/packages.lua.cmake) 28 | include(LuaSTG/shaders.cmake) 29 | add_subdirectory(imgui) 30 | 31 | add_subdirectory(engine) 32 | add_subdirectory(tool) 33 | add_subdirectory(LuaSTG) 34 | 35 | if (CMAKE_GENERATOR MATCHES "Visual Studio") 36 | message(STATUS "Current CMake generator is Visual Studio, set startup project to LuaSTG") 37 | set_directory_properties(PROPERTY VS_STARTUP_PROJECT LuaSTG) 38 | endif () 39 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # 如何为 LuaSTG Sub 引擎出谋献策 2 | 3 | > 下文中的“我们”指 LuaSTG Sub 引擎开发团队 4 | 5 | ## 发现并报告缺陷 6 | 7 | 无论你是玩家,还是游戏开发者,发现引擎的缺陷(bug)时,都向我们报告缺陷。 8 | 9 | 我们提供了多种报告缺陷的途径: 10 | 11 | * GitHub Issues:https://github.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/issues 12 | * 邮箱:contact@luastg-sub.com 13 | * LuaSTG 交流群(QQ群):230927410 14 | * LuaSTG 寒流群(QQ群):563868788 15 | 16 | 每一个缺陷报告都会帮助改善引擎代码质量,即使你并未编写一行代码。 17 | 18 | ## 提出功能需求 19 | 20 | LuaSTG Sub 并不是一款大而全的游戏引擎,在过去的 10 多年里,LuaSTG 系列引擎一直专精于“东方风弹幕射击游戏(东方STG)”这个小众领域,引擎提供的主要功能很少发生重大改变。 21 | 22 | 此外,我们是一群用爱发电的开发者,利用业余时间开发 LuaSTG Sub 引擎,时间、精力、技术都十分紧缺。虽然有很多“棒极了”的想法,但我们却无力开发。 23 | 24 | 尽管如此,我们仍然欢迎游戏开发者们提出功能需求,因为这会给东方STG带来新的可能性。比如,我们将引擎迁移到更加现代化的平台(Direct3D11、XAudio2等),提高了引擎对Windows 10/11系统的兼容性;我们开发了基本的模型渲染功能,而该功能已经被一些作品使用,关卡背景画面因此变得更加丰富。 25 | 26 | > 用开玩笑的方式来说,我们每次开发新功能都是被迫的——“屎都到屁眼了才知道急” 27 | 28 | ## 改进手册、API文档、翻译 29 | 30 | > 程序员最讨厌的是编写手册和API文档、他人的项目不提供手册和API文档 31 | 32 | 如果你发现手册和API文档有错、漏之处,欢迎向我们反馈。 33 | 34 | 当然,如果你非常熟悉 Git 和 GitHub 的使用,也可以发起 Pull Request。 35 | 36 | ## 提交代码 37 | 38 | > 程序员最讨厌的是阅读他人的代码 39 | 40 | 当你非常熟悉 Git 和 GitHub 的使用,且一些功能改进和缺陷已经自行开发、修复完成时,可以考虑发起 Pull Request。 41 | 42 | 发起 Pull Request 时,需要注意: 43 | 44 | * 及时合并主分支最新提交 45 | * 及时处理合并冲突 46 | * 存在破坏兼容性的修改时,可能不会合并到主分支,而是合并到单独的特性分支 47 | * 修改内容过多时,审阅代码可能需要花费很长的时间 48 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | Copyright © 2020-2025 璀境石 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /LuaSTG/Configurer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_executable(Setting WIN32) 3 | luastg_target_common_options(Setting) 4 | luastg_target_more_warning(Setting) 5 | target_precompile_headers(Setting PRIVATE 6 | SharedHeaders.h 7 | ) 8 | target_include_directories(Setting PRIVATE 9 | . 10 | ) 11 | target_sources(Setting PRIVATE 12 | SharedHeaders.h 13 | Main.cpp 14 | Configurer.manifest 15 | ) 16 | target_link_libraries(Setting PRIVATE 17 | d3d11.lib 18 | dxgi.lib 19 | spdlog 20 | utf8 21 | beautiful_win32_api 22 | imgui 23 | imgui_impl_win32 24 | imgui_impl_dx11 25 | nlohmann_json 26 | PlatformAPI 27 | ) 28 | 29 | set(LUASTG_SETTING_BUILD_OUTPUT_DIR ${CMAKE_BINARY_DIR}/bin) 30 | add_custom_command(TARGET Setting POST_BUILD 31 | # output dir 32 | 33 | COMMAND ${CMAKE_COMMAND} -E make_directory ${LUASTG_SETTING_BUILD_OUTPUT_DIR} 34 | 35 | # luastg configuer 36 | 37 | COMMAND ${CMAKE_COMMAND} -E rm -f ${LUASTG_SETTING_BUILD_OUTPUT_DIR}/$ 38 | COMMAND ${CMAKE_COMMAND} -E copy "$/$" ${LUASTG_SETTING_BUILD_OUTPUT_DIR} 39 | ) 40 | -------------------------------------------------------------------------------- /LuaSTG/Configurer/SharedHeaders.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef _WIN32_WINNT 4 | #undef _WIN32_WINNT 5 | #endif 6 | #ifdef NTDDI_VERSION 7 | #undef NTDDI_VERSION 8 | #endif 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include "spdlog/spdlog.h" 21 | #include "nlohmann/json.hpp" 22 | 23 | #define NOMINMAX 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "utf8.hpp" 31 | -------------------------------------------------------------------------------- /LuaSTG/Core/Audio/Decoder.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Core/Type.hpp" 3 | #include "core/ReferenceCounted.hpp" 4 | 5 | namespace core::Audio 6 | { 7 | struct IDecoder : public IReferenceCounted 8 | { 9 | virtual uint16_t getSampleSize() = 0; // 1byte(8bit) 2bytes(16bits) 3byte(24bits) 4byte(32bits) 10 | virtual uint16_t getChannelCount() = 0; // 1channels 2channels 11 | virtual uint16_t getFrameSize() = 0; // = getChannelCount() * getSampleSize() 12 | virtual uint32_t getSampleRate() = 0; // 22050Hz 44100Hz 48000Hz 13 | virtual uint32_t getByteRate() = 0; // = getSampleRate() * getFrameSize() 14 | virtual uint32_t getFrameCount() = 0; // how many pcm frames? 15 | 16 | virtual bool seek(uint32_t pcm_frame) = 0; 17 | virtual bool seekByTime(double sec) = 0; 18 | virtual bool tell(uint32_t* pcm_frame) = 0; 19 | virtual bool tellAsTime(double* sec) = 0; 20 | virtual bool read(uint32_t pcm_frame, void* buffer, uint32_t* read_pcm_frame) = 0; // s16 21 | 22 | static bool create(StringView path, IDecoder** pp_decoder); 23 | }; 24 | } 25 | 26 | namespace core { 27 | // UUID v5 28 | // ns:URL 29 | // https://www.luastg-sub.com/core.IDecoder 30 | template<> constexpr InterfaceId getInterfaceId() { return UUID::parse("d4b8ac05-c486-5795-a545-dbe6b65b3828"); } 31 | } 32 | -------------------------------------------------------------------------------- /LuaSTG/Core/Audio/Decoder_ALL.cpp: -------------------------------------------------------------------------------- 1 | #include "Core/Audio/Decoder.hpp" 2 | #include "Core/Audio/Decoder_WAV.hpp" 3 | #include "Core/Audio/Decoder_VorbisOGG.hpp" 4 | #include "Core/Audio/Decoder_FLAC.hpp" 5 | 6 | namespace core::Audio 7 | { 8 | bool IDecoder::create(StringView path, IDecoder** pp_decoder) 9 | { 10 | SmartReference p_decoder; 11 | 12 | try 13 | { 14 | p_decoder = new Decoder_WAV(path); 15 | *pp_decoder = p_decoder.get(); 16 | return true; 17 | } 18 | catch (std::exception const& e) 19 | { 20 | spdlog::error("[core] WAV: {}", e.what()); 21 | } 22 | 23 | try 24 | { 25 | p_decoder = new Decoder_VorbisOGG(path); 26 | *pp_decoder = p_decoder.get(); 27 | return true; 28 | } 29 | catch (std::exception const& e) 30 | { 31 | spdlog::error("[core] OGG: {}", e.what()); 32 | } 33 | 34 | try 35 | { 36 | p_decoder = new Decoder_FLAC(path); 37 | *pp_decoder = p_decoder.get(); 38 | return true; 39 | } 40 | catch (std::exception const& e) 41 | { 42 | spdlog::error("[core] FLAC: {}", e.what()); 43 | } 44 | 45 | *pp_decoder = nullptr; 46 | return false; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /LuaSTG/Core/Audio/Decoder_WAV.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "core/implement/ReferenceCounted.hpp" 3 | #include "Core/Audio/Decoder.hpp" 4 | #include "core/Data.hpp" 5 | 6 | #include "dr_wav.h" 7 | 8 | namespace core::Audio 9 | { 10 | class Decoder_WAV : public implement::ReferenceCounted 11 | { 12 | private: 13 | SmartReference m_data; 14 | drwav m_wav; 15 | bool m_init; 16 | 17 | private: 18 | void destroyResources(); 19 | 20 | public: 21 | uint16_t getSampleSize() { return 2; } // 固定为 16bits 22 | uint16_t getChannelCount() { return m_wav.channels; } 23 | uint16_t getFrameSize() { return getChannelCount() * getSampleSize(); } 24 | uint32_t getSampleRate() { return m_wav.sampleRate; } 25 | uint32_t getByteRate() { return getSampleRate() * (uint32_t)getFrameSize(); } 26 | uint32_t getFrameCount(); // TODO: uint32 在 44800Hz 的采样率下,只能表示 24 小时,但是一般也不会有人弄这么鬼长的音频文件吧…… 27 | 28 | bool seek(uint32_t pcm_frame); 29 | bool seekByTime(double sec); 30 | bool tell(uint32_t* pcm_frame); 31 | bool tellAsTime(double* sec); 32 | bool read(uint32_t pcm_frame, void* buffer, uint32_t* read_pcm_frame); 33 | 34 | public: 35 | Decoder_WAV(StringView path); 36 | ~Decoder_WAV(); 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /LuaSTG/Core/Graphics/Direct3D11/Buffer.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "core/implement/ReferenceCounted.hpp" 3 | #include "Core/Graphics/Device.hpp" 4 | 5 | // Buffer 6 | namespace core::Graphics::Direct3D11 { 7 | class Device; 8 | 9 | class Buffer final 10 | : public implement::ReferenceCounted 11 | , public IDeviceEventListener { 12 | public: 13 | // IDeviceEventListener 14 | 15 | void onDeviceCreate() override; 16 | void onDeviceDestroy() override; 17 | 18 | // IBuffer 19 | 20 | bool map(uint32_t size_in_bytes, bool discard, void** out_pointer) override; 21 | bool unmap() override; 22 | 23 | // Buffer 24 | 25 | Buffer(); 26 | Buffer(Buffer const&) = delete; 27 | Buffer(Buffer&&) = delete; 28 | Buffer& operator=(Buffer const&) = delete; 29 | Buffer& operator=(Buffer&&) = delete; 30 | ~Buffer(); 31 | 32 | [[nodiscard]] ID3D11Buffer* getNativeBuffer() const noexcept { return m_buffer.get(); } 33 | 34 | static constexpr uint8_t type_vertex_buffer{ 1 }; 35 | static constexpr uint8_t type_index_buffer{ 2 }; 36 | static constexpr uint8_t type_constant_buffer{ 3 }; 37 | 38 | bool initialize(Device* device, uint8_t type, uint32_t size_in_bytes); 39 | bool createResources(); 40 | 41 | private: 42 | SmartReference m_device; 43 | wil::com_ptr_nothrow m_buffer; 44 | uint32_t m_size_in_bytes{}; 45 | uint8_t m_type{}; 46 | bool m_initialized{ false }; 47 | }; 48 | } 49 | -------------------------------------------------------------------------------- /LuaSTG/Core/Graphics/Direct3D11/Constants.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace core::Graphics::Direct3D11 { 4 | class Constants { 5 | public: 6 | static constexpr uint32_t vertex_shader_stage_constant_buffer_slot_view_projection_matrix = 0; 7 | static constexpr uint32_t vertex_shader_stage_constant_buffer_slot_world_matrix = 1; 8 | 9 | static_assert(vertex_shader_stage_constant_buffer_slot_view_projection_matrix < D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT); 10 | static_assert(vertex_shader_stage_constant_buffer_slot_world_matrix < D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT); 11 | 12 | static constexpr uint32_t pixel_shader_stage_constant_buffer_slot_user_data = 0; // TODO: native! too young too simple! 13 | static constexpr uint32_t pixel_shader_stage_constant_buffer_slot_camera_position = 0; 14 | static constexpr uint32_t pixel_shader_stage_constant_buffer_slot_fog_parameter = 1; 15 | 16 | static_assert(pixel_shader_stage_constant_buffer_slot_user_data < D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT); 17 | static_assert(pixel_shader_stage_constant_buffer_slot_camera_position < D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT); 18 | static_assert(pixel_shader_stage_constant_buffer_slot_fog_parameter < D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT); 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /LuaSTG/Core/Graphics/Direct3D11/SamplerState.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "core/implement/ReferenceCounted.hpp" 3 | #include "Core/Graphics/Device.hpp" 4 | 5 | // SamplerState 6 | namespace core::Graphics::Direct3D11 { 7 | class Device; 8 | 9 | class SamplerState final 10 | : public implement::ReferenceCounted 11 | , public IDeviceEventListener { 12 | 13 | public: 14 | // IDeviceEventListener 15 | 16 | void onDeviceCreate() override; 17 | void onDeviceDestroy() override; 18 | 19 | // ISamplerState 20 | 21 | // SamplerState 22 | 23 | SamplerState(); 24 | SamplerState(SamplerState const&) = delete; 25 | SamplerState(SamplerState&&) = delete; 26 | SamplerState& operator=(SamplerState const&) = delete; 27 | SamplerState& operator=(SamplerState&&) = delete; 28 | ~SamplerState(); 29 | 30 | [[nodiscard]] ID3D11SamplerState* GetState() const noexcept { return m_sampler.Get(); } 31 | 32 | bool initialize(Device* device, core::Graphics::SamplerState const& info); 33 | bool createResource(); 34 | 35 | private: 36 | SmartReference m_device; 37 | Microsoft::WRL::ComPtr m_sampler; 38 | core::Graphics::SamplerState m_info{}; 39 | bool m_initialized{ false }; 40 | }; 41 | } -------------------------------------------------------------------------------- /LuaSTG/Core/Graphics/Format.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Core/Type.hpp" 3 | 4 | namespace core::Graphics 5 | { 6 | enum class Format : uint32_t 7 | { 8 | Unknown, 9 | R8G8B8A8_UNORM, 10 | B8G8R8A8_UNORM, 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /LuaSTG/Core/framework.cpp: -------------------------------------------------------------------------------- 1 | #include "Core/framework.hpp" 2 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/AppFrameRender.cpp: -------------------------------------------------------------------------------- 1 | #include "AppFrame.h" 2 | #include "GameResource/LegacyBlendStateHelper.hpp" 3 | 4 | namespace luastg { 5 | void AppFrame::updateGraph2DBlendMode(BlendMode const blend) { 6 | auto const [v, b] = translateLegacyBlendState(blend); 7 | auto const renderer = m_pAppModel->getRenderer(); 8 | renderer->setVertexColorBlendState(v); 9 | renderer->setBlendState(b); 10 | } 11 | 12 | bool AppFrame::Render(IParticlePool* p, float hscale, float vscale) noexcept { 13 | assert(p); 14 | 15 | // 设置混合 16 | updateGraph2DBlendMode(p->GetBlendMode()); 17 | 18 | // 渲染 19 | p->Render(hscale, vscale); 20 | return true; 21 | } 22 | 23 | void AppFrame::SnapShot(const char* path) noexcept { 24 | if (!GetAppModel()->getSwapChain()->saveSnapshotToFile(path)) { 25 | spdlog::error("[luastg] SnapShot: 保存截图到文件'{}'失败", path); 26 | return; 27 | } 28 | } 29 | void AppFrame::SaveTexture(const char* tex_name, const char* path) noexcept { 30 | core::SmartReference resTex = LRES.FindTexture(tex_name); 31 | if (!resTex) { 32 | spdlog::error("[luastg] SaveTexture: 找不到纹理资源'{}'", tex_name); 33 | return; 34 | } 35 | if (!resTex->GetTexture()->saveToFile(path)) { 36 | spdlog::error("[luastg] SaveTexture: 保存纹理'{}'到文件'{}'失败", tex_name, path); 37 | return; 38 | } 39 | } 40 | }; 41 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/Custom/Config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // ---------- ---------- framework ---------- ---------- // 4 | 5 | #define LUASTG_CONFIGURATION_FILE "config.json" 6 | 7 | #define LUASTG_LOG_FILE "engine.log" 8 | 9 | #define LUASTG_LAUNCH_SCRIPT "launch" 10 | 11 | #define USING_LAUNCH_FILE 12 | 13 | //#define USING_ENCRYPTION 14 | 15 | #define USING_DEAR_IMGUI 16 | 17 | #define USING_CONSOLE_OUTPUT 18 | 19 | // ---------- ---------- game play ---------- ---------- // 20 | 21 | // Sakuya: THE WORLD! 22 | #define LUASTG_ENABLE_THE_WORLD 23 | 24 | // !!!deprecated 25 | // lstg.GameObject.pause 26 | //#define LUASTG_ENABLE_GAME_OBJECT_PROPERTY_PAUSE 27 | 28 | // add gravity (self.ag), speed limit (self.maxv, self.maxvx, self.maxvy) 29 | #define USER_SYSTEM_OPERATION 30 | 31 | // !!!deprecated 32 | // BAKACHU 33 | #define GLOBAL_SCALE_COLLI_SHAPE 34 | 35 | // !!!deprecated 36 | // defective design (by BAKAESC) 37 | //#define USING_MULTI_GAME_WORLD 38 | 39 | // lstg.GameObject.ps 40 | // access lstg.GameObject particle system via lstg.ParticleSystem instance 41 | #define LUASTG_GAME_OBJECT_PARTICLE_SYSTEM_OBJECT 42 | 43 | // ---------- ---------- steam api ---------- ---------- // 44 | 45 | #define STEAM_APP_ID 0 46 | 47 | //#define USING_STEAM_API 48 | 49 | //#define KEEP_LAUNCH_BY_STEAM 50 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/Custom/Custom.cmake: -------------------------------------------------------------------------------- 1 | 2 | target_include_directories(LuaSTG PRIVATE 3 | ${CMAKE_CURRENT_LIST_DIR} 4 | ) 5 | set(_LuaSTG_res 6 | ${CMAKE_CURRENT_LIST_DIR}/AppFrameLuaEx.cpp 7 | ${CMAKE_CURRENT_LIST_DIR}/Config.h 8 | ${CMAKE_CURRENT_LIST_DIR}/ResourcePassword.cpp 9 | ${CMAKE_CURRENT_LIST_DIR}/app.ico 10 | ${CMAKE_CURRENT_LIST_DIR}/resource.h 11 | ${CMAKE_CURRENT_LIST_DIR}/resource.rc 12 | ) 13 | source_group(TREE ${CMAKE_CURRENT_LIST_DIR} PREFIX LuaSTG/Custom FILES ${_LuaSTG_res}) 14 | target_sources(LuaSTG PRIVATE 15 | ${_LuaSTG_res} 16 | ) 17 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/Custom/ResourcePassword.cpp: -------------------------------------------------------------------------------- 1 | #include "GameResource/ResourcePassword.hpp" 2 | 3 | std::string luastg::GetGameName() 4 | { 5 | return "password"; 6 | } 7 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/Custom/app.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/LuaSTG/LuaSTG/Custom/app.ico -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/Custom/resource.aps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/LuaSTG/LuaSTG/Custom/resource.aps -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/Custom/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | 3 | // resource.rc 4 | // 5 | #define IDI_APPICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 103 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 102 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/Debugger/ImGuiExtension.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace imgui 4 | { 5 | void loadConfig(); 6 | void saveConfig(); 7 | 8 | void bindEngine(); 9 | void unbindEngine(); 10 | 11 | void cacheGlyphFromString(std::string_view str); 12 | void cancelSetCursor(); 13 | void updateEngine(bool allow_set_cursor); 14 | void drawEngine(); 15 | 16 | void showTestInputWindow(bool* p_open = nullptr); 17 | }; 18 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/Debugger/Logger.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace luastg { 4 | class Logger { 5 | public: 6 | static void create(); 7 | static void destroy(); 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/GameResource/Implement/ResourceBaseImpl.cpp: -------------------------------------------------------------------------------- 1 | #include "GameResource/Implement/ResourceBaseImpl.hpp" 2 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/GameResource/Implement/ResourceBaseImpl.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "GameResource/ResourceBase.hpp" 3 | #include "core/implement/ReferenceCounted.hpp" 4 | 5 | namespace luastg 6 | { 7 | template 8 | class ResourceBaseImpl : public core::implement::ReferenceCounted 9 | { 10 | private: 11 | ResourceType m_resource_type; 12 | std::string m_resource_name; 13 | public: 14 | ResourceType GetType() const noexcept { return m_resource_type; } 15 | std::string_view GetResName() const noexcept { return m_resource_name; } 16 | public: 17 | ResourceBaseImpl(ResourceType t, std::string_view name) : m_resource_type(t), m_resource_name(name) {} 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/GameResource/Implement/ResourceFontImpl.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "GameResource/ResourceFont.hpp" 3 | #include "GameResource/Implement/ResourceBaseImpl.hpp" 4 | 5 | namespace luastg 6 | { 7 | class ResourceFontImpl : public ResourceBaseImpl 8 | { 9 | private: 10 | core::SmartReference m_glyphmgr; 11 | core::Color4B m_BlendColor; 12 | BlendMode m_BlendMode; 13 | 14 | public: 15 | core::Graphics::IGlyphManager* GetGlyphManager() { return m_glyphmgr.get(); } 16 | BlendMode GetBlendMode() { return m_BlendMode; } 17 | void SetBlendMode(BlendMode m) { m_BlendMode = m; } 18 | core::Color4B GetBlendColor() { return m_BlendColor; } 19 | void SetBlendColor(core::Color4B c) { m_BlendColor = c; } 20 | 21 | public: 22 | ResourceFontImpl(const char* name, std::string_view hge_path, bool mipmap); 23 | ResourceFontImpl(const char* name, std::string_view f2d_path, std::string_view tex_path, bool mipmap); 24 | ResourceFontImpl(const char* name, core::Graphics::IGlyphManager* p_mgr); 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/GameResource/Implement/ResourceModelImpl.cpp: -------------------------------------------------------------------------------- 1 | #include "GameResource/Implement/ResourceModelImpl.hpp" 2 | #include "AppFrame.h" 3 | 4 | namespace luastg 5 | { 6 | ResourceModelImpl::ResourceModelImpl(const char* name, const char* path) 7 | : ResourceBaseImpl(ResourceType::Model, name) 8 | { 9 | if (!LAPP.GetAppModel()->getRenderer()->createModel(path, model_.put())) 10 | throw std::runtime_error("ResourceModelImpl::ResourceModelImpl"); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/GameResource/Implement/ResourceModelImpl.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "GameResource/ResourceModel.hpp" 3 | #include "GameResource/Implement/ResourceBaseImpl.hpp" 4 | 5 | namespace luastg 6 | { 7 | class ResourceModelImpl : public ResourceBaseImpl 8 | { 9 | private: 10 | core::SmartReference model_; 11 | public: 12 | core::Graphics::IModel* GetModel() { return *model_; } 13 | public: 14 | ResourceModelImpl(const char* name, const char* path); 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/GameResource/Implement/ResourcePostEffectShaderImpl.cpp: -------------------------------------------------------------------------------- 1 | #include "GameResource/Implement/ResourcePostEffectShaderImpl.hpp" 2 | #include "AppFrame.h" 3 | 4 | namespace luastg 5 | { 6 | ResourcePostEffectShaderImpl::ResourcePostEffectShaderImpl(const char* name, const char* path) 7 | : ResourceBaseImpl(ResourceType::FX, name) 8 | { 9 | LAPP.GetAppModel()->getRenderer()->createPostEffectShader(path, m_shader.put()); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/GameResource/Implement/ResourcePostEffectShaderImpl.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "GameResource/ResourcePostEffectShader.hpp" 3 | #include "GameResource/Implement/ResourceBaseImpl.hpp" 4 | 5 | namespace luastg 6 | { 7 | class ResourcePostEffectShaderImpl : public ResourceBaseImpl 8 | { 9 | private: 10 | core::SmartReference m_shader; 11 | public: 12 | core::Graphics::IPostEffectShader* GetPostEffectShader() noexcept { return *m_shader; } 13 | public: 14 | ResourcePostEffectShaderImpl(const char* name, const char* path); 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/GameResource/Implement/ResourceSoundEffectImpl.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "GameResource/ResourceSoundEffect.hpp" 3 | #include "GameResource/Implement/ResourceBaseImpl.hpp" 4 | #include "Core/Audio/Device.hpp" 5 | 6 | namespace luastg 7 | { 8 | class ResourceSoundEffectImpl : public ResourceBaseImpl 9 | { 10 | private: 11 | enum class CommandType : uint32_t 12 | { 13 | None, 14 | Play, 15 | Stop, 16 | Reset, 17 | ResetAndStop, 18 | }; 19 | struct Command 20 | { 21 | CommandType type = CommandType::None; 22 | float vol = 0.0f; 23 | float pan = 0.0f; 24 | }; 25 | private: 26 | core::SmartReference m_player; 27 | int m_status = 0; // 0停止 1暂停 2播放 28 | Command m_last_command; 29 | public: 30 | void FlushCommand(); 31 | void Play(float vol, float pan); 32 | void Resume(); 33 | void Pause(); 34 | void Stop(); 35 | bool IsPlaying(); 36 | bool IsStopped(); 37 | bool SetSpeed(float speed); 38 | float GetSpeed(); 39 | 40 | public: 41 | ResourceSoundEffectImpl(const char* name, core::Audio::IAudioPlayer* p_player); 42 | }; 43 | } 44 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/GameResource/Implement/ResourceSpriteImpl.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "GameResource/ResourceSprite.hpp" 3 | #include "GameResource/Implement/ResourceBaseImpl.hpp" 4 | 5 | namespace luastg 6 | { 7 | class ResourceSpriteImpl : public ResourceBaseImpl 8 | { 9 | private: 10 | core::SmartReference m_sprite; 11 | BlendMode m_BlendMode = BlendMode::MulAlpha; 12 | double m_HalfSizeX = 0.0; 13 | double m_HalfSizeY = 0.0; 14 | bool m_bRectangle = false; 15 | public: 16 | core::Graphics::ISprite* GetSprite() { return m_sprite.get(); } 17 | BlendMode GetBlendMode() { return m_BlendMode; } 18 | void SetBlendMode(BlendMode m) { m_BlendMode = m; } 19 | double GetHalfSizeX() { return m_HalfSizeX; } 20 | double GetHalfSizeY() { return m_HalfSizeY; } 21 | bool IsRectangle() { return m_bRectangle; } 22 | void RenderRect(float l, float r, float b, float t, float z); 23 | void Render(float x, float y, float rot, float hscale, float vscale, float z); 24 | void Render(float x, float y, float rot, float hscale, float vscale, BlendMode blend, core::Color4B color, float z); 25 | void Render4V(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4); 26 | public: 27 | ResourceSpriteImpl(const char* name, core::Graphics::ISprite* sprite, double hx, double hy, bool rect); 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/GameResource/Implement/ResourceTextureImpl.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "GameResource/ResourceTexture.hpp" 3 | #include "GameResource/Implement/ResourceBaseImpl.hpp" 4 | 5 | namespace luastg 6 | { 7 | class ResourceTextureImpl : public ResourceBaseImpl 8 | { 9 | private: 10 | core::SmartReference m_texture; 11 | core::SmartReference m_rt; 12 | core::SmartReference m_ds; 13 | bool m_is_rendertarget{ false }; 14 | bool m_is_auto_resize{ false }; 15 | bool m_enable_depthbuffer{ false }; 16 | public: 17 | bool ResizeRenderTarget(core::Vector2U size); 18 | public: 19 | core::Graphics::ITexture2D* GetTexture() { return m_texture.get(); } 20 | core::Graphics::IRenderTarget* GetRenderTarget() { return m_rt.get(); } 21 | core::Graphics::IDepthStencilBuffer* GetDepthStencilBuffer() { return m_ds.get(); } 22 | bool IsRenderTarget() { return m_is_rendertarget; } 23 | bool HasDepthStencilBuffer() { return m_enable_depthbuffer; } 24 | public: 25 | // 纹理容器 26 | ResourceTextureImpl(const char* name, core::Graphics::ITexture2D* p_texture); 27 | // 渲染附件容器 28 | ResourceTextureImpl(const char* name, int w, int h, bool ds); 29 | // 自动调整大小的渲染附件容器 30 | ResourceTextureImpl(const char* name, bool ds); 31 | ~ResourceTextureImpl(); 32 | }; 33 | } 34 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/GameResource/LegacyBlendStateHelper.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Core/Graphics/Renderer.hpp" 3 | #include "GameResource/ResourceBase.hpp" 4 | 5 | namespace luastg { 6 | struct LegacyBlendStateData { 7 | core::Graphics::IRenderer::VertexColorBlendState vertex_color_blend_state{ core::Graphics::IRenderer::VertexColorBlendState::Mul }; 8 | core::Graphics::IRenderer::BlendState blend_state{ core::Graphics::IRenderer::BlendState::Alpha }; 9 | }; 10 | 11 | inline LegacyBlendStateData translateLegacyBlendState(BlendMode const legacy_blend_state) { 12 | LegacyBlendStateData data; 13 | #define CASE(A, B, C) case BlendMode::##A: data.vertex_color_blend_state = core::Graphics::IRenderer::VertexColorBlendState::##B; data.blend_state = core::Graphics::IRenderer::BlendState::##C; break 14 | switch (legacy_blend_state) { // NOLINT(clang-diagnostic-switch-enum) 15 | default: 16 | CASE(MulAlpha, Mul, Alpha); 17 | CASE(MulAdd, Mul, Add); 18 | CASE(MulRev, Mul, RevSub); 19 | CASE(MulSub, Mul, Sub); 20 | CASE(AddAlpha, Add, Alpha); 21 | CASE(AddAdd, Add, Add); 22 | CASE(AddRev, Add, RevSub); 23 | CASE(AddSub, Add, Sub); 24 | CASE(AlphaBal, Mul, Inv); 25 | CASE(MulMin, Mul, Min); 26 | CASE(MulMax, Mul, Max); 27 | CASE(MulMutiply, Mul, Mul); 28 | CASE(MulScreen, Mul, Screen); 29 | CASE(AddMin, Add, Min); 30 | CASE(AddMax, Add, Max); 31 | CASE(AddMutiply, Add, Mul); 32 | CASE(AddScreen, Add, Screen); 33 | CASE(One, Mul, One); 34 | } 35 | #undef CASE 36 | return data; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/GameResource/ResourceFont.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "GameResource/ResourceBase.hpp" 3 | #include "Core/Graphics/Font.hpp" 4 | 5 | namespace luastg 6 | { 7 | enum class FontAlignHorizontal // 水平对齐 8 | { 9 | Left, 10 | Center, 11 | Right 12 | }; 13 | 14 | enum class FontAlignVertical // 垂直对齐 15 | { 16 | Top, 17 | Middle, 18 | Bottom 19 | }; 20 | 21 | struct IResourceFont : IResourceBase 22 | { 23 | virtual core::Graphics::IGlyphManager* GetGlyphManager() = 0; 24 | virtual BlendMode GetBlendMode() = 0; 25 | virtual void SetBlendMode(BlendMode m) = 0; 26 | virtual core::Color4B GetBlendColor() = 0; 27 | virtual void SetBlendColor(core::Color4B c) = 0; 28 | }; 29 | } 30 | 31 | namespace core { 32 | // UUID v5 33 | // ns:URL 34 | // https://www.luastg-sub.com/luastg.IResourceFont 35 | template<> constexpr InterfaceId getInterfaceId() { return UUID::parse("73b6f11f-cd6c-523f-b534-e57f9ca54526"); } 36 | } 37 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/GameResource/ResourceModel.cpp: -------------------------------------------------------------------------------- 1 | #include "GameResource/ResourceModel.hpp" 2 | 3 | namespace luastg 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/GameResource/ResourceModel.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "GameResource/ResourceBase.hpp" 3 | #include "Core/Graphics/Renderer.hpp" 4 | 5 | namespace luastg 6 | { 7 | struct IResourceModel : public IResourceBase 8 | { 9 | virtual core::Graphics::IModel* GetModel() = 0; 10 | }; 11 | } 12 | 13 | namespace core { 14 | // UUID v5 15 | // ns:URL 16 | // https://www.luastg-sub.com/luastg.IResourceModel 17 | template<> constexpr InterfaceId getInterfaceId() { return UUID::parse("8010a289-8032-5fb3-8867-fb292dbb57df"); } 18 | } 19 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/GameResource/ResourcePassword.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace luastg 5 | { 6 | std::string GetGameName(); 7 | } 8 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/GameResource/ResourcePostEffectShader.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "GameResource/ResourceBase.hpp" 3 | #include "Core/Graphics/Renderer.hpp" 4 | 5 | namespace luastg 6 | { 7 | struct IResourcePostEffectShader : public IResourceBase 8 | { 9 | virtual core::Graphics::IPostEffectShader* GetPostEffectShader() = 0; 10 | }; 11 | } 12 | 13 | namespace core { 14 | // UUID v5 15 | // ns:URL 16 | // https://www.luastg-sub.com/luastg.IResourcePostEffectShader 17 | template<> constexpr InterfaceId getInterfaceId() { return UUID::parse("b8f16675-08d6-50f3-9049-a1f90277a86a"); } 18 | } 19 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/GameResource/ResourceSoundEffect.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "GameResource/ResourceBase.hpp" 3 | 4 | namespace luastg 5 | { 6 | struct IResourceSoundEffect : public IResourceBase 7 | { 8 | virtual void FlushCommand() = 0; 9 | virtual void Play(float vol, float pan) = 0; 10 | virtual void Resume() = 0; 11 | virtual void Pause() = 0; 12 | virtual void Stop() = 0; 13 | virtual bool IsPlaying() = 0; 14 | virtual bool IsStopped() = 0; 15 | virtual bool SetSpeed(float speed) = 0; 16 | virtual float GetSpeed() = 0; 17 | }; 18 | } 19 | 20 | namespace core { 21 | // UUID v5 22 | // ns:URL 23 | // https://www.luastg-sub.com/luastg.IResourceSoundEffect 24 | template<> constexpr InterfaceId getInterfaceId() { return UUID::parse("300c1295-98f3-5f6d-b285-d0be8d5ae3a2"); } 25 | } 26 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/GameResource/ResourceSprite.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "GameResource/ResourceBase.hpp" 3 | #include "Core/Graphics/Sprite.hpp" 4 | 5 | namespace luastg 6 | { 7 | struct IResourceSprite : public IResourceBase 8 | { 9 | virtual core::Graphics::ISprite* GetSprite() = 0; 10 | virtual BlendMode GetBlendMode() = 0; 11 | virtual void SetBlendMode(BlendMode m) = 0; 12 | virtual double GetHalfSizeX() = 0; 13 | virtual double GetHalfSizeY() = 0; 14 | virtual bool IsRectangle() = 0; 15 | virtual void RenderRect(float l, float r, float b, float t, float z = 0.5f) = 0; 16 | virtual void Render(float x, float y, float rot, float hscale, float vscale, float z = 0.5f) = 0; 17 | virtual void Render(float x, float y, float rot, float hscale, float vscale, BlendMode blend, core::Color4B color, float z = 0.5f) = 0; 18 | virtual void Render4V(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4) = 0; 19 | }; 20 | } 21 | 22 | namespace core { 23 | // UUID v5 24 | // ns:URL 25 | // https://www.luastg-sub.com/luastg.IResourceSprite 26 | template<> constexpr InterfaceId getInterfaceId() { return UUID::parse("83410d3d-4a9f-509b-b562-ab4d8f0190d9"); } 27 | } 28 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/GameResource/ResourceTexture.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "GameResource/ResourceBase.hpp" 3 | #include "Core/Graphics/Device.hpp" 4 | 5 | namespace luastg 6 | { 7 | struct IResourceTexture : public IResourceBase 8 | { 9 | virtual bool ResizeRenderTarget(core::Vector2U size) = 0; 10 | 11 | virtual core::Graphics::ITexture2D* GetTexture() = 0; 12 | virtual core::Graphics::IRenderTarget* GetRenderTarget() = 0; 13 | virtual core::Graphics::IDepthStencilBuffer* GetDepthStencilBuffer() = 0; 14 | virtual bool IsRenderTarget() = 0; 15 | virtual bool HasDepthStencilBuffer() = 0; 16 | }; 17 | }; 18 | 19 | namespace core { 20 | // UUID v5 21 | // ns:URL 22 | // https://www.luastg-sub.com/luastg.IResourceTexture 23 | template<> constexpr InterfaceId getInterfaceId() { return UUID::parse("33f4401f-8c9e-59b0-b9e5-98e4bd60b662"); } 24 | } 25 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define LUASTG_NAME "LuaSTG" 4 | #define LUASTG_BRANCH "Sub" 5 | #define LUASTG_VERSION_NAME "v0.21.105" 6 | #define LUASTG_VERSION_MAJOR 0 7 | #define LUASTG_VERSION_MINOR 21 8 | #define LUASTG_VERSION_PATCH 105 9 | 10 | #define LUASTG_INFO LUASTG_NAME " " LUASTG_BRANCH " " LUASTG_VERSION_NAME 11 | 12 | // WARNING: see write-version.lua 13 | 14 | //#define LuaSTG_enable_GameObjectManager_Debug 1 15 | 16 | //#define LDEVVERSION 1 17 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LMathConstant.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // 数学常量 pi 4 | constexpr double L_PI = 3.1415926535897932384626433832795; 5 | constexpr float L_PI_F = 3.1415926535897932384626433832795f; 6 | // pi 的一半 7 | constexpr double L_PI_HALF = L_PI * 0.5; 8 | constexpr float L_PI_HALF_F = L_PI_F * 0.5f; 9 | // pi 的两倍 tau 10 | constexpr double L_TAU = L_PI * 2.0; 11 | constexpr float L_TAU_F = L_PI_F * 2.0f; 12 | 13 | // 弧度到角度 14 | constexpr double L_RAD_TO_DEG = 180.0 / L_PI; 15 | constexpr float L_RAD_TO_DEG_F = 180.0f / L_PI_F; 16 | // 角度到弧度 17 | constexpr double L_DEG_TO_RAD = L_PI / 180.0; 18 | constexpr float L_DEG_TO_RAD_F = L_PI_F / 180.0f; 19 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/LuaAppFrame.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace luastg 4 | { 5 | namespace LuaEngine 6 | { 7 | constexpr auto G_CALLBACK_EngineInit = "GameInit"; 8 | constexpr auto G_CALLBACK_EngineStop = "GameExit"; 9 | constexpr auto G_CALLBACK_EngineUpdate = "FrameFunc"; 10 | constexpr auto G_CALLBACK_EngineDraw = "RenderFunc"; 11 | constexpr auto G_CALLBACK_EngineEvent = "EventFunc"; 12 | constexpr auto G_CALLBACK_FocusLoseFunc = "FocusLoseFunc"; 13 | constexpr auto G_CALLBACK_FocusGainFunc = "FocusGainFunc"; 14 | 15 | enum class EngineEvent 16 | { 17 | Idle, 18 | WindowActive, // handle(event:number, active:boolean) 19 | WindowResize, // handle(event:number, width:number, height:number) 20 | }; 21 | }; 22 | }; 23 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/LuaCustomLoader.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.hpp" 3 | 4 | namespace luastg 5 | { 6 | void lua_register_custom_loader(lua_State* L); 7 | }; 8 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/PostEffectShader.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Core/Graphics/Renderer.hpp" 3 | #include "lua.hpp" 4 | 5 | namespace luastg::binding 6 | { 7 | class PostEffectShader 8 | { 9 | public: 10 | static void Register(lua_State* L); 11 | static void Create(lua_State* L, core::Graphics::IPostEffectShader* p_shader); 12 | static core::Graphics::IPostEffectShader* Cast(lua_State* L, int idx); 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/Resource.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.hpp" 3 | 4 | int luaopen_LuaSTG_Sub(lua_State* L); 5 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/external/lua_dwrite.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.hpp" 3 | 4 | int luaopen_dwrite(lua_State* L); 5 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/external/lua_random.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.hpp" 3 | 4 | int luaopen_random(lua_State* L); 5 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/external/lua_xinput.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.hpp" 3 | 4 | int luaopen_xinput(lua_State* L); 5 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/generated/BlendModeX.hpp: -------------------------------------------------------------------------------- 1 | // This file was generated through a code generator, DO NOT edit it, please edit the code generator 2 | 3 | #ifndef _LuaSTG_BlendModeX_h_ 4 | #define _LuaSTG_BlendModeX_h_ 5 | 6 | namespace LuaSTG { 7 | 8 | enum class BlendModeX : int { 9 | __unknown__ = 0, 10 | MulAlpha = 1, 11 | MulAdd = 2, 12 | MulRev = 3, 13 | MulSub = 4, 14 | AddAlpha = 5, 15 | AddAdd = 6, 16 | AddRev = 7, 17 | AddSub = 8, 18 | AlphaBal = 9, 19 | MulMin = 10, 20 | MulMax = 11, 21 | MulMutiply = 12, 22 | MulScreen = 13, 23 | AddMin = 14, 24 | AddMax = 15, 25 | AddMutiply = 16, 26 | AddScreen = 17, 27 | One = 18, 28 | }; 29 | 30 | BlendModeX MapBlendModeX(char const* const key, size_t const len) noexcept; 31 | 32 | } 33 | 34 | #endif // _LuaSTG_BlendModeX_h_ 35 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/generated/ColorMember.hpp: -------------------------------------------------------------------------------- 1 | // This file was generated through a code generator, DO NOT edit it, please edit the code generator 2 | 3 | #ifndef _LuaSTG_ColorMember_h_ 4 | #define _LuaSTG_ColorMember_h_ 5 | 6 | namespace LuaSTG { 7 | 8 | enum class ColorMember : int { 9 | __unknown__ = -1, 10 | m_a = 2, 11 | m_r = 7, 12 | m_g = 5, 13 | m_b = 4, 14 | m_argb = 3, 15 | f_ARGB = 1, 16 | m_h = 6, 17 | m_s = 8, 18 | m_v = 9, 19 | f_AHSV = 0, 20 | }; 21 | 22 | ColorMember MapColorMember(char const* const key, size_t const len) noexcept; 23 | 24 | } 25 | 26 | #endif // _LuaSTG_ColorMember_h_ 27 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/generated/GameObjectMember.hpp: -------------------------------------------------------------------------------- 1 | // This file was generated through a code generator, DO NOT edit it, please edit the code generator 2 | 3 | #ifndef _LuaSTG_GameObjectMember_h_ 4 | #define _LuaSTG_GameObjectMember_h_ 5 | 6 | namespace LuaSTG { 7 | 8 | enum class GameObjectMember : int { 9 | __unknown__ = -1, 10 | STATUS = 37, 11 | CLASS = 15, 12 | TIMER = 38, 13 | X = 43, 14 | Y = 44, 15 | ROT = 36, 16 | HSCALE = 22, 17 | VSCALE = 39, 18 | DX = 18, 19 | DY = 19, 20 | OMIGA = 31, 21 | OMEGA = 30, 22 | AX = 11, 23 | AY = 12, 24 | AG = 9, 25 | VX = 40, 26 | VY = 41, 27 | MAXV = 25, 28 | MAXVX = 26, 29 | MAXVY = 27, 30 | NAVI = 28, 31 | LAYER = 24, 32 | HIDE = 21, 33 | IMG = 23, 34 | RES_RC = 33, 35 | ANI = 10, 36 | _BLEND = 3, 37 | _COLOR = 4, 38 | _A = 0, 39 | _R = 6, 40 | _G = 5, 41 | _B = 2, 42 | BOUND = 14, 43 | GROUP = 20, 44 | COLLI = 16, 45 | A = 8, 46 | B = 13, 47 | RECT = 34, 48 | COLLIDER = 17, 49 | VANGLE = 1, 50 | VSPEED = 7, 51 | PAUSE = 32, 52 | IGNORESUPERPAUSE = 29, 53 | RESOLVEMOVE = 35, 54 | WORLD = 42, 55 | }; 56 | 57 | GameObjectMember MapGameObjectMember(char const* const key, size_t const len) noexcept; 58 | 59 | } 60 | 61 | #endif // _LuaSTG_GameObjectMember_h_ 62 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/generated/placeholder: -------------------------------------------------------------------------------- 1 | DO NOT DELETE -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/modern/Clipboard.cpp: -------------------------------------------------------------------------------- 1 | #include "Clipboard.hpp" 2 | #include "core/Clipboard.hpp" 3 | #include "lua/plus.hpp" 4 | 5 | namespace luastg::binding { 6 | 7 | std::string_view const Clipboard::class_name{ "lstg.Clipboard" }; 8 | 9 | struct ClipboardBinding : Clipboard { 10 | 11 | // static methods 12 | 13 | static int hasText(lua_State* vm) { 14 | lua::stack_t const ctx(vm); 15 | ctx.push_value(core::Clipboard::hasText()); 16 | return 1; 17 | } 18 | static int getText(lua_State* vm) { 19 | lua::stack_t const ctx(vm); 20 | std::string buffer; 21 | if (core::Clipboard::getText(buffer)) { 22 | ctx.push_value(buffer); 23 | ctx.push_value(std::nullopt); 24 | } 25 | else { 26 | ctx.push_value(std::nullopt); 27 | ctx.push_value(std::nullopt); 28 | } 29 | return 2; 30 | } 31 | static int setText(lua_State* vm) { 32 | lua::stack_t const ctx(vm); 33 | auto const text = ctx.get_value(1); 34 | ctx.push_value(core::Clipboard::setText(text)); 35 | return 1; 36 | } 37 | 38 | }; 39 | 40 | void Clipboard::registerClass(lua_State* vm) { 41 | [[maybe_unused]] lua::stack_balancer_t sb(vm); 42 | lua::stack_t ctx(vm); 43 | 44 | // method 45 | 46 | auto const method_table = ctx.create_module(class_name); 47 | ctx.set_map_value(method_table, "hasText", &ClipboardBinding::hasText); 48 | ctx.set_map_value(method_table, "getText", &ClipboardBinding::getText); 49 | ctx.set_map_value(method_table, "setText", &ClipboardBinding::setText); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/modern/Clipboard.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.hpp" 3 | 4 | namespace luastg::binding { 5 | 6 | struct Clipboard { 7 | 8 | static std::string_view const class_name; 9 | 10 | static void registerClass(lua_State* L); 11 | 12 | }; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/modern/Display.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "lua.hpp" 4 | #include "Core/Graphics/Window.hpp" 5 | 6 | namespace luastg::binding { 7 | 8 | struct Display { 9 | 10 | static std::string_view class_name; 11 | 12 | [[maybe_unused]] core::Graphics::IDisplay* data{}; 13 | 14 | static bool is(lua_State* L, int index); 15 | 16 | static Display* as(lua_State* L, int index); 17 | 18 | static Display* create(lua_State* L); 19 | 20 | static void registerClass(lua_State* L); 21 | 22 | }; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/modern/FileSystemWatcher.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "core/FileSystemWatcher.hpp" 3 | #include "lua.hpp" 4 | 5 | namespace luastg::binding { 6 | 7 | struct FileSystemWatcher { 8 | 9 | static std::string_view const class_name; 10 | 11 | [[maybe_unused]] core::IMessageQueueBasedFileSystemWatcher* object{}; 12 | 13 | static bool is(lua_State* vm, int index); 14 | 15 | static FileSystemWatcher* as(lua_State* vm, int index); 16 | 17 | static FileSystemWatcher* create(lua_State* vm); 18 | 19 | static void registerClass(lua_State* vm); 20 | 21 | }; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/modern/GameObject.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "GameObject/GameObject.hpp" 3 | #include "lua.hpp" 4 | 5 | namespace luastg::binding { 6 | 7 | struct GameObject { 8 | 9 | static std::string_view const class_name; 10 | 11 | static bool is(lua_State* vm, int index); 12 | 13 | static luastg::GameObject* as(lua_State* vm, int index); 14 | 15 | static int pushGameObjectTable(lua_State* vm); 16 | 17 | static void registerClass(lua_State* vm); 18 | 19 | }; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/modern/Mesh.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.hpp" 3 | #include "Core/Graphics/Mesh.hpp" 4 | 5 | namespace luastg::binding { 6 | struct Mesh { 7 | static std::string_view class_name; 8 | 9 | [[maybe_unused]] core::Graphics::IMesh* data{}; 10 | 11 | static bool is(lua_State* vm, int index); 12 | static Mesh* as(lua_State* vm, int index); 13 | static Mesh* create(lua_State* vm); 14 | static void registerClass(lua_State* vm); 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/modern/MeshRenderer.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.hpp" 3 | #include "Core/Graphics/Mesh.hpp" 4 | 5 | namespace luastg::binding { 6 | struct MeshRenderer { 7 | static std::string_view class_name; 8 | 9 | [[maybe_unused]] core::Graphics::IMeshRenderer* data{}; 10 | [[maybe_unused]] core::Vector3F position; 11 | [[maybe_unused]] core::Vector3F scale; 12 | [[maybe_unused]] core::Vector3F rotation_yaw_pitch_roll; 13 | 14 | static bool is(lua_State* vm, int index); 15 | static MeshRenderer* as(lua_State* vm, int index); 16 | static MeshRenderer* create(lua_State* vm); 17 | static void registerClass(lua_State* vm); 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/modern/Sprite.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.hpp" 3 | #include "Core/Graphics/Sprite.hpp" 4 | 5 | namespace luastg::binding { 6 | struct Sprite { 7 | static std::string_view const class_name; 8 | 9 | [[maybe_unused]] core::Graphics::ISprite* data{}; 10 | 11 | static bool is(lua_State* vm, int index); 12 | static Sprite* as(lua_State* vm, int index); 13 | static Sprite* create(lua_State* vm); 14 | static void registerClass(lua_State* vm); 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/modern/SpriteRenderer.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.hpp" 3 | #include "Core/Graphics/Sprite.hpp" 4 | 5 | namespace luastg::binding { 6 | struct SpriteRenderer { 7 | static std::string_view const class_name; 8 | 9 | core::Graphics::ISpriteRenderer* data{}; 10 | core::Vector2F position; 11 | core::Vector2F scale; 12 | float rotation{}; 13 | bool is_dirty{}; 14 | 15 | static bool is(lua_State* vm, int index); 16 | static SpriteRenderer* as(lua_State* vm, int index); 17 | static SpriteRenderer* create(lua_State* vm); 18 | static void registerClass(lua_State* vm); 19 | }; 20 | 21 | struct SpriteRectRenderer { 22 | static std::string_view const class_name; 23 | 24 | core::Graphics::ISpriteRenderer* data{}; 25 | 26 | static bool is(lua_State* vm, int index); 27 | static SpriteRectRenderer* as(lua_State* vm, int index); 28 | static SpriteRectRenderer* create(lua_State* vm); 29 | static void registerClass(lua_State* vm); 30 | }; 31 | 32 | struct SpriteQuadRenderer { 33 | static std::string_view const class_name; 34 | 35 | core::Graphics::ISpriteRenderer* data{}; 36 | 37 | static bool is(lua_State* vm, int index); 38 | static SpriteQuadRenderer* as(lua_State* vm, int index); 39 | static SpriteQuadRenderer* create(lua_State* vm); 40 | static void registerClass(lua_State* vm); 41 | }; 42 | } 43 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/modern/SwapChain.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "lua.hpp" 4 | #include "Core/Graphics/SwapChain.hpp" 5 | 6 | namespace luastg::binding { 7 | 8 | struct SwapChain { 9 | 10 | static std::string_view class_name; 11 | 12 | [[maybe_unused]] core::Graphics::ISwapChain* data{}; 13 | 14 | static bool is(lua_State* L, int index); 15 | 16 | static SwapChain* as(lua_State* L, int index); 17 | 18 | static SwapChain* create(lua_State* L); 19 | 20 | static void registerClass(lua_State* L); 21 | 22 | }; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/modern/Texture2D.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.hpp" 3 | #include "Core/Graphics/Device.hpp" 4 | 5 | namespace luastg::binding { 6 | struct Texture2D { 7 | static std::string_view class_name; 8 | 9 | [[maybe_unused]] core::Graphics::ITexture2D* data{}; 10 | 11 | static bool is(lua_State* vm, int index); 12 | static Texture2D* as(lua_State* vm, int index); 13 | static Texture2D* create(lua_State* vm); 14 | static void registerClass(lua_State* vm); 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/modern/Vector2.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.hpp" 3 | #include "Core/Type.hpp" 4 | 5 | namespace luastg::binding { 6 | struct Vector2 { 7 | static std::string_view class_name; 8 | 9 | core::Vector2 data; 10 | 11 | static bool is(lua_State* vm, int index); 12 | static Vector2* as(lua_State* vm, int index); 13 | static Vector2* create(lua_State* vm); 14 | static void registerClass(lua_State* vm); 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/modern/Vector3.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.hpp" 3 | #include "Core/Type.hpp" 4 | 5 | namespace luastg::binding { 6 | struct Vector3 { 7 | static std::string_view class_name; 8 | 9 | core::Vector3 data; 10 | 11 | static bool is(lua_State* vm, int index); 12 | static Vector3* as(lua_State* vm, int index); 13 | static Vector3* create(lua_State* vm); 14 | static void registerClass(lua_State* vm); 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/modern/Vector4.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.hpp" 3 | #include "Core/Type.hpp" 4 | 5 | namespace luastg::binding { 6 | struct Vector4 { 7 | static std::string_view class_name; 8 | 9 | core::Vector4 data; 10 | 11 | static bool is(lua_State* vm, int index); 12 | static Vector4* as(lua_State* vm, int index); 13 | static Vector4* create(lua_State* vm); 14 | static void registerClass(lua_State* vm); 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/LuaBinding/modern/Well512.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.hpp" 3 | #include "Utility/well512.hpp" 4 | 5 | namespace luastg::binding { 6 | struct Well512 { 7 | static std::string_view const class_name; 8 | 9 | random::well512 well512; 10 | 11 | static bool is(lua_State* vm, int index); 12 | static random::well512* as(lua_State* vm, int index); 13 | static random::well512* create(lua_State* vm); 14 | static void registerClass(lua_State* vm); 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/Main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace luastg { 4 | int main(); 5 | } 6 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/RuntimeCheck.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace luastg 4 | { 5 | bool checkEngineRuntimeRequirement(); 6 | } 7 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/SharedHeaders.cpp: -------------------------------------------------------------------------------- 1 | #include "SharedHeaders.h" 2 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/SharedHeaders.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // 调试库 4 | #include 5 | #include 6 | 7 | // 数值与算法库 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | // 语言支持库 16 | #include 17 | #include 18 | #include 19 | 20 | // 容器库 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | // 输入输出、文件系统库 29 | #include 30 | #include 31 | 32 | // 调试工具 33 | #include "spdlog/spdlog.h" 34 | #include "tracy/Tracy.hpp" 35 | #include "tracy/TracyAPI.hpp" 36 | 37 | // 引擎公共头文件 38 | #include "Config.h" // 自定义编译配置 39 | #include "LConfig.h" // 引擎配置 40 | #include "LMathConstant.hpp" // 常用数学常量 41 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/SteamAPI/SteamAPI.cpp: -------------------------------------------------------------------------------- 1 | #include "SteamAPI/SteamAPI.hpp" 2 | 3 | #ifdef HAVE_STEAM_API 4 | #include "steam_api.h" 5 | #endif 6 | 7 | namespace luastg::SteamAPI 8 | { 9 | bool Init() 10 | { 11 | #ifdef HAVE_STEAM_API 12 | #ifdef USING_STEAM_API 13 | #ifdef KEEP_LAUNCH_BY_STEAM 14 | if (::SteamAPI_RestartAppIfNecessary(STEAM_APP_ID)) 15 | { 16 | return false; 17 | } 18 | #endif 19 | if (!::SteamAPI_Init()) 20 | { 21 | return false; 22 | } 23 | #endif 24 | #endif 25 | return true; 26 | } 27 | void RunCallbacks() 28 | { 29 | #ifdef HAVE_STEAM_API 30 | #ifdef USING_STEAM_API 31 | ::SteamAPI_RunCallbacks(); 32 | #endif 33 | #endif 34 | } 35 | void Shutdown() 36 | { 37 | #ifdef HAVE_STEAM_API 38 | #ifdef USING_STEAM_API 39 | ::SteamAPI_Shutdown(); 40 | #endif 41 | #endif 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/SteamAPI/SteamAPI.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace luastg::SteamAPI 4 | { 5 | bool Init(); 6 | void RunCallbacks(); 7 | void Shutdown(); 8 | } 9 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/Utility/Utility.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace luastg { 6 | // 计时域,离开作用域自动计算流逝的时间 7 | class TimerScope { 8 | private: 9 | int64_t _freq; 10 | int64_t _time; 11 | float& _out; 12 | public: 13 | float operator()() const; 14 | explicit TimerScope(float& Out); 15 | ~TimerScope(); 16 | }; 17 | 18 | // 自动配对调用 CoInitializeEx 和 CoUninitialize 19 | class CoInitializeScope { 20 | private: 21 | bool _result = false; 22 | public: 23 | inline bool operator()() const { return _result; } 24 | CoInitializeScope(); 25 | ~CoInitializeScope(); 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/Utility/well512.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | namespace random { 7 | // WELL512 随机数算法 8 | // 摘自《游戏编程精粹 7》 9 | class well512 { 10 | public: 11 | well512(); 12 | explicit well512(uint32_t const seed) noexcept { 13 | this->seed(seed); 14 | } 15 | 16 | [[nodiscard]] uint32_t seed() const noexcept { return m_seed; } 17 | void seed(uint32_t seed) noexcept; 18 | [[nodiscard]] uint32_t next() noexcept; 19 | [[nodiscard]] uint32_t next(uint32_t const bound) noexcept { 20 | return next() % (bound + 1); 21 | } 22 | [[nodiscard]] int32_t integer(int32_t const a, int32_t const b) noexcept { 23 | auto const range = static_cast(b) - static_cast(a); 24 | return a + next(static_cast(range)); 25 | } 26 | [[nodiscard]] float number() noexcept { 27 | return static_cast(next(1000000)) / 1000000.0f; 28 | } 29 | [[nodiscard]] float number(float const bound) noexcept { 30 | return number() * bound; 31 | } 32 | [[nodiscard]] float number(float const a, float const b) noexcept { 33 | return a + number() * (b - a); 34 | } 35 | [[nodiscard]] int32_t sign() noexcept { 36 | return static_cast(next(1) * 2) - 1; 37 | } 38 | [[nodiscard]] std::string serialize() const; 39 | [[nodiscard]] bool deserialize(std::string_view data); 40 | private: 41 | uint32_t m_state[16]{}; 42 | uint32_t m_index{}; 43 | uint32_t m_seed{}; 44 | }; 45 | } 46 | -------------------------------------------------------------------------------- /LuaSTG/LuaSTG/WindowsMain.cpp: -------------------------------------------------------------------------------- 1 | #include "Main.h" 2 | #define WIN32_LEAN_AND_MEAN 3 | #include 4 | 5 | _Use_decl_annotations_ int WINAPI wWinMain(HINSTANCE, HINSTANCE, PWSTR, int) { 6 | return luastg::main(); 7 | } 8 | -------------------------------------------------------------------------------- /LuaSTG/Platform/AdapterPolicy.cpp: -------------------------------------------------------------------------------- 1 | #include "AdapterPolicy.hpp" 2 | 3 | using uint32 = unsigned int; 4 | 5 | static_assert(sizeof(uint32) == 4); 6 | 7 | // https://developer.download.nvidia.cn/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf 8 | extern "C" __declspec(dllexport) uint32 NvOptimusEnablement = 0x00000000; 9 | 10 | // https://gpuopen.com/learn/amdpowerxpressrequesthighperformance/ 11 | extern "C" __declspec(dllexport) uint32 AmdPowerXpressRequestHighPerformance = 0x00000000; 12 | 13 | namespace Platform 14 | { 15 | void AdapterPolicy::setAll(bool active) 16 | { 17 | setNVIDIA(active); 18 | setAMD(active); 19 | } 20 | void AdapterPolicy::setNVIDIA(bool active) 21 | { 22 | NvOptimusEnablement = active ? 0x00000001 : 0x00000000; 23 | } 24 | void AdapterPolicy::setAMD(bool active) 25 | { 26 | AmdPowerXpressRequestHighPerformance = active ? 0x00000001 : 0x00000000; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /LuaSTG/Platform/AdapterPolicy.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Platform 4 | { 5 | class AdapterPolicy 6 | { 7 | public: 8 | static void setAll(bool active); 9 | static void setNVIDIA(bool active); 10 | static void setAMD(bool active); 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /LuaSTG/Platform/ApplicationSingleInstance.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace Platform 6 | { 7 | class ApplicationSingleInstance 8 | { 9 | private: 10 | typedef void* HANDLE; 11 | HANDLE m_event{}; 12 | std::string m_title{"Error"}; 13 | private: 14 | void ShowErrorWindow(std::string_view const text); 15 | void Clear(); 16 | public: 17 | void SetErrorWindowTitle(std::string_view const title); 18 | void Initialize(std::string_view const uuid); 19 | public: 20 | ApplicationSingleInstance(); 21 | ApplicationSingleInstance(std::string_view const title); 22 | ApplicationSingleInstance(std::string_view const title, std::string_view const uuid); 23 | ApplicationSingleInstance(ApplicationSingleInstance const&) = delete; 24 | ApplicationSingleInstance(ApplicationSingleInstance&&) = delete; 25 | ~ApplicationSingleInstance(); 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /LuaSTG/Platform/CleanWindows.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define WIN32_LEAN_AND_MEAN 4 | #define NOMINMAX 5 | #define NOSERVICE 6 | #define NOMCX 7 | #define NOIME 8 | 9 | #include 10 | 11 | // Now, let's FUCK Windows.h 12 | 13 | #ifdef DrawText 14 | #undef DrawText 15 | #endif 16 | 17 | #ifdef CreateWindow 18 | #undef CreateWindow 19 | #endif 20 | 21 | #ifdef DefWindowProc 22 | #undef DefWindowProc 23 | #endif 24 | 25 | #ifdef MessageBox 26 | #undef MessageBox 27 | #endif 28 | 29 | #undef WIN32_LEAN_AND_MEAN 30 | #undef NOMINMAX 31 | #undef NOSERVICE 32 | #undef NOMCX 33 | #undef NOIME 34 | -------------------------------------------------------------------------------- /LuaSTG/Platform/CommandLineArguments.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | namespace Platform 7 | { 8 | class CommandLineArguments 9 | { 10 | private: 11 | std::vector m_args; 12 | public: 13 | bool Update(); 14 | bool GetArguments(std::vector& list); 15 | bool IsOptionExist(std::string_view option); 16 | public: 17 | CommandLineArguments(); 18 | ~CommandLineArguments(); 19 | public: 20 | static CommandLineArguments& Get(); 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /LuaSTG/Platform/DXGI.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Platform 4 | { 5 | class DXGI 6 | { 7 | public: 8 | static BOOL CheckFeatureSupportPresentAllowTearing(IDXGIFactory* pFactory); 9 | static HRESULT MakeSwapChainWindowAssociation(IDXGISwapChain* pSwapChain, UINT flags); 10 | static HRESULT SetSwapChainMaximumFrameLatency(IDXGISwapChain* pSwapChain, UINT MaxLatency, HANDLE* pEvent); 11 | static HRESULT SetDeviceMaximumFrameLatency(IDXGISwapChain* pSwapChain, UINT MaxLatency); 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /LuaSTG/Platform/DesktopWindowManager.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Platform 4 | { 5 | class DesktopWindowManager 6 | { 7 | public: 8 | static BOOL IsOverlayTestModeExists(); 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /LuaSTG/Platform/Direct3D11.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Platform 4 | { 5 | class Direct3D11 6 | { 7 | public: 8 | static HRESULT GetDeviceAdater(ID3D11Device* pDevice, IDXGIAdapter1** ppAdapter); 9 | static HRESULT GetDeviceFactory(ID3D11Device* pDevice, IDXGIFactory2** ppFactory); 10 | static BOOL HasDevice(UINT Flags, D3D_FEATURE_LEVEL TargetFeatureLevel); 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /LuaSTG/Platform/ImmersiveTitleBarController.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace platform::windows { 4 | 5 | class ImmersiveTitleBarController { 6 | private: 7 | class Impl; 8 | Impl* impl; 9 | 10 | public: 11 | struct HandleWindowMessageResult { 12 | bool returnResult{ false }; 13 | LRESULT result{ 0 }; 14 | }; 15 | 16 | public: 17 | void setEnable(bool enable); 18 | BOOL adjustWindowRectExForDpi(RECT* lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle, UINT dpi); 19 | HandleWindowMessageResult handleWindowMessage(HWND window, UINT message, WPARAM arg1, LPARAM arg2); 20 | bool createResources(HWND window, ID2D1DeviceContext* context); 21 | void destroyResources(); 22 | bool setTitle(std::string const& text); 23 | bool setClientSize(HWND window, UINT width, UINT height); 24 | bool update(); 25 | bool isVisible(); 26 | UINT getHeight(); 27 | bool draw(ID2D1Bitmap1* target, D2D1_POINT_2F offset = {}); 28 | 29 | public: 30 | ImmersiveTitleBarController(); 31 | ImmersiveTitleBarController(ImmersiveTitleBarController const&) = delete; 32 | ImmersiveTitleBarController(ImmersiveTitleBarController&& other) noexcept; 33 | ~ImmersiveTitleBarController(); 34 | }; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /LuaSTG/Platform/KnownDirectory.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace Platform 6 | { 7 | class KnownDirectory 8 | { 9 | public: 10 | static bool getLocalAppDataW(std::wstring& buf); 11 | static bool getRoamingAppDataW(std::wstring& buf); 12 | static bool makeAppDataW(std::wstring_view const& company, std::wstring_view const& product, std::wstring& buf); 13 | 14 | static bool getLocalAppData(std::string& buf); 15 | static bool getRoamingAppData(std::string& buf); 16 | static bool makeAppData(std::string_view const& company, std::string_view const& product, std::string& buf); 17 | }; 18 | }; 19 | -------------------------------------------------------------------------------- /LuaSTG/Platform/MessageBox.cpp: -------------------------------------------------------------------------------- 1 | #include "Shared.hpp" 2 | #include "MessageBox.hpp" 3 | 4 | namespace Platform 5 | { 6 | static bool Show(int type, std::string_view title, std::string_view message, HWND window = NULL) 7 | { 8 | std::wstring wide_title(std::move(to_wide(title))); 9 | std::wstring wide_message(std::move(to_wide(message))); 10 | UINT flags = 0; 11 | switch (type) 12 | { 13 | case 1: 14 | flags |= MB_ICONWARNING; 15 | flags |= MB_OKCANCEL; 16 | break; 17 | case 2: 18 | flags = MB_ICONERROR; 19 | flags |= MB_OK; 20 | break; 21 | default: 22 | assert(false); 23 | break; 24 | } 25 | return IDOK == MessageBoxW(window, wide_message.c_str(), wide_title.c_str(), flags); 26 | } 27 | bool MessageBox::Warning(std::string_view title, std::string_view message) 28 | { 29 | return Show(1, title, message); 30 | } 31 | void MessageBox::Error(std::string_view title, std::string_view message) 32 | { 33 | Show(2, title, message); 34 | } 35 | bool MessageBox::WarningFromWindow(std::string_view title, std::string_view message, void* window) 36 | { 37 | return Show(1, title, message, (HWND)window); 38 | } 39 | void MessageBox::ErrorFromWindow(std::string_view title, std::string_view message, void* window) 40 | { 41 | Show(2, title, message, (HWND)window); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /LuaSTG/Platform/MessageBox.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | // FUCK MICROSOFT 5 | 6 | #ifdef MessageBox 7 | #undef MessageBox 8 | #endif 9 | 10 | namespace Platform 11 | { 12 | class MessageBox 13 | { 14 | public: 15 | static bool Warning(std::string_view title, std::string_view message); 16 | static void Error(std::string_view title, std::string_view message); 17 | static bool WarningFromWindow(std::string_view title, std::string_view message, void* window); 18 | static void ErrorFromWindow(std::string_view title, std::string_view message, void* window); 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /LuaSTG/Platform/ModuleLoader.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace Platform 5 | { 6 | class ModuleLoader 7 | { 8 | private: 9 | #ifdef _MINWINDEF_ 10 | HMODULE m_module{}; 11 | #else 12 | void* m_module{}; 13 | #endif 14 | public: 15 | #ifdef _MINWINDEF_ 16 | HRESULT Load(std::string_view const name, bool search_only_in_system); 17 | #else 18 | long Load(std::string_view const name, bool search_only_in_system); 19 | #endif 20 | void* GetFunction(std::string_view const name); 21 | template 22 | F* GetFunction(std::string_view const name) 23 | { 24 | return reinterpret_cast(GetFunction(name)); 25 | } 26 | public: 27 | ModuleLoader(); 28 | ModuleLoader(ModuleLoader const&) = delete; 29 | ModuleLoader(ModuleLoader&& right) noexcept; 30 | ~ModuleLoader(); 31 | public: 32 | static bool IsSearchOnlyInSystemSupported(); 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /LuaSTG/Platform/ProcessorInfo.cpp: -------------------------------------------------------------------------------- 1 | #include "ProcessorInfo.hpp" 2 | #include 3 | #include 4 | 5 | namespace Platform { 6 | std::string ProcessorInfo::name() { 7 | DWORD type{}; 8 | WCHAR buffer[256]{}; 9 | DWORD size{ sizeof(buffer) }; 10 | const LSTATUS result = RegGetValueW( 11 | HKEY_LOCAL_MACHINE, 12 | LR"(HARDWARE\DESCRIPTION\System\CentralProcessor\0)", 13 | L"ProcessorNameString", 14 | RRF_RT_REG_SZ, 15 | &type, 16 | buffer, 17 | &size 18 | ); 19 | if (ERROR_SUCCESS == result) { 20 | return winrt::to_string(buffer); 21 | } 22 | return "Unknown"; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /LuaSTG/Platform/ProcessorInfo.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace Platform { 5 | class ProcessorInfo { 6 | public: 7 | static std::string name(); 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /LuaSTG/Platform/RuntimeLoader/D3DKMT.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #define WIN32_LEAN_AND_MEAN 3 | #define NOMINMAX 4 | #define NOSERVICE 5 | #define NOMCX 6 | #define NOIME 7 | #include 8 | #include // NTSTATUS 9 | #include 10 | 11 | namespace Platform::RuntimeLoader 12 | { 13 | class D3DKMT 14 | { 15 | private: 16 | HMODULE dll_gdi{}; 17 | decltype(D3DKMTOpenAdapterFromLuid)* api_D3DKMTOpenAdapterFromLuid{}; 18 | decltype(D3DKMTOpenAdapterFromGdiDisplayName)* api_D3DKMTOpenAdapterFromGdiDisplayName{}; 19 | decltype(D3DKMTCloseAdapter)* api_D3DKMTCloseAdapter{}; 20 | decltype(D3DKMTCreateDevice)* api_D3DKMTCreateDevice{}; 21 | decltype(D3DKMTDestroyDevice)* api_D3DKMTDestroyDevice{}; 22 | decltype(D3DKMTQueryAdapterInfo)* api_D3DKMTQueryAdapterInfo{}; 23 | decltype(D3DKMTGetMultiPlaneOverlayCaps)* api_D3DKMTGetMultiPlaneOverlayCaps{}; 24 | public: 25 | D3DKMT(); 26 | ~D3DKMT(); 27 | public: 28 | NTSTATUS OpenAdapterFromLuid(D3DKMT_OPENADAPTERFROMLUID* arg); 29 | NTSTATUS OpenAdapterFromGdiDisplayName(D3DKMT_OPENADAPTERFROMGDIDISPLAYNAME* arg); 30 | NTSTATUS CloseAdapter(CONST D3DKMT_CLOSEADAPTER* arg); 31 | NTSTATUS CreateDevice(D3DKMT_CREATEDEVICE* arg); 32 | NTSTATUS DestroyDevice(CONST D3DKMT_DESTROYDEVICE* arg); 33 | NTSTATUS QueryAdapterInfo(D3DKMT_QUERYADAPTERINFO* arg); 34 | NTSTATUS GetMultiPlaneOverlayCaps(D3DKMT_GET_MULTIPLANE_OVERLAY_CAPS* arg); 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /LuaSTG/Platform/RuntimeLoader/DXGI.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Platform::RuntimeLoader 4 | { 5 | class DXGI 6 | { 7 | private: 8 | HMODULE dll_dxgi{}; 9 | decltype(CreateDXGIFactory)* api_CreateDXGIFactory{}; 10 | decltype(CreateDXGIFactory1)* api_CreateDXGIFactory1{}; 11 | decltype(CreateDXGIFactory2)* api_CreateDXGIFactory2{}; 12 | public: 13 | HRESULT CreateFactory(REFIID riid, void** ppFactory); 14 | public: 15 | DXGI(); 16 | ~DXGI(); 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /LuaSTG/Platform/RuntimeLoader/Direct2D1.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Platform::RuntimeLoader 4 | { 5 | class Direct2D1 6 | { 7 | private: 8 | // FUCK Microsoft 9 | typedef HRESULT(WINAPI* PFN_D2D1CreateFactory)( 10 | D2D1_FACTORY_TYPE factoryType, 11 | REFIID riid, 12 | CONST D2D1_FACTORY_OPTIONS* pFactoryOptions, 13 | void** ppIFactory); 14 | typedef HRESULT(WINAPI* PFN_D2D1CreateDevice)( 15 | IDXGIDevice* dxgiDevice, 16 | CONST D2D1_CREATION_PROPERTIES* creationProperties, 17 | ID2D1Device** d2dDevice); 18 | private: 19 | HMODULE dll_d2d1{}; 20 | PFN_D2D1CreateFactory api_D2D1CreateFactory{}; 21 | PFN_D2D1CreateDevice api_D2D1CreateDevice{}; 22 | public: 23 | HRESULT CreateFactory( 24 | D2D1_FACTORY_TYPE factoryType, 25 | REFIID riid, 26 | void** ppIFactory); 27 | HRESULT CreateDevice( 28 | IDXGIDevice* dxgiDevice, 29 | BOOL multiThread, 30 | ID2D1Device** d2dDevice); 31 | HRESULT CreateDevice( 32 | IDXGIDevice* dxgiDevice, 33 | BOOL multiThread, 34 | ID2D1Device** d2dDevice, 35 | ID2D1DeviceContext** d2dDeviceContext); 36 | public: 37 | Direct2D1(); 38 | ~Direct2D1(); 39 | }; 40 | } 41 | -------------------------------------------------------------------------------- /LuaSTG/Platform/RuntimeLoader/Direct3D11.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Platform::RuntimeLoader 4 | { 5 | class Direct3D11 6 | { 7 | private: 8 | HMODULE dll_d3d11{}; 9 | decltype(D3D11CreateDevice)* api_D3D11CreateDevice{}; 10 | public: 11 | HRESULT CreateDevice( 12 | UINT Flags, 13 | D3D_FEATURE_LEVEL TargetFeatureLevel, 14 | ID3D11Device** ppDevice, 15 | D3D_FEATURE_LEVEL* pFeatureLevel, 16 | ID3D11DeviceContext** ppImmediateContext); 17 | HRESULT CreateDeviceFromAdapter( 18 | IDXGIAdapter* pAdapter, 19 | UINT Flags, 20 | D3D_FEATURE_LEVEL TargetFeatureLevel, 21 | ID3D11Device** ppDevice, 22 | D3D_FEATURE_LEVEL* pFeatureLevel, 23 | ID3D11DeviceContext** ppImmediateContext); 24 | HRESULT CreateDeviceFromSoftAdapter( 25 | UINT Flags, 26 | D3D_FEATURE_LEVEL TargetFeatureLevel, 27 | ID3D11Device** ppDevice, 28 | D3D_FEATURE_LEVEL* pFeatureLevel, 29 | ID3D11DeviceContext** ppImmediateContext, 30 | D3D_DRIVER_TYPE* pType = nullptr); 31 | public: 32 | Direct3D11(); 33 | ~Direct3D11(); 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /LuaSTG/Platform/RuntimeLoader/Direct3DCompiler.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Platform::RuntimeLoader 4 | { 5 | class Direct3DCompiler 6 | { 7 | private: 8 | HMODULE dll_d3dcompiler{}; 9 | decltype(D3DCompile)* api_D3DCompile{}; 10 | decltype(D3DReflect)* api_D3DReflect{}; 11 | public: 12 | HRESULT Compile(LPCVOID pSrcData, 13 | SIZE_T SrcDataSize, 14 | LPCSTR pSourceName, 15 | CONST D3D_SHADER_MACRO* pDefines, 16 | ID3DInclude* pInclude, 17 | LPCSTR pEntrypoint, 18 | LPCSTR pTarget, 19 | UINT Flags1, 20 | UINT Flags2, 21 | ID3DBlob** ppCode, 22 | ID3DBlob** ppErrorMsgs); 23 | HRESULT Reflect(LPCVOID pSrcData, 24 | SIZE_T SrcDataSize, 25 | REFIID pInterface, 26 | void** ppReflector); 27 | public: 28 | Direct3DCompiler(); 29 | ~Direct3DCompiler(); 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /LuaSTG/Platform/RuntimeLoader/DirectComposition.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Platform::RuntimeLoader 4 | { 5 | class DirectComposition 6 | { 7 | private: 8 | HMODULE dll_dcomp{}; 9 | decltype(DCompositionCreateDevice)* api_DCompositionCreateDevice{}; 10 | decltype(DCompositionCreateDevice2)* api_DCompositionCreateDevice2{}; 11 | decltype(DCompositionCreateDevice3)* api_DCompositionCreateDevice3{}; 12 | public: 13 | HRESULT CreateDevice(IUnknown* renderingDevice, REFIID iid, void** dcompositionDevice); 14 | public: 15 | DirectComposition(); 16 | ~DirectComposition(); 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /LuaSTG/Platform/RuntimeLoader/DirectWrite.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Platform::RuntimeLoader 4 | { 5 | class DirectWrite 6 | { 7 | private: 8 | HMODULE dll_dwrite{}; 9 | decltype(DWriteCreateFactory)* api_DWriteCreateFactory{}; 10 | public: 11 | HRESULT CreateFactory( 12 | DWRITE_FACTORY_TYPE factoryType, 13 | REFIID iid, 14 | void** factory); 15 | public: 16 | DirectWrite(); 17 | ~DirectWrite(); 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /LuaSTG/Platform/RuntimeLoader/XAudio2.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Platform::RuntimeLoader 4 | { 5 | class XAudio2 6 | { 7 | private: 8 | typedef HRESULT(WINAPI* PFN_XAudio2CreateWithVersionInfo)(IXAudio2**, UINT32, XAUDIO2_PROCESSOR, DWORD); 9 | typedef HRESULT(WINAPI* PFN_XAudio2Create)(IXAudio2**, UINT32, XAUDIO2_PROCESSOR); 10 | private: 11 | HMODULE dll_xaudio2{}; 12 | PFN_XAudio2CreateWithVersionInfo api_XAudio2CreateWithVersionInfo{}; 13 | PFN_XAudio2Create api_XAudio2Create{}; 14 | public: 15 | HRESULT Create(IXAudio2** ppXAudio2); 16 | public: 17 | XAudio2(); 18 | ~XAudio2(); 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /LuaSTG/Platform/WindowTheme.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace Platform 4 | { 5 | class WindowTheme 6 | { 7 | public: 8 | static BOOL IsSystemDarkModeEnabled(); 9 | static BOOL ShouldApplicationEnableDarkMode(); 10 | static BOOL SetDarkMode(HWND hWnd, BOOL bEnable, BOOL bFocus); 11 | static BOOL UpdateColorMode(HWND hWnd, BOOL bFocus); 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /LuaSTG/Shader/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(ShaderCompiler) 2 | set_target_properties(ShaderCompiler PROPERTIES 3 | C_STANDARD 17 4 | C_STANDARD_REQUIRED ON 5 | CXX_STANDARD 20 6 | CXX_STANDARD_REQUIRED ON 7 | ) 8 | target_compile_options(ShaderCompiler 9 | PRIVATE 10 | "/utf-8" 11 | "/W4" # 更多警告 12 | ) 13 | #target_link_options(ShaderCompiler 14 | #PRIVATE 15 | # "/DEPENDENTLOADFLAG:0x800" # Windows 10 1607+ 强制 DLL 搜索目录为系统目录 16 | #) 17 | target_compile_definitions(ShaderCompiler 18 | PRIVATE 19 | _UNICODE 20 | UNICODE 21 | HREADER_OUTPUT_DIRECTORY=\"${CMAKE_CURRENT_LIST_DIR}/generated\" 22 | HREADER_INPUT_DIRECTORY=\"${CMAKE_CURRENT_LIST_DIR}\" 23 | ) 24 | target_include_directories(ShaderCompiler 25 | PRIVATE 26 | ${CMAKE_CURRENT_LIST_DIR} 27 | ) 28 | target_sources(ShaderCompiler 29 | PRIVATE 30 | ShaderCompiler.cpp 31 | ) 32 | target_link_libraries(ShaderCompiler 33 | PRIVATE 34 | d3dcompiler.lib 35 | ) 36 | -------------------------------------------------------------------------------- /LuaSTG/Shader/imgui/backend/d3d11/pixel_shader.hlsl: -------------------------------------------------------------------------------- 1 | SamplerState sampler0; 2 | Texture2D texture0; 3 | 4 | struct PS_INPUT 5 | { 6 | float4 pos : SV_POSITION; 7 | float4 col : COLOR0; 8 | float2 uv : TEXCOORD0; 9 | }; 10 | 11 | float4 main(PS_INPUT input) : SV_Target 12 | { 13 | float4 out_col = input.col * texture0.Sample(sampler0, input.uv); 14 | return out_col; 15 | } 16 | -------------------------------------------------------------------------------- /LuaSTG/Shader/imgui/backend/d3d11/vertex_shader.hlsl: -------------------------------------------------------------------------------- 1 | cbuffer vertexBuffer : register(b0) 2 | { 3 | float4x4 ProjectionMatrix; 4 | }; 5 | 6 | struct VS_INPUT 7 | { 8 | float2 pos : POSITION; 9 | float4 col : COLOR0; 10 | float2 uv : TEXCOORD0; 11 | }; 12 | 13 | struct PS_INPUT 14 | { 15 | float4 pos : SV_POSITION; 16 | float4 col : COLOR0; 17 | float2 uv : TEXCOORD0; 18 | }; 19 | 20 | PS_INPUT main(VS_INPUT input) 21 | { 22 | PS_INPUT output; 23 | output.pos = mul(ProjectionMatrix, float4(input.pos.xy, 0.f, 1.f)); 24 | output.col = input.col; 25 | output.uv = input.uv; 26 | return output; 27 | } 28 | -------------------------------------------------------------------------------- /LuaSTG/Shader/luastg/sub/renderer/vertex_shader.hlsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | cbuffer view_proj_buffer : register(b0) 4 | { 5 | float4x4 view_proj; 6 | }; 7 | #if defined(WORLD_MATRIX) 8 | cbuffer world_buffer : register(b1) 9 | { 10 | float4x4 world; 11 | }; 12 | #endif 13 | 14 | struct VS_Input 15 | { 16 | float3 pos : POSITION0; 17 | float2 uv : TEXCOORD0; 18 | float4 col : COLOR0; 19 | }; 20 | struct VS_Output 21 | { 22 | float4 sxy : SV_POSITION; 23 | #if defined(FOG_ENABLE) 24 | float4 pos : POSITION0; 25 | #endif 26 | float2 uv : TEXCOORD0; 27 | float4 col : COLOR0; 28 | }; 29 | 30 | VS_Output main(VS_Input input) 31 | { 32 | float4 pos_world = float4(input.pos, 1.0f); 33 | #if defined(WORLD_MATRIX) 34 | pos_world = mul(world, pos_world); 35 | #endif 36 | 37 | VS_Output output; 38 | output.sxy = mul(view_proj, pos_world); 39 | #if defined(FOG_ENABLE) 40 | output.pos = pos_world; 41 | #endif 42 | output.uv = input.uv; 43 | output.col = input.col; 44 | // TODO: 顶点颜色转到线性颜色空间 45 | //output.col = pow(input.col, 1.0f / 2.2f); 46 | 47 | return output; 48 | }; 49 | 50 | -------------------------------------------------------------------------------- /LuaSTG/shaders.cmake: -------------------------------------------------------------------------------- 1 | add_library(GeneratedShaderHeaders INTERFACE) 2 | target_include_directories(GeneratedShaderHeaders 3 | INTERFACE 4 | ${CMAKE_CURRENT_LIST_DIR}/Shader/generated 5 | ) 6 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | We only make security updates to the latest 2 major versions. 6 | 7 | | Version | Status | 8 | | ------- | ------------------ | 9 | | 0.21.x | :white_check_mark: Actively developing | 10 | | 0.20.x | :warning: Security updates only | 11 | | 0.1.x - 0.19.x | :x: EOL | 12 | 13 | ## Reporting a Vulnerability 14 | 15 | * GitHub Security: https://github.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/security/advisories 16 | * E-mail: contact@luastg-sub.com 17 | * LuaSTG 交流群 (QQ group): 230927410 18 | * LuaSTG 寒流群 (QQ group): 563868788 19 | -------------------------------------------------------------------------------- /artwork/logo-pure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/artwork/logo-pure.png -------------------------------------------------------------------------------- /artwork/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/artwork/logo.png -------------------------------------------------------------------------------- /cmake/build/all.cmake: -------------------------------------------------------------------------------- 1 | set(LUASTG_CMAKE_SUB_BUILD_ROOT ${CMAKE_CURRENT_LIST_DIR}) 2 | 3 | include(${LUASTG_CMAKE_SUB_BUILD_ROOT}/z.cmake) 4 | include(${LUASTG_CMAKE_SUB_BUILD_ROOT}/xiph.cmake) 5 | include(${LUASTG_CMAKE_SUB_BUILD_ROOT}/freetype.cmake) 6 | #include(${LUASTG_CMAKE_SUB_BUILD_ROOT}/harfbuzz.cmake) 7 | include(${LUASTG_CMAKE_SUB_BUILD_ROOT}/gtest.cmake) 8 | -------------------------------------------------------------------------------- /cmake/import/ada_url.cmake: -------------------------------------------------------------------------------- 1 | # ada_url 2 | 3 | CPMAddPackage( 4 | NAME ada_url 5 | VERSION 3.2.4 6 | URL https://github.com/ada-url/ada/releases/download/v3.2.4/singleheader.zip 7 | URL_HASH SHA256=BD89FCF57C93E965E6E2488448AB9D1CF8005311808C563B288F921D987E4924 8 | DOWNLOAD_ONLY YES 9 | ) 10 | 11 | if(ada_url_ADDED) 12 | add_library(ada_url STATIC) 13 | luastg_target_common_options(ada_url) 14 | target_include_directories(ada_url PUBLIC 15 | ${ada_url_SOURCE_DIR} 16 | ) 17 | target_sources(ada_url PRIVATE 18 | ${ada_url_SOURCE_DIR}/ada.h 19 | ${ada_url_SOURCE_DIR}/ada.cpp 20 | ${ada_url_SOURCE_DIR}/ada_c.h 21 | ) 22 | set_target_properties(ada_url PROPERTIES FOLDER external) 23 | endif() 24 | -------------------------------------------------------------------------------- /cmake/import/all.cmake: -------------------------------------------------------------------------------- 1 | set(LUASTG_CMAKE_IMPORT_ROOT ${CMAKE_CURRENT_LIST_DIR}) 2 | 3 | include(${CMAKE_CURRENT_LIST_DIR}/cpm.cmake) 4 | 5 | if(LUASTG_LINK_YY_THUNKS) 6 | include(${CMAKE_CURRENT_LIST_DIR}/yy_thunks.cmake) 7 | endif() 8 | 9 | include(${CMAKE_CURRENT_LIST_DIR}/spdlog.cmake) 10 | include(${CMAKE_CURRENT_LIST_DIR}/tracy.cmake) 11 | include(${CMAKE_CURRENT_LIST_DIR}/json.cmake) 12 | include(${CMAKE_CURRENT_LIST_DIR}/pugixml.cmake) 13 | include(${CMAKE_CURRENT_LIST_DIR}/stb.cmake) 14 | include(${CMAKE_CURRENT_LIST_DIR}/dr_libs.cmake) 15 | include(${CMAKE_CURRENT_LIST_DIR}/tinygltf.cmake) # depends json, stb 16 | include(${CMAKE_CURRENT_LIST_DIR}/tinyobjloader.cmake) 17 | include(${CMAKE_CURRENT_LIST_DIR}/pcg.cmake) 18 | include(${CMAKE_CURRENT_LIST_DIR}/xxhash.cmake) 19 | include(${CMAKE_CURRENT_LIST_DIR}/simdutf.cmake) 20 | include(${CMAKE_CURRENT_LIST_DIR}/ada_url.cmake) 21 | 22 | include(${CMAKE_CURRENT_LIST_DIR}/wil.cmake) 23 | include(${CMAKE_CURRENT_LIST_DIR}/directx_tk.cmake) 24 | include(${CMAKE_CURRENT_LIST_DIR}/directx_tex.cmake) 25 | include(${CMAKE_CURRENT_LIST_DIR}/xaudio2.cmake) 26 | include(${CMAKE_CURRENT_LIST_DIR}/d3dcompiler.cmake) 27 | -------------------------------------------------------------------------------- /cmake/import/cpm.cmake: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors 4 | 5 | set(CPM_DOWNLOAD_VERSION 0.40.8) 6 | set(CPM_HASH_SUM "78ba32abdf798bc616bab7c73aac32a17bbd7b06ad9e26a6add69de8f3ae4791") 7 | 8 | if(CPM_SOURCE_CACHE) 9 | set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") 10 | elseif(DEFINED ENV{CPM_SOURCE_CACHE}) 11 | set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") 12 | else() 13 | set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") 14 | endif() 15 | 16 | # Expand relative path. This is important if the provided path contains a tilde (~) 17 | get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE) 18 | 19 | file(DOWNLOAD 20 | https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake 21 | ${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM} 22 | ) 23 | 24 | include(${CPM_DOWNLOAD_LOCATION}) 25 | -------------------------------------------------------------------------------- /cmake/import/d3dcompiler.cmake: -------------------------------------------------------------------------------- 1 | # d3dcompiler 2 | 3 | add_library(Microsoft.D3DCompiler.Redist SHARED IMPORTED GLOBAL) 4 | 5 | # 注意:从 Windows SDK 10.0.26100 开始,d3dcompiler_47.dll 不再静态链接 CRT,而是链接到 UCRT 6 | 7 | CPMAddPackage( 8 | NAME Microsoft.Windows.SDK.CPP 9 | VERSION 10.0.22621.3233 10 | URL https://www.nuget.org/api/v2/package/Microsoft.Windows.SDK.CPP/10.0.22621.3233 11 | URL_HASH SHA256=E4EFE1768EA61F4F999DBEF61B09895320629F975F9CEED8290A9633E0C31623 12 | DOWNLOAD_ONLY YES 13 | ) 14 | 15 | if (NOT Microsoft.Windows.SDK.CPP_ADDED) 16 | message(FATAL_ERROR "Microsoft.Windows.SDK.CPP is required") 17 | endif () 18 | 19 | set(d3dcompiler47_dll "d3dcompiler_47.dll") 20 | if(Microsoft.Windows.SDK.CPP_ADDED) 21 | set(windows_sdk_redist "${Microsoft.Windows.SDK.CPP_SOURCE_DIR}/c/Redist/D3D") 22 | if (CMAKE_SIZEOF_VOID_P EQUAL 8) 23 | set(windows_sdk_redist "${windows_sdk_redist}/x64") 24 | elseif (CMAKE_SIZEOF_VOID_P EQUAL 4) 25 | set(windows_sdk_redist "${windows_sdk_redist}/x86") 26 | else () 27 | message(FATAL_ERROR "unknown platform") 28 | endif () 29 | set(d3dcompiler47_dll "${windows_sdk_redist}/d3dcompiler_47.dll") 30 | endif() 31 | 32 | if (NOT EXISTS ${d3dcompiler47_dll}) 33 | message(FATAL_ERROR "d3dcompiler_47.dll not exists in nuget package Microsoft.Windows.SDK.CPP") 34 | endif() 35 | 36 | # import 37 | 38 | set_target_properties(Microsoft.D3DCompiler.Redist PROPERTIES 39 | IMPORTED_IMPLIB d3dcompiler.lib 40 | IMPORTED_LOCATION ${d3dcompiler47_dll} 41 | ) 42 | -------------------------------------------------------------------------------- /cmake/import/directx_tex.cmake: -------------------------------------------------------------------------------- 1 | # Microsoft.DirectXTex 2 | 3 | CPMAddPackage( 4 | NAME Microsoft.DirectXTex 5 | VERSION 2024.10.1 6 | GITHUB_REPOSITORY microsoft/DirectXTex 7 | GIT_TAG oct2024 8 | DOWNLOAD_ONLY YES 9 | ) 10 | 11 | if(Microsoft.DirectXTex_ADDED) 12 | set(DirectXTex_DIR ${Microsoft.DirectXTex_SOURCE_DIR}) 13 | add_library(DirectXTexMini STATIC) 14 | luastg_target_common_options(DirectXTexMini) 15 | luastg_target_platform_windows_7(DirectXTexMini) 16 | target_include_directories(DirectXTexMini PUBLIC 17 | ${DirectXTex_DIR} 18 | ${DirectXTex_DIR}/ScreenGrab 19 | ${DirectXTex_DIR}/WICTextureLoader 20 | ${DirectXTex_DIR}/DDSTextureLoader 21 | ) 22 | target_sources(DirectXTexMini PRIVATE 23 | ${DirectXTex_DIR}/ScreenGrab/ScreenGrab11.h 24 | ${DirectXTex_DIR}/ScreenGrab/ScreenGrab11.cpp 25 | ${DirectXTex_DIR}/WICTextureLoader/WICTextureLoader11.h 26 | ${DirectXTex_DIR}/WICTextureLoader/WICTextureLoader11.cpp 27 | ${DirectXTex_DIR}/DDSTextureLoader/DDSTextureLoader11.h 28 | ${DirectXTex_DIR}/DDSTextureLoader/DDSTextureLoader11.cpp 29 | ) 30 | target_link_libraries(DirectXTexMini PUBLIC 31 | dxguid.lib 32 | ) 33 | 34 | add_library(DirectX::TextureMini ALIAS DirectXTexMini) 35 | set_target_properties(DirectXTexMini PROPERTIES FOLDER external) 36 | else() 37 | message(FATAL_ERROR "Microsoft.DirectXTex is requied") 38 | endif() 39 | -------------------------------------------------------------------------------- /cmake/import/directx_tk.cmake: -------------------------------------------------------------------------------- 1 | # Microsoft.DirectXTK 2 | 3 | CPMAddPackage( 4 | NAME Microsoft.DirectXTK 5 | VERSION 2024.10.1 6 | GITHUB_REPOSITORY microsoft/DirectXTK 7 | GIT_TAG oct2024 8 | DOWNLOAD_ONLY YES 9 | ) 10 | 11 | if(Microsoft.DirectXTK_ADDED) 12 | set(DirectXTK_DIR ${Microsoft.DirectXTK_SOURCE_DIR}) 13 | add_library(DirectXTKMini STATIC) 14 | luastg_target_common_options(DirectXTKMini) 15 | luastg_target_platform_windows_7(DirectXTKMini) 16 | target_include_directories(DirectXTKMini PUBLIC 17 | ${DirectXTK_DIR}/Inc 18 | ) 19 | target_sources(DirectXTKMini PRIVATE 20 | ${DirectXTK_DIR}/Inc/Keyboard.h 21 | ${DirectXTK_DIR}/Inc/Mouse.h 22 | ${DirectXTK_DIR}/Src/Keyboard.cpp 23 | ${DirectXTK_DIR}/Src/Mouse.cpp 24 | ${DirectXTK_DIR}/Src/pch.h 25 | ${DirectXTK_DIR}/Src/pch.cpp 26 | ${DirectXTK_DIR}/Src/PlatformHelpers.h 27 | ) 28 | 29 | add_library(DirectX::ToolKitMini ALIAS DirectXTKMini) 30 | set_target_properties(DirectXTKMini PROPERTIES FOLDER external) 31 | else() 32 | message(FATAL_ERROR "Microsoft.DirectXTK is requied") 33 | endif() 34 | -------------------------------------------------------------------------------- /cmake/import/dr_libs.cmake: -------------------------------------------------------------------------------- 1 | # dr_libs 2 | 3 | CPMAddPackage( 4 | NAME dr_libs 5 | VERSION 2024.12.17 6 | # !!!警告:不要直接使用 mackron dr_libs 的 git 仓库,否则下载耗时++++ 7 | #GITHUB_REPOSITORY mackron/dr_libs 8 | #GIT_TAG 660795b2834aebb2217c9849d668b6e4bd4ef810 9 | URL https://github.com/mackron/dr_libs/archive/660795b2834aebb2217c9849d668b6e4bd4ef810.zip 10 | URL_HASH SHA256=5AA009A6E5BC35361D4255490C6976560D66B261DF8CD657EB0950A29AC34D15 11 | DOWNLOAD_ONLY YES 12 | ) 13 | 14 | if(dr_libs_ADDED) 15 | add_library(dr_libs STATIC) 16 | target_include_directories(dr_libs PUBLIC 17 | ${dr_libs_SOURCE_DIR} 18 | ) 19 | if (NOT EXISTS ${CMAKE_BINARY_DIR}/dr_libs/dr_libs.c) 20 | file(WRITE ${CMAKE_BINARY_DIR}/dr_libs/dr_libs.c 21 | "#define DR_WAV_IMPLEMENTATION\n" 22 | "#define DR_MP3_IMPLEMENTATION\n" 23 | "#define DR_FLAC_IMPLEMENTATION\n" 24 | "#include \"dr_wav.h\"\n" 25 | "#include \"dr_mp3.h\"\n" 26 | "#include \"dr_flac.h\"\n" 27 | ) 28 | endif () 29 | target_sources(dr_libs PRIVATE 30 | ${dr_libs_SOURCE_DIR}/dr_wav.h 31 | ${dr_libs_SOURCE_DIR}/dr_mp3.h 32 | ${dr_libs_SOURCE_DIR}/dr_flac.h 33 | ${CMAKE_BINARY_DIR}/dr_libs/dr_libs.c 34 | ) 35 | set_target_properties(dr_libs PROPERTIES FOLDER external) 36 | endif() 37 | -------------------------------------------------------------------------------- /cmake/import/json.cmake: -------------------------------------------------------------------------------- 1 | # nlohmann json 2 | 3 | CPMAddPackage( 4 | NAME nlohmann_json 5 | VERSION 3.12.0 6 | # !!!警告:不要直接使用 nlohmann json 的 git 仓库,否则下载耗时++++ 7 | #GITHUB_REPOSITORY nlohmann/json 8 | #OPTIONS 9 | #"JSON_BuildTests OFF" 10 | URL https://github.com/nlohmann/json/releases/download/v3.12.0/include.zip 11 | URL_HASH SHA256=B8CB0EF2DD7F57F18933997C9934BB1FA962594F701CD5A8D3C2C80541559372 12 | DOWNLOAD_ONLY YES 13 | ) 14 | 15 | if(nlohmann_json_ADDED) 16 | add_library(nlohmann_json INTERFACE) 17 | add_library(nlohmann_json::nlohmann_json ALIAS nlohmann_json) 18 | target_include_directories(nlohmann_json INTERFACE ${nlohmann_json_SOURCE_DIR}/include) 19 | endif() 20 | -------------------------------------------------------------------------------- /cmake/import/pcg.cmake: -------------------------------------------------------------------------------- 1 | # pcg random 2 | 3 | CPMAddPackage( 4 | NAME pcg_cpp 5 | GITHUB_REPOSITORY imneme/pcg-cpp 6 | GIT_TAG 428802d1a5634f96bcd0705fab379ff0113bcf13 7 | DOWNLOAD_ONLY YES 8 | ) 9 | 10 | if(pcg_cpp_ADDED) 11 | add_library(pcg_cpp INTERFACE) 12 | target_include_directories(pcg_cpp INTERFACE 13 | ${pcg_cpp_SOURCE_DIR}/include 14 | ) 15 | endif() 16 | -------------------------------------------------------------------------------- /cmake/import/pugixml.cmake: -------------------------------------------------------------------------------- 1 | # pugixml 2 | 3 | CPMAddPackage( 4 | NAME pugixml 5 | VERSION 1.15 6 | GITHUB_REPOSITORY zeux/pugixml 7 | DOWNLOAD_ONLY YES 8 | ) 9 | 10 | if(pugixml_ADDED) 11 | # pugixml 提供的 CMake 支持有点脏,我们自己来 12 | add_library(pugixml STATIC) 13 | target_include_directories(pugixml PUBLIC 14 | ${pugixml_SOURCE_DIR}/src 15 | ) 16 | set(pugixml_src 17 | ${pugixml_SOURCE_DIR}/src/pugiconfig.hpp 18 | ${pugixml_SOURCE_DIR}/src/pugixml.hpp 19 | ${pugixml_SOURCE_DIR}/src/pugixml.cpp 20 | ) 21 | source_group(TREE ${pugixml_SOURCE_DIR} FILES ${pugixml_src}) 22 | set(pugixml_natvis 23 | ${pugixml_SOURCE_DIR}/scripts/natvis/pugixml.natvis 24 | ) 25 | source_group(TREE ${pugixml_SOURCE_DIR}/scripts FILES ${pugixml_natvis}) 26 | target_sources(pugixml PUBLIC 27 | ${pugixml_src} 28 | ${pugixml_natvis} 29 | ) 30 | set_target_properties(pugixml PROPERTIES FOLDER external) 31 | endif() 32 | -------------------------------------------------------------------------------- /cmake/import/simdutf.cmake: -------------------------------------------------------------------------------- 1 | # simdutf 2 | 3 | CPMAddPackage( 4 | NAME simdutf 5 | VERSION 6.2.0 6 | URL https://github.com/simdutf/simdutf/releases/download/v6.2.0/singleheader.zip 7 | URL_HASH SHA256=66C85F591133E3BAA23CC441D6E2400DD2C94C4902820734DDBCD9E04DD3988B 8 | DOWNLOAD_ONLY YES 9 | ) 10 | 11 | if (NOT simdutf_ADDED) 12 | message(FATAL_ERROR "simdutf is requied") 13 | endif () 14 | 15 | set(_root ${simdutf_SOURCE_DIR}) 16 | 17 | add_library(simdutf STATIC) 18 | add_library(simdutf::simdutf ALIAS simdutf) 19 | target_compile_features(simdutf PRIVATE c_std_17 cxx_std_20) 20 | target_include_directories(simdutf PUBLIC ${_root}) 21 | target_sources(simdutf PRIVATE ${_root}/simdutf.h ${_root}/simdutf.cpp) 22 | 23 | set_target_properties(simdutf PROPERTIES FOLDER external) 24 | -------------------------------------------------------------------------------- /cmake/import/spdlog.cmake: -------------------------------------------------------------------------------- 1 | # spdlog 2 | 3 | CPMAddPackage( 4 | NAME spdlog 5 | VERSION 1.15.1 6 | GITHUB_REPOSITORY gabime/spdlog 7 | OPTIONS 8 | "SPDLOG_WCHAR_SUPPORT ON" 9 | "SPDLOG_WCHAR_FILENAMES ON" 10 | "SPDLOG_WCHAR_CONSOLE ON" 11 | "SPDLOG_DISABLE_DEFAULT_LOGGER ON" 12 | ) 13 | 14 | if(TARGET spdlog) 15 | if(MSVC) 16 | target_compile_options(spdlog PUBLIC 17 | "/DSPDLOG_SHORT_LEVEL_NAMES={\"V\",\"D\",\"I\",\"W\",\"E\",\"F\",\"O\"}" 18 | ) 19 | endif() 20 | set_target_properties(spdlog PROPERTIES FOLDER external) 21 | endif() 22 | -------------------------------------------------------------------------------- /cmake/import/tinyobjloader.cmake: -------------------------------------------------------------------------------- 1 | # tinyobjloader 2 | 3 | CPMAddPackage( 4 | NAME tinyobjloader 5 | #VERSION 2.0.0 6 | GITHUB_REPOSITORY tinyobjloader/tinyobjloader 7 | GIT_TAG v2.0.0rc13 8 | DOWNLOAD_ONLY YES 9 | ) 10 | 11 | if(tinyobjloader_ADDED) 12 | # tinyobjloader 提供的 CMake 支持有点脏,我们自己来 13 | add_library(tinyobjloader STATIC) 14 | target_include_directories(tinyobjloader PUBLIC 15 | ${tinyobjloader_SOURCE_DIR} 16 | ) 17 | target_sources(tinyobjloader PRIVATE 18 | ${tinyobjloader_SOURCE_DIR}/tiny_obj_loader.h 19 | ${tinyobjloader_SOURCE_DIR}/tiny_obj_loader.cc 20 | ) 21 | set_target_properties(tinyobjloader PROPERTIES FOLDER external) 22 | endif() 23 | -------------------------------------------------------------------------------- /cmake/import/tracy.cmake: -------------------------------------------------------------------------------- 1 | # tracy 2 | 3 | CPMAddPackage( 4 | NAME tracy 5 | VERSION 0.11.1 6 | GITHUB_REPOSITORY wolfpld/tracy 7 | DOWNLOAD_ONLY YES 8 | ) 9 | 10 | if(tracy_ADDED) 11 | add_library(tracy STATIC) 12 | luastg_target_common_options(tracy) 13 | if(LUASTG_LINK_TRACY_CLIENT) 14 | target_compile_definitions(tracy PUBLIC 15 | TRACY_ENABLE 16 | ) 17 | endif() 18 | # WTF ??? 19 | #target_compile_definitions(tracy PUBLIC 20 | # TracyFunction=__FUNCSIG__ 21 | #) 22 | target_include_directories(tracy PUBLIC 23 | ${tracy_SOURCE_DIR}/public 24 | ) 25 | target_sources(tracy PRIVATE 26 | ${tracy_SOURCE_DIR}/public/tracy/Tracy.hpp 27 | ${tracy_SOURCE_DIR}/public/tracy/TracyD3D11.hpp 28 | ${tracy_SOURCE_DIR}/public/TracyClient.cpp 29 | ) 30 | set_target_properties(tracy PROPERTIES FOLDER external) 31 | endif() 32 | -------------------------------------------------------------------------------- /cmake/import/wil.cmake: -------------------------------------------------------------------------------- 1 | # Microsoft.Windows.ImplementationLibrary 2 | 3 | CPMAddPackage( 4 | NAME WIL 5 | VERSION 1.0.240803.1 6 | GITHUB_REPOSITORY microsoft/wil 7 | # 你妈的解压出来的的路径这么长,动不动就超出 Windows 路径长度限制 8 | #URL https://www.nuget.org/api/v2/package/Microsoft.Windows.ImplementationLibrary/1.0.231216.1 9 | #URL_HASH SHA256=5557B5C82D00DB3BD539AA886058475BE552EE09B538CEF87CBCAFF440BAF5E8 10 | DOWNLOAD_ONLY YES 11 | ) 12 | 13 | if(WIL_ADDED) 14 | set(WIL_PACKAGE_NAME Microsoft.Windows.ImplementationLibrary) 15 | set(WIL_PACKAGE_PATH ${WIL_SOURCE_DIR}) 16 | add_library(${WIL_PACKAGE_NAME} INTERFACE) 17 | target_include_directories(${WIL_PACKAGE_NAME} INTERFACE 18 | ${WIL_PACKAGE_PATH}/include 19 | ) 20 | set(WIL_PACKAGE_NATVIS ${WIL_PACKAGE_PATH}/natvis/wil.natvis) 21 | source_group(TREE ${WIL_PACKAGE_PATH} FILES ${WIL_PACKAGE_NATVIS}) 22 | target_sources(${WIL_PACKAGE_NAME} INTERFACE 23 | ${WIL_PACKAGE_NATVIS} 24 | ) 25 | unset(WIL_PACKAGE_NATVIS) 26 | unset(WIL_PACKAGE_NAME) 27 | unset(WIL_PACKAGE_PATH) 28 | else() 29 | message(FATAL_ERROR "Microsoft.Windows.ImplementationLibrary is requied") 30 | endif() 31 | -------------------------------------------------------------------------------- /cmake/import/xxhash.cmake: -------------------------------------------------------------------------------- 1 | # xxhash 2 | 3 | CPMAddPackage( 4 | NAME xxhash 5 | VERSION 0.8.3 6 | GITHUB_REPOSITORY Cyan4973/xxHash 7 | DOWNLOAD_ONLY YES 8 | ) 9 | 10 | if(xxhash_ADDED) 11 | add_library(xxhash STATIC) 12 | set_target_properties(xxhash PROPERTIES 13 | C_STANDARD 17 14 | C_STANDARD_REQUIRED ON 15 | CXX_STANDARD 20 16 | CXX_STANDARD_REQUIRED ON 17 | ) 18 | target_include_directories(xxhash PUBLIC 19 | ${xxhash_SOURCE_DIR} 20 | ) 21 | target_sources(xxhash PRIVATE 22 | ${xxhash_SOURCE_DIR}/xxhash.c 23 | ${xxhash_SOURCE_DIR}/xxhash.h 24 | ) 25 | set_target_properties(xxhash PROPERTIES FOLDER external) 26 | endif() 27 | -------------------------------------------------------------------------------- /cmake/import/yy_thunks.cmake: -------------------------------------------------------------------------------- 1 | # YY-Thunks 2 | # 日你妈的 Windows 7 3 | 4 | CPMAddPackage( 5 | NAME YY_Thunks 6 | VERSION 1.1.4 7 | #GITHUB_REPOSITORY Chuyu-Team/YY-Thunks 8 | URL https://github.com/Chuyu-Team/YY-Thunks/releases/download/v1.1.4/YY-Thunks-1.1.4-Objs.zip 9 | URL_HASH SHA256=F9850A35D1F2B0CAE15E64DA516DE0EC5E798C060B320E91788AA33B853E85BA 10 | DOWNLOAD_ONLY YES 11 | ) 12 | 13 | if(YY_Thunks_ADDED) 14 | add_library(YY_Thunks INTERFACE) 15 | if (CMAKE_SIZEOF_VOID_P EQUAL 8) 16 | target_link_libraries(YY_Thunks INTERFACE 17 | ${YY_Thunks_SOURCE_DIR}/objs/x64/YY_Thunks_for_Win7.obj 18 | ) 19 | else() 20 | target_link_libraries(YY_Thunks INTERFACE 21 | ${YY_Thunks_SOURCE_DIR}/objs/x86/YY_Thunks_for_Win7.obj 22 | ) 23 | endif() 24 | message(STATUS "[LuaSTG] Import: YY_Thunks") 25 | endif() 26 | -------------------------------------------------------------------------------- /cmake/options.cmake: -------------------------------------------------------------------------------- 1 | # utf-8 source files and binary 2 | 3 | add_library(options_compile_utf8 INTERFACE) 4 | if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") 5 | target_compile_options(options_compile_utf8 INTERFACE "/utf-8") 6 | endif () 7 | -------------------------------------------------------------------------------- /data/example/.gitignore: -------------------------------------------------------------------------------- 1 | # local data 2 | 3 | /engine.log 4 | /imgui.ini 5 | /userdata/** 6 | 7 | # workspace 8 | 9 | !/example.code-workspace 10 | !/.vscode/settings.json 11 | -------------------------------------------------------------------------------- /data/example/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Lua.workspace.library": [ 3 | "../../doc" 4 | ] 5 | } -------------------------------------------------------------------------------- /data/example/assets/texture/white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/data/example/assets/texture/white.png -------------------------------------------------------------------------------- /data/example/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "file_system": { 3 | "resources": [ 4 | { 5 | "name": "scripts", 6 | "type": "directory", 7 | "path": "scripts/" 8 | } 9 | ], 10 | "user": "userdata/" 11 | }, 12 | "graphics_system": { 13 | "allow_software_device": true 14 | } 15 | } -------------------------------------------------------------------------------- /data/example/example.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | }, 6 | { 7 | "path": "../../doc" 8 | } 9 | ], 10 | "settings": { 11 | "Lua.runtime.version": "LuaJIT" 12 | } 13 | } -------------------------------------------------------------------------------- /data/example/scripts/task/init.lua: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- 2 | --- lua coroutine wrapper 3 | --- by 璀境石 4 | -------------------------------------------------------------------------------- 5 | 6 | ---@class task 7 | local task = {} 8 | 9 | ---@param frames integer 10 | function task.wait(frames) 11 | for _ = 1, frames do 12 | coroutine.yield() 13 | end 14 | end 15 | 16 | return task 17 | -------------------------------------------------------------------------------- /data/example/使用说明.txt: -------------------------------------------------------------------------------- 1 | 《使用说明》 2 | 3 | 注意:如果不知道这是什么,请下载 LuaSTG After Ex Plus! 4 | 提示:使用 LuaSTG After Ex Plus 开发框架和 LuaSTG Editor Sharp 编辑器制作东方风弹幕作品。 5 | 6 | 该文件夹中包含以下内容: 7 | 8 | 1、LuaSTG Sub 引擎程序文件 9 | 2、LuaSTG Sub 引擎 API 文档和更新日志 10 | 3、LuaSTG Sub 引擎以及第三方库的开放源代码协议 11 | 4、示例程序脚本,运行 LuaSTGSub.exe 后可见“海内存知己 天涯若比邻 欢迎来到 LuaSTG Sub” 12 | 13 | 以上内容均由 LuaSTG Sub 引擎源代码编译得到。 14 | 15 | LuaSTG Sub 引擎源代码仓库地址: 16 | 17 | 1、GitHub(国外平台,可能难以打开):https://github.com/Legacy-LuaSTG-Engine/LuaSTG-Sub 18 | 2、Gitee(码云):https://gitee.com/LuaSTG-Community/LuaSTG-Sub 19 | 20 | LuaSTG After Ex Plus 开发框架源代码仓库地址: 21 | 22 | 1、GitHub(国外平台,可能难以打开):https://github.com/Legacy-LuaSTG-Engine/Bundle-After-Ex-Plus 23 | 24 | LuaSTG Editor Sharp 编辑器源代码仓库地址: 25 | 26 | 1、GitHub(国外平台,可能难以打开):https://github.com/czh098tom/LuaSTG-Editor-Sharp 27 | 28 | LuaSTG Sub 引擎、LuaSTG After Ex Plus 开发框架、LuaSTG Editor Sharp 编辑器下载地址: 29 | 30 | 1、OneDrive 网盘(国外平台,可能难以打开):https://files.luastg-sub.com 31 | 2、百度网盘(提取码9961):https://pan.baidu.com/share/init?surl=usZgDH3k8VBM6KcEkhBFNg&pwd=9961 32 | 3、LuaSTG交流群(QQ群,主群):230927410 33 | 4、LuaSTG寒流群(QQ群,二群):563868788 34 | 5、LuaSTG直流群(QQ群,仅存放文件):673067136 35 | -------------------------------------------------------------------------------- /data/license/CPM.cmake/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019-2022 Lars Melchior and contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /data/license/Dear_ImGui/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2023 Omar Cornut 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /data/license/DirectXTK/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /data/license/DirectXTex/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /data/license/LuaSTG_Sub/License.txt: -------------------------------------------------------------------------------- 1 | Copyright © 2020-2025 璀境石 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /data/license/Microsoft.Windows.ImplementationLibrary/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /data/license/dr_libs/LICENSE: -------------------------------------------------------------------------------- 1 | MIT No Attribution 2 | 3 | Copyright 2020 David Reid 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | of the Software, and to permit persons to whom the Software is furnished to do 10 | so. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 15 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 18 | SOFTWARE. 19 | -------------------------------------------------------------------------------- /data/license/fmtlib/LICENSE.rst: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 - present, Victor Zverovich and {fmt} contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | --- Optional exception to the license --- 23 | 24 | As an exception, if, as a result of your compiling your source code, portions 25 | of this Software are embedded into a machine-executable object form of such 26 | source code, you may redistribute such embedded portions in such object form 27 | without including the above copyright and permission notices. 28 | -------------------------------------------------------------------------------- /data/license/imneme_pcg_cpp/LICENSE-MIT.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2017 Melissa O'Neill and PCG Project contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /data/license/implot/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Evan Pezent 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /data/license/lstg_XMath/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Xrysnow 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /data/license/lua_cjson/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2012 Mark Pulford 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /data/license/luasocket/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2004-2022 Diego Nehab 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and associated documentation files (the "Software"), 5 | to deal in the Software without restriction, including without limitation 6 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | and/or sell copies of the Software, and to permit persons to whom the 8 | Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | DEALINGS IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /data/license/minizip_ng/LICENSE: -------------------------------------------------------------------------------- 1 | Condition of use and distribution are the same as zlib: 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgement in the product documentation would be 14 | appreciated but is not required. 15 | 2. Altered source versions must be plainly marked as such, and must not be 16 | misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. 18 | -------------------------------------------------------------------------------- /data/license/nlohmann_json/LICENSE.MIT: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-2022 Niels Lohmann 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /data/license/nothings_stb/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Sean Barrett 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 9 | of the Software, and to permit persons to whom the Software is furnished to do 10 | so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /data/license/phoboslab_qoi/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Dominic Szablewski 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /data/license/pugixml/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2006-2022 Arseny Kapoulkine 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the "Software"), to deal in the Software without 8 | restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the 11 | Software is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice shall be 15 | included in all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 | OTHER DEALINGS IN THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /data/license/simdutf/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright 2021 The simdutf authors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /data/license/spdlog/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Gabi Melman. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | -- NOTE: Third party dependency used by this software -- 24 | This software depends on the fmt lib (MIT License), 25 | and users must comply to its license: https://github.com/fmtlib/fmt/blob/master/LICENSE.rst 26 | -------------------------------------------------------------------------------- /data/license/tinygltf/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Syoyo Fujita, Aurélien Chatelain and many contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /data/license/xxhash/LICENSE: -------------------------------------------------------------------------------- 1 | xxHash Library 2 | Copyright (c) 2012-2021 Yann Collet 3 | All rights reserved. 4 | 5 | BSD 2-Clause License (https://www.opensource.org/licenses/bsd-license.php) 6 | 7 | Redistribution and use in source and binary forms, with or without modification, 8 | are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright notice, this 14 | list of conditions and the following disclaimer in the documentation and/or 15 | other materials provided with the distribution. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 21 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 24 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /data/license/zlib_ng/LICENSE.md: -------------------------------------------------------------------------------- 1 | (C) 1995-2013 Jean-loup Gailly and Mark Adler 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 16 | 2. Altered source versions must be plainly marked as such, and must not be 17 | misrepresented as being the original software. 18 | 19 | 3. This notice may not be removed or altered from any source distribution. 20 | -------------------------------------------------------------------------------- /data/test/.gitignore: -------------------------------------------------------------------------------- 1 | /engine.log 2 | /res/model/* 3 | /userdata 4 | -------------------------------------------------------------------------------- /data/test/assets/alpha.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/data/test/assets/alpha.zip -------------------------------------------------------------------------------- /data/test/assets/alpha.zip.password.txt: -------------------------------------------------------------------------------- 1 | password -------------------------------------------------------------------------------- /data/test/assets/alpha/alpha.lua: -------------------------------------------------------------------------------- 1 | print("alpha") 2 | -------------------------------------------------------------------------------- /data/test/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "file_system": { 3 | "resources": [ 4 | { 5 | "name": "sample-scripts", 6 | "type": "directory", 7 | "path": "../example/scripts/" 8 | }, 9 | { 10 | "name": "scripts", 11 | "type": "directory", 12 | "path": "scripts/" 13 | } 14 | ], 15 | "user": "userdata/" 16 | }, 17 | "graphics_system": { 18 | "allow_software_device": true 19 | } 20 | } -------------------------------------------------------------------------------- /data/test/deep/res/se_ok00.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/data/test/deep/res/se_ok00.wav -------------------------------------------------------------------------------- /data/test/deep/res/se_ok00.wav.readme.md: -------------------------------------------------------------------------------- 1 | # 关于这个文件 2 | 3 | 这是一个损坏的 wav 文件,它的 `fmt ` 块的内容如下: 4 | 5 | | field | content | description | 6 | |:--------------------:|:-------:|:------------------------------------:| 7 | | chunk id | "fmt " | | 8 | | chunk size | 18 | | 9 | | format tag | 1 | PCM | 10 | | channels | 1 | | 11 | | sample rate | 22050 | | 12 | | AVG bytes per sample | 44100 | = (block align) * (sample rate) | 13 | | block align | 2 | = (channels) * (bits per sample) / 8 | 14 | | bits per sample | 16 | | 15 | | extended data size | 24932 | | 16 | 17 | 可以发现 `extended data size` 的值为 24932,理论上后续应该还有其他拓展内容,但实际上紧接着下一个块就是 `data`,也就是音频数据。 18 | 19 | ``` 20 | Address 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 21 | 22 | 00000000 52 49 46 46 C2 2D 00 00 57 41 56 45 66 6D 74 20 RIFF.-.. WAVEfmt 23 | 00000010 12 00 00 00 01 00 01 00 22 56 00 00 44 AC 00 00 ........ "V..D... 24 | 00000020 02 00 10 00 64 61 64 61 74 61 9C 2D 00 00 23 00 ....dada ta.-..#. 25 | ``` 26 | 27 | 这会导致一些软件无法解析该文件。 28 | 29 | 要修复该文件,只需要将 `extended data size` 的值设为 0 并保存即可(地址:00000024 到 00000025)。 30 | -------------------------------------------------------------------------------- /data/test/deep/res/se_ok00_fixed.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/data/test/deep/res/se_ok00_fixed.wav -------------------------------------------------------------------------------- /data/test/res/audio/啊!.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/data/test/res/audio/啊!.wav -------------------------------------------------------------------------------- /data/test/res/blend_color_burn.hlsl: -------------------------------------------------------------------------------- 1 | #include "res/shared.hlsli" 2 | #include "res/blend_shared.hlsli" 3 | 4 | //cbuffer g_buffer : register(b0) 5 | //{ 6 | // float2 g_render_target_size; 7 | // float4 g_viewport; 8 | //}; 9 | 10 | Texture2D g_render_target : register(t0); 11 | SamplerState g_render_target_sampler : register(s0); 12 | 13 | Texture2D g_texture : register(t1); 14 | SamplerState g_texture_sampler : register(s1); 15 | 16 | static const float _1_2dot2 = 1.0f / 2.2f; 17 | 18 | PS_Output main(PS_Input input) 19 | { 20 | //float2 xy = input.uv * g_render_target_size; 21 | //if (xy.x < g_viewport.x || xy.y < g_viewport.y || xy.x > g_viewport.z || xy.y > g_viewport.w) 22 | //{ 23 | // discard; 24 | //} 25 | 26 | float4 bottom_color = g_render_target.Sample(g_render_target_sampler, input.uv); 27 | //bottom_color.rgb = pow(bottom_color.rgb, _1_2dot2); 28 | float4 top_color = g_texture.Sample(g_texture_sampler, input.uv); 29 | //top_color.rgb = pow(top_color.rgb, _1_2dot2); 30 | 31 | float4 final_color = float4(color_burn(bottom_color.rgb, top_color.rgb), 1.0f); 32 | //final_color.rgb = pow(final_color.rgb, 2.2f); 33 | 34 | PS_Output output; 35 | output.col = final_color; 36 | return output; 37 | } 38 | -------------------------------------------------------------------------------- /data/test/res/blend_color_dodge.hlsl: -------------------------------------------------------------------------------- 1 | #include "res/shared.hlsli" 2 | #include "res/blend_shared.hlsli" 3 | 4 | //cbuffer g_buffer : register(b0) 5 | //{ 6 | // float2 g_render_target_size; 7 | // float4 g_viewport; 8 | //}; 9 | 10 | Texture2D g_render_target : register(t0); 11 | SamplerState g_render_target_sampler : register(s0); 12 | 13 | Texture2D g_texture : register(t1); 14 | SamplerState g_texture_sampler : register(s1); 15 | 16 | static const float _1_2dot2 = 1.0f / 2.2f; 17 | 18 | PS_Output main(PS_Input input) 19 | { 20 | //float2 xy = input.uv * g_render_target_size; 21 | //if (xy.x < g_viewport.x || xy.y < g_viewport.y || xy.x > g_viewport.z || xy.y > g_viewport.w) 22 | //{ 23 | // discard; 24 | //} 25 | 26 | float4 bottom_color = g_render_target.Sample(g_render_target_sampler, input.uv); 27 | //bottom_color.rgb = pow(bottom_color.rgb, _1_2dot2); 28 | float4 top_color = g_texture.Sample(g_texture_sampler, input.uv); 29 | //top_color.rgb = pow(top_color.rgb, _1_2dot2); 30 | 31 | float4 final_color = float4(color_dodge(bottom_color.rgb, top_color.rgb), 1.0f); 32 | //final_color.rgb = pow(final_color.rgb, 2.2f); 33 | 34 | PS_Output output; 35 | output.col = final_color; 36 | return output; 37 | } 38 | -------------------------------------------------------------------------------- /data/test/res/blend_shared.hlsli: -------------------------------------------------------------------------------- 1 | // color burn 2 | // color dodge 3 | 4 | static const float _1_255 = 1.0f / 255.0f; 5 | 6 | float color_burn_single_channel(float bottom_color, float top_color) 7 | { 8 | if (top_color < _1_255) 9 | { 10 | return 0.0f; 11 | } 12 | else 13 | { 14 | return 1.0f - clamp((1.0f - bottom_color) / top_color, 0.0f, 1.0f); 15 | } 16 | } 17 | 18 | float3 color_burn(float3 bottom_color, float3 top_color) 19 | { 20 | float3 color; 21 | color.r = color_burn_single_channel(bottom_color.r, top_color.r); 22 | color.g = color_burn_single_channel(bottom_color.g, top_color.g); 23 | color.b = color_burn_single_channel(bottom_color.b, top_color.b); 24 | return color; 25 | } 26 | 27 | float color_dodge_single_channel(float bottom_color, float top_color) 28 | { 29 | if ((1.0f - top_color) < _1_255) 30 | { 31 | return 0.0f; 32 | } 33 | else 34 | { 35 | return clamp(bottom_color / (1.0f - top_color), 0.0f, 1.0f); 36 | } 37 | } 38 | 39 | float3 color_dodge(float3 bottom_color, float3 top_color) 40 | { 41 | float3 color; 42 | color.r = color_dodge_single_channel(bottom_color.r, top_color.r); 43 | color.g = color_dodge_single_channel(bottom_color.g, top_color.g); 44 | color.b = color_dodge_single_channel(bottom_color.b, top_color.b); 45 | return color; 46 | } 47 | -------------------------------------------------------------------------------- /data/test/res/block.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/data/test/res/block.png -------------------------------------------------------------------------------- /data/test/res/block.qoi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/data/test/res/block.qoi -------------------------------------------------------------------------------- /data/test/res/f2dfont.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/data/test/res/f2dfont.png -------------------------------------------------------------------------------- /data/test/res/f2dfont.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /data/test/res/ghost_fire_1.psi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/data/test/res/ghost_fire_1.psi -------------------------------------------------------------------------------- /data/test/res/hgefont.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/data/test/res/hgefont.png -------------------------------------------------------------------------------- /data/test/res/image_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/data/test/res/image_1.png -------------------------------------------------------------------------------- /data/test/res/image_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/data/test/res/image_2.jpg -------------------------------------------------------------------------------- /data/test/res/linear.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:85b39258911462edf307c49ac654014e6f62b4a42b5bbc0ab545897f5583ffd4 3 | size 439073 4 | -------------------------------------------------------------------------------- /data/test/res/mask_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/data/test/res/mask_1.png -------------------------------------------------------------------------------- /data/test/res/particles.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:76f0b6905f9a2f5a1d1a00730778486d24bdee1974e88ffa974dabffaa1777f9 3 | size 11270 4 | -------------------------------------------------------------------------------- /data/test/res/rgb_select.hlsl: -------------------------------------------------------------------------------- 1 | // 引擎设置的参数,不可修改 2 | 3 | SamplerState screen_texture_sampler : register(s4); // RenderTarget 纹理的采样器 4 | Texture2D screen_texture : register(t4); // RenderTarget 纹理 5 | cbuffer engine_data : register(b1) 6 | { 7 | float4 screen_texture_size; // 纹理大小 8 | float4 viewport; // 视口 9 | }; 10 | 11 | // 用户传递的浮点参数 12 | // 由多个 float4 组成,且 float4 是最小单元,最多可传递 8 个 float4 13 | 14 | cbuffer user_data : register(b0) 15 | { 16 | float4 user_data_0; 17 | }; 18 | 19 | // 为了方便使用,可以定义一些宏 20 | 21 | #define channel_factor (user_data_0) 22 | 23 | // 主函数 24 | 25 | struct PS_Input 26 | { 27 | float4 sxy : SV_Position; 28 | float2 uv : TEXCOORD0; 29 | float4 col : COLOR0; 30 | }; 31 | struct PS_Output 32 | { 33 | float4 col : SV_Target; 34 | }; 35 | 36 | PS_Output main(PS_Input input) 37 | { 38 | float4 tex_col = screen_texture.Sample(screen_texture_sampler, input.uv); 39 | float value = dot(tex_col.rgb, channel_factor.rgb); 40 | tex_col.r = value; 41 | tex_col.g = value; 42 | tex_col.b = value; 43 | 44 | PS_Output output; 45 | output.col = tex_col; 46 | return output; 47 | } 48 | -------------------------------------------------------------------------------- /data/test/res/rgb_select_new.hlsl: -------------------------------------------------------------------------------- 1 | // 引擎设置的参数,不可修改 2 | 3 | SamplerState screen_texture_sampler : register(s4); // RenderTarget 纹理的采样器 4 | Texture2D screen_texture : register(t4); // RenderTarget 纹理 5 | cbuffer engine_data : register(b1) 6 | { 7 | float4 screen_texture_size; // 纹理大小 8 | float4 viewport; // 视口 9 | }; 10 | 11 | // 用户传递的浮点参数 12 | 13 | cbuffer user_data : register(b0) 14 | { 15 | float4 channel_factor; 16 | }; 17 | 18 | // 用户传递的纹理参数 19 | 20 | //SamplerState screen_texture_sampler2 : register(s0); 21 | //Texture2D screen_texture2 : register(t0); 22 | 23 | // 主函数 24 | 25 | struct PS_Input 26 | { 27 | float4 sxy : SV_Position; 28 | float2 uv : TEXCOORD0; 29 | float4 col : COLOR0; 30 | }; 31 | struct PS_Output 32 | { 33 | float4 col : SV_Target; 34 | }; 35 | 36 | PS_Output main(PS_Input input) 37 | { 38 | float4 tex_col = screen_texture.Sample(screen_texture_sampler, input.uv); 39 | float value = dot(tex_col.rgb, channel_factor.rgb); 40 | tex_col.r = value; 41 | tex_col.g = value; 42 | tex_col.b = value; 43 | 44 | PS_Output output; 45 | output.col = tex_col; 46 | return output; 47 | } 48 | -------------------------------------------------------------------------------- /data/test/res/sRGB.png: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:425ce34a57b18bea52cdaa48afcfd7873e5c497194a3867beaa47b1768e99653 3 | size 439114 4 | -------------------------------------------------------------------------------- /data/test/res/shader_mask.hlsl: -------------------------------------------------------------------------------- 1 | #include "res/shared.hlsli" 2 | 3 | Texture2D g_texture : register(t0); 4 | SamplerState g_texture_sampler : register(s0); 5 | 6 | Texture2D g_render_target : register(t1); 7 | SamplerState g_render_target_sampler : register(s1); 8 | 9 | cbuffer g_buffer : register(b0) 10 | { 11 | float2 g_render_target_size; 12 | float4 g_viewport; 13 | }; 14 | 15 | PS_Output main(PS_Input input) 16 | { 17 | float2 xy = input.uv * g_render_target_size; 18 | if (xy.x < g_viewport.x || xy.y < g_viewport.y || xy.x > g_viewport.z || xy.y > g_viewport.w) 19 | { 20 | discard; 21 | } 22 | 23 | float4 color_mask = g_texture.Sample(g_texture_sampler, input.uv); 24 | float mask_value = (color_mask.r + color_mask.g + color_mask.b) / 3.0f; 25 | float4 color_buffer = g_render_target.Sample(g_render_target_sampler, input.uv); 26 | float4 color = color_buffer * float4(mask_value, mask_value, mask_value, mask_value); 27 | 28 | PS_Output output; 29 | output.col = color; 30 | return output; 31 | } 32 | -------------------------------------------------------------------------------- /data/test/res/shared.hlsli: -------------------------------------------------------------------------------- 1 | 2 | struct PS_Input 3 | { 4 | float4 pos : SV_Position; 5 | float2 uv : TEXCOORD0; 6 | float4 col : COLOR0; 7 | }; 8 | 9 | struct PS_Output 10 | { 11 | float4 col : SV_Target; 12 | }; 13 | -------------------------------------------------------------------------------- /data/test/res/素材备忘录.txt: -------------------------------------------------------------------------------- 1 | Tseum https://space.bilibili.com/445523424/ 2 | image_1.png https://www.bilibili.com/opus/717675119652110422 3 | 燃烧的基毛 https://space.bilibili.com/4267021/ 4 | image_2.jpg https://www.bilibili.com/opus/722683124539981824 5 | -------------------------------------------------------------------------------- /data/test/sampler/res/white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/data/test/sampler/res/white.png -------------------------------------------------------------------------------- /data/test/scripts/mod/test.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/data/test/scripts/mod/test.lua -------------------------------------------------------------------------------- /data/test/scripts/scripts/bad.lua.txt: -------------------------------------------------------------------------------- 1 | do 2 | print("hello") 3 | -------------------------------------------------------------------------------- /data/test/scripts/test/audio/SoundEffect.lua: -------------------------------------------------------------------------------- 1 | local test = require("test") 2 | local imgui = require("imgui") 3 | 4 | ---@class test.audio.SoundEffect : test.Base 5 | local M = {} 6 | 7 | function M:onCreate() 8 | local old = lstg.GetResourceStatus() 9 | lstg.SetResourceStatus("global") 10 | lstg.LoadSound("啊!", "res/audio/啊!.wav") 11 | lstg.SetResourceStatus(old) 12 | end 13 | 14 | function M:onDestroy() 15 | lstg.RemoveResource("global", 5, "啊!") 16 | end 17 | 18 | function M:onUpdate() 19 | ---@diagnostic disable-next-line: undefined-field 20 | local ImGui = imgui.ImGui 21 | if ImGui.Begin("Audio: Sound Effect") then 22 | ImGui.Text(("SE State: %s"):format(lstg.GetSoundState("啊!"))) 23 | if ImGui.Button("Play") then 24 | lstg.PlaySound("啊!") 25 | end 26 | if ImGui.Button("Pause") then 27 | lstg.PauseSound("啊!") 28 | end 29 | if ImGui.Button("Resume") then 30 | lstg.ResumeSound("啊!") 31 | end 32 | if ImGui.Button("Stop") then 33 | lstg.StopSound("啊!") 34 | end 35 | end 36 | ImGui.End() 37 | end 38 | 39 | function M:onRender() 40 | end 41 | 42 | test.registerTest("test.audio.SoundEffect", M, "Audio: Sound Effect") 43 | -------------------------------------------------------------------------------- /data/test/scripts/test/audio/init.lua: -------------------------------------------------------------------------------- 1 | require("test.audio.SoundEffect") 2 | -------------------------------------------------------------------------------- /data/test/scripts/test/file/FileSystemArchive.lua: -------------------------------------------------------------------------------- 1 | local test = require("test") 2 | local imgui = require("imgui") 3 | 4 | local TEST_NAME = "File: FileSystemArchive" 5 | 6 | ---@class test.file.FileSystemArchive : test.Base 7 | local M = {} 8 | 9 | function M:onCreate() 10 | lstg.LoadPackSub("assets/alpha.zip") 11 | lstg.DoFile("alpha/alpha.lua", "assets/alpha.zip") 12 | end 13 | 14 | function M:onDestroy() 15 | end 16 | 17 | function M:onUpdate() 18 | end 19 | 20 | function M:onRender() 21 | end 22 | 23 | test.registerTest("test.file.FileSystemArchive", M, TEST_NAME) 24 | -------------------------------------------------------------------------------- /data/test/scripts/test/file/init.lua: -------------------------------------------------------------------------------- 1 | require("test.file.FileSystemWatcher") 2 | require("test.file.FileSystemArchive") 3 | -------------------------------------------------------------------------------- /data/test/scripts/test/gameplay/init.lua: -------------------------------------------------------------------------------- 1 | require("test.gameplay.GameObjectUpdate") -------------------------------------------------------------------------------- /data/test/scripts/test/graphics/Texture2D.lua: -------------------------------------------------------------------------------- 1 | local test = require("test") 2 | local imgui = require("imgui") 3 | local Texture2D = require("lstg.Texture2D") 4 | 5 | ---@class test.graphics.Texture2D : test.Base 6 | local M = {} 7 | 8 | function M:onCreate() 9 | self.texture = Texture2D.createFromFile("res/image_1.png") 10 | end 11 | 12 | function M:onDestroy() 13 | end 14 | 15 | function M:onUpdate() 16 | ---@diagnostic disable-next-line: undefined-field 17 | local ImGui = imgui.ImGui 18 | if ImGui.Begin("Graphics: Texture2D") then 19 | local width, height = self.texture:getWidth(), self.texture:getHeight() 20 | ImGui.Text(("size: %d x %d"):format(width, height)) 21 | end 22 | ImGui.End() 23 | end 24 | 25 | function M:onRender() 26 | end 27 | 28 | test.registerTest("test.graphics.Texture2D", M, "Graphics: Texture2D") 29 | -------------------------------------------------------------------------------- /data/test/scripts/test/graphics/init.lua: -------------------------------------------------------------------------------- 1 | require("test.graphics.Texture2D") 2 | require("test.graphics.SpriteRenderer") 3 | require("test.graphics.Mesh") 4 | require("test.graphics.MeshRenderer") 5 | -------------------------------------------------------------------------------- /data/test/scripts/test/imgui/ImVec2.lua: -------------------------------------------------------------------------------- 1 | local imgui = require("imgui") 2 | 3 | local v1 = imgui.ImVec2(); 4 | assert(v1.x == 0.0) 5 | assert(v1.y == 0.0) 6 | 7 | local v2 = imgui.ImVec2(114.514, 19.19) 8 | assert(math.abs(v2.x - 114.514) < 0.00001) 9 | assert(math.abs(v2.y - 19.19) < 0.00001) 10 | 11 | local v3 = imgui.ImVec2() 12 | v3.x = 114.514 13 | v3.y = 19.19 14 | assert(math.abs(v3.x - 114.514) < 0.00001) 15 | assert(math.abs(v3.y - 19.19) < 0.00001) 16 | assert(v1 ~= v3) 17 | assert(v2 == v3) 18 | 19 | assert(v1 ~= nil) 20 | assert(nil ~= v1) 21 | assert(v1 ~= false) 22 | assert(false ~= v1) 23 | assert(v1 ~= 0) 24 | assert(0 ~= v1) 25 | assert(v1 ~= "0") 26 | assert("0" ~= v1) 27 | assert(v1 ~= {}) 28 | assert({} ~= v1) 29 | -------------------------------------------------------------------------------- /data/test/scripts/test/imgui/ImVec4.lua: -------------------------------------------------------------------------------- 1 | local imgui = require("imgui") 2 | 3 | local v1 = imgui.ImVec4(); 4 | assert(v1.x == 0.0) 5 | assert(v1.y == 0.0) 6 | assert(v1.z == 0.0) 7 | assert(v1.w == 0.0) 8 | 9 | local v2 = imgui.ImVec4(114.514, 19.19, 1.0, 2.0) 10 | assert(math.abs(v2.x - 114.514) < 0.00001) 11 | assert(math.abs(v2.y - 19.19) < 0.00001) 12 | assert(math.abs(v2.z - 1.0) < 0.00001) 13 | assert(math.abs(v2.w - 2.0) < 0.00001) 14 | 15 | local v3 = imgui.ImVec4() 16 | v3.x = 114.514 17 | v3.y = 19.19 18 | v3.z = 1.0 19 | v3.w = 2.0 20 | assert(math.abs(v3.x - 114.514) < 0.00001) 21 | assert(math.abs(v3.y - 19.19) < 0.00001) 22 | assert(math.abs(v3.z - 1.0) < 0.00001) 23 | assert(math.abs(v3.w - 2.0) < 0.00001) 24 | assert(v1 ~= v3) 25 | assert(v2 == v3) 26 | 27 | assert(v1 ~= nil) 28 | assert(nil ~= v1) 29 | assert(v1 ~= false) 30 | assert(false ~= v1) 31 | assert(v1 ~= 0) 32 | assert(0 ~= v1) 33 | assert(v1 ~= "0") 34 | assert("0" ~= v1) 35 | assert(v1 ~= {}) 36 | assert({} ~= v1) 37 | -------------------------------------------------------------------------------- /data/test/scripts/test/imgui/init.lua: -------------------------------------------------------------------------------- 1 | require("test.imgui.ImVec2") 2 | require("test.imgui.ImVec4") 3 | -------------------------------------------------------------------------------- /data/test/scripts/test/input/init.lua: -------------------------------------------------------------------------------- 1 | require("test.input.Clipboard") 2 | require("test.input.InputMethod") 3 | -------------------------------------------------------------------------------- /data/test/scripts/test/math/init.lua: -------------------------------------------------------------------------------- 1 | require("test.math.Vector") -------------------------------------------------------------------------------- /data/test/scripts/test_bad_lua.lua: -------------------------------------------------------------------------------- 1 | local t = coroutine.create(function() 2 | --lstg.DoFile("src/scripts/bad.lua.txt") 3 | dofile("src/scripts/bad.lua.txt") 4 | end) 5 | local b, e = coroutine.resume(t) 6 | if not b then 7 | error(e .. debug.traceback(t)) 8 | end 9 | -------------------------------------------------------------------------------- /data/test/scripts/test_f2dfont.lua: -------------------------------------------------------------------------------- 1 | local test = require("test") 2 | 3 | ---@class test.Module.Fancy2DFont : test.Base 4 | local M = {} 5 | 6 | function M:onCreate() 7 | local old_pool = lstg.GetResourceStatus() 8 | lstg.SetResourceStatus("global") 9 | 10 | lstg.LoadFont("f2dfont:f2dfont", "res/f2dfont.xml", "res/f2dfont.png", false) 11 | 12 | lstg.SetResourceStatus(old_pool) 13 | end 14 | 15 | function M:onDestroy() 16 | lstg.RemoveResource("global", 7, "f2dfont:f2dfont") 17 | end 18 | 19 | function M:onUpdate() 20 | end 21 | 22 | function M:onRender() 23 | window:applyCameraV() 24 | lstg.RenderText("f2dfont:f2dfont", "114514AABB", window.width / 2, window.height / 2, 1, 0 + 0) 25 | end 26 | 27 | test.registerTest("test.Module.Fancy2DFont", M) 28 | -------------------------------------------------------------------------------- /data/test/scripts/test_filesys.lua: -------------------------------------------------------------------------------- 1 | local test = require("test") 2 | 3 | ---@class test.Module.FileSystem : test.Base 4 | local M = {} 5 | 6 | function M:onCreate() 7 | local list = lstg.FileManager.EnumFiles("src/") 8 | for _, v in ipairs(list) do 9 | lstg.Print(v[1], v[2]) 10 | end 11 | end 12 | 13 | function M:onDestroy() 14 | end 15 | 16 | function M:onUpdate() 17 | end 18 | 19 | function M:onRender() 20 | end 21 | 22 | test.registerTest("test.Module.FileSystem", M) 23 | -------------------------------------------------------------------------------- /data/test/scripts/test_hgefont.lua: -------------------------------------------------------------------------------- 1 | local test = require("test") 2 | 3 | ---@class test.Module.HGEFont : test.Base 4 | local M = {} 5 | 6 | function M:onCreate() 7 | local old_pool = lstg.GetResourceStatus() 8 | lstg.SetResourceStatus("global") 9 | 10 | lstg.LoadFont("hgefont:hgefont", "res/hgefont.fnt", false) 11 | 12 | lstg.SetResourceStatus(old_pool) 13 | end 14 | 15 | function M:onDestroy() 16 | lstg.RemoveResource("global", 7, "hgefont:hgefont") 17 | end 18 | 19 | function M:onUpdate() 20 | end 21 | 22 | function M:onRender() 23 | window:applyCameraV() 24 | lstg.RenderText("hgefont:hgefont", "114514AABB", window.width / 2, window.height / 2, 1, 0 + 0) 25 | end 26 | 27 | test.registerTest("test.Module.HGEFont", M) 28 | -------------------------------------------------------------------------------- /data/test/scripts/test_log.lua: -------------------------------------------------------------------------------- 1 | local test = require("test") 2 | 3 | ---@class test.Module.Log : test.Base 4 | local M = {} 5 | 6 | function M:onCreate() 7 | lstg.SystemLog("aaaa sss") 8 | lstg.Print(1, 2, 3, true, false, "hhhh", "xxxx", nil, 1, nil, 2) 9 | print("a", 1, 2, 3, true, false, "hhhh", "xxxx", nil, 1, nil, 2) 10 | end 11 | 12 | function M:onDestroy() 13 | end 14 | 15 | function M:onUpdate() 16 | end 17 | 18 | function M:onRender() 19 | end 20 | 21 | test.registerTest("test.Module.Log", M) 22 | -------------------------------------------------------------------------------- /data/test/scripts/test_rendertarget.lua: -------------------------------------------------------------------------------- 1 | local test = require("test") 2 | 3 | ---@class test.Module.RenderTarget : test.Base 4 | local M = {} 5 | 6 | function M:onCreate() 7 | local old_pool = lstg.GetResourceStatus() 8 | lstg.SetResourceStatus("global") 9 | lstg.CreateRenderTarget("rt:test1") 10 | lstg.CreateRenderTarget("rt:test2") 11 | lstg.SetResourceStatus(old_pool) 12 | self.press_key = false 13 | end 14 | 15 | function M:onDestroy() 16 | lstg.RemoveResource("global", 1, "rt:test1") 17 | lstg.RemoveResource("global", 1, "rt:test2") 18 | end 19 | 20 | function M:onUpdate() 21 | local Keyboard = lstg.Input.Keyboard 22 | if not self.press_key then 23 | if Keyboard.GetKeyState(Keyboard.D1) then 24 | window:setSize(1280, 720) 25 | self.press_key = true 26 | elseif Keyboard.GetKeyState(Keyboard.D2) then 27 | window:setSize(1920, 1080) 28 | self.press_key = true 29 | end 30 | else 31 | if not Keyboard.GetKeyState(Keyboard.D1) and not Keyboard.GetKeyState(Keyboard.D2) then 32 | self.press_key = false 33 | end 34 | end 35 | end 36 | 37 | function M:onRender() 38 | end 39 | 40 | test.registerTest("test.Module.RenderTarget", M) 41 | -------------------------------------------------------------------------------- /data/test/scripts/test_sampler.lua: -------------------------------------------------------------------------------- 1 | local test = require("test") 2 | 3 | ---@class test.Module.Sampler : test.Base 4 | local M = {} 5 | 6 | function M:onCreate() 7 | local old_pool = lstg.GetResourceStatus() 8 | lstg.SetResourceStatus("global") 9 | 10 | lstg.LoadTexture("tex:block", "res/block.png") 11 | lstg.SetTextureSamplerState("tex:block", "linear+wrap") 12 | 13 | lstg.SetResourceStatus(old_pool) 14 | 15 | self.timer = 0 16 | end 17 | 18 | function M:onDestroy() 19 | lstg.RemoveResource("global", 1, "tex:block") 20 | end 21 | 22 | function M:onUpdate() 23 | self.timer = self.timer + 1 24 | end 25 | 26 | function M:onRender() 27 | window:applyCameraV() 28 | local cx, cy = window.width / 2, window.height / 2 29 | local cc = lstg.Color(255, 255, 255, 255) 30 | local dt = self.timer 31 | lstg.RenderTexture("tex:block", "", 32 | { cx - 256.0, cy + 256.0, 0.5, 0.0, 0.0 + dt, cc }, 33 | { cx + 256.0, cy + 256.0, 0.5, 256.0, 0.0 + dt, cc }, 34 | { cx + 256.0, cy - 256.0, 0.5, 256.0, 256.0 + dt, cc }, 35 | { cx - 256.0, cy - 256.0, 0.5, 0.0, 256.0 + dt, cc }) 36 | end 37 | 38 | test.registerTest("test.Module.Sampler", M) 39 | -------------------------------------------------------------------------------- /data/test/scripts/test_se.lua: -------------------------------------------------------------------------------- 1 | local test = require("test") 2 | 3 | ---@class test.Module.SoundEffect : test.Base 4 | local M = {} 5 | 6 | lstg.FileManager.AddSearchPath("deep/") 7 | 8 | function M:onCreate() 9 | local pool = lstg.GetResourceStatus() 10 | lstg.SetResourceStatus("global") 11 | pcall(function() 12 | lstg.LoadSound("se:ok00", "res/se_ok00.wav") 13 | end) 14 | lstg.LoadSound("se:ok00", "res/se_ok00_fixed.wav") 15 | lstg.SetResourceStatus(pool) 16 | lstg.SetResourceStatus(pool) 17 | end 18 | 19 | function M:onDestroy() 20 | lstg.RemoveResource("global", 5, "se:ok00") 21 | end 22 | 23 | function M:onUpdate() 24 | end 25 | 26 | function M:onRender() 27 | end 28 | 29 | test.registerTest("Test BAD SoundEffect", M) 30 | -------------------------------------------------------------------------------- /data/test/scripts/test_stringpack.lua: -------------------------------------------------------------------------------- 1 | local test = require("test") 2 | 3 | ---@class test.Module.string_pack : test.Base 4 | local M = {} 5 | 6 | function M:onCreate() 7 | for k, v in pairs(string) do 8 | lstg.Print(k, v) 9 | end 10 | local str = string.pack(" 3 | #include 4 | 5 | namespace core { 6 | class Clipboard { 7 | public: 8 | static bool hasText(); 9 | static bool setText(std::string_view const& text); 10 | static bool getText(std::string& buffer); 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /engine/collection/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB_RECURSE lib_src RELATIVE ${CMAKE_CURRENT_LIST_DIR} "core/*.hpp" "core/*.cpp") 2 | source_group(TREE ${CMAKE_CURRENT_LIST_DIR} FILES ${lib_src}) 3 | 4 | set(lib_name Core.Collection) 5 | add_library(${lib_name} STATIC) 6 | luastg_target_common_options(${lib_name}) 7 | luastg_target_more_warning(${lib_name}) 8 | target_compile_features(${lib_name} PRIVATE cxx_std_20) 9 | target_include_directories(${lib_name} PUBLIC .) 10 | target_sources(${lib_name} PRIVATE ${lib_src}) 11 | 12 | set_target_properties(Core.Collection PROPERTIES FOLDER engine) 13 | -------------------------------------------------------------------------------- /engine/collection/core/dummy.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/engine/collection/core/dummy.cpp -------------------------------------------------------------------------------- /engine/configuration/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB_RECURSE lib_src RELATIVE ${CMAKE_CURRENT_LIST_DIR} "core/*.hpp" "core/*.cpp") 2 | source_group(TREE ${CMAKE_CURRENT_LIST_DIR} FILES ${lib_src}) 3 | 4 | set(lib_name Core.Configuration) 5 | add_library(${lib_name} STATIC) 6 | luastg_target_common_options(${lib_name}) 7 | luastg_target_more_warning(${lib_name}) 8 | target_compile_features(${lib_name} PRIVATE cxx_std_20) 9 | target_include_directories(${lib_name} PUBLIC .) 10 | target_sources(${lib_name} PRIVATE ${lib_src}) 11 | target_link_libraries(${lib_name} PUBLIC nlohmann_json) 12 | 13 | set_target_properties(Core.Configuration PROPERTIES FOLDER engine) 14 | -------------------------------------------------------------------------------- /engine/embedded-file-system/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB_RECURSE lib_src RELATIVE ${CMAKE_CURRENT_LIST_DIR} luastg/*.hpp luastg/*.cpp generated/*.hpp generated/*.cpp) 2 | source_group(TREE ${CMAKE_CURRENT_LIST_DIR} FILES ${lib_src}) 3 | 4 | set(lib_name "LuaSTG.InternalLuaScriptsFileSystem") 5 | 6 | add_library(${lib_name}) 7 | luastg_target_common_options(${lib_name}) 8 | luastg_target_more_warning(${lib_name}) 9 | target_include_directories(${lib_name} PRIVATE ../common) 10 | target_include_directories(${lib_name} PUBLIC .) 11 | target_sources(${lib_name} PRIVATE ${lib_src}) 12 | target_link_libraries(${lib_name} PRIVATE options_compile_utf8) 13 | target_link_libraries(${lib_name} PUBLIC 14 | Core.FileSystem 15 | ) 16 | 17 | set_target_properties(${lib_name} PROPERTIES FOLDER engine) 18 | -------------------------------------------------------------------------------- /engine/embedded-file-system/generated/scripts.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace luastg { 6 | struct InternalLuaScriptsFileSystemNode { 7 | std::string_view name; 8 | std::span data; 9 | }; 10 | 11 | namespace generated { 12 | extern std::span const files; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /engine/embedded-file-system/luastg/EmbeddedFileSystem.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "core/FileSystem.hpp" 3 | 4 | namespace luastg { 5 | struct CORE_NO_VIRTUAL_TABLE IEmbeddedFileSystem : core::IFileSystem { 6 | static IEmbeddedFileSystem* getInstance(); 7 | }; 8 | } 9 | 10 | namespace core { 11 | // UUID v5 12 | // ns:URL 13 | // https://www.luastg-sub.com/luastg.IEmbeddedFileSystem 14 | template<> constexpr InterfaceId getInterfaceId() { return UUID::parse("d049a157-0c7d-55c6-87f1-84d8bc50d674"); } 15 | } 16 | -------------------------------------------------------------------------------- /engine/embedded-file-system/luastg/mask.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | namespace luastg { 5 | inline void mask(void* const data, size_t const size) { 6 | auto const p = static_cast(data); 7 | for (size_t i = 0; i < size; ++i) { 8 | constexpr uint8_t MASK[4]{'l', 's', 't', 'g'}; 9 | p[i] = p[i] ^ MASK[i % 4]; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /engine/embedded-script/luastg/cjson.lua: -------------------------------------------------------------------------------- 1 | if cjson then 2 | package.loaded["cjson"] = cjson -- fuck you cjson 3 | end 4 | -------------------------------------------------------------------------------- /engine/embedded-script/luastg/ffi/sample.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/engine/embedded-script/luastg/ffi/sample.lua -------------------------------------------------------------------------------- /engine/embedded-script/luastg/io.lua: -------------------------------------------------------------------------------- 1 | local table = require("table") 2 | local lstg = require("lstg") 3 | 4 | local LOG_LEVEL_INFO = 2 5 | 6 | function lstg.SystemLog(text) 7 | lstg.Log(LOG_LEVEL_INFO, text) 8 | end 9 | 10 | function lstg.Print(...) 11 | local args = {...} 12 | local argc = select('#', ...) 13 | for i = 1, argc do 14 | args[i] = tostring(args[i]) 15 | end 16 | lstg.Log(LOG_LEVEL_INFO, table.concat(args, '\t')) 17 | end 18 | 19 | print = lstg.Print 20 | -------------------------------------------------------------------------------- /engine/embedded-script/luastg/main.lua: -------------------------------------------------------------------------------- 1 | require("luastg.cjson") 2 | require("luastg.io") 3 | require("luastg.math") 4 | require("luastg.removed") 5 | require("luastg.GameObject") 6 | 7 | function GameInit() end 8 | function FrameFunc() return false end 9 | function RenderFunc() end 10 | function GameExit() end 11 | function FocusLoseFunc() end 12 | function FocusGainFunc() end 13 | function EventFunc(event, ...) end 14 | -------------------------------------------------------------------------------- /engine/embedded-script/luastg/math.lua: -------------------------------------------------------------------------------- 1 | local math = require("math") 2 | local lstg = require("lstg") 3 | 4 | local rad = math.rad 5 | local deg = math.deg 6 | local sin = math.sin 7 | local cos = math.cos 8 | local tan = math.tan 9 | local asin = math.asin 10 | local acos = math.acos 11 | local atan = math.atan 12 | local atan2 = math.atan2 or math.atan 13 | 14 | function lstg.sin(x) return sin(rad(x)) end 15 | function lstg.cos(x) return cos(rad(x)) end 16 | function lstg.tan(x) return tan(rad(x)) end 17 | function lstg.asin(x) return deg(asin(x)) end 18 | function lstg.acos(x) return deg(acos(x)) end 19 | function lstg.atan(...) return deg(atan(...)) end 20 | function lstg.atan2(y, x) return deg(atan2(y, x)) end 21 | -------------------------------------------------------------------------------- /engine/embedded-script/luastg/removed.lua: -------------------------------------------------------------------------------- 1 | local lstg = require("lstg") 2 | 3 | function lstg.ShowSplashWindow() end 4 | function lstg.PostEffectCapture() end 5 | function lstg.PostEffectApply() end 6 | -------------------------------------------------------------------------------- /engine/file-system/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB_RECURSE lib_src RELATIVE ${CMAKE_CURRENT_LIST_DIR} core/*.hpp core/*.cpp) 2 | source_group(TREE ${CMAKE_CURRENT_LIST_DIR} FILES ${lib_src}) 3 | 4 | set(lib_name "Core.FileSystem") 5 | 6 | add_library(${lib_name}) 7 | luastg_target_common_options(${lib_name}) 8 | luastg_target_more_warning(${lib_name}) 9 | target_include_directories(${lib_name} PUBLIC .) 10 | target_sources(${lib_name} PRIVATE ${lib_src}) 11 | target_link_libraries(${lib_name} PRIVATE options_compile_utf8) 12 | target_link_libraries(${lib_name} PUBLIC 13 | utf8 14 | minizip_ng 15 | Core.ReferenceCounted 16 | Core.String 17 | Core.Logging 18 | Microsoft.Windows.ImplementationLibrary 19 | ) 20 | 21 | set_target_properties(${lib_name} PROPERTIES FOLDER engine) 22 | 23 | set(test_name "Core.FileSystem.Test") 24 | 25 | add_executable(${test_name}) 26 | luastg_target_common_options(${test_name}) 27 | luastg_target_more_warning(${test_name}) 28 | target_compile_features(${test_name} PRIVATE cxx_std_23) 29 | target_sources(${test_name} PRIVATE test/Test.cpp) 30 | target_link_libraries(${test_name} PRIVATE options_compile_utf8 ${lib_name} GTest::gtest_main) 31 | 32 | set_target_properties(${test_name} PROPERTIES FOLDER engine/test) 33 | -------------------------------------------------------------------------------- /engine/file-system/core/Data.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "core/ReferenceCounted.hpp" 3 | 4 | namespace core { 5 | struct CORE_NO_VIRTUAL_TABLE IData : IReferenceCounted { 6 | virtual void* data() = 0; 7 | virtual size_t size() = 0; 8 | 9 | static bool create(size_t size, IData** pp_data); 10 | static bool create(size_t size, size_t align, IData** pp_data); 11 | }; 12 | 13 | // UUID v5 14 | // ns:URL 15 | // https://www.luastg-sub.com/core.IData 16 | template<> constexpr InterfaceId getInterfaceId() { return UUID::parse("acc69b53-02e3-5d58-a6c6-6c30c936ac98"); } 17 | } 18 | -------------------------------------------------------------------------------- /engine/file-system/core/FileSystemCommon.cpp: -------------------------------------------------------------------------------- 1 | #include "core/FileSystemCommon.hpp" 2 | -------------------------------------------------------------------------------- /engine/file-system/core/FileSystemWindows.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace win32 { 6 | bool isFilePathCaseCorrect(std::string_view const& path, std::string& correct); 7 | bool isFilePathCaseCorrect(std::string const& path, std::string& correct); 8 | bool isFilePathCaseCorrect(std::wstring_view const& path, std::wstring& correct); 9 | bool isFilePathCaseCorrect(std::wstring const& path, std::wstring& correct); 10 | bool isFilePathCaseCorrect(std::filesystem::path const& path, std::string& correct); 11 | bool isFilePathCaseCorrect(std::filesystem::path const& path, std::wstring& correct); 12 | } 13 | -------------------------------------------------------------------------------- /engine/logging/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB_RECURSE lib_src RELATIVE ${CMAKE_CURRENT_LIST_DIR} core/*.hpp core/*.cpp) 2 | source_group(TREE ${CMAKE_CURRENT_LIST_DIR} FILES ${lib_src}) 3 | 4 | set(lib_name "Core.Logging") 5 | 6 | add_library(${lib_name}) 7 | luastg_target_common_options(${lib_name}) 8 | luastg_target_more_warning(${lib_name}) 9 | target_include_directories(${lib_name} PUBLIC .) 10 | target_sources(${lib_name} PRIVATE ${lib_src}) 11 | target_link_libraries(${lib_name} PRIVATE options_compile_utf8) 12 | target_link_libraries(${lib_name} PUBLIC utf8 spdlog) 13 | 14 | set_target_properties(${lib_name} PROPERTIES FOLDER engine) 15 | -------------------------------------------------------------------------------- /engine/logging/core/spdlog/Logger.cpp: -------------------------------------------------------------------------------- 1 | #include "core/Logger.hpp" 2 | #include "spdlog/spdlog.h" 3 | 4 | namespace core { 5 | void Logger::info(std::string_view const& message) { 6 | spdlog::info(message); 7 | } 8 | void Logger::info(std::string const& message) { 9 | spdlog::info(message); 10 | } 11 | 12 | void Logger::warn(std::string_view const& message) { 13 | spdlog::warn(message); 14 | } 15 | void Logger::warn(std::string const& message) { 16 | spdlog::warn(message); 17 | } 18 | 19 | void Logger::error(std::string_view const& message) { 20 | spdlog::error(message); 21 | } 22 | void Logger::error(std::string const& message) { 23 | spdlog::error(message); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /engine/lua/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(lib_name lua_plus) 2 | add_library(${lib_name} STATIC) 3 | luastg_target_common_options(${lib_name}) 4 | luastg_target_more_warning(${lib_name}) 5 | target_include_directories(${lib_name} PUBLIC .) 6 | target_sources(${lib_name} PRIVATE lua/plus.hpp lua/plus.cpp) 7 | target_link_libraries(${lib_name} PUBLIC lua51_static) 8 | 9 | set_target_properties(${lib_name} PROPERTIES FOLDER engine) 10 | -------------------------------------------------------------------------------- /engine/lua/lua/plus.cpp: -------------------------------------------------------------------------------- 1 | #include "lua/plus.hpp" 2 | 3 | #ifndef NDEBUG 4 | namespace { 5 | using std::string_literals::operator ""s; 6 | using std::string_view_literals::operator ""sv; 7 | void main(lua_State* L) { 8 | lua::stack_t S(L); 9 | S.push_value(true); 10 | S.push_value(false); 11 | S.push_value(1i32); 12 | S.push_value(1ui32); 13 | S.push_value(3.14f); 14 | S.push_value(6.28); 15 | S.push_value("Hello world!"); 16 | S.push_value("Hello world!"sv); 17 | S.push_value("Hello world!"s); 18 | } 19 | } 20 | #endif 21 | -------------------------------------------------------------------------------- /engine/reference-counted/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB_RECURSE lib_src RELATIVE ${CMAKE_CURRENT_LIST_DIR} core/*.hpp core/*.cpp) 2 | source_group(TREE ${CMAKE_CURRENT_LIST_DIR} FILES ${lib_src}) 3 | 4 | set(lib_name "Core.ReferenceCounted") 5 | 6 | add_library(${lib_name}) 7 | luastg_target_common_options(${lib_name}) 8 | luastg_target_more_warning(${lib_name}) 9 | target_include_directories(${lib_name} PUBLIC .) 10 | target_sources(${lib_name} PRIVATE ${lib_src}) 11 | target_link_libraries(${lib_name} PRIVATE options_compile_utf8) 12 | target_link_libraries(${lib_name} PUBLIC Core.UUID) 13 | 14 | set_target_properties(${lib_name} PROPERTIES FOLDER engine) 15 | 16 | set(test_name "Core.ReferenceCounted.Test") 17 | 18 | add_executable(${test_name}) 19 | luastg_target_common_options(${test_name}) 20 | luastg_target_more_warning(${test_name}) 21 | target_sources(${test_name} PRIVATE test/Test.cpp) 22 | target_link_libraries(${test_name} PRIVATE options_compile_utf8 ${lib_name} GTest::gtest_main) 23 | 24 | set_target_properties(${test_name} PROPERTIES FOLDER engine/test) 25 | -------------------------------------------------------------------------------- /engine/reference-counted/core/ReferenceCounted.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "core/UUID.hpp" 4 | 5 | #define CORE_NO_VIRTUAL_TABLE __declspec(novtable) 6 | 7 | namespace core { 8 | using InterfaceId = UUID; 9 | 10 | template 11 | InterfaceId getInterfaceId() { return Interface::interface_uuid; } 12 | 13 | struct CORE_NO_VIRTUAL_TABLE IReferenceCounted { 14 | virtual bool queryInterface(InterfaceId const& uuid, void** output) = 0; 15 | virtual int32_t retain() = 0; 16 | virtual int32_t release() = 0; 17 | 18 | template bool queryInterface(Interface** const output) { 19 | static_assert(std::is_base_of_v); 20 | return queryInterface(getInterfaceId(), reinterpret_cast(output)); 21 | } 22 | }; 23 | 24 | // UUID v5 25 | // ns:URL 26 | // https://www.luastg-sub.com/core.IReferenceCounted 27 | template<> constexpr InterfaceId getInterfaceId() { return UUID::parse("b6a42c9f-376b-57e7-95a0-68b74556d1e4"); } 28 | } 29 | -------------------------------------------------------------------------------- /engine/reference-counted/core/WeakReference.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "core/ReferenceCounted.hpp" 3 | 4 | namespace core { 5 | struct CORE_NO_VIRTUAL_TABLE IWeakReference : IReferenceCounted { 6 | virtual bool resolve(InterfaceId const& uuid, void** output) = 0; 7 | 8 | template bool resolve(Interface** const output) { 9 | static_assert(std::is_base_of_v); 10 | return resolve(getInterfaceId(), reinterpret_cast(output)); 11 | } 12 | }; 13 | 14 | // UUID v5 15 | // ns:URL 16 | // https://www.luastg-sub.com/core.IWeakReference 17 | template<> constexpr InterfaceId getInterfaceId() { return UUID::parse("cef127a6-3ae3-541c-a8e2-42257d983eaa"); } 18 | } 19 | -------------------------------------------------------------------------------- /engine/reference-counted/core/WeakReferenceSource.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "core/WeakReference.hpp" 3 | 4 | namespace core { 5 | struct CORE_NO_VIRTUAL_TABLE IWeakReferenceSource : IReferenceCounted { 6 | virtual void getWeakReference(IWeakReference** output) = 0; 7 | }; 8 | 9 | // UUID v5 10 | // ns:URL 11 | // https://www.luastg-sub.com/core.IWeakReferenceSource 12 | template<> constexpr InterfaceId getInterfaceId() { return UUID::parse("beabd630-bc16-5df7-b4f1-595f4c55d1a4"); } 13 | } 14 | -------------------------------------------------------------------------------- /engine/reference-counted/core/implement/ReferenceCountedDebugger.cpp: -------------------------------------------------------------------------------- 1 | #include "core/implement/ReferenceCountedDebugger.hpp" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #ifdef _WIN32 8 | #include 9 | #endif 10 | 11 | namespace { 12 | std::recursive_mutex object_set_lock; 13 | std::set object_set; 14 | } 15 | 16 | namespace core::implement { 17 | void ReferenceCountedDebugger::startTracking(IReferenceCounted* const object) { 18 | [[maybe_unused]] std::scoped_lock lock(object_set_lock); 19 | object_set.insert(object); 20 | } 21 | void ReferenceCountedDebugger::stopTracking(IReferenceCounted* const object) { 22 | [[maybe_unused]] std::scoped_lock lock(object_set_lock); 23 | object_set.erase(object); 24 | } 25 | bool ReferenceCountedDebugger::hasLeak() { 26 | [[maybe_unused]] std::scoped_lock lock(object_set_lock); 27 | return !object_set.empty(); 28 | } 29 | void ReferenceCountedDebugger::reportLeak() { 30 | [[maybe_unused]] std::scoped_lock lock(object_set_lock); 31 | if (!object_set.empty()) { 32 | std::string buffer; 33 | buffer.append(std::format("[ReferenceCountedDebugger] Detected {} objects leaking\n", object_set.size())); 34 | for (auto const& object : object_set) { 35 | buffer.append(std::format(" object 0x{:X}\n", reinterpret_cast(object))); 36 | } 37 | std::cerr << buffer; 38 | #ifdef _WIN32 39 | OutputDebugStringA(buffer.c_str()); 40 | #endif 41 | assert(false); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /engine/reference-counted/core/implement/ReferenceCountedDebugger.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "core/ReferenceCounted.hpp" 3 | 4 | namespace core::implement { 5 | class ReferenceCountedDebugger { 6 | public: 7 | static void startTracking(IReferenceCounted* object); 8 | static void stopTracking(IReferenceCounted* object); 9 | static bool hasLeak(); 10 | static void reportLeak(); 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /engine/string/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB_RECURSE lib_src RELATIVE ${CMAKE_CURRENT_LIST_DIR} core/*.hpp core/*.cpp) 2 | source_group(TREE ${CMAKE_CURRENT_LIST_DIR} FILES ${lib_src}) 3 | 4 | set(lib_name "Core.String") 5 | 6 | add_library(${lib_name}) 7 | luastg_target_common_options(${lib_name}) 8 | luastg_target_more_warning(${lib_name}) 9 | target_include_directories(${lib_name} PUBLIC .) 10 | target_sources(${lib_name} PRIVATE ${lib_src}) 11 | target_link_libraries(${lib_name} PRIVATE options_compile_utf8) 12 | target_link_libraries(${lib_name} PUBLIC Core.ReferenceCounted) 13 | 14 | set_target_properties(${lib_name} PROPERTIES FOLDER engine) 15 | -------------------------------------------------------------------------------- /engine/string/core/ImmutableString.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "core/ReferenceCounted.hpp" 3 | 4 | namespace core { 5 | // 字符串视图 6 | 7 | using StringView = std::string_view; // pointer | size 8 | 9 | // 不可变的空终止字符串 10 | 11 | struct CORE_NO_VIRTUAL_TABLE IImmutableString : IReferenceCounted { 12 | [[nodiscard]] virtual bool empty() const noexcept = 0; 13 | [[nodiscard]] virtual char const* data() const noexcept = 0; 14 | [[nodiscard]] virtual size_t size() const noexcept = 0; 15 | [[nodiscard]] virtual char const* c_str() const noexcept = 0; 16 | [[nodiscard]] virtual size_t length() const noexcept = 0; 17 | [[nodiscard]] virtual StringView view() const noexcept = 0; 18 | 19 | static void create(StringView const& view, IImmutableString** output); 20 | static void create(char const* data, size_t size, IImmutableString** output); 21 | }; 22 | 23 | // UUID v5 24 | // ns:URL 25 | // https://www.luastg-sub.com/core.IImmutableString 26 | template<> constexpr InterfaceId getInterfaceId() { return UUID::parse("1ef36173-0c4d-5bd8-af47-fa362a5e4805"); } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /engine/utf8/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(utf8 STATIC) 2 | luastg_target_common_options(utf8) 3 | luastg_target_more_warning(utf8) 4 | target_include_directories(utf8 PUBLIC .) 5 | target_sources(utf8 PRIVATE utf8.hpp utf8.cpp) 6 | 7 | set_target_properties(utf8 PROPERTIES FOLDER engine) 8 | -------------------------------------------------------------------------------- /engine/utf8/utf8.cpp: -------------------------------------------------------------------------------- 1 | #include "utf8.hpp" 2 | #include 3 | #include 4 | 5 | namespace utf8 { 6 | static_assert(CHAR_BIT == 8); 7 | std::string to_string(std::wstring_view const& str) { 8 | std::string buffer; 9 | if (str.empty()) { 10 | return buffer; 11 | } 12 | int const length = WideCharToMultiByte( 13 | CP_UTF8, 0, 14 | str.data(), static_cast(str.size()), 15 | nullptr, 0, 16 | nullptr, nullptr); 17 | if (length <= 0) { 18 | assert(false); 19 | return buffer; 20 | } 21 | buffer.resize(static_cast(length)); 22 | int const result = WideCharToMultiByte( 23 | CP_UTF8, 0, 24 | str.data(), static_cast(str.length()), 25 | buffer.data(), length, 26 | nullptr, nullptr); 27 | if (result != length) { 28 | assert(false); 29 | buffer.clear(); 30 | } 31 | return buffer; 32 | } 33 | std::wstring to_wstring(std::string_view const& str) { 34 | std::wstring buffer; 35 | if (str.empty()) { 36 | return buffer; 37 | } 38 | int const length = MultiByteToWideChar( 39 | CP_UTF8, 0, 40 | str.data(), static_cast(str.length()), 41 | nullptr, 0); 42 | if (length <= 0) { 43 | assert(false); 44 | return buffer; 45 | } 46 | buffer.resize(static_cast(length)); 47 | int const result = MultiByteToWideChar( 48 | CP_UTF8, 0, 49 | str.data(), static_cast(str.length()), 50 | buffer.data(), length); 51 | if (result != length) { 52 | assert(false); 53 | buffer.clear(); 54 | } 55 | return buffer; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /engine/utf8/utf8.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _UTF8_H_20250101_ 4 | #define _UTF8_H_20250101_ 5 | 6 | #include 7 | #include 8 | 9 | namespace utf8 { 10 | static_assert(CHAR_BIT == 8); 11 | inline std::string to_string(std::u8string_view const& str) { 12 | return { reinterpret_cast(str.data()), str.size() }; 13 | } 14 | std::string to_string(std::wstring_view const& str); 15 | std::wstring to_wstring(std::string_view const& str); 16 | inline std::wstring to_wstring(std::u8string_view const& str) { 17 | return to_wstring(std::string_view(reinterpret_cast(str.data()), str.size())); 18 | } 19 | inline std::string_view remove_bom(std::string_view const& str) { 20 | if (str.starts_with("\xEF\xBB\xBF")) { 21 | return str.substr(3); 22 | } 23 | return str; 24 | } 25 | } 26 | 27 | #endif // _UTF8_H_20250101_ 28 | -------------------------------------------------------------------------------- /engine/utility/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(utility STATIC) 2 | luastg_target_common_options(utility) 3 | luastg_target_more_warning(utility) 4 | target_include_directories(utility PUBLIC .) 5 | set(utility_sources 6 | utility/path.hpp 7 | utility/path.cpp 8 | utility/utf.hpp 9 | ) 10 | source_group(TREE ${CMAKE_CURRENT_LIST_DIR} FILES ${utility_sources}) 11 | target_sources(utility PRIVATE ${utility_sources}) 12 | target_link_libraries(utility PUBLIC utf8) 13 | 14 | set_target_properties(utility PROPERTIES FOLDER engine) 15 | -------------------------------------------------------------------------------- /engine/utility/utility/path.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | namespace utility::path 6 | { 7 | bool is_separator(char c); 8 | bool is_separator(wchar_t c); 9 | void to_slash(std::string& utf8_string); 10 | void to_slash(std::wstring& wide_string); 11 | void to_backslash(std::string& utf8_string); 12 | void to_backslash(std::wstring& wide_string); 13 | void merge_separator(std::string& utf8_string); 14 | void merge_separator(std::wstring& wide_string); 15 | bool compare(std::string_view p1, std::string_view p2); 16 | bool compare(std::wstring_view p1, std::wstring_view p2); 17 | bool compare(std::string_view utf8_path, std::wstring_view wide_path); 18 | } 19 | -------------------------------------------------------------------------------- /engine/uuid/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB_RECURSE src RELATIVE ${CMAKE_CURRENT_LIST_DIR} *.h *.c *.hpp *.cpp) 2 | source_group(TREE ${CMAKE_CURRENT_LIST_DIR} FILES ${src}) 3 | 4 | add_library(Core.UUID STATIC) 5 | luastg_target_common_options(Core.UUID) 6 | luastg_target_more_warning(Core.UUID) 7 | target_include_directories(Core.UUID PUBLIC .) 8 | target_sources(Core.UUID PRIVATE ${src}) 9 | target_link_libraries(Core.UUID PRIVATE options_compile_utf8) 10 | 11 | set_target_properties(Core.UUID PROPERTIES FOLDER engine) 12 | -------------------------------------------------------------------------------- /external/.gitignore: -------------------------------------------------------------------------------- 1 | .download/* 2 | XAudio2Redist/* 3 | Microsoft.XAudio2.Redist/* 4 | Microsoft.Windows.ImplementationLibrary/* 5 | -------------------------------------------------------------------------------- /external/image.qoi-patch/qoi.c: -------------------------------------------------------------------------------- 1 | #ifndef QOI_NO_STDIO 2 | #define QOI_NO_STDIO 3 | #endif 4 | #ifndef QOI_IMPLEMENTATION 5 | #define QOI_IMPLEMENTATION 6 | #endif 7 | #include "qoi.h" 8 | -------------------------------------------------------------------------------- /external/lua-cjson-patch/lua_cjson.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.h" 3 | 4 | int luaopen_cjson(lua_State* L); 5 | -------------------------------------------------------------------------------- /external/lua-csv/lua_xlsx_csv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.hpp" 3 | 4 | int lua_xlsx_open(lua_State* L); 5 | int lua_csv_open(lua_State* L); 6 | -------------------------------------------------------------------------------- /external/lua-filesystem-lite/lfs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.h" 3 | 4 | int luaopen_lfs(lua_State * L); 5 | -------------------------------------------------------------------------------- /external/steam_api/.gitignore: -------------------------------------------------------------------------------- 1 | SteamworksSDK/* 2 | !SteamworksSDK/sdk 3 | SteamworksSDK/sdk/* 4 | !SteamworksSDK/sdk/Download.txt 5 | -------------------------------------------------------------------------------- /external/steam_api/SteamworksSDK/sdk/Download.txt: -------------------------------------------------------------------------------- 1 | Steam的条款不允许再发行SteamAPI,因此如果需要用到SteamAPI,请前往SteamWorks自行下载。 2 | 下载好后会得到一个压缩包,将压缩包的sdk文件夹内的所有文件解压到这个文件夹中。 3 | -------------------------------------------------------------------------------- /external/steam_api/binding/lua_steam.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "lua.hpp" 4 | 5 | bool lua_steam_check(uint32_t appid); 6 | int lua_steam_open(lua_State* L); 7 | -------------------------------------------------------------------------------- /external/steam_api/binding/lua_steam_dll.cpp: -------------------------------------------------------------------------------- 1 | #include "lua_steam.h" 2 | 3 | extern "C" __declspec(dllexport) int luaopen_steam(lua_State* L) 4 | { 5 | return lua_steam_open(L); 6 | } 7 | -------------------------------------------------------------------------------- /external/steam_api/binding/lua_steam_empty.cpp: -------------------------------------------------------------------------------- 1 | #include "lua_steam.h" 2 | #include 3 | 4 | bool lua_steam_check(uint32_t appid) 5 | { 6 | std::ignore = appid; 7 | return true; 8 | } 9 | int lua_steam_open(lua_State* L) 10 | { 11 | const luaL_Reg lib[] = {{NULL, NULL}}; 12 | luaL_register(L, "steam", lib); 13 | return 1; 14 | } 15 | -------------------------------------------------------------------------------- /external/tracy-patch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(TracyAPI INTERFACE) 2 | target_include_directories(TracyAPI INTERFACE ${CMAKE_CURRENT_LIST_DIR}) 3 | target_link_libraries(TracyAPI INTERFACE tracy) 4 | -------------------------------------------------------------------------------- /external/xmath-patch/math/Vec2.cpp: -------------------------------------------------------------------------------- 1 | #include "Vec2.h" 2 | 3 | namespace cocos2d 4 | { 5 | void Vec2::normalize() { 6 | float n = x * x + y * y; 7 | // Already normalized. 8 | if (n == 1.0f) 9 | return; 10 | n = std::sqrt(n); 11 | // Too close to zero. 12 | if (n < std::numeric_limits::min()) 13 | return; 14 | n = 1.0f / n; 15 | x *= n; 16 | y *= n; 17 | } 18 | 19 | void Vec2::rotate(const Vec2& point, float angle) { 20 | float sinAngle = std::sin(angle); 21 | float cosAngle = std::cos(angle); 22 | 23 | if (point.isZero()) 24 | { 25 | float tempX = x * cosAngle - y * sinAngle; 26 | y = y * cosAngle + x * sinAngle; 27 | x = tempX; 28 | } 29 | else 30 | { 31 | float tempX = x - point.x; 32 | float tempY = y - point.y; 33 | x = tempX * cosAngle - tempY * sinAngle + point.x; 34 | y = tempY * cosAngle + tempX * sinAngle + point.y; 35 | } 36 | } 37 | 38 | const Vec2 Vec2::ZERO(0.0f, 0.0f); 39 | } 40 | -------------------------------------------------------------------------------- /imgui/binding/doc/imgui.lua: -------------------------------------------------------------------------------- 1 | ---@diagnostic disable: duplicate-set-field, missing-return, unused-local 2 | 3 | ---@class imgui 4 | local imgui = {} 5 | 6 | ---@class imgui.ImVec2 7 | ---@field x number 8 | ---@field y number 9 | 10 | ---@return imgui.ImVec2 11 | function imgui.ImVec2() 12 | end 13 | 14 | ---@param x number 15 | ---@param y number 16 | ---@return imgui.ImVec2 17 | function imgui.ImVec2(x, y) 18 | end 19 | 20 | ---@class imgui.ImVec4 21 | ---@field x number 22 | ---@field y number 23 | ---@field z number 24 | ---@field w number 25 | 26 | ---@return imgui.ImVec4 27 | function imgui.ImVec4() 28 | end 29 | 30 | ---@param x number 31 | ---@param y number 32 | ---@param z number 33 | ---@param w number 34 | ---@return imgui.ImVec4 35 | function imgui.ImVec4(x, y, z, w) 36 | end 37 | 38 | return imgui 39 | -------------------------------------------------------------------------------- /imgui/binding/include/lua_imgui.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.hpp" 3 | 4 | int luaopen_imgui(lua_State* L); 5 | -------------------------------------------------------------------------------- /imgui/binding/src/generated/ImGuiTextBufferMember.hpp: -------------------------------------------------------------------------------- 1 | // This file was generated through a code generator, DO NOT edit it, please edit the code generator 2 | 3 | #ifndef _imgui_binding_lua_ImGuiTextBufferMember_h_ 4 | #define _imgui_binding_lua_ImGuiTextBufferMember_h_ 5 | 6 | namespace imgui_binding_lua { 7 | 8 | enum class ImGuiTextBufferMember : int { 9 | __unknown__ = -1, 10 | append = 0, 11 | c_str = 1, 12 | clear = 2, 13 | empty = 3, 14 | reserve = 4, 15 | size = 6, 16 | resize = 5, 17 | }; 18 | 19 | ImGuiTextBufferMember mapImGuiTextBufferMember(char const* const key, size_t const len) noexcept; 20 | 21 | } 22 | 23 | #endif // _imgui_binding_lua_ImGuiTextBufferMember_h_ 24 | -------------------------------------------------------------------------------- /imgui/binding/src/generated/placeholder: -------------------------------------------------------------------------------- 1 | DO NOT DELETE -------------------------------------------------------------------------------- /imgui/binding/src/lua_imgui.cpp: -------------------------------------------------------------------------------- 1 | #include "lua_imgui_common.hpp" 2 | #include "lua_imgui.hpp" 3 | #include "lua_imgui_enum.hpp" 4 | #include "lua_imgui_type.hpp" 5 | #include "lua_imgui_ImGui.hpp" 6 | #include "imgui.h" 7 | 8 | int luaopen_imgui(lua_State* L) 9 | { 10 | _luaL_reglib(L, lua_module_imgui); // ? M 11 | 12 | lua_pushstring(L, "IMGUI_VERSION"); // ? M k 13 | lua_pushstring(L, IMGUI_VERSION); // ? M k s 14 | lua_settable(L, -3); // ? M 15 | lua_pushstring(L, "IMGUI_VERSION_NUM"); // ? M k 16 | lua_pushinteger(L, IMGUI_VERSION_NUM); // ? M k v 17 | lua_settable(L, -3); // ? M 18 | 19 | imgui_binding_lua_register_enum(L); 20 | lua::register_type(L); 21 | lua::register_type(L); 22 | imgui_binding_lua_register_ImGuiStyle(L); 23 | imgui_binding_lua_register_ImGuiTextBuffer(L); 24 | imgui_binding_lua_register_ImGui(L); 25 | 26 | return 1; 27 | } 28 | -------------------------------------------------------------------------------- /imgui/binding/src/lua_imgui_ImGui.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.hpp" 3 | 4 | void imgui_binding_lua_register_ImGui(lua_State* L); 5 | -------------------------------------------------------------------------------- /imgui/binding/src/lua_imgui_common.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.hpp" 3 | 4 | #if (LUA_VERSION_NUM >= 504) 5 | inline void _luaL_reglib(lua_State* L, const char* name) 6 | { 7 | struct Wrapper 8 | { 9 | static int require(lua_State* L) 10 | { 11 | lua_newtable(L); 12 | return 1; 13 | } 14 | }; 15 | luaL_requiref(L, name, &Wrapper::require, true); 16 | } 17 | inline int _luaL_len(lua_State* L, int idx) 18 | { 19 | return (int)luaL_len(L, idx); 20 | } 21 | inline size_t _luaL_szlen(lua_State* L, int idx) 22 | { 23 | return (size_t)luaL_len(L, idx); 24 | } 25 | inline void _luaL_setfuncs(lua_State* L, const luaL_Reg *l) 26 | { 27 | luaL_setfuncs(L, l, 0); 28 | } 29 | #elif (LUA_VERSION_NUM >= 501) 30 | inline void _luaL_reglib(lua_State* L, const char* name) 31 | { 32 | const luaL_Reg fun[1] = { 33 | {NULL, NULL} 34 | }; 35 | luaL_register(L, name, fun); 36 | } 37 | inline int _luaL_len(lua_State* L, int idx) 38 | { 39 | return (int)lua_objlen(L, idx); 40 | } 41 | inline size_t _luaL_szlen(lua_State* L, int idx) 42 | { 43 | return lua_objlen(L, idx); 44 | } 45 | inline void _luaL_setfuncs(lua_State* L, const luaL_Reg *l) 46 | { 47 | luaL_register(L, NULL, l); 48 | } 49 | #else 50 | #error "not support" 51 | #endif 52 | -------------------------------------------------------------------------------- /imgui/binding/src/lua_imgui_enum.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "lua.hpp" 3 | 4 | void imgui_binding_lua_register_enum(lua_State* L); 5 | -------------------------------------------------------------------------------- /tool/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(embedded-file-system-builder) 2 | -------------------------------------------------------------------------------- /tool/embedded-file-system-builder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(tool_name embedded-file-system-builder) 2 | 3 | add_executable(${tool_name}) 4 | target_compile_options(${tool_name} PRIVATE 5 | "$<$:/utf-8>" 6 | "$<$:/sdl>" 7 | "$<$:/W4>" 8 | ) 9 | set_target_properties(${tool_name} PROPERTIES 10 | CXX_STANDARD 23 11 | CXX_STANDARD_REQUIRED ON 12 | CXX_EXTENSIONS OFF 13 | ) 14 | target_include_directories(${tool_name} PRIVATE ../../engine/embedded-file-system) 15 | target_sources(${tool_name} PRIVATE main.cpp) 16 | 17 | set_target_properties(embedded-file-system-builder PROPERTIES FOLDER tool) 18 | 19 | add_custom_target(generate-embedded-file-system 20 | $ 21 | ${CMAKE_CURRENT_LIST_DIR}/../../engine/embedded-script 22 | --output ${CMAKE_CURRENT_LIST_DIR}/../../engine/embedded-file-system/generated/scripts.cpp 23 | ) 24 | 25 | set_target_properties(generate-embedded-file-system PROPERTIES FOLDER tool) 26 | -------------------------------------------------------------------------------- /tool/lua/license/lua/readme.txt: -------------------------------------------------------------------------------- 1 | See: https://lua.org/license.html 2 | -------------------------------------------------------------------------------- /tool/lua/lua54.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/tool/lua/lua54.dll -------------------------------------------------------------------------------- /tool/lua/lua54.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/tool/lua/lua54.exe -------------------------------------------------------------------------------- /tool/luajit/license/lua51.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/tool/luajit/license/lua51.dll -------------------------------------------------------------------------------- /tool/luajit/license/luajit.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Legacy-LuaSTG-Engine/LuaSTG-Sub/e192e4afaf746957ce99b77bd7912a519c90023e/tool/luajit/license/luajit.exe -------------------------------------------------------------------------------- /tool/property_map/logger.lua: -------------------------------------------------------------------------------- 1 | ---@class logger 2 | local logger = {} 3 | 4 | local function date() 5 | local os_date = os.date("*t") 6 | return string.format( 7 | "%04d-%02d-%02d %02d:%02d:%02d", 8 | os_date.year, os_date.month, os_date.day, 9 | os_date.hour, os_date.min, os_date.sec) 10 | end 11 | 12 | function logger.debug(fmt, ...) 13 | print(string.format("[%s] [D] " .. fmt, date(), ...)) 14 | end 15 | 16 | function logger.info(fmt, ...) 17 | print(string.format("[%s] [I] " .. fmt, date(), ...)) 18 | end 19 | 20 | function logger.warn(fmt, ...) 21 | print(string.format("[%s] [W] " .. fmt, date(), ...)) 22 | end 23 | 24 | function logger.error(fmt, ...) 25 | print(string.format("[%s] [E] " .. fmt, date(), ...)) 26 | end 27 | 28 | return logger 29 | -------------------------------------------------------------------------------- /tool/property_map/main.lua: -------------------------------------------------------------------------------- 1 | require("luastg") 2 | require("imgui") 3 | -------------------------------------------------------------------------------- /tool/property_map/update_property_map.ps1: -------------------------------------------------------------------------------- 1 | $LastLocation = Get-Location 2 | Set-Location -Path $PSScriptRoot 3 | & ($PSScriptRoot + "/../lua/lua54.exe") "main.lua" 4 | Set-Location $LastLocation 5 | -------------------------------------------------------------------------------- /tool/version-info-generator/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "major": 0, 3 | "minor": 21, 4 | "patch": 105, 5 | "package": "ChuiKingShek.LuaSTG.Sub", 6 | "organization": "璀境石" 7 | } -------------------------------------------------------------------------------- /tool/version-info-generator/license/json.lua/LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 actboy168 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /tool/version-info-generator/license/json.lua/readme.txt: -------------------------------------------------------------------------------- 1 | json.lua from https://github.com/actboy168/json.lua/blob/master/json.lua 2 | -------------------------------------------------------------------------------- /tool/version-info-generator/template/LConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define LUASTG_NAME "LuaSTG" 4 | #define LUASTG_BRANCH "Sub" 5 | #define LUASTG_VERSION_NAME "v${VERSION}" 6 | #define LUASTG_VERSION_MAJOR ${VERSION_MAJOR} 7 | #define LUASTG_VERSION_MINOR ${VERSION_MINOR} 8 | #define LUASTG_VERSION_PATCH ${VERSION_PATCH} 9 | 10 | #define LUASTG_INFO LUASTG_NAME " " LUASTG_BRANCH " " LUASTG_VERSION_NAME 11 | 12 | // WARNING: see write-version.lua 13 | 14 | //#define LuaSTG_enable_GameObjectManager_Debug 1 15 | 16 | //#define LDEVVERSION 1 17 | -------------------------------------------------------------------------------- /tool/version-info-generator/update_version.ps1: -------------------------------------------------------------------------------- 1 | $LastLocation = Get-Location 2 | Set-Location -Path $PSScriptRoot 3 | & ($PSScriptRoot + "/../lua/lua54.exe") "main.lua" 4 | Set-Location $LastLocation 5 | --------------------------------------------------------------------------------