[deploy] Add GetVersion function

This commit is contained in:
Nomango 2020-03-31 10:10:33 +08:00
parent a1e7e77c96
commit a6961c0d20
5 changed files with 48 additions and 23 deletions

5
projects/kiwano/cpp.hint Normal file
View File

@ -0,0 +1,5 @@
// 提示文件帮助 Visual Studio IDE 解释 Visual C++ 标识符,
// 如函数和宏的名称。
// 有关详细信息,请参见 https://go.microsoft.com/fwlink/?linkid=865984
#define KGE_API

View File

@ -182,6 +182,9 @@
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{FF7F943D-A89C-4E6C-97CF-84F7D8FF8EDF}</ProjectGuid>
<RootNamespace>kiwano</RootNamespace>
@ -260,4 +263,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -534,4 +534,7 @@
<Filter>core</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />
</ItemGroup>
</Project>

View File

@ -29,6 +29,11 @@
namespace kiwano
{
int GetVersion()
{
return KGE_VERSION;
}
Application::Application()
: quiting_(false)
, time_scale_(1.f)
@ -40,11 +45,6 @@ Application::Application()
Application::~Application() {}
int Application::GetVersion() const
{
return KGE_VERSION;
}
void Application::Run(RunnerPtr runner, bool debug)
{
KGE_ASSERT(runner);
@ -112,6 +112,22 @@ void Application::SetTimeScale(float scale_factor)
time_scale_ = scale_factor;
}
void Application::DispatchEvent(EventPtr evt)
{
this->DispatchEvent(evt.Get());
}
void Application::DispatchEvent(Event* evt)
{
for (auto comp : modules_)
{
if (auto event_comp = comp->Cast<EventModule>())
{
event_comp->HandleEvent(evt);
}
}
}
void Application::Update(Duration dt)
{
// Before update
@ -200,17 +216,6 @@ void Application::Render()
renderer.Present();
}
void Application::DispatchEvent(Event* evt)
{
for (auto comp : modules_)
{
if (auto event_comp = comp->Cast<EventModule>())
{
event_comp->HandleEvent(evt);
}
}
}
void Application::PreformInMainThread(Function<void()> func)
{
std::lock_guard<std::mutex> lock(perform_mutex_);

View File

@ -30,6 +30,13 @@
namespace kiwano
{
/**
* \~chinese
* @brief
*/
extern KGE_API int GetVersion();
/**
* \~chinese
* @brief
@ -70,12 +77,6 @@ public:
*/
WindowPtr GetMainWindow() const;
/**
* \~chinese
* @brief
*/
int GetVersion() const;
/**
* \~chinese
* @brief
@ -92,6 +93,14 @@ public:
*/
void SetTimeScale(float scale_factor);
/**
* \~chinese
* @brief
* @details
* @param evt
*/
void DispatchEvent(EventPtr evt);
/**
* \~chinese
* @brief