commit
2818171411
|
|
@ -6,9 +6,13 @@ x64/
|
|||
Debug/
|
||||
Release/
|
||||
|
||||
# CMake folders
|
||||
/cmake-build-release/
|
||||
/cmake-build-debug/
|
||||
|
||||
# Application folders
|
||||
.vs
|
||||
.vscode
|
||||
.idea
|
||||
|
||||
# vs2010
|
||||
ipch/
|
||||
|
|
@ -28,4 +32,8 @@ packages/
|
|||
# Resources bin
|
||||
*.aps
|
||||
|
||||
docs/
|
||||
# Mac cache files
|
||||
.DS_Store
|
||||
|
||||
# Documents
|
||||
docs/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Mac",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/src/**"
|
||||
],
|
||||
"defines": [
|
||||
"TARGET_OS_MAC"
|
||||
],
|
||||
"macFrameworkPath": [
|
||||
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
|
||||
],
|
||||
"compilerPath": "/usr/bin/clang",
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++14",
|
||||
"intelliSenseMode": "clang-x64"
|
||||
},
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/src/**"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++14",
|
||||
"intelliSenseMode": "clang-x64"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"files.autoGuessEncoding": true,
|
||||
"files.encoding": "gb2312"
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
cmake_minimum_required(VERSION 3.16)
|
||||
project(Kiwano C CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
if (WIN32)
|
||||
message(STATUS "Building on Windows platform.")
|
||||
elseif (APPLE)
|
||||
message(STATUS "Building on MacOS platform.")
|
||||
add_compile_definitions(TARGET_OS_MAC)
|
||||
elseif (UNIX)
|
||||
message(STATUS "Building on UNIX-like OS platform.")
|
||||
endif ()
|
||||
|
||||
include_directories(src/3rd-party)
|
||||
include_directories(src)
|
||||
|
||||
add_subdirectory(src/kiwano)
|
||||
add_subdirectory(src/kiwano-audio)
|
||||
add_subdirectory(src/kiwano-imgui)
|
||||
add_subdirectory(src/kiwano-network)
|
||||
add_subdirectory(src/kiwano-physics)
|
||||
add_subdirectory(src/3rd-party/Box2D)
|
||||
add_subdirectory(src/3rd-party/curl)
|
||||
add_subdirectory(src/3rd-party/nlohmann)
|
||||
add_subdirectory(src/3rd-party/pugixml)
|
||||
3
Doxyfile
3
Doxyfile
|
|
@ -5,7 +5,7 @@
|
|||
#---------------------------------------------------------------------------
|
||||
|
||||
PROJECT_NAME = "Kiwano Engine"
|
||||
PROJECT_NUMBER = v1.0.14
|
||||
PROJECT_NUMBER = v1.0.x
|
||||
PROJECT_BRIEF =
|
||||
PROJECT_LOGO = logo/logo_tiny.png
|
||||
|
||||
|
|
@ -81,6 +81,7 @@ HTML_HEADER =
|
|||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_EXTRA_STYLESHEET =
|
||||
HTML_EXTRA_FILES = logo/favicon.ico
|
||||
|
||||
GENERATE_TREEVIEW = YES
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 128 KiB |
|
|
@ -1,5 +0,0 @@
|
|||
// 提示文件帮助 Visual Studio IDE 解释 Visual C++ 标识符,
|
||||
// 如函数和宏的名称。
|
||||
// 有关详细信息,请参见 https://go.microsoft.com/fwlink/?linkid=865984
|
||||
|
||||
#define KGE_API
|
||||
|
|
@ -5,58 +5,53 @@
|
|||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionDelay.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionGroup.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionHelper.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionManager.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionScheduler.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionWalk.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionTween.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\Animation.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\Button.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\Component.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\Frame.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\Actor.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\GifSprite.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\base\component\Button.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\base\component\Component.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\base\component\ComponentManager.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\base\Director.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\base\Module.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\base\ObjectBase.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\base\RefCounter.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\Allocator.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\Any.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\Cloneable.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\Common.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\Director.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\event\Event.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\event\EventType.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\event\KeyEvent.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\event\MouseEvent.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\event\WindowEvent.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\Exception.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\Function.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\IntrusiveList.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\Json.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\Keys.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\Library.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\Serializable.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\Singleton.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\String.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\Time.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\Xml.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\event\Event.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\event\EventDispatcher.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\event\EventListener.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\event\Events.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\event\EventType.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\event\KeyEvent.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\event\MouseEvent.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\event\WindowEvent.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\kiwano.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\config.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\macros.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\Canvas.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\DebugActor.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\FrameSequence.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\ShapeActor.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\LayerActor.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\Actor.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\Stage.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\Sprite.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\TextActor.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\2d\Transition.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\Module.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\EventDispatcher.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\EventListener.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\Logger.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\ObjectBase.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\RefCounter.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\Resource.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\SmartPtr.hpp" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\Timer.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\TimerManager.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\math\Constants.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\math\EaseFunctions.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\math\Math.h" />
|
||||
|
|
@ -78,6 +73,7 @@
|
|||
<ClInclude Include="..\..\src\kiwano\render\DirectX\D2DDeviceResources.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\render\DirectX\D3D10DeviceResources.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\render\DirectX\D3D11DeviceResources.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\render\DirectX\D3DDeviceResources.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\render\DirectX\D3DDeviceResourcesBase.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\render\DirectX\FontCollectionLoader.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\render\DirectX\helper.h" />
|
||||
|
|
@ -86,6 +82,8 @@
|
|||
<ClInclude Include="..\..\src\kiwano\render\DirectX\RendererImpl.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\render\DirectX\TextRenderer.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\render\Font.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\render\Frame.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\render\FrameSequence.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\render\NativeObject.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\render\Shape.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\render\ShapeMaker.h" />
|
||||
|
|
@ -98,51 +96,55 @@
|
|||
<ClInclude Include="..\..\src\kiwano\render\TextStyle.hpp" />
|
||||
<ClInclude Include="..\..\src\kiwano\render\Texture.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\render\TextureCache.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\utils\EventTicker.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\utils\Json.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\utils\LocalStorage.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\utils\Logger.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\utils\ResourceCache.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\utils\Task.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\utils\TaskScheduler.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\utils\Ticker.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\utils\Timer.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\utils\UserData.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\utils\Xml.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\Action.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\ActionDelay.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\ActionGroup.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\ActionManager.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\ActionScheduler.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\ActionWalk.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\ActionTween.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\Animation.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\Button.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\Actor.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\Canvas.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\Component.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\DebugActor.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\Frame.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\FrameSequence.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\ShapeActor.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\GifSprite.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\LayerActor.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\Actor.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\Stage.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\Sprite.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\TextActor.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\2d\Transition.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\base\component\Button.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\base\component\Component.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\base\component\ComponentManager.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\base\Director.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\base\Module.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\base\ObjectBase.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\base\RefCounter.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\core\Allocator.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\core\Module.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\core\Director.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\core\EventDispatcher.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\core\EventListener.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\core\event\Event.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\core\event\KeyEvent.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\core\event\MouseEvent.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\core\event\WindowEvent.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\core\Exception.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\core\Library.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\core\Logger.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\core\ObjectBase.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\core\RefCounter.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\core\Resource.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\core\String.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\core\Time.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\core\Timer.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\core\TimerManager.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\event\Event.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\event\EventDispatcher.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\event\EventListener.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\event\KeyEvent.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\event\MouseEvent.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\event\WindowEvent.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\platform\Application.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\platform\FileSystem.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\platform\Input.cpp" />
|
||||
|
|
@ -160,6 +162,8 @@
|
|||
<ClCompile Include="..\..\src\kiwano\render\DirectX\RendererImpl.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\render\DirectX\TextRenderer.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\render\Font.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\render\Frame.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\render\FrameSequence.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\render\Shape.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\render\ShapeMaker.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\render\GifImage.cpp" />
|
||||
|
|
@ -170,8 +174,14 @@
|
|||
<ClCompile Include="..\..\src\kiwano\render\TextLayout.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\render\Texture.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\render\TextureCache.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\utils\EventTicker.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\utils\LocalStorage.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\utils\Logger.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\utils\ResourceCache.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\utils\Task.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\utils\TaskScheduler.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\utils\Ticker.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\utils\Timer.cpp" />
|
||||
<ClCompile Include="..\..\src\kiwano\utils\UserData.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
|
|
@ -185,7 +195,7 @@
|
|||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="cpp.hint" />
|
||||
<None Include="suppress_warning.ruleset" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}</ProjectGuid>
|
||||
|
|
|
|||
|
|
@ -22,15 +22,21 @@
|
|||
<Filter Include="platform\win32">
|
||||
<UniqueIdentifier>{e84dcf9a-e650-473e-8c9c-193804ab9e76}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="core\event">
|
||||
<UniqueIdentifier>{c629aedd-ffb9-4bc1-82c3-f50e77c82e77}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="render">
|
||||
<UniqueIdentifier>{adb44ca9-674a-4b77-993f-d65193d8ab06}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="render\DirectX">
|
||||
<UniqueIdentifier>{fd281702-0006-46d2-8fd1-28c502464164}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="base">
|
||||
<UniqueIdentifier>{f514ae4f-2f6a-4d47-aa38-245628d6e01c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="event">
|
||||
<UniqueIdentifier>{b0d28d20-bfaf-4816-8415-28c20ecf9fac}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="base\component">
|
||||
<UniqueIdentifier>{d15f4de1-7c2c-40d6-a3ce-68860b95a61e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\kiwano\2d\Canvas.h">
|
||||
|
|
@ -42,12 +48,6 @@
|
|||
<ClInclude Include="..\..\src\kiwano\2d\Transition.h">
|
||||
<Filter>2d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\core\EventDispatcher.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\core\EventListener.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\core\Resource.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -69,24 +69,12 @@
|
|||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\kiwano.h" />
|
||||
<ClInclude Include="..\..\src\kiwano\core\Timer.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\core\TimerManager.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\2d\GifSprite.h">
|
||||
<Filter>2d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\2d\Actor.h">
|
||||
<Filter>2d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\2d\Stage.h">
|
||||
<Filter>2d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\2d\Frame.h">
|
||||
<Filter>2d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\Action.h">
|
||||
<Filter>2d\action</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -99,18 +87,12 @@
|
|||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionTween.h">
|
||||
<Filter>2d\action</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionManager.h">
|
||||
<Filter>2d\action</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\Animation.h">
|
||||
<Filter>2d\action</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\utils\ResourceCache.h">
|
||||
<Filter>utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\2d\FrameSequence.h">
|
||||
<Filter>2d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\2d\DebugActor.h">
|
||||
<Filter>2d</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -123,12 +105,6 @@
|
|||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionWalk.h">
|
||||
<Filter>2d\action</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\core\Logger.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\core\ObjectBase.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\utils\LocalStorage.h">
|
||||
<Filter>utils</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -150,36 +126,12 @@
|
|||
<ClInclude Include="..\..\src\kiwano\2d\TextActor.h">
|
||||
<Filter>2d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\core\RefCounter.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\platform\win32\ComPtr.hpp">
|
||||
<Filter>platform\win32</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\platform\win32\libraries.h">
|
||||
<Filter>platform\win32</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\core\event\Event.h">
|
||||
<Filter>core\event</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\core\event\EventType.h">
|
||||
<Filter>core\event</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\core\event\KeyEvent.h">
|
||||
<Filter>core\event</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\core\event\MouseEvent.h">
|
||||
<Filter>core\event</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\core\event\WindowEvent.h">
|
||||
<Filter>core\event</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\2d\Button.h">
|
||||
<Filter>2d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\core\Director.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\core\Singleton.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -282,9 +234,6 @@
|
|||
<ClInclude Include="..\..\src\kiwano\render\Layer.h">
|
||||
<Filter>render</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\core\Module.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\platform\Runner.h">
|
||||
<Filter>platform</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -297,12 +246,6 @@
|
|||
<ClInclude Include="..\..\src\kiwano\core\Any.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\core\Json.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\core\Xml.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\core\IntrusiveList.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -315,9 +258,6 @@
|
|||
<ClInclude Include="..\..\src\kiwano\render\ShapeMaker.h">
|
||||
<Filter>render</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\2d\Component.h">
|
||||
<Filter>2d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\core\Allocator.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
|
|
@ -327,6 +267,90 @@
|
|||
<ClInclude Include="..\..\src\kiwano\core\Serializable.h">
|
||||
<Filter>core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\render\Frame.h">
|
||||
<Filter>render</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\render\FrameSequence.h">
|
||||
<Filter>render</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\utils\EventTicker.h">
|
||||
<Filter>utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\utils\Json.h">
|
||||
<Filter>utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\utils\Task.h">
|
||||
<Filter>utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\utils\Ticker.h">
|
||||
<Filter>utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\utils\Timer.h">
|
||||
<Filter>utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\utils\Xml.h">
|
||||
<Filter>utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\utils\TaskScheduler.h">
|
||||
<Filter>utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\2d\action\ActionScheduler.h">
|
||||
<Filter>2d\action</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\render\DirectX\D3DDeviceResources.h">
|
||||
<Filter>render\DirectX</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\utils\Logger.h">
|
||||
<Filter>utils</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\base\Director.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\base\Module.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\base\ObjectBase.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\base\RefCounter.h">
|
||||
<Filter>base</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\event\Event.h">
|
||||
<Filter>event</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\event\EventDispatcher.h">
|
||||
<Filter>event</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\event\EventListener.h">
|
||||
<Filter>event</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\event\Events.h">
|
||||
<Filter>event</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\event\EventType.h">
|
||||
<Filter>event</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\event\KeyEvent.h">
|
||||
<Filter>event</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\event\MouseEvent.h">
|
||||
<Filter>event</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\event\WindowEvent.h">
|
||||
<Filter>event</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\2d\Actor.h">
|
||||
<Filter>2d</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\base\component\Button.h">
|
||||
<Filter>base\component</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\base\component\Component.h">
|
||||
<Filter>base\component</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\kiwano\base\component\ComponentManager.h">
|
||||
<Filter>base\component</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\kiwano\2d\Canvas.cpp">
|
||||
|
|
@ -338,36 +362,18 @@
|
|||
<ClCompile Include="..\..\src\kiwano\2d\Transition.cpp">
|
||||
<Filter>2d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\core\EventDispatcher.cpp">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\core\EventListener.cpp">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\core\Resource.cpp">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\platform\Application.cpp">
|
||||
<Filter>platform</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\core\Timer.cpp">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\core\TimerManager.cpp">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\2d\GifSprite.cpp">
|
||||
<Filter>2d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\2d\Actor.cpp">
|
||||
<Filter>2d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\2d\Stage.cpp">
|
||||
<Filter>2d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\2d\Frame.cpp">
|
||||
<Filter>2d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\Action.cpp">
|
||||
<Filter>2d\action</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -377,18 +383,12 @@
|
|||
<ClCompile Include="..\..\src\kiwano\2d\action\ActionTween.cpp">
|
||||
<Filter>2d\action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\ActionManager.cpp">
|
||||
<Filter>2d\action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\Animation.cpp">
|
||||
<Filter>2d\action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\utils\ResourceCache.cpp">
|
||||
<Filter>utils</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\2d\FrameSequence.cpp">
|
||||
<Filter>2d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\2d\DebugActor.cpp">
|
||||
<Filter>2d</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -401,12 +401,6 @@
|
|||
<ClCompile Include="..\..\src\kiwano\2d\action\ActionWalk.cpp">
|
||||
<Filter>2d\action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\core\Logger.cpp">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\core\ObjectBase.cpp">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\utils\LocalStorage.cpp">
|
||||
<Filter>utils</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -428,30 +422,9 @@
|
|||
<ClCompile Include="..\..\src\kiwano\2d\TextActor.cpp">
|
||||
<Filter>2d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\core\RefCounter.cpp">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\platform\win32\libraries.cpp">
|
||||
<Filter>platform\win32</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\core\event\Event.cpp">
|
||||
<Filter>core\event</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\core\event\KeyEvent.cpp">
|
||||
<Filter>core\event</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\core\event\MouseEvent.cpp">
|
||||
<Filter>core\event</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\core\event\WindowEvent.cpp">
|
||||
<Filter>core\event</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\2d\Button.cpp">
|
||||
<Filter>2d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\core\Director.cpp">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\platform\win32\WindowImpl.cpp">
|
||||
<Filter>platform\win32</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -521,9 +494,6 @@
|
|||
<ClCompile Include="..\..\src\kiwano\render\Layer.cpp">
|
||||
<Filter>render</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\core\Module.cpp">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\platform\Runner.cpp">
|
||||
<Filter>platform</Filter>
|
||||
</ClCompile>
|
||||
|
|
@ -533,14 +503,80 @@
|
|||
<ClCompile Include="..\..\src\kiwano\render\ShapeMaker.cpp">
|
||||
<Filter>render</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\2d\Component.cpp">
|
||||
<Filter>2d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\core\Allocator.cpp">
|
||||
<Filter>core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\render\Frame.cpp">
|
||||
<Filter>render</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\render\FrameSequence.cpp">
|
||||
<Filter>render</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\utils\EventTicker.cpp">
|
||||
<Filter>utils</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\utils\Task.cpp">
|
||||
<Filter>utils</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\utils\Ticker.cpp">
|
||||
<Filter>utils</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\utils\Timer.cpp">
|
||||
<Filter>utils</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\utils\TaskScheduler.cpp">
|
||||
<Filter>utils</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\2d\action\ActionScheduler.cpp">
|
||||
<Filter>2d\action</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\utils\Logger.cpp">
|
||||
<Filter>utils</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\base\Director.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\base\Module.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\base\ObjectBase.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\base\RefCounter.cpp">
|
||||
<Filter>base</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\event\Event.cpp">
|
||||
<Filter>event</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\event\EventDispatcher.cpp">
|
||||
<Filter>event</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\event\EventListener.cpp">
|
||||
<Filter>event</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\event\KeyEvent.cpp">
|
||||
<Filter>event</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\event\MouseEvent.cpp">
|
||||
<Filter>event</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\event\WindowEvent.cpp">
|
||||
<Filter>event</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\2d\Actor.cpp">
|
||||
<Filter>2d</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\base\component\Button.cpp">
|
||||
<Filter>base\component</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\base\component\Component.cpp">
|
||||
<Filter>base\component</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\kiwano\base\component\ComponentManager.cpp">
|
||||
<Filter>base\component</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="cpp.hint" />
|
||||
<None Include="suppress_warning.ruleset" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RuleSet Name="suppress_warning" ToolsVersion="16.0">
|
||||
<Include Path="nativerecommendedrules.ruleset" Action="Default" />
|
||||
<Rules AnalyzerId="Microsoft.Analyzers.NativeCodeAnalysis" RuleNamespace="Microsoft.Rules.Native">
|
||||
<Rule Id="C26812" Action="None" />
|
||||
</Rules>
|
||||
</RuleSet>
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
include_directories(..)
|
||||
|
||||
set(SOURCE_FILES
|
||||
Collision/Shapes/b2ChainShape.cpp
|
||||
Collision/Shapes/b2ChainShape.h
|
||||
Collision/Shapes/b2CircleShape.cpp
|
||||
Collision/Shapes/b2CircleShape.h
|
||||
Collision/Shapes/b2EdgeShape.cpp
|
||||
Collision/Shapes/b2EdgeShape.h
|
||||
Collision/Shapes/b2PolygonShape.cpp
|
||||
Collision/Shapes/b2PolygonShape.h
|
||||
Collision/Shapes/b2Shape.h
|
||||
Collision/b2BroadPhase.cpp
|
||||
Collision/b2BroadPhase.h
|
||||
Collision/b2CollideCircle.cpp
|
||||
Collision/b2CollideEdge.cpp
|
||||
Collision/b2CollidePolygon.cpp
|
||||
Collision/b2Collision.cpp
|
||||
Collision/b2Collision.h
|
||||
Collision/b2Distance.cpp
|
||||
Collision/b2Distance.h
|
||||
Collision/b2DynamicTree.cpp
|
||||
Collision/b2DynamicTree.h
|
||||
Collision/b2TimeOfImpact.cpp
|
||||
Collision/b2TimeOfImpact.h
|
||||
Common/b2BlockAllocator.cpp
|
||||
Common/b2BlockAllocator.h
|
||||
Common/b2Draw.cpp
|
||||
Common/b2Draw.h
|
||||
Common/b2GrowableStack.h
|
||||
Common/b2Math.cpp
|
||||
Common/b2Math.h
|
||||
Common/b2Settings.cpp
|
||||
Common/b2Settings.h
|
||||
Common/b2StackAllocator.cpp
|
||||
Common/b2StackAllocator.h
|
||||
Common/b2Timer.cpp
|
||||
Common/b2Timer.h
|
||||
Dynamics/Contacts/b2ChainAndCircleContact.cpp
|
||||
Dynamics/Contacts/b2ChainAndCircleContact.h
|
||||
Dynamics/Contacts/b2ChainAndPolygonContact.cpp
|
||||
Dynamics/Contacts/b2ChainAndPolygonContact.h
|
||||
Dynamics/Contacts/b2CircleContact.cpp
|
||||
Dynamics/Contacts/b2CircleContact.h
|
||||
Dynamics/Contacts/b2Contact.cpp
|
||||
Dynamics/Contacts/b2Contact.h
|
||||
Dynamics/Contacts/b2ContactSolver.cpp
|
||||
Dynamics/Contacts/b2ContactSolver.h
|
||||
Dynamics/Contacts/b2EdgeAndCircleContact.cpp
|
||||
Dynamics/Contacts/b2EdgeAndCircleContact.h
|
||||
Dynamics/Contacts/b2EdgeAndPolygonContact.cpp
|
||||
Dynamics/Contacts/b2EdgeAndPolygonContact.h
|
||||
Dynamics/Contacts/b2PolygonAndCircleContact.cpp
|
||||
Dynamics/Contacts/b2PolygonAndCircleContact.h
|
||||
Dynamics/Contacts/b2PolygonContact.cpp
|
||||
Dynamics/Contacts/b2PolygonContact.h
|
||||
Dynamics/Joints/b2DistanceJoint.cpp
|
||||
Dynamics/Joints/b2DistanceJoint.h
|
||||
Dynamics/Joints/b2FrictionJoint.cpp
|
||||
Dynamics/Joints/b2FrictionJoint.h
|
||||
Dynamics/Joints/b2GearJoint.cpp
|
||||
Dynamics/Joints/b2GearJoint.h
|
||||
Dynamics/Joints/b2Joint.cpp
|
||||
Dynamics/Joints/b2Joint.h
|
||||
Dynamics/Joints/b2MotorJoint.cpp
|
||||
Dynamics/Joints/b2MotorJoint.h
|
||||
Dynamics/Joints/b2MouseJoint.cpp
|
||||
Dynamics/Joints/b2MouseJoint.h
|
||||
Dynamics/Joints/b2PrismaticJoint.cpp
|
||||
Dynamics/Joints/b2PrismaticJoint.h
|
||||
Dynamics/Joints/b2PulleyJoint.cpp
|
||||
Dynamics/Joints/b2PulleyJoint.h
|
||||
Dynamics/Joints/b2RevoluteJoint.cpp
|
||||
Dynamics/Joints/b2RevoluteJoint.h
|
||||
Dynamics/Joints/b2RopeJoint.cpp
|
||||
Dynamics/Joints/b2RopeJoint.h
|
||||
Dynamics/Joints/b2WeldJoint.cpp
|
||||
Dynamics/Joints/b2WeldJoint.h
|
||||
Dynamics/Joints/b2WheelJoint.cpp
|
||||
Dynamics/Joints/b2WheelJoint.h
|
||||
Dynamics/b2Body.cpp
|
||||
Dynamics/b2Body.h
|
||||
Dynamics/b2ContactManager.cpp
|
||||
Dynamics/b2ContactManager.h
|
||||
Dynamics/b2Fixture.cpp
|
||||
Dynamics/b2Fixture.h
|
||||
Dynamics/b2Island.cpp
|
||||
Dynamics/b2Island.h
|
||||
Dynamics/b2TimeStep.h
|
||||
Dynamics/b2World.cpp
|
||||
Dynamics/b2World.h
|
||||
Dynamics/b2WorldCallbacks.cpp
|
||||
Dynamics/b2WorldCallbacks.h
|
||||
Rope/b2Rope.cpp
|
||||
Rope/b2Rope.h
|
||||
Box2D.h)
|
||||
|
||||
add_library(libbox2d ${SOURCE_FILES})
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
#define B2_MATH_H
|
||||
|
||||
#include "b2Settings.h"
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
/// This function is used to ensure that a floating point number is not a NaN or infinity.
|
||||
inline bool b2IsValid(float32 x)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
include_directories(..)
|
||||
|
||||
set(SOURCE_FILES
|
||||
curl.h
|
||||
curlbuild.h
|
||||
curlrules.h
|
||||
curlver.h
|
||||
easy.h
|
||||
mprintf.h
|
||||
multi.h
|
||||
stdcheaders.h
|
||||
typecheck-gcc.h)
|
||||
|
||||
add_library(libcurl ${SOURCE_FILES})
|
||||
|
||||
target_link_libraries(libcurl ./libs/libcurl.lib)
|
||||
|
||||
set_target_properties(libcurl PROPERTIES LINKER_LANGUAGE CXX)
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
include_directories(..)
|
||||
|
||||
set(SOURCE_FILES
|
||||
imconfig.h
|
||||
imgui.cpp
|
||||
imgui.h
|
||||
imgui_demo.cpp
|
||||
imgui_draw.cpp
|
||||
imgui_internal.h
|
||||
imgui_widgets.cpp
|
||||
imstb_rectpack.h
|
||||
imstb_textedit.h
|
||||
imstb_truetype.h)
|
||||
|
||||
add_library(libimgui ${SOURCE_FILES})
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
include_directories(..)
|
||||
|
||||
set(SOURCE_FILES
|
||||
json.hpp)
|
||||
|
||||
add_library(libnlohmann ${SOURCE_FILES})
|
||||
|
||||
set_target_properties(libnlohmann PROPERTIES LINKER_LANGUAGE CXX)
|
||||
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
include_directories(..)
|
||||
|
||||
set(SOURCE_FILES
|
||||
pugiconfig.hpp
|
||||
pugixml-impl.hpp
|
||||
pugixml.hpp)
|
||||
|
||||
add_library(libpugixml ${SOURCE_FILES})
|
||||
|
||||
set_target_properties(libpugixml PROPERTIES LINKER_LANGUAGE CXX)
|
||||
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
#include <kiwano-audio/AudioModule.h>
|
||||
#include <kiwano-audio/libraries.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/core/Exception.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include <kiwano-audio/Sound.h>
|
||||
#include <kiwano-audio/Transcoder.h>
|
||||
#include <kiwano/core/Common.h>
|
||||
#include <kiwano/core/Module.h>
|
||||
#include <kiwano/base/Module.h>
|
||||
#include <xaudio2.h>
|
||||
|
||||
namespace kiwano
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
include_directories(..)
|
||||
|
||||
set(SOURCE_FILES
|
||||
AudioModule.cpp
|
||||
AudioModule.h
|
||||
kiwano-audio.h
|
||||
libraries.cpp
|
||||
libraries.h
|
||||
Sound.cpp
|
||||
Sound.h
|
||||
SoundPlayer.cpp
|
||||
SoundPlayer.h
|
||||
Transcoder.cpp
|
||||
Transcoder.h)
|
||||
|
||||
add_library(libkiwanoaudio ${SOURCE_FILES})
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include <kiwano-audio/AudioModule.h>
|
||||
#include <kiwano-audio/Sound.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
#include <kiwano/platform/FileSystem.h>
|
||||
|
||||
namespace kiwano
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
#pragma once
|
||||
#include <kiwano-audio/Transcoder.h>
|
||||
#include <kiwano/core/ObjectBase.h>
|
||||
#include <kiwano/core/Resource.h>
|
||||
#include <kiwano/base/ObjectBase.h>
|
||||
#include <kiwano/platform/win32/ComPtr.hpp>
|
||||
#include <xaudio2.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#pragma once
|
||||
#include <kiwano-audio/Sound.h>
|
||||
#include <kiwano/core/ObjectBase.h>
|
||||
#include <kiwano/base/ObjectBase.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,9 +25,8 @@
|
|||
#include <kiwano-audio/Transcoder.h>
|
||||
#include <kiwano-audio/libraries.h>
|
||||
#include <kiwano/core/Common.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/core/Resource.h>
|
||||
#include <kiwano/macros.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
#include <kiwano/platform/win32/ComPtr.hpp>
|
||||
#include <kiwano/platform/win32/libraries.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano-audio/libraries.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
#include <kiwano/core/Exception.h>
|
||||
|
||||
namespace kiwano
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
include_directories(..)
|
||||
|
||||
set(SOURCE_FILES
|
||||
imgui_impl/imgui_impl.h
|
||||
imgui_impl/imgui_impl_dx10.cpp
|
||||
imgui_impl/imgui_impl_dx10.h
|
||||
imgui_impl/imgui_impl_dx11.cpp
|
||||
imgui_impl/imgui_impl_dx11.h
|
||||
ImGuiLayer.cpp
|
||||
ImGuiLayer.h
|
||||
ImGuiModule.cpp
|
||||
ImGuiModule.h
|
||||
kiwano-imgui.h)
|
||||
|
||||
add_library(libkiwanoimgui ${SOURCE_FILES})
|
||||
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
|
||||
#include <kiwano/core/Common.h>
|
||||
#include <kiwano/core/event/KeyEvent.h>
|
||||
#include <kiwano/core/event/MouseEvent.h>
|
||||
#include <kiwano/event/Events.h>
|
||||
#include <kiwano/platform/Input.h>
|
||||
#include <kiwano/platform/Application.h>
|
||||
#include <kiwano/render/Renderer.h>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#pragma once
|
||||
#include <kiwano/core/Common.h>
|
||||
#include <kiwano/core/Module.h>
|
||||
#include <kiwano/base/Module.h>
|
||||
#include <kiwano/platform/Window.h>
|
||||
|
||||
namespace kiwano
|
||||
|
|
|
|||
|
|
@ -7,13 +7,12 @@
|
|||
#if !defined(KGE_USE_DIRECTX10)
|
||||
|
||||
#include <kiwano-imgui/imgui_impl/imgui_impl_dx11.h>
|
||||
#include <kiwano/render/DirectX/RendererImpl.h>
|
||||
#include <kiwano/render/DirectX/D3DDeviceResources.h>
|
||||
|
||||
inline bool ImGui_Impl_Init()
|
||||
{
|
||||
::kiwano::RendererImpl& renderer = ::kiwano::RendererImpl::GetInstance();
|
||||
return ImGui_ImplDX11_Init(renderer.GetD3DDeviceResources()->GetDevice(),
|
||||
renderer.GetD3DDeviceResources()->GetDeviceContext());
|
||||
auto d3d = kiwano::graphics::directx::GetD3DDeviceResources();
|
||||
return ImGui_ImplDX11_Init(d3d->GetDevice(), d3d->GetDeviceContext());
|
||||
}
|
||||
|
||||
inline void ImGui_Impl_Shutdown()
|
||||
|
|
@ -44,11 +43,12 @@ inline bool ImGui_Impl_CreateDeviceObjects()
|
|||
#else
|
||||
|
||||
#include <kiwano-imgui/imgui_impl/imgui_impl_dx10.h>
|
||||
#include <kiwano/render/DirectX/D3DDeviceResources.h>
|
||||
|
||||
inline bool ImGui_Impl_Init()
|
||||
{
|
||||
::kiwano::RendererImpl& renderer = ::kiwano::RendererImpl::GetInstance();
|
||||
return ImGui_ImplDX10_Init(renderer.GetD3DDeviceResources()->GetDevice());
|
||||
auto d3d = kiwano::graphics::directx::GetD3DDeviceResources();
|
||||
return ImGui_ImplDX10_Init(d3d->GetDevice());
|
||||
}
|
||||
|
||||
inline void ImGui_Impl_Shutdown()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
include_directories(..)
|
||||
|
||||
set(SOURCE_FILES
|
||||
HttpModule.cpp
|
||||
HttpModule.h
|
||||
HttpRequest.cpp
|
||||
HttpRequest.h
|
||||
HttpResponse.hpp
|
||||
kiwano-network.h)
|
||||
|
||||
add_library(libkiwanonetwork ${SOURCE_FILES})
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
#include <kiwano/platform/Application.h>
|
||||
#include <kiwano-network/HttpRequest.h>
|
||||
#include <kiwano-network/HttpResponse.hpp>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <kiwano/core/Common.h>
|
||||
#include <kiwano/core/Module.h>
|
||||
#include <kiwano/base/Module.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
#pragma once
|
||||
#include <kiwano/core/Common.h>
|
||||
#include <kiwano/core/ObjectBase.h>
|
||||
#include <kiwano/core/Json.h>
|
||||
#include <kiwano/base/ObjectBase.h>
|
||||
#include <kiwano/utils/Json.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
include_directories(..)
|
||||
include_directories(../3rd-party)
|
||||
|
||||
set(SOURCE_FILES
|
||||
Contact.cpp
|
||||
Contact.h
|
||||
ContactEdge.cpp
|
||||
ContactEdge.h
|
||||
ContactEvent.cpp
|
||||
ContactEvent.h
|
||||
Fixture.cpp
|
||||
Fixture.h
|
||||
Global.cpp
|
||||
Global.h
|
||||
Joint.cpp
|
||||
Joint.h
|
||||
kiwano-physics.h
|
||||
PhysicBody.cpp
|
||||
PhysicBody.h
|
||||
PhysicWorld.cpp
|
||||
PhysicWorld.h)
|
||||
|
||||
add_library(libkiwanophysics ${SOURCE_FILES})
|
||||
|
||||
target_link_libraries(libkiwanophysics libbox2d)
|
||||
|
|
@ -18,7 +18,6 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
#include <kiwano-physics/Global.h>
|
||||
|
||||
namespace kiwano
|
||||
|
|
|
|||
|
|
@ -32,25 +32,23 @@ public:
|
|||
DebugDrawer(const Size& size)
|
||||
{
|
||||
canvas_ = Canvas::Create(size);
|
||||
ctx_ = canvas_->GetContext2D();
|
||||
|
||||
fill_brush_ = Brush::Create(Color::White);
|
||||
line_brush_ = Brush::Create(Color::White);
|
||||
|
||||
canvas_->SetFillBrush(fill_brush_);
|
||||
canvas_->SetStrokeBrush(line_brush_);
|
||||
|
||||
b2Draw::SetFlags(b2Draw::e_shapeBit | b2Draw::e_jointBit | b2Draw::e_jointBit | b2Draw::e_centerOfMassBit);
|
||||
}
|
||||
|
||||
void BeginDraw()
|
||||
{
|
||||
canvas_->BeginDraw();
|
||||
canvas_->Clear();
|
||||
ctx_->BeginDraw();
|
||||
ctx_->Clear();
|
||||
}
|
||||
|
||||
void EndDraw()
|
||||
{
|
||||
canvas_->EndDraw();
|
||||
ctx_->EndDraw();
|
||||
}
|
||||
|
||||
void Render(RenderContext& ctx)
|
||||
|
|
@ -61,11 +59,13 @@ public:
|
|||
void SetFillColor(const b2Color& color)
|
||||
{
|
||||
fill_brush_->SetColor(reinterpret_cast<const Color&>(color));
|
||||
ctx_->SetCurrentBrush(fill_brush_);
|
||||
}
|
||||
|
||||
void SetLineColor(const b2Color& color)
|
||||
{
|
||||
line_brush_->SetColor(reinterpret_cast<const Color&>(color));
|
||||
ctx_->SetCurrentBrush(line_brush_);
|
||||
}
|
||||
|
||||
void DrawPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color) override
|
||||
|
|
@ -76,7 +76,7 @@ public:
|
|||
for (int32 i = 0; i < vertexCount; ++i)
|
||||
{
|
||||
b2Vec2 p2 = vertices[i];
|
||||
canvas_->DrawLine(global::WorldToLocal(p1), global::WorldToLocal(p2));
|
||||
ctx_->DrawLine(global::WorldToLocal(p1), global::WorldToLocal(p2));
|
||||
p1 = p2;
|
||||
}
|
||||
}
|
||||
|
|
@ -92,25 +92,25 @@ public:
|
|||
maker.EndPath(true);
|
||||
|
||||
SetFillColor(color);
|
||||
canvas_->FillShape(maker.GetShape());
|
||||
ctx_->FillShape(*maker.GetShape());
|
||||
}
|
||||
|
||||
void DrawCircle(const b2Vec2& center, float32 radius, const b2Color& color) override
|
||||
{
|
||||
SetLineColor(color);
|
||||
canvas_->DrawCircle(global::WorldToLocal(center), global::WorldToLocal(radius));
|
||||
ctx_->DrawCircle(global::WorldToLocal(center), global::WorldToLocal(radius));
|
||||
}
|
||||
|
||||
void DrawSolidCircle(const b2Vec2& center, float32 radius, const b2Vec2& axis, const b2Color& color) override
|
||||
{
|
||||
SetFillColor(color);
|
||||
canvas_->FillCircle(global::WorldToLocal(center), global::WorldToLocal(radius));
|
||||
ctx_->FillCircle(global::WorldToLocal(center), global::WorldToLocal(radius));
|
||||
}
|
||||
|
||||
void DrawSegment(const b2Vec2& p1, const b2Vec2& p2, const b2Color& color) override
|
||||
{
|
||||
SetLineColor(color);
|
||||
canvas_->DrawLine(global::WorldToLocal(p1), global::WorldToLocal(p2));
|
||||
ctx_->DrawLine(global::WorldToLocal(p1), global::WorldToLocal(p2));
|
||||
}
|
||||
|
||||
void DrawTransform(const b2Transform& xf) override
|
||||
|
|
@ -124,24 +124,25 @@ public:
|
|||
p2 = p1 + k_axisScale * xf.q.GetXAxis();
|
||||
|
||||
SetLineColor(red);
|
||||
canvas_->DrawLine(global::WorldToLocal(p1), global::WorldToLocal(p2));
|
||||
ctx_->DrawLine(global::WorldToLocal(p1), global::WorldToLocal(p2));
|
||||
|
||||
p2 = p1 + k_axisScale * xf.q.GetYAxis();
|
||||
|
||||
SetLineColor(green);
|
||||
canvas_->DrawLine(global::WorldToLocal(p1), global::WorldToLocal(p2));
|
||||
ctx_->DrawLine(global::WorldToLocal(p1), global::WorldToLocal(p2));
|
||||
}
|
||||
|
||||
void DrawPoint(const b2Vec2& p, float32 size, const b2Color& color) override
|
||||
{
|
||||
SetFillColor(color);
|
||||
canvas_->FillCircle(global::WorldToLocal(p), global::WorldToLocal(size));
|
||||
ctx_->FillCircle(global::WorldToLocal(p), global::WorldToLocal(size));
|
||||
}
|
||||
|
||||
private:
|
||||
CanvasPtr canvas_;
|
||||
BrushPtr fill_brush_;
|
||||
BrushPtr line_brush_;
|
||||
CanvasPtr canvas_;
|
||||
RenderContextPtr ctx_;
|
||||
BrushPtr fill_brush_;
|
||||
BrushPtr line_brush_;
|
||||
};
|
||||
|
||||
class DestructionListener : public b2DestructionListener
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include <kiwano/2d/Actor.h>
|
||||
#include <kiwano/2d/Stage.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
#include <kiwano/render/Renderer.h>
|
||||
|
||||
namespace kiwano
|
||||
|
|
@ -46,7 +46,8 @@ ActorPtr Actor::Create()
|
|||
}
|
||||
|
||||
Actor::Actor()
|
||||
: visible_(true)
|
||||
: ComponentManager(this)
|
||||
, visible_(true)
|
||||
, visible_in_rt_(true)
|
||||
, update_pausing_(false)
|
||||
, hover_(false)
|
||||
|
|
@ -77,9 +78,9 @@ Actor::~Actor()
|
|||
|
||||
void Actor::Update(Duration dt)
|
||||
{
|
||||
UpdateActions(this, dt);
|
||||
UpdateComponents(dt);
|
||||
UpdateTimers(dt);
|
||||
ActionScheduler::Update(this, dt);
|
||||
TaskScheduler::Update(dt);
|
||||
ComponentManager::Update(dt);
|
||||
|
||||
if (!update_pausing_)
|
||||
{
|
||||
|
|
@ -112,7 +113,7 @@ void Actor::Render(RenderContext& ctx)
|
|||
if (CheckVisibility(ctx))
|
||||
{
|
||||
PrepareToRender(ctx);
|
||||
RenderComponents(ctx);
|
||||
ComponentManager::Render(ctx);
|
||||
OnRender(ctx);
|
||||
}
|
||||
}
|
||||
|
|
@ -132,7 +133,7 @@ void Actor::Render(RenderContext& ctx)
|
|||
if (CheckVisibility(ctx))
|
||||
{
|
||||
PrepareToRender(ctx);
|
||||
RenderComponents(ctx);
|
||||
ComponentManager::Render(ctx);
|
||||
OnRender(ctx);
|
||||
}
|
||||
|
||||
|
|
@ -242,19 +243,7 @@ void Actor::DoDeserialize(Deserializer* deserializer)
|
|||
|
||||
bool Actor::HandleEvent(Event* evt)
|
||||
{
|
||||
if (!components_.IsEmpty())
|
||||
{
|
||||
ComponentPtr next;
|
||||
for (auto component = components_.GetFirst(); component; component = next)
|
||||
{
|
||||
next = component->GetNext();
|
||||
|
||||
if (component->IsEnable())
|
||||
{
|
||||
component->HandleEvent(evt);
|
||||
}
|
||||
}
|
||||
}
|
||||
ComponentManager::DispatchToComponents(evt);
|
||||
|
||||
if (!EventDispatcher::DispatchEvent(evt))
|
||||
return false;
|
||||
|
|
@ -304,40 +293,6 @@ bool Actor::HandleEvent(Event* evt)
|
|||
return true;
|
||||
}
|
||||
|
||||
void Actor::UpdateComponents(Duration dt)
|
||||
{
|
||||
if (!components_.IsEmpty())
|
||||
{
|
||||
ComponentPtr next;
|
||||
for (auto component = components_.GetFirst(); component; component = next)
|
||||
{
|
||||
next = component->GetNext();
|
||||
|
||||
if (component->IsEnable())
|
||||
{
|
||||
component->OnUpdate(dt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Actor::RenderComponents(RenderContext& ctx)
|
||||
{
|
||||
if (!components_.IsEmpty())
|
||||
{
|
||||
ComponentPtr next;
|
||||
for (auto component = components_.GetFirst(); component; component = next)
|
||||
{
|
||||
next = component->GetNext();
|
||||
|
||||
if (component->IsEnable())
|
||||
{
|
||||
component->OnRender(ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const Matrix3x2& Actor::GetTransformMatrix() const
|
||||
{
|
||||
UpdateTransform();
|
||||
|
|
@ -657,72 +612,6 @@ void Actor::RemoveFromParent()
|
|||
}
|
||||
}
|
||||
|
||||
Component* Actor::AddComponent(ComponentPtr component)
|
||||
{
|
||||
KGE_ASSERT(component && "AddComponent failed, NULL pointer exception");
|
||||
|
||||
if (component)
|
||||
{
|
||||
component->InitComponent(this);
|
||||
components_.PushBack(component);
|
||||
}
|
||||
return component.Get();
|
||||
}
|
||||
|
||||
ComponentList& Actor::GetAllComponents()
|
||||
{
|
||||
return components_;
|
||||
}
|
||||
|
||||
const ComponentList& Actor::GetAllComponents() const
|
||||
{
|
||||
return components_;
|
||||
}
|
||||
|
||||
void Actor::RemoveComponent(ComponentPtr component)
|
||||
{
|
||||
auto iter = std::find(components_.begin(), components_.end(), component);
|
||||
if (iter != components_.end())
|
||||
{
|
||||
component->DestroyComponent();
|
||||
components_.Remove(component);
|
||||
}
|
||||
}
|
||||
|
||||
void Actor::RemoveComponents(const String& name)
|
||||
{
|
||||
if (!components_.IsEmpty())
|
||||
{
|
||||
ComponentPtr next;
|
||||
for (auto component = components_.GetFirst(); component; component = next)
|
||||
{
|
||||
next = component->GetNext();
|
||||
|
||||
if (component->IsName(name))
|
||||
{
|
||||
component->DestroyComponent();
|
||||
components_.Remove(component);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Actor::RemoveAllComponents()
|
||||
{
|
||||
// Destroy all components
|
||||
if (!components_.IsEmpty())
|
||||
{
|
||||
ComponentPtr next;
|
||||
for (auto component = components_.GetFirst(); component; component = next)
|
||||
{
|
||||
next = component->GetNext();
|
||||
|
||||
component->DestroyComponent();
|
||||
}
|
||||
}
|
||||
components_.Clear();
|
||||
}
|
||||
|
||||
void Actor::RemoveChild(ActorPtr child)
|
||||
{
|
||||
KGE_ASSERT(child && "Actor::RemoveChild failed, NULL pointer exception");
|
||||
|
|
|
|||
|
|
@ -19,13 +19,13 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
#include <kiwano/core/ObjectBase.h>
|
||||
#include <kiwano/core/Time.h>
|
||||
#include <kiwano/core/TimerManager.h>
|
||||
#include <kiwano/core/EventDispatcher.h>
|
||||
#include <kiwano/math/Math.h>
|
||||
#include <kiwano/2d/action/ActionManager.h>
|
||||
#include <kiwano/2d/Component.h>
|
||||
#include <kiwano/core/Time.h>
|
||||
#include <kiwano/base/ObjectBase.h>
|
||||
#include <kiwano/base/component/ComponentManager.h>
|
||||
#include <kiwano/event/EventDispatcher.h>
|
||||
#include <kiwano/utils/TaskScheduler.h>
|
||||
#include <kiwano/2d/action/ActionScheduler.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
@ -58,13 +58,14 @@ typedef IntrusiveList<ActorPtr> ActorList;
|
|||
* \~chinese
|
||||
* @brief 角色
|
||||
* @details
|
||||
* 角色是舞台上最基本的元素,是完成渲染、更新、事件分发等功能的最小单位,也是动画、定时器、事件监听等功能的载体
|
||||
* 角色是舞台上最基本的元素,是完成渲染、更新、事件分发等功能的最小单位,也是动画、任务、事件监听等功能的载体
|
||||
*/
|
||||
class KGE_API Actor
|
||||
: public ObjectBase
|
||||
, public TimerManager
|
||||
, public ActionManager
|
||||
, public TaskScheduler
|
||||
, public ActionScheduler
|
||||
, public EventDispatcher
|
||||
, public ComponentManager
|
||||
, protected IntrusiveListValue<ActorPtr>
|
||||
{
|
||||
friend class Director;
|
||||
|
|
@ -370,32 +371,6 @@ public:
|
|||
/// @brief 从父角色移除
|
||||
void RemoveFromParent();
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 添加组件
|
||||
/// @param component 组件
|
||||
Component* AddComponent(ComponentPtr component);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 获取所有组件
|
||||
ComponentList& GetAllComponents();
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 获取所有组件
|
||||
const ComponentList& GetAllComponents() const;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 移除组件
|
||||
void RemoveComponent(ComponentPtr component);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 移除组件
|
||||
/// @param name 组件名称
|
||||
void RemoveComponents(const String& name);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 移除所有组件
|
||||
void RemoveAllComponents();
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 暂停角色更新
|
||||
void PauseUpdating();
|
||||
|
|
@ -499,14 +474,6 @@ protected:
|
|||
/// @brief 处理事件
|
||||
bool HandleEvent(Event* evt);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 更新组件
|
||||
void UpdateComponents(Duration dt);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 渲染组件
|
||||
void RenderComponents(RenderContext& ctx);
|
||||
|
||||
private:
|
||||
bool visible_;
|
||||
bool update_pausing_;
|
||||
|
|
@ -524,7 +491,6 @@ private:
|
|||
Point anchor_;
|
||||
Size size_;
|
||||
ActorList children_;
|
||||
ComponentList components_;
|
||||
UpdateCallback cb_update_;
|
||||
Transform transform_;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano/2d/Canvas.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
@ -42,20 +42,11 @@ CanvasPtr Canvas::Create(const Size& size)
|
|||
return ptr;
|
||||
}
|
||||
|
||||
Canvas::Canvas()
|
||||
{
|
||||
}
|
||||
Canvas::Canvas() {}
|
||||
|
||||
void Canvas::BeginDraw()
|
||||
RenderContextPtr Canvas::GetContext2D() const
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->BeginDraw();
|
||||
}
|
||||
|
||||
void Canvas::EndDraw()
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->EndDraw();
|
||||
return render_ctx_;
|
||||
}
|
||||
|
||||
void Canvas::OnRender(RenderContext& ctx)
|
||||
|
|
@ -66,232 +57,6 @@ void Canvas::OnRender(RenderContext& ctx)
|
|||
}
|
||||
}
|
||||
|
||||
void Canvas::SetBrush(BrushPtr brush)
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->SetCurrentBrush(brush);
|
||||
}
|
||||
|
||||
void Canvas::SetBrushTransform(const Transform& transform)
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->SetTransform(transform.ToMatrix());
|
||||
}
|
||||
|
||||
void Canvas::SetBrushTransform(const Matrix3x2& transform)
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->SetTransform(transform);
|
||||
}
|
||||
|
||||
void Canvas::PushLayer(LayerPtr layer)
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
if (layer)
|
||||
{
|
||||
render_ctx_->PushLayer(*layer);
|
||||
}
|
||||
}
|
||||
|
||||
void Canvas::PopLayer()
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->PopLayer();
|
||||
}
|
||||
|
||||
void Canvas::PushClipRect(const Rect& clip_rect)
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->PushClipRect(clip_rect);
|
||||
}
|
||||
|
||||
void Canvas::PopClipRect()
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->PopClipRect();
|
||||
}
|
||||
|
||||
void Canvas::DrawShape(ShapePtr shape)
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
if (shape)
|
||||
{
|
||||
render_ctx_->SetCurrentBrush(stroke_brush_);
|
||||
render_ctx_->SetCurrentStrokeStyle(stroke_style_);
|
||||
render_ctx_->DrawShape(*shape);
|
||||
}
|
||||
}
|
||||
|
||||
void Canvas::DrawLine(const Point& begin, const Point& end)
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->SetCurrentBrush(stroke_brush_);
|
||||
render_ctx_->SetCurrentStrokeStyle(stroke_style_);
|
||||
render_ctx_->DrawLine(begin, end);
|
||||
}
|
||||
|
||||
void Canvas::DrawCircle(const Point& center, float radius)
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->SetCurrentBrush(stroke_brush_);
|
||||
render_ctx_->SetCurrentStrokeStyle(stroke_style_);
|
||||
render_ctx_->DrawEllipse(center, Vec2(radius, radius));
|
||||
}
|
||||
|
||||
void Canvas::DrawEllipse(const Point& center, const Vec2& radius)
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->SetCurrentBrush(stroke_brush_);
|
||||
render_ctx_->SetCurrentStrokeStyle(stroke_style_);
|
||||
render_ctx_->DrawEllipse(center, radius);
|
||||
}
|
||||
|
||||
void Canvas::DrawRect(const Rect& rect)
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->SetCurrentBrush(stroke_brush_);
|
||||
render_ctx_->SetCurrentStrokeStyle(stroke_style_);
|
||||
render_ctx_->DrawRectangle(rect);
|
||||
}
|
||||
|
||||
void Canvas::DrawRoundedRect(const Rect& rect, const Vec2& radius)
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->SetCurrentBrush(stroke_brush_);
|
||||
render_ctx_->SetCurrentStrokeStyle(stroke_style_);
|
||||
render_ctx_->DrawRoundedRectangle(rect, radius);
|
||||
}
|
||||
|
||||
void Canvas::FillShape(ShapePtr shape)
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
if (shape)
|
||||
{
|
||||
render_ctx_->SetCurrentBrush(fill_brush_);
|
||||
render_ctx_->FillShape(*shape);
|
||||
}
|
||||
}
|
||||
|
||||
void Canvas::FillCircle(const Point& center, float radius)
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->SetCurrentBrush(fill_brush_);
|
||||
render_ctx_->FillEllipse(center, Vec2(radius, radius));
|
||||
}
|
||||
|
||||
void Canvas::FillEllipse(const Point& center, const Vec2& radius)
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->SetCurrentBrush(fill_brush_);
|
||||
render_ctx_->FillEllipse(center, radius);
|
||||
}
|
||||
|
||||
void Canvas::FillRect(const Rect& rect)
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->SetCurrentBrush(fill_brush_);
|
||||
render_ctx_->FillRectangle(rect);
|
||||
}
|
||||
|
||||
void Canvas::FillRoundedRect(const Rect& rect, const Vec2& radius)
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->SetCurrentBrush(fill_brush_);
|
||||
render_ctx_->FillRoundedRectangle(rect, radius);
|
||||
}
|
||||
|
||||
void Canvas::DrawFrame(FramePtr frame, const Point& pos)
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
if (frame && frame->IsValid())
|
||||
{
|
||||
render_ctx_->DrawTexture(*frame->GetTexture(), &frame->GetCropRect(), &Rect(pos, frame->GetSize()));
|
||||
}
|
||||
}
|
||||
|
||||
void Canvas::DrawFrame(FramePtr frame, const Point& pos, const Size& size)
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
if (frame && frame->IsValid())
|
||||
{
|
||||
render_ctx_->DrawTexture(*frame->GetTexture(), &frame->GetCropRect(), &Rect(pos, size));
|
||||
}
|
||||
}
|
||||
|
||||
void Canvas::DrawTextLayout(const String& text, const TextStyle& style, const Point& point)
|
||||
{
|
||||
if (text.empty())
|
||||
return;
|
||||
|
||||
DrawTextLayout(TextLayout::Create(text, style), point);
|
||||
}
|
||||
|
||||
void Canvas::DrawTextLayout(TextLayoutPtr layout, const Point& point)
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
if (layout)
|
||||
{
|
||||
render_ctx_->DrawTextLayout(*layout, point);
|
||||
}
|
||||
}
|
||||
|
||||
void Canvas::BeginPath(const Point& begin_pos)
|
||||
{
|
||||
shape_maker_.BeginPath(begin_pos);
|
||||
}
|
||||
|
||||
void Canvas::EndPath(bool closed)
|
||||
{
|
||||
shape_maker_.EndPath(closed);
|
||||
}
|
||||
|
||||
void Canvas::AddLine(const Point& point)
|
||||
{
|
||||
shape_maker_.AddLine(point);
|
||||
}
|
||||
|
||||
void Canvas::AddLines(const Vector<Point>& points)
|
||||
{
|
||||
shape_maker_.AddLines(points);
|
||||
}
|
||||
|
||||
void Canvas::AddBezier(const Point& point1, const Point& point2, const Point& point3)
|
||||
{
|
||||
shape_maker_.AddBezier(point1, point2, point3);
|
||||
}
|
||||
|
||||
void Canvas::AddArc(const Point& point, const Size& radius, float rotation, bool clockwise, bool is_small)
|
||||
{
|
||||
shape_maker_.AddArc(point, radius, rotation, clockwise, is_small);
|
||||
}
|
||||
|
||||
void Canvas::StrokePath()
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->SetCurrentBrush(stroke_brush_);
|
||||
render_ctx_->SetCurrentStrokeStyle(stroke_style_);
|
||||
render_ctx_->DrawShape(*shape_maker_.GetShape());
|
||||
}
|
||||
|
||||
void Canvas::FillPath()
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->SetCurrentBrush(fill_brush_);
|
||||
render_ctx_->FillShape(*shape_maker_.GetShape());
|
||||
}
|
||||
|
||||
void Canvas::Clear()
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->Clear();
|
||||
}
|
||||
|
||||
void Canvas::Clear(const Color& clear_color)
|
||||
{
|
||||
KGE_ASSERT(render_ctx_);
|
||||
render_ctx_->Clear(clear_color);
|
||||
}
|
||||
|
||||
void Canvas::ResizeAndClear(Size size)
|
||||
{
|
||||
texture_cached_ = memory::New<Texture>();
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#pragma once
|
||||
#include <kiwano/2d/Actor.h>
|
||||
#include <kiwano/2d/Frame.h>
|
||||
#include <kiwano/render/Frame.h>
|
||||
#include <kiwano/render/ShapeMaker.h>
|
||||
#include <kiwano/render/RenderContext.h>
|
||||
|
||||
|
|
@ -48,222 +48,12 @@ public:
|
|||
static CanvasPtr Create(const Size& size);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 开始绘图
|
||||
void BeginDraw();
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 结束绘图
|
||||
void EndDraw();
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 画形状轮廓
|
||||
/// @param shape 形状
|
||||
void DrawShape(ShapePtr shape);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 画线段
|
||||
/// @param begin 线段起点
|
||||
/// @param end 线段终点
|
||||
void DrawLine(const Point& begin, const Point& end);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 画圆形边框
|
||||
/// @param center 圆形原点
|
||||
/// @param radius 圆形半径
|
||||
void DrawCircle(const Point& center, float radius);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 画椭圆形边框
|
||||
/// @param center 椭圆原点
|
||||
/// @param radius 椭圆半径
|
||||
void DrawEllipse(const Point& center, const Vec2& radius);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 画矩形边框
|
||||
/// @param rect 矩形
|
||||
void DrawRect(const Rect& rect);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 画圆角矩形边框
|
||||
/// @param rect 矩形
|
||||
/// @param radius 矩形圆角半径
|
||||
void DrawRoundedRect(const Rect& rect, const Vec2& radius);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 填充形状
|
||||
/// @param shape 形状
|
||||
void FillShape(ShapePtr shape);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 填充圆形
|
||||
/// @param center 圆形原点
|
||||
/// @param radius 圆形半径
|
||||
void FillCircle(const Point& center, float radius);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 填充椭圆形
|
||||
/// @param center 椭圆原点
|
||||
/// @param radius 椭圆半径
|
||||
void FillEllipse(const Point& center, const Vec2& radius);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 填充矩形
|
||||
/// @param rect 矩形
|
||||
void FillRect(const Rect& rect);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 填充圆角矩形
|
||||
/// @param rect 矩形
|
||||
/// @param radius 矩形圆角半径
|
||||
void FillRoundedRect(const Rect& rect, const Vec2& radius);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 绘制图像帧
|
||||
/// @param frame 图像帧
|
||||
/// @param pos 绘制图像的位置
|
||||
void DrawFrame(FramePtr frame, const Point& pos);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 绘制图像帧
|
||||
/// @param frame 图像帧
|
||||
/// @param pos 绘制图像的位置
|
||||
/// @param size 渲染的图像大小
|
||||
void DrawFrame(FramePtr frame, const Point& pos, const Size& size);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 绘制文字布局
|
||||
/// @param text 文字
|
||||
/// @param style 文字样式
|
||||
/// @param point 绘制文字的位置
|
||||
void DrawTextLayout(const String& text, const TextStyle& style, const Point& point);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 绘制文字布局
|
||||
/// @param layout 文字布局
|
||||
/// @param point 绘制布局的位置
|
||||
void DrawTextLayout(TextLayoutPtr layout, const Point& point);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 开始绘制路径
|
||||
/// @param begin_pos 路径起始点
|
||||
void BeginPath(const Point& begin_pos);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 结束路径
|
||||
/// @param closed 路径是否闭合
|
||||
void EndPath(bool closed = false);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 添加一条线段
|
||||
/// @param point 端点
|
||||
void AddLine(const Point& point);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 添加多条线段
|
||||
/// @param points 端点集合
|
||||
void AddLines(const Vector<Point>& points);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 添加一条三次方贝塞尔曲线
|
||||
/// @param point1 贝塞尔曲线的第一个控制点
|
||||
/// @param point2 贝塞尔曲线的第二个控制点
|
||||
/// @param point3 贝塞尔曲线的终点
|
||||
void AddBezier(const Point& point1, const Point& point2, const Point& point3);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 添加弧线
|
||||
/// @param point 终点
|
||||
/// @param radius 椭圆半径
|
||||
/// @param rotation 椭圆旋转角度
|
||||
/// @param clockwise 顺时针 or 逆时针
|
||||
/// @param is_small 是否取小于 180° 的弧
|
||||
void AddArc(const Point& point, const Size& radius, float rotation, bool clockwise = true, bool is_small = true);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 以描边的方式绘制路径
|
||||
void StrokePath();
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 以填充的方式绘制路径
|
||||
void FillPath();
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 清空画布
|
||||
void Clear();
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 清空画布
|
||||
/// @param clear_color 清空颜色
|
||||
void Clear(const Color& clear_color);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 设置填充颜色
|
||||
/// @param color 填充颜色
|
||||
void SetFillColor(const Color& color);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 设置填充画刷
|
||||
/// @param[in] brush 填充画刷
|
||||
void SetFillBrush(BrushPtr brush);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 设置轮廓颜色
|
||||
/// @param color 轮廓颜色
|
||||
void SetStrokeColor(const Color& color);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 设置轮廓画刷
|
||||
/// @param[in] brush 轮廓画刷
|
||||
void SetStrokeBrush(BrushPtr brush);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 设置轮廓样式
|
||||
/// @param stroke_style 轮廓样式
|
||||
void SetStrokeStyle(StrokeStylePtr stroke_style);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 设置画刷
|
||||
/// @param[in] brush 画刷
|
||||
void SetBrush(BrushPtr brush);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 设置画刷二维变换
|
||||
/// @param transform 二维变换
|
||||
void SetBrushTransform(const Transform& transform);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 设置画刷二维变换矩阵
|
||||
/// @param transform 二维变换矩阵
|
||||
void SetBrushTransform(const Matrix3x2& transform);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 添加一个图层
|
||||
/// @param layer 图层
|
||||
void PushLayer(LayerPtr layer);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 删除最近添加的图层
|
||||
void PopLayer();
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 添加一个裁剪区域
|
||||
/// @param clip_rect 裁剪矩形
|
||||
void PushClipRect(const Rect& clip_rect);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 删除最近添加的裁剪区域
|
||||
void PopClipRect();
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 获取填充画刷
|
||||
BrushPtr GetFillBrush() const;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 获取轮廓画刷
|
||||
BrushPtr GetStrokeBrush() const;
|
||||
/// @brief 获取2D绘图上下文
|
||||
RenderContextPtr GetContext2D() const;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 清空画布大小并重设画布大小
|
||||
/// @warning 该函数会导致原绘图上下文失效
|
||||
void ResizeAndClear(Size size);
|
||||
|
||||
/// \~chinese
|
||||
|
|
@ -276,57 +66,10 @@ private:
|
|||
Canvas();
|
||||
|
||||
private:
|
||||
StrokeStylePtr stroke_style_;
|
||||
ShapeMaker shape_maker_;
|
||||
BrushPtr fill_brush_;
|
||||
BrushPtr stroke_brush_;
|
||||
TexturePtr texture_cached_;
|
||||
RenderContextPtr render_ctx_;
|
||||
};
|
||||
|
||||
/** @} */
|
||||
|
||||
inline void Canvas::SetStrokeStyle(StrokeStylePtr stroke_style)
|
||||
{
|
||||
stroke_style_ = stroke_style;
|
||||
}
|
||||
|
||||
inline void Canvas::SetStrokeColor(const Color& color)
|
||||
{
|
||||
if (!stroke_brush_)
|
||||
{
|
||||
stroke_brush_ = memory::New<Brush>();
|
||||
}
|
||||
stroke_brush_->SetColor(color);
|
||||
}
|
||||
|
||||
inline void Canvas::SetFillColor(const Color& color)
|
||||
{
|
||||
if (!fill_brush_)
|
||||
{
|
||||
fill_brush_ = memory::New<Brush>();
|
||||
}
|
||||
fill_brush_->SetColor(color);
|
||||
}
|
||||
|
||||
inline void Canvas::SetFillBrush(BrushPtr brush)
|
||||
{
|
||||
fill_brush_ = brush;
|
||||
}
|
||||
|
||||
inline void Canvas::SetStrokeBrush(BrushPtr brush)
|
||||
{
|
||||
stroke_brush_ = brush;
|
||||
}
|
||||
|
||||
inline BrushPtr Canvas::GetFillBrush() const
|
||||
{
|
||||
return fill_brush_;
|
||||
}
|
||||
|
||||
inline BrushPtr Canvas::GetStrokeBrush() const
|
||||
{
|
||||
return stroke_brush_;
|
||||
}
|
||||
|
||||
} // namespace kiwano
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano/2d/DebugActor.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
#include <kiwano/render/Renderer.h>
|
||||
#include <psapi.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano/2d/ShapeActor.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
#include <kiwano/render/Renderer.h>
|
||||
|
||||
namespace kiwano
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#pragma once
|
||||
#include <kiwano/2d/Actor.h>
|
||||
#include <kiwano/2d/Frame.h>
|
||||
#include <kiwano/render/Frame.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano/2d/Stage.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
#include <kiwano/render/Renderer.h>
|
||||
|
||||
namespace kiwano
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano/2d/TextActor.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
#include <kiwano/render/Renderer.h>
|
||||
|
||||
namespace kiwano
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include <kiwano/2d/Actor.h>
|
||||
#include <kiwano/2d/Stage.h>
|
||||
#include <kiwano/2d/Transition.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
#include <kiwano/platform/Window.h>
|
||||
#include <kiwano/render/Renderer.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,9 @@ void Action::UpdateStep(Actor* target, Duration dt)
|
|||
case Status::Started:
|
||||
Update(target, dt);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (status_ == Status::Done)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#pragma once
|
||||
#include <kiwano/core/Common.h>
|
||||
#include <kiwano/core/Cloneable.h>
|
||||
#include <kiwano/core/ObjectBase.h>
|
||||
#include <kiwano/base/ObjectBase.h>
|
||||
#include <kiwano/core/SmartPtr.hpp>
|
||||
#include <kiwano/core/Time.h>
|
||||
#include <kiwano/core/IntrusiveList.h>
|
||||
|
|
@ -30,14 +30,10 @@
|
|||
namespace kiwano
|
||||
{
|
||||
class Actor;
|
||||
class ActionManager;
|
||||
class ActionScheduler;
|
||||
|
||||
KGE_DECLARE_SMART_PTR(Action);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 动画列表
|
||||
typedef IntrusiveList<ActionPtr> ActionList;
|
||||
|
||||
/**
|
||||
* \~chinese
|
||||
* \defgroup Actions ¶¯»
|
||||
|
|
@ -55,7 +51,7 @@ class KGE_API Action
|
|||
, public Cloneable<Action>
|
||||
, protected IntrusiveListValue<ActionPtr>
|
||||
{
|
||||
friend class ActionManager;
|
||||
friend class ActionScheduler;
|
||||
friend class ActionGroup;
|
||||
friend IntrusiveList<ActionPtr>;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include <kiwano/2d/Actor.h>
|
||||
#include <kiwano/2d/action/ActionGroup.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,12 +19,13 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano/2d/Actor.h>
|
||||
#include <kiwano/2d/action/ActionManager.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/2d/action/ActionScheduler.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
void ActionManager::UpdateActions(Actor* target, Duration dt)
|
||||
|
||||
void ActionScheduler::Update(Actor* target, Duration dt)
|
||||
{
|
||||
if (actions_.IsEmpty() || !target)
|
||||
return;
|
||||
|
|
@ -42,7 +43,7 @@ void ActionManager::UpdateActions(Actor* target, Duration dt)
|
|||
}
|
||||
}
|
||||
|
||||
Action* ActionManager::AddAction(ActionPtr action)
|
||||
Action* ActionScheduler::AddAction(ActionPtr action)
|
||||
{
|
||||
KGE_ASSERT(action && "AddAction failed, NULL pointer exception");
|
||||
|
||||
|
|
@ -53,7 +54,7 @@ Action* ActionManager::AddAction(ActionPtr action)
|
|||
return action.Get();
|
||||
}
|
||||
|
||||
void ActionManager::ResumeAllActions()
|
||||
void ActionScheduler::ResumeAllActions()
|
||||
{
|
||||
if (actions_.IsEmpty())
|
||||
return;
|
||||
|
|
@ -64,7 +65,7 @@ void ActionManager::ResumeAllActions()
|
|||
}
|
||||
}
|
||||
|
||||
void ActionManager::PauseAllActions()
|
||||
void ActionScheduler::PauseAllActions()
|
||||
{
|
||||
if (actions_.IsEmpty())
|
||||
return;
|
||||
|
|
@ -75,7 +76,7 @@ void ActionManager::PauseAllActions()
|
|||
}
|
||||
}
|
||||
|
||||
void ActionManager::StopAllActions()
|
||||
void ActionScheduler::StopAllActions()
|
||||
{
|
||||
if (actions_.IsEmpty())
|
||||
return;
|
||||
|
|
@ -86,7 +87,7 @@ void ActionManager::StopAllActions()
|
|||
}
|
||||
}
|
||||
|
||||
ActionPtr ActionManager::GetAction(const String& name)
|
||||
ActionPtr ActionScheduler::GetAction(const String& name)
|
||||
{
|
||||
if (actions_.IsEmpty())
|
||||
return nullptr;
|
||||
|
|
@ -97,7 +98,7 @@ ActionPtr ActionManager::GetAction(const String& name)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const ActionList& ActionManager::GetAllActions() const
|
||||
const ActionList& ActionScheduler::GetAllActions() const
|
||||
{
|
||||
return actions_;
|
||||
}
|
||||
|
|
@ -23,16 +23,21 @@
|
|||
|
||||
namespace kiwano
|
||||
{
|
||||
|
||||
/**
|
||||
* \addtogroup Actions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 动画列表
|
||||
typedef IntrusiveList<ActionPtr> ActionList;
|
||||
|
||||
/**
|
||||
* \~chinese
|
||||
* @brief 动画管理器
|
||||
* @brief 动画调度器
|
||||
*/
|
||||
class KGE_API ActionManager
|
||||
class KGE_API ActionScheduler
|
||||
{
|
||||
public:
|
||||
/// \~chinese
|
||||
|
|
@ -60,10 +65,9 @@ public:
|
|||
/// @brief 获取所有动画
|
||||
const ActionList& GetAllActions() const;
|
||||
|
||||
protected:
|
||||
/// \~chinese
|
||||
/// @brief 更新动画
|
||||
void UpdateActions(Actor* target, Duration dt);
|
||||
void Update(Actor* target, Duration dt);
|
||||
|
||||
private:
|
||||
ActionList actions_;
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#pragma once
|
||||
#include <kiwano/2d/action/Action.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano/2d/FrameSequence.h>
|
||||
#include <kiwano/render/FrameSequence.h>
|
||||
#include <kiwano/2d/Sprite.h>
|
||||
#include <kiwano/2d/action/Animation.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
#include <kiwano/2d/FrameSequence.h>
|
||||
#include <kiwano/render/FrameSequence.h>
|
||||
#include <kiwano/2d/action/ActionTween.h>
|
||||
|
||||
namespace kiwano
|
||||
|
|
|
|||
|
|
@ -0,0 +1,175 @@
|
|||
include_directories(..)
|
||||
|
||||
set(SOURCE_FILES
|
||||
2d/action/Action.cpp
|
||||
2d/action/Action.h
|
||||
2d/action/ActionDelay.cpp
|
||||
2d/action/ActionDelay.h
|
||||
2d/action/ActionGroup.cpp
|
||||
2d/action/ActionGroup.h
|
||||
2d/action/ActionHelper.h
|
||||
2d/action/ActionManager.cpp
|
||||
2d/action/ActionManager.h
|
||||
2d/action/ActionTween.cpp
|
||||
2d/action/ActionTween.h
|
||||
2d/action/ActionWalk.cpp
|
||||
2d/action/ActionWalk.h
|
||||
2d/action/Animation.cpp
|
||||
2d/action/Animation.h
|
||||
2d/Actor.cpp
|
||||
2d/Actor.h
|
||||
2d/Button.cpp
|
||||
2d/Button.h
|
||||
2d/Canvas.cpp
|
||||
2d/Canvas.h
|
||||
2d/Component.cpp
|
||||
2d/Component.h
|
||||
2d/DebugActor.cpp
|
||||
2d/DebugActor.h
|
||||
2d/GifSprite.cpp
|
||||
2d/GifSprite.h
|
||||
2d/LayerActor.cpp
|
||||
2d/LayerActor.h
|
||||
2d/ShapeActor.cpp
|
||||
2d/ShapeActor.h
|
||||
2d/Sprite.cpp
|
||||
2d/Sprite.h
|
||||
2d/Stage.cpp
|
||||
2d/Stage.h
|
||||
2d/TextActor.cpp
|
||||
2d/TextActor.h
|
||||
2d/Transition.cpp
|
||||
2d/Transition.h
|
||||
core/event/Event.cpp
|
||||
core/event/Event.h
|
||||
core/event/EventType.h
|
||||
core/event/KeyEvent.cpp
|
||||
core/event/KeyEvent.h
|
||||
core/event/MouseEvent.cpp
|
||||
core/event/MouseEvent.h
|
||||
core/event/WindowEvent.cpp
|
||||
core/event/WindowEvent.h
|
||||
core/Allocator.cpp
|
||||
core/Allocator.h
|
||||
core/Any.h
|
||||
core/Cloneable.h
|
||||
core/Common.h
|
||||
core/Director.cpp
|
||||
core/Director.h
|
||||
core/EventDispatcher.cpp
|
||||
core/EventDispatcher.h
|
||||
core/EventListener.cpp
|
||||
core/EventListener.h
|
||||
core/Exception.cpp
|
||||
core/Exception.h
|
||||
core/Function.h
|
||||
core/IntrusiveList.h
|
||||
core/Json.h
|
||||
core/Keys.h
|
||||
core/Library.cpp
|
||||
core/Library.h
|
||||
core/Logger.cpp
|
||||
core/Logger.h
|
||||
core/Module.cpp
|
||||
core/Module.h
|
||||
core/ObjectBase.cpp
|
||||
core/ObjectBase.h
|
||||
core/RefCounter.cpp
|
||||
core/RefCounter.h
|
||||
core/Resource.cpp
|
||||
core/Resource.h
|
||||
core/Serializable.h
|
||||
core/Singleton.h
|
||||
core/SmartPtr.hpp
|
||||
core/String.cpp
|
||||
core/String.h
|
||||
core/Time.cpp
|
||||
core/Time.h
|
||||
core/Timer.cpp
|
||||
core/Timer.h
|
||||
core/TimerManager.cpp
|
||||
core/TimerManager.h
|
||||
core/Xml.h
|
||||
math/Constants.h
|
||||
math/EaseFunctions.h
|
||||
math/Math.h
|
||||
math/Matrix.hpp
|
||||
math/Random.h
|
||||
math/Rect.hpp
|
||||
math/Scalar.h
|
||||
math/Transform.hpp
|
||||
math/Vec2.hpp
|
||||
platform/win32/ComPtr.hpp
|
||||
platform/win32/libraries.cpp
|
||||
platform/win32/libraries.h
|
||||
platform/win32/WindowImpl.cpp
|
||||
platform/Application.cpp
|
||||
platform/Application.h
|
||||
platform/FileSystem.cpp
|
||||
platform/FileSystem.h
|
||||
platform/Input.cpp
|
||||
platform/Input.h
|
||||
platform/Runner.cpp
|
||||
platform/Runner.h
|
||||
platform/Window.cpp
|
||||
platform/Window.h
|
||||
render/DirectX/D2DDeviceResources.cpp
|
||||
render/DirectX/D2DDeviceResources.h
|
||||
render/DirectX/D3D10DeviceResources.cpp
|
||||
render/DirectX/D3D10DeviceResources.h
|
||||
render/DirectX/D3D11DeviceResources.cpp
|
||||
render/DirectX/D3D11DeviceResources.h
|
||||
render/DirectX/D3DDeviceResourcesBase.h
|
||||
render/DirectX/FontCollectionLoader.cpp
|
||||
render/DirectX/FontCollectionLoader.h
|
||||
render/DirectX/helper.h
|
||||
render/DirectX/NativePtr.h
|
||||
render/DirectX/RenderContextImpl.cpp
|
||||
render/DirectX/RenderContextImpl.h
|
||||
render/DirectX/RendererImpl.cpp
|
||||
render/DirectX/RendererImpl.h
|
||||
render/DirectX/TextRenderer.cpp
|
||||
render/DirectX/TextRenderer.h
|
||||
render/Brush.cpp
|
||||
render/Brush.h
|
||||
render/Color.cpp
|
||||
render/Color.h
|
||||
render/Font.cpp
|
||||
render/Font.h
|
||||
render/Frame.cpp
|
||||
render/Frame.h
|
||||
render/FrameSequence.cpp
|
||||
render/FrameSequence.h
|
||||
render/GifImage.cpp
|
||||
render/GifImage.h
|
||||
render/Layer.cpp
|
||||
render/Layer.h
|
||||
render/NativeObject.h
|
||||
render/RenderContext.cpp
|
||||
render/RenderContext.h
|
||||
render/Renderer.cpp
|
||||
render/Renderer.h
|
||||
render/Shape.cpp
|
||||
render/Shape.h
|
||||
render/ShapeMaker.cpp
|
||||
render/ShapeMaker.h
|
||||
render/StrokeStyle.cpp
|
||||
render/StrokeStyle.h
|
||||
render/TextLayout.cpp
|
||||
render/TextLayout.h
|
||||
render/TextStyle.hpp
|
||||
render/Texture.cpp
|
||||
render/Texture.h
|
||||
render/TextureCache.cpp
|
||||
render/TextureCache.h
|
||||
utils/LocalStorage.cpp
|
||||
utils/LocalStorage.h
|
||||
utils/ResourceCache.cpp
|
||||
utils/ResourceCache.h
|
||||
utils/UserData.cpp
|
||||
utils/UserData.h
|
||||
config.h
|
||||
kiwano.h
|
||||
macros.h)
|
||||
|
||||
add_library(libkiwano ${SOURCE_FILES})
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
#include <kiwano/2d/DebugActor.h>
|
||||
#include <kiwano/2d/Stage.h>
|
||||
#include <kiwano/2d/Transition.h>
|
||||
#include <kiwano/core/Director.h>
|
||||
#include <kiwano/base/Director.h>
|
||||
#include <kiwano/render/RenderContext.h>
|
||||
|
||||
namespace kiwano
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
#include <kiwano/2d/Actor.h>
|
||||
#include <kiwano/2d/Stage.h>
|
||||
#include <kiwano/2d/Transition.h>
|
||||
#include <kiwano/core/Module.h>
|
||||
#include <kiwano/base/Module.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano/core/Module.h>
|
||||
#include <kiwano/base/Module.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano/core/ObjectBase.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/core/Json.h>
|
||||
#include <kiwano/base/ObjectBase.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
#include <kiwano/utils/Json.h>
|
||||
#include <typeinfo>
|
||||
|
||||
namespace kiwano
|
||||
|
|
@ -19,11 +19,11 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
#include <kiwano/macros.h>
|
||||
#include <kiwano/core/Common.h>
|
||||
#include <kiwano/core/Serializable.h>
|
||||
#include <kiwano/core/RefCounter.h>
|
||||
#include <kiwano/core/SmartPtr.hpp>
|
||||
#include <kiwano/macros.h>
|
||||
#include <kiwano/base/RefCounter.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano/core/RefCounter.h>
|
||||
#include <kiwano/base/RefCounter.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano/2d/Button.h>
|
||||
#include <kiwano/base/component/Button.h>
|
||||
#include <kiwano/2d/Stage.h>
|
||||
#include <kiwano/platform/Application.h>
|
||||
|
||||
|
|
@ -26,6 +26,11 @@ namespace kiwano
|
|||
|
||||
KGE_DECLARE_SMART_PTR(Button);
|
||||
|
||||
/**
|
||||
* \addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \~chinese
|
||||
* @brief °´Å¥
|
||||
|
|
@ -109,6 +114,8 @@ private:
|
|||
Callback mouse_out_callback_;
|
||||
};
|
||||
|
||||
/** @} */
|
||||
|
||||
inline void Button::SetClickCallback(const Callback& func)
|
||||
{
|
||||
click_callback_ = func;
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano/2d/Component.h>
|
||||
#include <kiwano/base/component/Component.h>
|
||||
#include <kiwano/2d/Actor.h>
|
||||
|
||||
namespace kiwano
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#pragma once
|
||||
#include <kiwano/core/Time.h>
|
||||
#include <kiwano/core/ObjectBase.h>
|
||||
#include <kiwano/base/ObjectBase.h>
|
||||
#include <kiwano/core/IntrusiveList.h>
|
||||
#include <kiwano/render/RenderContext.h>
|
||||
|
||||
|
|
@ -29,12 +29,19 @@ namespace kiwano
|
|||
|
||||
class Actor;
|
||||
class Event;
|
||||
class ComponentManager;
|
||||
|
||||
KGE_DECLARE_SMART_PTR(Component);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 组件列表
|
||||
typedef IntrusiveList<ComponentPtr> ComponentList;
|
||||
/**
|
||||
* \~chinese
|
||||
* \defgroup Component ×é¼þ
|
||||
*/
|
||||
|
||||
/**
|
||||
* \addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \~chinese
|
||||
|
|
@ -44,7 +51,7 @@ class KGE_API Component
|
|||
: public ObjectBase
|
||||
, protected IntrusiveListValue<ComponentPtr>
|
||||
{
|
||||
friend class Actor;
|
||||
friend class ComponentManager;
|
||||
friend IntrusiveList<ComponentPtr>;
|
||||
|
||||
public:
|
||||
|
|
@ -94,6 +101,8 @@ private:
|
|||
Actor* actor_;
|
||||
};
|
||||
|
||||
/** @} */
|
||||
|
||||
inline bool Component::IsEnable() const
|
||||
{
|
||||
return enabled_;
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano/base/component/ComponentManager.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
||||
ComponentManager::ComponentManager(Actor* target)
|
||||
: target_(target)
|
||||
{
|
||||
}
|
||||
|
||||
Component* ComponentManager::AddComponent(ComponentPtr component)
|
||||
{
|
||||
KGE_ASSERT(component && "AddComponent failed, NULL pointer exception");
|
||||
|
||||
if (component)
|
||||
{
|
||||
component->InitComponent(target_);
|
||||
components_.PushBack(component);
|
||||
}
|
||||
return component.Get();
|
||||
}
|
||||
|
||||
ComponentList& ComponentManager::GetAllComponents()
|
||||
{
|
||||
return components_;
|
||||
}
|
||||
|
||||
const ComponentList& ComponentManager::GetAllComponents() const
|
||||
{
|
||||
return components_;
|
||||
}
|
||||
|
||||
void ComponentManager::RemoveComponent(ComponentPtr component)
|
||||
{
|
||||
auto iter = std::find(components_.begin(), components_.end(), component);
|
||||
if (iter != components_.end())
|
||||
{
|
||||
component->DestroyComponent();
|
||||
components_.Remove(component);
|
||||
}
|
||||
}
|
||||
|
||||
void ComponentManager::RemoveComponents(const String& name)
|
||||
{
|
||||
if (!components_.IsEmpty())
|
||||
{
|
||||
ComponentPtr next;
|
||||
for (auto component = components_.GetFirst(); component; component = next)
|
||||
{
|
||||
next = component->GetNext();
|
||||
|
||||
if (component->IsName(name))
|
||||
{
|
||||
component->DestroyComponent();
|
||||
components_.Remove(component);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ComponentManager::RemoveAllComponents()
|
||||
{
|
||||
// Destroy all components
|
||||
if (!components_.IsEmpty())
|
||||
{
|
||||
ComponentPtr next;
|
||||
for (auto component = components_.GetFirst(); component; component = next)
|
||||
{
|
||||
next = component->GetNext();
|
||||
|
||||
component->DestroyComponent();
|
||||
}
|
||||
}
|
||||
components_.Clear();
|
||||
}
|
||||
|
||||
void ComponentManager::Update(Duration dt)
|
||||
{
|
||||
if (!components_.IsEmpty())
|
||||
{
|
||||
ComponentPtr next;
|
||||
for (auto component = components_.GetFirst(); component; component = next)
|
||||
{
|
||||
next = component->GetNext();
|
||||
|
||||
if (component->IsEnable())
|
||||
{
|
||||
component->OnUpdate(dt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ComponentManager::Render(RenderContext& ctx)
|
||||
{
|
||||
if (!components_.IsEmpty())
|
||||
{
|
||||
ComponentPtr next;
|
||||
for (auto component = components_.GetFirst(); component; component = next)
|
||||
{
|
||||
next = component->GetNext();
|
||||
|
||||
if (component->IsEnable())
|
||||
{
|
||||
component->OnRender(ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ComponentManager::DispatchToComponents(Event* evt)
|
||||
{
|
||||
if (!components_.IsEmpty())
|
||||
{
|
||||
ComponentPtr next;
|
||||
for (auto component = components_.GetFirst(); component; component = next)
|
||||
{
|
||||
next = component->GetNext();
|
||||
|
||||
if (component->IsEnable())
|
||||
{
|
||||
component->HandleEvent(evt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace kiwano
|
||||
|
|
@ -19,70 +19,74 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
#include <kiwano/core/Timer.h>
|
||||
#include <kiwano/core/IntrusiveList.h>
|
||||
#include <kiwano/base/component/Component.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
||||
/**
|
||||
* \addtogroup Component
|
||||
* @{
|
||||
*/
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 组件列表
|
||||
typedef IntrusiveList<ComponentPtr> ComponentList;
|
||||
|
||||
/**
|
||||
* \~chinese
|
||||
* @brief 定时器管理器
|
||||
* @brief 组件管理器
|
||||
*/
|
||||
class KGE_API TimerManager
|
||||
class KGE_API ComponentManager
|
||||
{
|
||||
public:
|
||||
/// \~chinese
|
||||
/// @brief 添加定时器
|
||||
/// @param cb 回调函数
|
||||
/// @param interval 时间间隔
|
||||
/// @param times 执行次数(设 -1 为永久执行)
|
||||
Timer* AddTimer(const Timer::Callback& cb, Duration interval, int times = -1);
|
||||
/// @brief 添加组件
|
||||
/// @param component 组件
|
||||
Component* AddComponent(ComponentPtr component);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 添加定时器
|
||||
/// @param name 定时器名称
|
||||
/// @param cb 回调函数
|
||||
/// @param interval 时间间隔
|
||||
/// @param times 执行次数(设 -1 为永久执行)
|
||||
Timer* AddTimer(const String& name, const Timer::Callback& cb, Duration interval, int times = -1);
|
||||
/// @brief 获取所有组件
|
||||
ComponentList& GetAllComponents();
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 添加定时器
|
||||
Timer* AddTimer(TimerPtr timer);
|
||||
/// @brief 获取所有组件
|
||||
const ComponentList& GetAllComponents() const;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 启动定时器
|
||||
void StartTimers(const String& timer_name);
|
||||
/// @brief 移除组件
|
||||
void RemoveComponent(ComponentPtr component);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 停止定时器
|
||||
void StopTimers(const String& timer_name);
|
||||
/// @brief 移除组件
|
||||
/// @param name 组件名称
|
||||
void RemoveComponents(const String& name);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 移除定时器
|
||||
void RemoveTimers(const String& timer_name);
|
||||
/// @brief 移除所有组件
|
||||
void RemoveAllComponents();
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 启动所有定时器
|
||||
void StartAllTimers();
|
||||
/// @brief 更新组件
|
||||
void Update(Duration dt);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 停止所有定时器
|
||||
void StopAllTimers();
|
||||
/// @brief 渲染组件
|
||||
void Render(RenderContext& ctx);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 移除所有定时器
|
||||
void RemoveAllTimers();
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 获取所有定时器
|
||||
const TimerList& GetAllTimers() const;
|
||||
/// @brief 分发事件
|
||||
void DispatchToComponents(Event* evt);
|
||||
|
||||
protected:
|
||||
/// \~chinese
|
||||
/// @brief 更新定时器
|
||||
void UpdateTimers(Duration dt);
|
||||
ComponentManager(Actor* target);
|
||||
|
||||
private:
|
||||
TimerList timers_;
|
||||
Actor* target_;
|
||||
ComponentList components_;
|
||||
};
|
||||
|
||||
/** @} */
|
||||
|
||||
} // namespace kiwano
|
||||
|
|
@ -25,10 +25,14 @@ namespace kiwano
|
|||
namespace memory
|
||||
{
|
||||
|
||||
MemoryAllocator* current_allocator_ = GetGlobalAllocator();
|
||||
MemoryAllocator* current_allocator_ = nullptr;
|
||||
|
||||
MemoryAllocator* GetAllocator()
|
||||
{
|
||||
if (!current_allocator_)
|
||||
{
|
||||
current_allocator_ = GetGlobalAllocator();
|
||||
}
|
||||
return current_allocator_;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,9 +73,9 @@ public:
|
|||
|
||||
/// \~chinese
|
||||
/// @brief »ñÈ¡º¬ÓжÔÏóÀàÐÍ
|
||||
inline const type_info& GetType() const noexcept
|
||||
inline const std::type_info& GetType() const noexcept
|
||||
{
|
||||
const type_info* const info = GetTypeinfo();
|
||||
const std::type_info* const info = GetTypeinfo();
|
||||
if (info)
|
||||
{
|
||||
return *info;
|
||||
|
|
@ -132,7 +132,7 @@ public:
|
|||
{
|
||||
static_assert(!std::is_void<_Ty>::value, "oc::Any cannot contain void");
|
||||
|
||||
const type_info* const info = GetTypeinfo();
|
||||
const std::type_info* const info = GetTypeinfo();
|
||||
if (info && (*info == typeid(std::decay<_Ty>::type)))
|
||||
{
|
||||
if (HasSmallType())
|
||||
|
|
@ -193,12 +193,12 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
const type_info*& GetTypeinfo()
|
||||
const std::type_info*& GetTypeinfo()
|
||||
{
|
||||
return storage_.small_.info_;
|
||||
}
|
||||
|
||||
const type_info* GetTypeinfo() const
|
||||
const std::type_info* GetTypeinfo() const
|
||||
{
|
||||
return storage_.small_.info_;
|
||||
}
|
||||
|
|
@ -430,14 +430,14 @@ private:
|
|||
private:
|
||||
struct SmallStorage
|
||||
{
|
||||
const type_info* info_;
|
||||
const std::type_info* info_;
|
||||
SmallStorageRTTI rtti_;
|
||||
char buffer_[ANY_SMALL_SPACE_SIZE];
|
||||
};
|
||||
|
||||
struct BigStorage
|
||||
{
|
||||
const type_info* info_;
|
||||
const std::type_info* info_;
|
||||
BigStorageRTTI rtti_;
|
||||
void* ptr_;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include <kiwano/core/Exception.h>
|
||||
#include <kiwano/core/Library.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
|
||||
#if defined(KGE_PLATFORM_WINDOWS)
|
||||
#include <memory>
|
||||
|
|
|
|||
|
|
@ -20,19 +20,22 @@
|
|||
|
||||
#pragma once
|
||||
#include <kiwano/core/Common.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
#include <stdexcept>
|
||||
#include <system_error>
|
||||
|
||||
#define KGE_THROW(MESSAGE) \
|
||||
do \
|
||||
{ \
|
||||
kiwano::StackTracer().Print(); \
|
||||
throw kiwano::RuntimeError(MESSAGE); \
|
||||
#define KGE_THROW(MESSAGE) \
|
||||
do \
|
||||
{ \
|
||||
KGE_ERROR("An exception occurred: %s", MESSAGE); \
|
||||
kiwano::StackTracer().Print(); \
|
||||
throw kiwano::RuntimeError(MESSAGE); \
|
||||
} while (0)
|
||||
|
||||
#define KGE_THROW_SYSTEM_ERROR(ERRCODE, MESSAGE) \
|
||||
do \
|
||||
{ \
|
||||
KGE_ERROR("An exception occurred (%#x): %s", ERRCODE, MESSAGE); \
|
||||
kiwano::StackTracer().Print(); \
|
||||
throw kiwano::SystemError(std::error_code(kiwano::error_enum(ERRCODE)), MESSAGE); \
|
||||
} while (0)
|
||||
|
|
|
|||
|
|
@ -75,9 +75,9 @@ public:
|
|||
virtual void Release() = 0;
|
||||
virtual _Ret Invoke(_Args&&... args) const = 0;
|
||||
|
||||
virtual const type_info& TargetType() const noexcept = 0;
|
||||
virtual const std::type_info& TargetType() const noexcept = 0;
|
||||
|
||||
virtual const void* Target(const type_info& type) const noexcept = 0;
|
||||
virtual const void* Target(const std::type_info& type) const noexcept = 0;
|
||||
};
|
||||
|
||||
template <typename _Ret, typename... _Args>
|
||||
|
|
@ -121,12 +121,12 @@ public:
|
|||
return std::invoke(callee_, std::forward<_Args>(args)...);
|
||||
}
|
||||
|
||||
virtual const type_info& TargetType() const noexcept
|
||||
virtual const std::type_info& TargetType() const noexcept
|
||||
{
|
||||
return typeid(_Ty);
|
||||
}
|
||||
|
||||
virtual const void* Target(const type_info& type) const noexcept
|
||||
virtual const void* Target(const std::type_info& type) const noexcept
|
||||
{
|
||||
if (type == this->TargetType())
|
||||
return &callee_;
|
||||
|
|
@ -153,12 +153,12 @@ public:
|
|||
return std::invoke(func_, ptr_, std::forward<_Args>(args)...);
|
||||
}
|
||||
|
||||
virtual const type_info& TargetType() const noexcept
|
||||
virtual const std::type_info& TargetType() const noexcept
|
||||
{
|
||||
return typeid(ProxyMemCallable);
|
||||
}
|
||||
|
||||
virtual const void* Target(const type_info& type) const noexcept
|
||||
virtual const void* Target(const std::type_info& type) const noexcept
|
||||
{
|
||||
if (type == this->TargetType())
|
||||
return this;
|
||||
|
|
@ -193,12 +193,12 @@ public:
|
|||
return std::invoke(func_, ptr_, std::forward<_Args>(args)...);
|
||||
}
|
||||
|
||||
virtual const type_info& TargetType() const noexcept
|
||||
virtual const std::type_info& TargetType() const noexcept
|
||||
{
|
||||
return typeid(ProxyConstMemCallable);
|
||||
}
|
||||
|
||||
virtual const void* Target(const type_info& type) const noexcept
|
||||
virtual const void* Target(const std::type_info& type) const noexcept
|
||||
{
|
||||
if (type == this->TargetType())
|
||||
return this;
|
||||
|
|
@ -321,7 +321,7 @@ public:
|
|||
std::swap(callable_, rhs.callable_);
|
||||
}
|
||||
|
||||
const type_info& target_type() const noexcept
|
||||
const std::type_info& target_type() const noexcept
|
||||
{
|
||||
return callable_->TargetType();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,13 +246,13 @@ public:
|
|||
}
|
||||
|
||||
public:
|
||||
template <typename _PtrTy>
|
||||
template <typename _IterPtrTy>
|
||||
struct Iterator
|
||||
{
|
||||
using iterator_category = std::bidirectional_iterator_tag;
|
||||
using value_type = _PtrTy;
|
||||
using pointer = _PtrTy*;
|
||||
using reference = _PtrTy&;
|
||||
using value_type = _IterPtrTy;
|
||||
using pointer = _IterPtrTy*;
|
||||
using reference = _IterPtrTy&;
|
||||
using difference_type = ptrdiff_t;
|
||||
|
||||
inline Iterator(value_type ptr = nullptr, bool is_end = false)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#include <iostream>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
#include <kiwano/core/Resource.h>
|
||||
|
||||
namespace kiwano
|
||||
|
|
|
|||
|
|
@ -24,6 +24,15 @@
|
|||
|
||||
namespace kiwano
|
||||
{
|
||||
/**
|
||||
* \~chinese
|
||||
* \defgroup Serialization 序列化
|
||||
*/
|
||||
|
||||
/**
|
||||
* \addtogroup Serialization
|
||||
* @{
|
||||
*/
|
||||
|
||||
/// \~chinese
|
||||
/// @brief ÐòÁл¯Æ÷
|
||||
|
|
@ -230,7 +239,7 @@ class Serializable
|
|||
{
|
||||
public:
|
||||
/// \~chinese
|
||||
/// @brief 序列化为字符串
|
||||
/// @brief 序列化为字节串
|
||||
inline Vector<uint8_t> Serialize() const
|
||||
{
|
||||
Vector<uint8_t> data;
|
||||
|
|
@ -240,7 +249,7 @@ public:
|
|||
}
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 从字符串反序列化
|
||||
/// @brief 从字节串反序列化
|
||||
inline void Deserialize(const Vector<uint8_t>& data)
|
||||
{
|
||||
ByteDeserializer deserializer(data);
|
||||
|
|
@ -438,4 +447,7 @@ inline Deserializer& operator>>(Deserializer& deserializer, math::TransformT<flo
|
|||
return deserializer >> transform.position >> transform.rotation >> transform.scale >> transform.skew;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
} // namespace kiwano
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#include <utility>
|
||||
#include <type_traits>
|
||||
#include <kiwano/core/Common.h>
|
||||
#include <kiwano/core/RefCounter.h>
|
||||
#include <kiwano/base/RefCounter.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
@ -73,13 +73,13 @@ public:
|
|||
SmartPtr(pointer_type p)
|
||||
: ptr_(p)
|
||||
{
|
||||
typename _ProxyTy::Retain(ptr_);
|
||||
_ProxyTy::Retain(ptr_);
|
||||
}
|
||||
|
||||
SmartPtr(const SmartPtr& other)
|
||||
: ptr_(other.ptr_)
|
||||
{
|
||||
typename _ProxyTy::Retain(ptr_);
|
||||
_ProxyTy::Retain(ptr_);
|
||||
}
|
||||
|
||||
SmartPtr(SmartPtr&& other) noexcept
|
||||
|
|
@ -97,7 +97,7 @@ public:
|
|||
SmartPtr(const SmartPtr<_UTy, _ProxyTy>& other)
|
||||
{
|
||||
ptr_ = const_cast<pointer_type>(dynamic_cast<const_pointer_type>(other.Get()));
|
||||
typename _ProxyTy::Retain(ptr_);
|
||||
_ProxyTy::Retain(ptr_);
|
||||
}
|
||||
|
||||
inline pointer_type Get() noexcept
|
||||
|
|
@ -193,7 +193,7 @@ public:
|
|||
private:
|
||||
void Tidy()
|
||||
{
|
||||
typename _ProxyTy::Release(ptr_);
|
||||
_ProxyTy::Release(ptr_);
|
||||
ptr_ = nullptr;
|
||||
}
|
||||
|
||||
|
|
@ -268,7 +268,7 @@ inline bool operator<(const SmartPtr<_Ty, _ProxyTy>& lhs, const SmartPtr<_UTy, _
|
|||
}
|
||||
|
||||
// template class cannot specialize std::swap,
|
||||
// so implement a Swap Function in kiwano namespace
|
||||
// so implement a swap function in kiwano namespace
|
||||
template <class _Ty, class _ProxyTy>
|
||||
inline void swap(SmartPtr<_Ty, _ProxyTy>& lhs, SmartPtr<_Ty, _ProxyTy>& rhs) noexcept
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,10 +19,12 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano/core/Exception.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
#include <kiwano/core/Time.h>
|
||||
#include <regex>
|
||||
#include <unordered_map>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
@ -35,7 +37,7 @@ Time::Time()
|
|||
{
|
||||
}
|
||||
|
||||
Time::Time(long dur)
|
||||
Time::Time(int64_t dur)
|
||||
: dur_(dur)
|
||||
{
|
||||
}
|
||||
|
|
@ -69,19 +71,114 @@ const Duration Time::operator-(const Time& other) const
|
|||
|
||||
Time Time::Now() noexcept
|
||||
{
|
||||
static LARGE_INTEGER freq = {};
|
||||
if (freq.QuadPart == 0LL)
|
||||
#if defined(KGE_PLATFORM_WINDOWS)
|
||||
|
||||
static double millisecs_per_count = {};
|
||||
if (millisecs_per_count == 0)
|
||||
{
|
||||
LARGE_INTEGER freq = {};
|
||||
// the Function will always succceed on systems that run Windows XP or later
|
||||
QueryPerformanceFrequency(&freq);
|
||||
millisecs_per_count = 1000.0 / static_cast<double>(freq.QuadPart);
|
||||
}
|
||||
|
||||
LARGE_INTEGER count;
|
||||
QueryPerformanceCounter(&count);
|
||||
return Time{ static_cast<int64_t>(count.QuadPart * millisecs_per_count) };
|
||||
|
||||
const long long whole = (count.QuadPart / freq.QuadPart) * 1000LL;
|
||||
const long long part = (count.QuadPart % freq.QuadPart) * 1000LL / freq.QuadPart;
|
||||
return Time{ static_cast<long>(whole + part) };
|
||||
#else
|
||||
|
||||
using std::chrono::steady_clock;
|
||||
using std::chrono::duration_cast;
|
||||
using std::chrono::milliseconds;
|
||||
|
||||
const auto now = steady_clock::now();
|
||||
const auto count = duration_cast<milliseconds>(now.time_since_epoch()).count();
|
||||
return Time{ static_cast<int64_t>(count) };
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------
|
||||
// ClockTime
|
||||
//-------------------------------------------------------
|
||||
|
||||
ClockTime::ClockTime()
|
||||
: ms_since_epoch_(0)
|
||||
{
|
||||
}
|
||||
|
||||
int64_t ClockTime::GetTimeStamp() const
|
||||
{
|
||||
using std::chrono::duration_cast;
|
||||
using std::chrono::milliseconds;
|
||||
using std::chrono::seconds;
|
||||
|
||||
const auto timestamp = duration_cast<seconds>(milliseconds(ms_since_epoch_)).count();
|
||||
return static_cast<int64_t>(timestamp);
|
||||
}
|
||||
|
||||
int64_t ClockTime::GetMillisecondsSinceEpoch() const
|
||||
{
|
||||
return ms_since_epoch_;
|
||||
}
|
||||
|
||||
std::time_t ClockTime::GetCTime() const
|
||||
{
|
||||
return static_cast<time_t>(GetTimeStamp());
|
||||
}
|
||||
|
||||
ClockTime::ClockTime(int64_t ms_since_epoch)
|
||||
: ms_since_epoch_(ms_since_epoch)
|
||||
{
|
||||
}
|
||||
|
||||
ClockTime ClockTime::FromTimeStamp(int64_t timestamp) noexcept
|
||||
{
|
||||
using std::chrono::duration_cast;
|
||||
using std::chrono::milliseconds;
|
||||
using std::chrono::seconds;
|
||||
|
||||
const auto ms = duration_cast<milliseconds>(seconds(timestamp)).count();
|
||||
return ClockTime(static_cast<int64_t>(ms));
|
||||
}
|
||||
|
||||
ClockTime ClockTime::Now() noexcept
|
||||
{
|
||||
using std::chrono::duration_cast;
|
||||
using std::chrono::milliseconds;
|
||||
using std::chrono::system_clock;
|
||||
|
||||
const auto now = system_clock::now();
|
||||
const auto count = duration_cast<milliseconds>(now.time_since_epoch()).count();
|
||||
return ClockTime{ static_cast<int64_t>(count) };
|
||||
}
|
||||
|
||||
const Duration ClockTime::operator-(const ClockTime& other) const
|
||||
{
|
||||
return Duration(ms_since_epoch_ - other.ms_since_epoch_);
|
||||
}
|
||||
|
||||
const ClockTime ClockTime::operator+(const Duration& dur) const
|
||||
{
|
||||
return ClockTime{ ms_since_epoch_ + dur.Milliseconds() };
|
||||
}
|
||||
|
||||
const ClockTime ClockTime::operator-(const Duration& dur) const
|
||||
{
|
||||
return ClockTime{ ms_since_epoch_ - dur.Milliseconds() };
|
||||
}
|
||||
|
||||
ClockTime& ClockTime::operator+=(const Duration& other)
|
||||
{
|
||||
ms_since_epoch_ += other.Milliseconds();
|
||||
return (*this);
|
||||
}
|
||||
|
||||
ClockTime& ClockTime::operator-=(const Duration& other)
|
||||
{
|
||||
ms_since_epoch_ -= other.Milliseconds();
|
||||
return (*this);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------
|
||||
|
|
@ -109,30 +206,41 @@ Duration::Duration()
|
|||
{
|
||||
}
|
||||
|
||||
Duration::Duration(long milliseconds)
|
||||
Duration::Duration(int64_t milliseconds)
|
||||
: milliseconds_(milliseconds)
|
||||
{
|
||||
}
|
||||
|
||||
float Duration::Seconds() const
|
||||
{
|
||||
long sec = milliseconds_ / Second.milliseconds_;
|
||||
long ms = milliseconds_ % Second.milliseconds_;
|
||||
return static_cast<float>(sec) + static_cast<float>(ms) / 1000.f;
|
||||
auto sec = milliseconds_ / Second.milliseconds_;
|
||||
auto ms = milliseconds_ % Second.milliseconds_;
|
||||
return static_cast<float>(sec + ms) / 1000.f;
|
||||
}
|
||||
|
||||
float Duration::Minutes() const
|
||||
{
|
||||
long min = milliseconds_ / Minute.milliseconds_;
|
||||
long ms = milliseconds_ % Minute.milliseconds_;
|
||||
return static_cast<float>(min) + static_cast<float>(ms) / (60 * 1000.f);
|
||||
auto min = milliseconds_ / Minute.milliseconds_;
|
||||
auto ms = milliseconds_ % Minute.milliseconds_;
|
||||
return static_cast<float>(min + ms) / (60 * 1000.f);
|
||||
}
|
||||
|
||||
float Duration::Hours() const
|
||||
{
|
||||
long hour = milliseconds_ / Hour.milliseconds_;
|
||||
long ms = milliseconds_ % Hour.milliseconds_;
|
||||
return static_cast<float>(hour) + static_cast<float>(ms) / (60 * 60 * 1000.f);
|
||||
auto hour = milliseconds_ / Hour.milliseconds_;
|
||||
auto ms = milliseconds_ % Hour.milliseconds_;
|
||||
return static_cast<float>(hour + ms) / (60 * 60 * 1000.f);
|
||||
}
|
||||
|
||||
void Duration::Sleep() const
|
||||
{
|
||||
using std::chrono::milliseconds;
|
||||
using std::this_thread::sleep_for;
|
||||
|
||||
if (milliseconds_)
|
||||
{
|
||||
sleep_for(milliseconds(milliseconds_));
|
||||
}
|
||||
}
|
||||
|
||||
String Duration::ToString() const
|
||||
|
|
@ -142,18 +250,18 @@ String Duration::ToString() const
|
|||
return String("0s");
|
||||
}
|
||||
|
||||
String result;
|
||||
long total_ms = milliseconds_;
|
||||
String result;
|
||||
int64_t total_ms = milliseconds_;
|
||||
if (total_ms < 0)
|
||||
{
|
||||
result.append("-");
|
||||
total_ms = -total_ms;
|
||||
}
|
||||
|
||||
long hour = total_ms / Hour.milliseconds_;
|
||||
long min = total_ms / Minute.milliseconds_ - hour * 60;
|
||||
long sec = total_ms / Second.milliseconds_ - (hour * 60 * 60 + min * 60);
|
||||
long ms = total_ms % Second.milliseconds_;
|
||||
int64_t hour = total_ms / Hour.milliseconds_;
|
||||
int64_t min = total_ms / Minute.milliseconds_ - hour * 60;
|
||||
int64_t sec = total_ms / Second.milliseconds_ - (hour * 60 * 60 + min * 60);
|
||||
int64_t ms = total_ms % Second.milliseconds_;
|
||||
|
||||
if (hour)
|
||||
{
|
||||
|
|
@ -167,7 +275,7 @@ String Duration::ToString() const
|
|||
|
||||
if (ms != 0)
|
||||
{
|
||||
result.append(std::to_string(static_cast<float>(sec) + static_cast<float>(ms) / 1000.f)).append("s");
|
||||
result.append(std::to_string(static_cast<float>(sec + ms) / 1000.f)).append("s");
|
||||
}
|
||||
else if (sec != 0)
|
||||
{
|
||||
|
|
@ -233,22 +341,22 @@ const Duration Duration::operator*(int val) const
|
|||
|
||||
const Duration Duration::operator*(unsigned long long val) const
|
||||
{
|
||||
return Duration(static_cast<long>(milliseconds_ * val));
|
||||
return Duration(static_cast<int64_t>(milliseconds_ * val));
|
||||
}
|
||||
|
||||
const Duration Duration::operator*(float val) const
|
||||
{
|
||||
return Duration(static_cast<long>(milliseconds_ * val));
|
||||
return Duration(static_cast<int64_t>(milliseconds_ * val));
|
||||
}
|
||||
|
||||
const Duration Duration::operator*(double val) const
|
||||
{
|
||||
return Duration(static_cast<long>(milliseconds_ * val));
|
||||
return Duration(static_cast<int64_t>(milliseconds_ * val));
|
||||
}
|
||||
|
||||
const Duration Duration::operator*(long double val) const
|
||||
{
|
||||
return Duration(static_cast<long>(milliseconds_ * val));
|
||||
return Duration(static_cast<int64_t>(milliseconds_ * val));
|
||||
}
|
||||
|
||||
const Duration Duration::operator/(int val) const
|
||||
|
|
@ -258,12 +366,12 @@ const Duration Duration::operator/(int val) const
|
|||
|
||||
const Duration Duration::operator/(float val) const
|
||||
{
|
||||
return Duration(static_cast<long>(milliseconds_ / val));
|
||||
return Duration(static_cast<int64_t>(milliseconds_ / val));
|
||||
}
|
||||
|
||||
const Duration Duration::operator/(double val) const
|
||||
{
|
||||
return Duration(static_cast<long>(milliseconds_ / val));
|
||||
return Duration(static_cast<int64_t>(milliseconds_ / val));
|
||||
}
|
||||
|
||||
Duration& Duration::operator+=(const Duration& other)
|
||||
|
|
@ -286,31 +394,31 @@ Duration& Duration::operator*=(int val)
|
|||
|
||||
Duration& Duration::operator/=(int val)
|
||||
{
|
||||
milliseconds_ = static_cast<long>(milliseconds_ / val);
|
||||
milliseconds_ = static_cast<int64_t>(milliseconds_ / val);
|
||||
return (*this);
|
||||
}
|
||||
|
||||
Duration& Duration::operator*=(float val)
|
||||
{
|
||||
milliseconds_ = static_cast<long>(milliseconds_ * val);
|
||||
milliseconds_ = static_cast<int64_t>(milliseconds_ * val);
|
||||
return (*this);
|
||||
}
|
||||
|
||||
Duration& Duration::operator/=(float val)
|
||||
{
|
||||
milliseconds_ = static_cast<long>(milliseconds_ / val);
|
||||
milliseconds_ = static_cast<int64_t>(milliseconds_ / val);
|
||||
return (*this);
|
||||
}
|
||||
|
||||
Duration& Duration::operator*=(double val)
|
||||
{
|
||||
milliseconds_ = static_cast<long>(milliseconds_ * val);
|
||||
milliseconds_ = static_cast<int64_t>(milliseconds_ * val);
|
||||
return (*this);
|
||||
}
|
||||
|
||||
Duration& Duration::operator/=(double val)
|
||||
{
|
||||
milliseconds_ = static_cast<long>(milliseconds_ / val);
|
||||
milliseconds_ = static_cast<int64_t>(milliseconds_ / val);
|
||||
return (*this);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#pragma once
|
||||
#include <kiwano/core/Common.h>
|
||||
#include <ctime>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
@ -52,11 +53,11 @@ struct KGE_API Duration
|
|||
/// \~chinese
|
||||
/// @brief 构造时间段
|
||||
/// @param milliseconds 毫秒数
|
||||
Duration(long milliseconds);
|
||||
Duration(int64_t milliseconds);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 获取毫秒数
|
||||
long Milliseconds() const;
|
||||
int64_t Milliseconds() const;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 获取秒数
|
||||
|
|
@ -78,7 +79,7 @@ struct KGE_API Duration
|
|||
/// \~chinese
|
||||
/// @brief 设置毫秒数
|
||||
/// @param ms 毫秒数
|
||||
void SetMilliseconds(long ms);
|
||||
void SetMilliseconds(int64_t ms);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 设置秒数
|
||||
|
|
@ -95,6 +96,10 @@ struct KGE_API Duration
|
|||
/// @param hours 小时数
|
||||
void SetHours(float hours);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 休眠
|
||||
void Sleep() const;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 转为字符串
|
||||
String ToString() const;
|
||||
|
|
@ -154,7 +159,7 @@ struct KGE_API Duration
|
|||
friend const Duration operator/(double, const Duration&);
|
||||
|
||||
private:
|
||||
long milliseconds_;
|
||||
int64_t milliseconds_;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -192,13 +197,56 @@ struct KGE_API Time
|
|||
Time& operator-=(const Duration&);
|
||||
|
||||
private:
|
||||
Time(long ms);
|
||||
Time(int64_t ms);
|
||||
|
||||
private:
|
||||
long dur_;
|
||||
int64_t dur_;
|
||||
};
|
||||
|
||||
inline long Duration::Milliseconds() const
|
||||
/**
|
||||
* \~chinese
|
||||
* @brief 时钟时间
|
||||
*/
|
||||
struct KGE_API ClockTime
|
||||
{
|
||||
ClockTime();
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 获取当前时间戳
|
||||
int64_t GetTimeStamp() const;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 获取自纪元以来的毫秒数
|
||||
int64_t GetMillisecondsSinceEpoch() const;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 获取 C 风格的时间
|
||||
std::time_t GetCTime() const;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 获取当前时间
|
||||
static ClockTime Now() noexcept;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 时间戳转化为时间
|
||||
static ClockTime FromTimeStamp(int64_t timestamp) noexcept;
|
||||
|
||||
const Duration operator-(const ClockTime&) const;
|
||||
|
||||
const ClockTime operator+(const Duration&) const;
|
||||
const ClockTime operator-(const Duration&) const;
|
||||
|
||||
ClockTime& operator+=(const Duration&);
|
||||
ClockTime& operator-=(const Duration&);
|
||||
|
||||
private:
|
||||
ClockTime(int64_t ms_since_epoch);
|
||||
|
||||
private:
|
||||
int64_t ms_since_epoch_;
|
||||
};
|
||||
|
||||
inline int64_t Duration::Milliseconds() const
|
||||
{
|
||||
return milliseconds_;
|
||||
}
|
||||
|
|
@ -208,7 +256,7 @@ inline bool Duration::IsZero() const
|
|||
return milliseconds_ == 0LL;
|
||||
}
|
||||
|
||||
inline void Duration::SetMilliseconds(long ms)
|
||||
inline void Duration::SetMilliseconds(int64_t ms)
|
||||
{
|
||||
milliseconds_ = ms;
|
||||
}
|
||||
|
|
@ -232,6 +280,7 @@ inline bool Time::IsZero() const
|
|||
{
|
||||
return dur_ == 0;
|
||||
}
|
||||
|
||||
} // namespace kiwano
|
||||
|
||||
#if defined(KGE_HAS_LITERALS)
|
||||
|
|
|
|||
|
|
@ -1,198 +0,0 @@
|
|||
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
#include <kiwano/core/ObjectBase.h>
|
||||
#include <kiwano/core/Time.h>
|
||||
#include <kiwano/core/IntrusiveList.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
class TimerManager;
|
||||
|
||||
KGE_DECLARE_SMART_PTR(Timer);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 定时器列表
|
||||
typedef IntrusiveList<TimerPtr> TimerList;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 定时器
|
||||
/// @details 定时器用于每隔一段时间执行一次回调函数,且可以指定执行总次数
|
||||
class KGE_API Timer
|
||||
: public ObjectBase
|
||||
, protected IntrusiveListValue<TimerPtr>
|
||||
{
|
||||
friend class TimerManager;
|
||||
friend IntrusiveList<TimerPtr>;
|
||||
|
||||
public:
|
||||
/// \~chinese
|
||||
/// @brief 定时器回调函数
|
||||
/// @details
|
||||
/// 回调函数第一个参数是定时器自身,第二个参数是距离上次更新的时间间隔
|
||||
using Callback = Function<void(Timer* /* self */, Duration /* dt */)>;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 创建定时器
|
||||
/// @param cb 回调函数
|
||||
/// @param interval 时间间隔
|
||||
/// @param times 执行次数(设 -1 为永久执行)
|
||||
static TimerPtr Create(const Callback& cb, Duration interval, int times = -1);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 创建定时器
|
||||
/// @param name 名称
|
||||
/// @param cb 回调函数
|
||||
/// @param interval 时间间隔
|
||||
/// @param times 执行次数(设 -1 为永久执行)
|
||||
static TimerPtr Create(const String& name, const Callback& cb, Duration interval, int times = -1);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 构造空定时器
|
||||
Timer();
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 启动定时器
|
||||
void Start();
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 停止定时器
|
||||
void Stop();
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 移除定时器
|
||||
void Remove();
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 定时器是否在运行
|
||||
bool IsRunning() const;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 定时器是否可移除
|
||||
bool IsRemoveable() const;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 获取定时器执行过回调函数的次数
|
||||
int GetRunTimes() const;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 获取定时器执行回调函数的总次数
|
||||
int GetTotalRunTimes() const;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 设置定时器执行回调函数的总次数
|
||||
void SetTotalRunTimes(int times);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 获取定时器执行时间间隔
|
||||
Duration GetInterval() const;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 设置定时器执行时间间隔
|
||||
void SetInterval(Duration interval);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 获取定时器回调函数
|
||||
Callback GetCallback() const;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 设置定时器回调函数
|
||||
void SetCallback(const Callback& callback);
|
||||
|
||||
private:
|
||||
/// \~chinese
|
||||
/// @brief 更新定时器
|
||||
void Update(Duration dt);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 重置定时器
|
||||
void Reset();
|
||||
|
||||
private:
|
||||
bool running_;
|
||||
bool removeable_;
|
||||
int run_times_;
|
||||
int total_times_;
|
||||
Duration interval_;
|
||||
Duration elapsed_;
|
||||
Callback callback_;
|
||||
};
|
||||
|
||||
inline void Timer::Start()
|
||||
{
|
||||
running_ = true;
|
||||
}
|
||||
|
||||
inline void Timer::Stop()
|
||||
{
|
||||
running_ = false;
|
||||
}
|
||||
|
||||
inline void Timer::Remove()
|
||||
{
|
||||
removeable_ = true;
|
||||
}
|
||||
|
||||
inline bool Timer::IsRunning() const
|
||||
{
|
||||
return running_;
|
||||
}
|
||||
|
||||
inline bool Timer::IsRemoveable() const
|
||||
{
|
||||
return removeable_;
|
||||
}
|
||||
|
||||
inline int Timer::GetRunTimes() const
|
||||
{
|
||||
return run_times_;
|
||||
}
|
||||
|
||||
inline int Timer::GetTotalRunTimes() const
|
||||
{
|
||||
return total_times_;
|
||||
}
|
||||
|
||||
inline void Timer::SetTotalRunTimes(int times)
|
||||
{
|
||||
total_times_ = times;
|
||||
}
|
||||
|
||||
inline Duration Timer::GetInterval() const
|
||||
{
|
||||
return interval_;
|
||||
}
|
||||
|
||||
inline void Timer::SetInterval(Duration interval)
|
||||
{
|
||||
interval_ = interval;
|
||||
}
|
||||
|
||||
inline Timer::Callback Timer::GetCallback() const
|
||||
{
|
||||
return callback_;
|
||||
}
|
||||
|
||||
inline void Timer::SetCallback(const Timer::Callback& callback)
|
||||
{
|
||||
callback_ = callback;
|
||||
}
|
||||
} // namespace kiwano
|
||||
|
|
@ -1,140 +0,0 @@
|
|||
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/core/TimerManager.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
void TimerManager::UpdateTimers(Duration dt)
|
||||
{
|
||||
if (timers_.IsEmpty())
|
||||
return;
|
||||
|
||||
TimerPtr next;
|
||||
for (auto timer = timers_.GetFirst(); timer; timer = next)
|
||||
{
|
||||
next = timer->GetNext();
|
||||
|
||||
timer->Update(dt);
|
||||
|
||||
if (timer->IsRemoveable())
|
||||
timers_.Remove(timer);
|
||||
}
|
||||
}
|
||||
|
||||
Timer* TimerManager::AddTimer(const Timer::Callback& cb, Duration interval, int times)
|
||||
{
|
||||
return AddTimer(String(), cb, interval, times);
|
||||
}
|
||||
|
||||
Timer* TimerManager::AddTimer(const String& name, const Timer::Callback& cb, Duration interval, int times)
|
||||
{
|
||||
TimerPtr timer = Timer::Create(name, cb, interval, times);
|
||||
return AddTimer(timer);
|
||||
}
|
||||
|
||||
Timer* TimerManager::AddTimer(TimerPtr timer)
|
||||
{
|
||||
KGE_ASSERT(timer && "AddTimer failed, NULL pointer exception");
|
||||
|
||||
if (timer)
|
||||
{
|
||||
timer->Reset();
|
||||
timers_.PushBack(timer);
|
||||
}
|
||||
|
||||
return timer.Get();
|
||||
}
|
||||
|
||||
void TimerManager::StopTimers(const String& name)
|
||||
{
|
||||
if (timers_.IsEmpty())
|
||||
return;
|
||||
|
||||
for (auto& timer : timers_)
|
||||
{
|
||||
if (timer->IsName(name))
|
||||
{
|
||||
timer->Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TimerManager::StartTimers(const String& name)
|
||||
{
|
||||
if (timers_.IsEmpty())
|
||||
return;
|
||||
|
||||
for (auto& timer : timers_)
|
||||
{
|
||||
if (timer->IsName(name))
|
||||
{
|
||||
timer->Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TimerManager::RemoveTimers(const String& name)
|
||||
{
|
||||
if (timers_.IsEmpty())
|
||||
return;
|
||||
|
||||
for (auto& timer : timers_)
|
||||
{
|
||||
if (timer->IsName(name))
|
||||
{
|
||||
timer->Remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TimerManager::StopAllTimers()
|
||||
{
|
||||
if (timers_.IsEmpty())
|
||||
return;
|
||||
|
||||
for (auto& timer : timers_)
|
||||
{
|
||||
timer->Stop();
|
||||
}
|
||||
}
|
||||
|
||||
void TimerManager::StartAllTimers()
|
||||
{
|
||||
if (timers_.IsEmpty())
|
||||
return;
|
||||
|
||||
for (auto& timer : timers_)
|
||||
{
|
||||
timer->Start();
|
||||
}
|
||||
}
|
||||
|
||||
void TimerManager::RemoveAllTimers()
|
||||
{
|
||||
timers_.Clear();
|
||||
}
|
||||
|
||||
const TimerList& TimerManager::GetAllTimers() const
|
||||
{
|
||||
return timers_;
|
||||
}
|
||||
} // namespace kiwano
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include <kiwano/core/event/Event.h>
|
||||
#include <kiwano/event/Event.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#pragma once
|
||||
#include <kiwano/core/SmartPtr.hpp>
|
||||
#include <kiwano/core/event/EventType.h>
|
||||
#include <kiwano/event/EventType.h>
|
||||
#include <kiwano/math/Math.h>
|
||||
|
||||
namespace kiwano
|
||||
|
|
@ -18,8 +18,8 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano/core/EventDispatcher.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/event/EventDispatcher.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
@ -19,13 +19,18 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
#include <kiwano/core/EventListener.h>
|
||||
#include <kiwano/event/EventListener.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 监听器列表
|
||||
typedef IntrusiveList<EventListenerPtr> ListenerList;
|
||||
|
||||
/**
|
||||
* \~chinese
|
||||
* @brief 事件分发系统
|
||||
* @brief 事件分发器
|
||||
*/
|
||||
class KGE_API EventDispatcher
|
||||
{
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
#include <kiwano/core/EventListener.h>
|
||||
#include <kiwano/event/EventListener.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
@ -20,13 +20,10 @@
|
|||
|
||||
#pragma once
|
||||
#include <kiwano/core/Common.h>
|
||||
#include <kiwano/core/ObjectBase.h>
|
||||
#include <kiwano/base/ObjectBase.h>
|
||||
#include <kiwano/core/SmartPtr.hpp>
|
||||
#include <kiwano/core/IntrusiveList.h>
|
||||
#include <kiwano/core/event/Event.h>
|
||||
#include <kiwano/core/event/KeyEvent.h>
|
||||
#include <kiwano/core/event/MouseEvent.h>
|
||||
#include <kiwano/core/event/WindowEvent.h>
|
||||
#include <kiwano/event/Events.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
@ -34,10 +31,6 @@ class EventDispatcher;
|
|||
|
||||
KGE_DECLARE_SMART_PTR(EventListener);
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 监听器列表
|
||||
typedef IntrusiveList<EventListenerPtr> ListenerList;
|
||||
|
||||
/**
|
||||
* \~chinese
|
||||
* @brief 事件监听器
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (c) 2016-2018 Kiwano - Nomango
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <kiwano/event/Event.h>
|
||||
#include <kiwano/event/KeyEvent.h>
|
||||
#include <kiwano/event/MouseEvent.h>
|
||||
#include <kiwano/event/WindowEvent.h>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include <kiwano/core/event/KeyEvent.h>
|
||||
#include <kiwano/event/KeyEvent.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#pragma once
|
||||
#include <kiwano/core/Keys.h>
|
||||
#include <kiwano/core/event/Event.h>
|
||||
#include <kiwano/event/Event.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include <kiwano/core/event/MouseEvent.h>
|
||||
#include <kiwano/event/MouseEvent.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#pragma once
|
||||
#include <kiwano/core/Keys.h>
|
||||
#include <kiwano/core/event/Event.h>
|
||||
#include <kiwano/event/Event.h>
|
||||
#include <kiwano/math/Math.h>
|
||||
|
||||
namespace kiwano
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include <kiwano/core/event/WindowEvent.h>
|
||||
#include <kiwano/event/WindowEvent.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
// THE SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
#include <kiwano/core/event/Event.h>
|
||||
#include <kiwano/event/Event.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
@ -44,20 +44,33 @@
|
|||
//
|
||||
|
||||
#include <kiwano/core/Common.h>
|
||||
#include <kiwano/core/Director.h>
|
||||
#include <kiwano/core/EventDispatcher.h>
|
||||
#include <kiwano/core/EventListener.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/core/ObjectBase.h>
|
||||
#include <kiwano/core/Resource.h>
|
||||
#include <kiwano/core/SmartPtr.hpp>
|
||||
#include <kiwano/core/Time.h>
|
||||
#include <kiwano/core/Timer.h>
|
||||
#include <kiwano/core/TimerManager.h>
|
||||
#include <kiwano/core/event/Event.h>
|
||||
#include <kiwano/core/event/KeyEvent.h>
|
||||
#include <kiwano/core/event/MouseEvent.h>
|
||||
#include <kiwano/core/event/WindowEvent.h>
|
||||
|
||||
//
|
||||
// base
|
||||
//
|
||||
|
||||
#include <kiwano/base/RefCounter.h>
|
||||
#include <kiwano/base/ObjectBase.h>
|
||||
#include <kiwano/base/Director.h>
|
||||
#include <kiwano/base/Module.h>
|
||||
#include <kiwano/base/component/Component.h>
|
||||
#include <kiwano/base/component/ComponentManager.h>
|
||||
#include <kiwano/base/component/Button.h>
|
||||
|
||||
|
||||
//
|
||||
// event
|
||||
//
|
||||
|
||||
#include <kiwano/event/Event.h>
|
||||
#include <kiwano/event/KeyEvent.h>
|
||||
#include <kiwano/event/MouseEvent.h>
|
||||
#include <kiwano/event/WindowEvent.h>
|
||||
#include <kiwano/event/EventListener.h>
|
||||
#include <kiwano/event/EventDispatcher.h>
|
||||
|
||||
//
|
||||
// renderer
|
||||
|
|
@ -68,6 +81,8 @@
|
|||
#include <kiwano/render/Shape.h>
|
||||
#include <kiwano/render/ShapeMaker.h>
|
||||
#include <kiwano/render/Texture.h>
|
||||
#include <kiwano/render/Frame.h>
|
||||
#include <kiwano/render/FrameSequence.h>
|
||||
#include <kiwano/render/GifImage.h>
|
||||
#include <kiwano/render/Layer.h>
|
||||
#include <kiwano/render/TextLayout.h>
|
||||
|
|
@ -79,11 +94,8 @@
|
|||
//
|
||||
|
||||
#include <kiwano/2d/Actor.h>
|
||||
#include <kiwano/2d/Button.h>
|
||||
#include <kiwano/2d/Canvas.h>
|
||||
#include <kiwano/2d/DebugActor.h>
|
||||
#include <kiwano/2d/Frame.h>
|
||||
#include <kiwano/2d/FrameSequence.h>
|
||||
#include <kiwano/2d/GifSprite.h>
|
||||
#include <kiwano/2d/LayerActor.h>
|
||||
#include <kiwano/2d/ShapeActor.h>
|
||||
|
|
@ -95,7 +107,7 @@
|
|||
#include <kiwano/2d/action/ActionDelay.h>
|
||||
#include <kiwano/2d/action/ActionGroup.h>
|
||||
#include <kiwano/2d/action/ActionHelper.h>
|
||||
#include <kiwano/2d/action/ActionManager.h>
|
||||
#include <kiwano/2d/action/ActionScheduler.h>
|
||||
#include <kiwano/2d/action/ActionTween.h>
|
||||
#include <kiwano/2d/action/ActionWalk.h>
|
||||
#include <kiwano/2d/action/Animation.h>
|
||||
|
|
@ -114,6 +126,12 @@
|
|||
// utils
|
||||
//
|
||||
|
||||
#include <kiwano/utils/Logger.h>
|
||||
#include <kiwano/utils/LocalStorage.h>
|
||||
#include <kiwano/utils/ResourceCache.h>
|
||||
#include <kiwano/utils/UserData.h>
|
||||
#include <kiwano/utils/Timer.h>
|
||||
#include <kiwano/utils/Ticker.h>
|
||||
#include <kiwano/utils/EventTicker.h>
|
||||
#include <kiwano/utils/Task.h>
|
||||
#include <kiwano/utils/TaskScheduler.h>
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@
|
|||
//
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef KGE_PLATFORM_WINDOWS
|
||||
#if defined(KGE_PLATFORM_WINDOWS)
|
||||
|
||||
#if KGE_RENDER_ENGINE == KGE_RENDER_ENGINE_NONE
|
||||
# undef KGE_RENDER_ENGINE
|
||||
|
|
@ -157,6 +157,32 @@ KGE_SUPPRESS_WARNING(4251)
|
|||
#include <wincodec.h>
|
||||
#include <windows.h>
|
||||
|
||||
#elif defined(KGE_PLATFORM_MACOS)
|
||||
|
||||
#if KGE_RENDER_ENGINE == KGE_RENDER_ENGINE_NONE
|
||||
# undef KGE_RENDER_ENGINE
|
||||
# define KGE_RENDER_ENGINE KGE_RENDER_ENGINE_OPENGL
|
||||
#endif
|
||||
|
||||
#define KGE_DEPRECATED(...)
|
||||
|
||||
#define KGE_SUPPRESS_WARNING_PUSH
|
||||
#define KGE_SUPPRESS_WARNING(CODE)
|
||||
#define KGE_SUPPRESS_WARNING_POP
|
||||
|
||||
#ifndef KGE_API
|
||||
# if defined(KGE_USE_DLL)
|
||||
# define KGE_API
|
||||
# elif defined(KGE_EXPORT_DLL)
|
||||
# define KGE_API
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef KGE_API
|
||||
/* Building or calling Kiwano as a static library */
|
||||
# define KGE_API
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#if KGE_RENDER_ENGINE == KGE_RENDER_ENGINE_DIRECTX
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
#include <kiwano/platform/Application.h>
|
||||
#include <kiwano/platform/Input.h>
|
||||
#include <kiwano/core/Director.h>
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/base/Director.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
#include <kiwano/render/Renderer.h>
|
||||
#include <kiwano/render/TextureCache.h>
|
||||
#include <kiwano/utils/ResourceCache.h>
|
||||
|
|
@ -35,20 +35,29 @@ int GetVersion()
|
|||
}
|
||||
|
||||
Application::Application()
|
||||
: quiting_(false)
|
||||
: running_(false)
|
||||
, is_paused_(false)
|
||||
, time_scale_(1.f)
|
||||
{
|
||||
Use(Renderer::GetInstance());
|
||||
Use(Input::GetInstance());
|
||||
Use(Director::GetInstance());
|
||||
|
||||
ticker_ = Ticker::Create(0);
|
||||
ticker_->Tick();
|
||||
}
|
||||
|
||||
Application::~Application() {}
|
||||
Application::~Application()
|
||||
{
|
||||
this->Destroy();
|
||||
}
|
||||
|
||||
void Application::Run(RunnerPtr runner, bool debug)
|
||||
{
|
||||
KGE_ASSERT(runner);
|
||||
runner_ = runner;
|
||||
running_ = true;
|
||||
is_paused_ = false;
|
||||
|
||||
// Setup all modules
|
||||
for (auto c : modules_)
|
||||
|
|
@ -65,30 +74,49 @@ void Application::Run(RunnerPtr runner, bool debug)
|
|||
// Everything is ready
|
||||
runner->OnReady();
|
||||
|
||||
quiting_ = false;
|
||||
last_update_time_ = Time::Now();
|
||||
while (!quiting_)
|
||||
while (running_)
|
||||
{
|
||||
const Time now = Time::Now();
|
||||
const Duration dt = (now - last_update_time_);
|
||||
last_update_time_ = now;
|
||||
|
||||
if (!runner->MainLoop(dt))
|
||||
quiting_ = true;
|
||||
if (ticker_->Tick())
|
||||
{
|
||||
if (!runner->MainLoop(ticker_->GetDeltaTime()))
|
||||
running_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Destroy all resources
|
||||
runner->OnDestroy();
|
||||
this->Destroy();
|
||||
}
|
||||
|
||||
void Application::Pause()
|
||||
{
|
||||
is_paused_ = true;
|
||||
if (ticker_)
|
||||
{
|
||||
ticker_->Pause();
|
||||
}
|
||||
}
|
||||
|
||||
void Application::Resume()
|
||||
{
|
||||
is_paused_ = false;
|
||||
if (ticker_)
|
||||
{
|
||||
ticker_->Resume();
|
||||
}
|
||||
}
|
||||
|
||||
void Application::Quit()
|
||||
{
|
||||
quiting_ = true;
|
||||
running_ = false;
|
||||
}
|
||||
|
||||
void Application::Destroy()
|
||||
{
|
||||
if (runner_)
|
||||
{
|
||||
runner_->OnDestroy();
|
||||
runner_ = nullptr;
|
||||
}
|
||||
|
||||
// Clear all resources
|
||||
Director::GetInstance().ClearStages();
|
||||
ResourceCache::GetInstance().Clear();
|
||||
|
|
@ -98,6 +126,7 @@ void Application::Destroy()
|
|||
{
|
||||
(*iter)->DestroyModule();
|
||||
}
|
||||
modules_.clear();
|
||||
}
|
||||
|
||||
void Application::Use(Module& module)
|
||||
|
|
@ -124,6 +153,9 @@ void Application::DispatchEvent(EventPtr evt)
|
|||
|
||||
void Application::DispatchEvent(Event* evt)
|
||||
{
|
||||
if (!running_ /* Dispatch events even if application is paused */)
|
||||
return;
|
||||
|
||||
for (auto comp : modules_)
|
||||
{
|
||||
if (auto event_comp = comp->Cast<EventModule>())
|
||||
|
|
@ -135,6 +167,9 @@ void Application::DispatchEvent(Event* evt)
|
|||
|
||||
void Application::Update(Duration dt)
|
||||
{
|
||||
if (!running_ || is_paused_)
|
||||
return;
|
||||
|
||||
// Before update
|
||||
for (auto comp : modules_)
|
||||
{
|
||||
|
|
@ -186,6 +221,9 @@ void Application::Update(Duration dt)
|
|||
|
||||
void Application::Render()
|
||||
{
|
||||
if (!running_ /* Render even if application is paused */)
|
||||
return;
|
||||
|
||||
Renderer& renderer = Renderer::GetInstance();
|
||||
renderer.Clear();
|
||||
|
||||
|
|
|
|||
|
|
@ -21,12 +21,13 @@
|
|||
#pragma once
|
||||
#include <mutex>
|
||||
#include <kiwano/core/Common.h>
|
||||
#include <kiwano/core/Module.h>
|
||||
#include <kiwano/base/Module.h>
|
||||
#include <kiwano/core/Time.h>
|
||||
#include <kiwano/core/Singleton.h>
|
||||
#include <kiwano/core/event/Event.h>
|
||||
#include <kiwano/event/Event.h>
|
||||
#include <kiwano/platform/Runner.h>
|
||||
#include <kiwano/platform/Window.h>
|
||||
#include <kiwano/utils/Ticker.h>
|
||||
|
||||
namespace kiwano
|
||||
{
|
||||
|
|
@ -59,6 +60,18 @@ public:
|
|||
*/
|
||||
void Run(RunnerPtr runner, bool debug = false);
|
||||
|
||||
/**
|
||||
* \~chinese
|
||||
* @brief 暂停应用程序
|
||||
*/
|
||||
void Pause();
|
||||
|
||||
/**
|
||||
* \~chinese
|
||||
* @brief 继续应用程序
|
||||
*/
|
||||
void Resume();
|
||||
|
||||
/**
|
||||
* \~chinese
|
||||
* @brief ÖÕÖ¹Ó¦ÓóÌÐò
|
||||
|
|
@ -77,6 +90,18 @@ public:
|
|||
*/
|
||||
WindowPtr GetMainWindow() const;
|
||||
|
||||
/**
|
||||
* \~chinese
|
||||
* @brief 获取报时器
|
||||
*/
|
||||
TickerPtr GetTicker() const;
|
||||
|
||||
/**
|
||||
* \~chinese
|
||||
* @brief 获取暂停状态
|
||||
*/
|
||||
bool IsPaused() const;
|
||||
|
||||
/**
|
||||
* \~chinese
|
||||
* @brief Ìí¼ÓÄ£¿é
|
||||
|
|
@ -136,17 +161,12 @@ public:
|
|||
*/
|
||||
void Destroy();
|
||||
|
||||
/**
|
||||
* \~chinese
|
||||
* @brief 获取上一次更新时间
|
||||
*/
|
||||
Time GetLastUpdateTime() const;
|
||||
|
||||
private:
|
||||
bool quiting_;
|
||||
bool running_;
|
||||
bool is_paused_;
|
||||
float time_scale_;
|
||||
RunnerPtr runner_;
|
||||
Time last_update_time_;
|
||||
TickerPtr ticker_;
|
||||
List<Module*> modules_;
|
||||
std::mutex perform_mutex_;
|
||||
Queue<Function<void()>> functions_to_perform_;
|
||||
|
|
@ -163,9 +183,14 @@ inline WindowPtr Application::GetMainWindow() const
|
|||
return runner_->GetMainWindow();
|
||||
}
|
||||
|
||||
inline Time Application::GetLastUpdateTime() const
|
||||
inline TickerPtr Application::GetTicker() const
|
||||
{
|
||||
return last_update_time_;
|
||||
return ticker_;
|
||||
}
|
||||
|
||||
inline bool Application::IsPaused() const
|
||||
{
|
||||
return is_paused_;
|
||||
}
|
||||
|
||||
} // namespace kiwano
|
||||
|
|
|
|||
|
|
@ -18,9 +18,8 @@
|
|||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include <kiwano/core/Logger.h>
|
||||
#include <kiwano/core/event/KeyEvent.h>
|
||||
#include <kiwano/core/event/MouseEvent.h>
|
||||
#include <kiwano/utils/Logger.h>
|
||||
#include <kiwano/event/Events.h>
|
||||
#include <kiwano/platform/Input.h>
|
||||
|
||||
namespace kiwano
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue