update DebugActor
This commit is contained in:
parent
7b8e4814a9
commit
3c47aaf007
|
|
@ -29,7 +29,6 @@
|
||||||
<ClInclude Include="..\src\kiwano\2d\include-forwards.h" />
|
<ClInclude Include="..\src\kiwano\2d\include-forwards.h" />
|
||||||
<ClInclude Include="..\src\kiwano\2d\Canvas.h" />
|
<ClInclude Include="..\src\kiwano\2d\Canvas.h" />
|
||||||
<ClInclude Include="..\src\kiwano\2d\DebugActor.h" />
|
<ClInclude Include="..\src\kiwano\2d\DebugActor.h" />
|
||||||
<ClInclude Include="..\src\kiwano\2d\Font.hpp" />
|
|
||||||
<ClInclude Include="..\src\kiwano\2d\FrameSequence.h" />
|
<ClInclude Include="..\src\kiwano\2d\FrameSequence.h" />
|
||||||
<ClInclude Include="..\src\kiwano\2d\ShapeActor.h" />
|
<ClInclude Include="..\src\kiwano\2d\ShapeActor.h" />
|
||||||
<ClInclude Include="..\src\kiwano\2d\Layer.h" />
|
<ClInclude Include="..\src\kiwano\2d\Layer.h" />
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,6 @@
|
||||||
<ClInclude Include="..\src\kiwano\2d\Canvas.h">
|
<ClInclude Include="..\src\kiwano\2d\Canvas.h">
|
||||||
<Filter>2d</Filter>
|
<Filter>2d</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\src\kiwano\2d\Font.hpp">
|
|
||||||
<Filter>2d</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\src\kiwano\2d\include-forwards.h">
|
<ClInclude Include="..\src\kiwano\2d\include-forwards.h">
|
||||||
<Filter>2d</Filter>
|
<Filter>2d</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,13 @@ $replaceTo = "<DebugInformationFormat>None</DebugInformationFormat>"
|
||||||
|
|
||||||
Get-ChildItem -Path 'projects\' *.vcxproj | ForEach-Object {
|
Get-ChildItem -Path 'projects\' *.vcxproj | ForEach-Object {
|
||||||
$filePath = 'projects\' + $_
|
$filePath = 'projects\' + $_
|
||||||
|
|
||||||
|
# Create a copy of .vcxproj file
|
||||||
Copy-Item -Path $filePath -Destination ($filePath + '.template')
|
Copy-Item -Path $filePath -Destination ($filePath + '.template')
|
||||||
|
|
||||||
|
# Overlay some configurations
|
||||||
Get-Content ($filePath + '.template') -Encoding UTF8 | ForEach-Object { $_ -replace $replace, $replaceTo } | Out-File $filePath -Encoding UTF8
|
Get-Content ($filePath + '.template') -Encoding UTF8 | ForEach-Object { $_ -replace $replace, $replaceTo } | Out-File $filePath -Encoding UTF8
|
||||||
|
|
||||||
|
# Delete the copy file
|
||||||
Remove-Item -Path ($filePath + '.template')
|
Remove-Item -Path ($filePath + '.template')
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,14 @@ Write-Host "Start to build nupkg files"
|
||||||
# This is the CoApp .autopkg file to create.
|
# This is the CoApp .autopkg file to create.
|
||||||
$autopkgFile = "scripts\coapp\kiwano.autopkg"
|
$autopkgFile = "scripts\coapp\kiwano.autopkg"
|
||||||
|
|
||||||
|
# Create a copy of ".autopkg" file
|
||||||
|
Copy-Item -Path $autopkgFile -Destination ($autopkgFile + '.template')
|
||||||
|
|
||||||
# Get the ".autopkg.template" file, replace "@appveyor_version" with the Appveyor version number, then save to the ".autopkg" file.
|
# Get the ".autopkg.template" file, replace "@appveyor_version" with the Appveyor version number, then save to the ".autopkg" file.
|
||||||
Get-Content ($autopkgFile + ".template") | ForEach-Object { $_ -replace "@appveyor_version", $env:appveyor_build_version } > $autopkgFile
|
Get-Content ($autopkgFile + ".template") -Encoding UTF8 | ForEach-Object { $_ -replace "@appveyor_version", $env:appveyor_build_version } | Out-File $autopkgFile -Encoding UTF8
|
||||||
|
|
||||||
|
# Delete the copy file
|
||||||
|
Remove-Item -Path ($autopkgFile + '.template')
|
||||||
|
|
||||||
# Use the CoApp tools to create NuGet native packages from the .autopkg.
|
# Use the CoApp tools to create NuGet native packages from the .autopkg.
|
||||||
Write-NuGetPackage $autopkgFile
|
Write-NuGetPackage $autopkgFile
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#defines {
|
#defines {
|
||||||
// Global variables may be added here.
|
// Global variables may be added here.
|
||||||
// Variables on the "value" side of each definition will be processed at access time.
|
// Variables on the "value" side of each definition will be processed at access time.
|
||||||
// GlobalVar1 = "";
|
// GlobalVar1 = "";
|
||||||
|
|
@ -21,13 +21,29 @@
|
||||||
#include "DebugActor.h"
|
#include "DebugActor.h"
|
||||||
#include "Text.h"
|
#include "Text.h"
|
||||||
#include "../renderer/Renderer.h"
|
#include "../renderer/Renderer.h"
|
||||||
#include <sstream>
|
|
||||||
#include <psapi.h>
|
#include <psapi.h>
|
||||||
|
|
||||||
#pragma comment(lib, "psapi.lib")
|
#pragma comment(lib, "psapi.lib")
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
class comma_numpunct : public std::numpunct<wchar_t>
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
virtual wchar_t do_thousands_sep() const override
|
||||||
|
{
|
||||||
|
return L',';
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual std::string do_grouping() const override
|
||||||
|
{
|
||||||
|
return "\03";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
DebugActor::DebugActor()
|
DebugActor::DebugActor()
|
||||||
: background_color_(0.0f, 0.0f, 0.0f, 0.7f)
|
: background_color_(0.0f, 0.0f, 0.0f, 0.7f)
|
||||||
{
|
{
|
||||||
|
|
@ -41,6 +57,7 @@ namespace kiwano
|
||||||
this->AddChild(debug_text_);
|
this->AddChild(debug_text_);
|
||||||
|
|
||||||
Font font;
|
Font font;
|
||||||
|
font.family = L"Arial";
|
||||||
font.size = 16.f;
|
font.size = 16.f;
|
||||||
font.weight = FontWeight::Normal;
|
font.weight = FontWeight::Normal;
|
||||||
debug_text_->SetFont(font);
|
debug_text_->SetFont(font);
|
||||||
|
|
@ -61,11 +78,7 @@ namespace kiwano
|
||||||
{
|
{
|
||||||
PrepareRender(renderer);
|
PrepareRender(renderer);
|
||||||
|
|
||||||
renderer->GetSolidColorBrush()->SetColor(DX::ConvertToColorF(background_color_));
|
renderer->FillRoundedRectangle(GetBounds(), Vec2{ 5.f, 5.f }, background_color_);
|
||||||
renderer->GetD2DDeviceResources()->GetDeviceContext()->FillRoundedRectangle(
|
|
||||||
D2D1::RoundedRect(DX::ConvertToRectF(GetBounds()), 5.f, 5.f),
|
|
||||||
renderer->GetSolidColorBrush()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebugActor::OnUpdate(Duration dt)
|
void DebugActor::OnUpdate(Duration dt)
|
||||||
|
|
@ -78,7 +91,14 @@ namespace kiwano
|
||||||
frame_time_.erase(frame_time_.begin());
|
frame_time_.erase(frame_time_.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstringstream ss;
|
StringStream ss;
|
||||||
|
|
||||||
|
{
|
||||||
|
// For formatting integers with commas
|
||||||
|
static std::locale comma_locale(std::locale(), new comma_numpunct);
|
||||||
|
(void)ss.imbue(comma_locale);
|
||||||
|
}
|
||||||
|
|
||||||
ss << "Fps: " << frame_time_.size() << std::endl;
|
ss << "Fps: " << frame_time_.size() << std::endl;
|
||||||
|
|
||||||
#if defined(KGE_DEBUG)
|
#if defined(KGE_DEBUG)
|
||||||
|
|
@ -90,11 +110,21 @@ namespace kiwano
|
||||||
|
|
||||||
ss << "Render: " << Renderer::GetInstance()->GetStatus().duration.Milliseconds() << "ms" << std::endl;
|
ss << "Render: " << Renderer::GetInstance()->GetStatus().duration.Milliseconds() << "ms" << std::endl;
|
||||||
|
|
||||||
ss << "Primitives / sec: " << Renderer::GetInstance()->GetStatus().primitives * frame_time_.size() << std::endl;
|
ss << "Primitives / sec: " << std::fixed << Renderer::GetInstance()->GetStatus().primitives * frame_time_.size() << std::endl;
|
||||||
|
|
||||||
PROCESS_MEMORY_COUNTERS_EX pmc;
|
ss << "Memory: ";
|
||||||
GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*)&pmc, sizeof(pmc));
|
{
|
||||||
ss << "Memory: " << pmc.PrivateUsage / 1024 << "kb";
|
PROCESS_MEMORY_COUNTERS_EX pmc;
|
||||||
|
GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*)&pmc, sizeof(pmc));
|
||||||
|
|
||||||
|
if (pmc.PrivateUsage > 1024 * 1024)
|
||||||
|
{
|
||||||
|
ss << pmc.PrivateUsage / (1024 * 1024) << "Mb ";
|
||||||
|
pmc.PrivateUsage %= (1024 * 1024);
|
||||||
|
}
|
||||||
|
|
||||||
|
ss << pmc.PrivateUsage / 1024 << "Kb";
|
||||||
|
}
|
||||||
|
|
||||||
debug_text_->SetText(ss.str());
|
debug_text_->SetText(ss.str());
|
||||||
SetSize(Size{ 20 + debug_text_->GetSize().x, 20 + debug_text_->GetSize().y });
|
SetSize(Size{ 20 + debug_text_->GetSize().x, 20 + debug_text_->GetSize().y });
|
||||||
|
|
|
||||||
|
|
@ -279,7 +279,7 @@ namespace kiwano
|
||||||
{
|
{
|
||||||
static WChar temp_buffer[1024 * 3 + 1];
|
static WChar temp_buffer[1024 * 3 + 1];
|
||||||
|
|
||||||
std::wstringstream ss;
|
StringStream ss;
|
||||||
ss << Logger::OutPrefix;
|
ss << Logger::OutPrefix;
|
||||||
|
|
||||||
if (prompt)
|
if (prompt)
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,7 @@ namespace kiwano
|
||||||
template <typename ..._Args>
|
template <typename ..._Args>
|
||||||
std::wstring Logger::MakeOutputString(const WChar* prompt, _Args&& ... args) const
|
std::wstring Logger::MakeOutputString(const WChar* prompt, _Args&& ... args) const
|
||||||
{
|
{
|
||||||
std::wstringstream ss;
|
StringStream ss;
|
||||||
ss << Logger::OutPrefix;
|
ss << Logger::OutPrefix;
|
||||||
|
|
||||||
if (prompt)
|
if (prompt)
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -43,15 +43,15 @@ namespace kiwano
|
||||||
public:
|
public:
|
||||||
String family; // 字体族
|
String family; // 字体族
|
||||||
Float32 size; // 字号
|
Float32 size; // 字号
|
||||||
UInt32 weight; // ´Öϸֵ
|
UInt32 weight; // ´Öϸֵ
|
||||||
bool italic; // 是否斜体
|
bool italic; // 是否斜体
|
||||||
FontCollection collection; // 字体集
|
FontCollection collection; // 字体集
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Font(
|
Font(
|
||||||
const String& family = L"",
|
const String& family = L"",
|
||||||
Float32 size = 18,
|
Float32 size = 18,
|
||||||
UInt32 weight = FontWeight::Normal,
|
UInt32 weight = FontWeight::Normal,
|
||||||
bool italic = false,
|
bool italic = false,
|
||||||
FontCollection collection = FontCollection()
|
FontCollection collection = FontCollection()
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue