Update Singleton
This commit is contained in:
parent
d938922605
commit
9329b6f888
|
|
@ -63,7 +63,7 @@ Sound::~Sound()
|
|||
|
||||
bool Sound::Load(String const& file_path)
|
||||
{
|
||||
if (!FileSystem::Instance().IsFileExists(file_path))
|
||||
if (!FileSystem::GetInstance().IsFileExists(file_path))
|
||||
{
|
||||
KGE_WARN(L"Media file '%s' not found", file_path.c_str());
|
||||
return false;
|
||||
|
|
@ -74,7 +74,7 @@ bool Sound::Load(String const& file_path)
|
|||
Close();
|
||||
}
|
||||
|
||||
String full_path = FileSystem::Instance().GetFullPathForFile(file_path);
|
||||
String full_path = FileSystem::GetInstance().GetFullPathForFile(file_path);
|
||||
|
||||
HRESULT hr = transcoder_.LoadMediaFile(full_path);
|
||||
if (FAILED(hr))
|
||||
|
|
@ -83,7 +83,7 @@ bool Sound::Load(String const& file_path)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!AudioEngine::Instance().CreateSound(*this, transcoder_.GetBuffer()))
|
||||
if (!AudioEngine::GetInstance().CreateSound(*this, transcoder_.GetBuffer()))
|
||||
{
|
||||
Close();
|
||||
return false;
|
||||
|
|
@ -107,7 +107,7 @@ bool Sound::Load(Resource const& res)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!AudioEngine::Instance().CreateSound(*this, transcoder_.GetBuffer()))
|
||||
if (!AudioEngine::GetInstance().CreateSound(*this, transcoder_.GetBuffer()))
|
||||
{
|
||||
Close();
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ void ImGuiModule::SetupComponent()
|
|||
ImGui::StyleColorsDark();
|
||||
|
||||
// Setup Platform/Renderer bindings
|
||||
target_window_ = Renderer::Instance().GetTargetWindow();
|
||||
target_window_ = Renderer::GetInstance().GetTargetWindow();
|
||||
|
||||
io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors; // We can honor GetMouseCursor() values (optional)
|
||||
io.BackendFlags |=
|
||||
|
|
@ -58,7 +58,7 @@ void ImGuiModule::SetupComponent()
|
|||
io.KeyMap[ImGuiKey_Y] = (int)KeyCode::Y;
|
||||
io.KeyMap[ImGuiKey_Z] = (int)KeyCode::Z;
|
||||
|
||||
ImGui_Impl_Init(Renderer::Instance());
|
||||
ImGui_Impl_Init(Renderer::GetInstance());
|
||||
}
|
||||
|
||||
void ImGuiModule::DestroyComponent()
|
||||
|
|
@ -75,10 +75,10 @@ void ImGuiModule::OnUpdate(Duration dt)
|
|||
io.DeltaTime = dt.Seconds();
|
||||
|
||||
// Read keyboard modifiers inputs
|
||||
io.KeyCtrl = Input::Instance().IsDown(KeyCode::Ctrl);
|
||||
io.KeyShift = Input::Instance().IsDown(KeyCode::Shift);
|
||||
io.KeyAlt = Input::Instance().IsDown(KeyCode::Alt);
|
||||
io.KeySuper = Input::Instance().IsDown(KeyCode::Super);
|
||||
io.KeyCtrl = Input::GetInstance().IsDown(KeyCode::Ctrl);
|
||||
io.KeyShift = Input::GetInstance().IsDown(KeyCode::Shift);
|
||||
io.KeyAlt = Input::GetInstance().IsDown(KeyCode::Alt);
|
||||
io.KeySuper = Input::GetInstance().IsDown(KeyCode::Super);
|
||||
// io.KeysDown[], io.MousePos, io.MouseDown[], io.MouseWheel: filled by the HandleEvent function below.
|
||||
|
||||
// Update OS mouse position
|
||||
|
|
@ -96,7 +96,7 @@ void ImGuiModule::BeforeRender()
|
|||
KGE_ASSERT(io.Fonts->IsBuilt() && "Font atlas not built!");
|
||||
|
||||
// Setup display size (every frame to accommodate for window resizing)
|
||||
Size display_size = Renderer::Instance().GetOutputSize();
|
||||
Size display_size = Renderer::GetInstance().GetOutputSize();
|
||||
io.DisplaySize = ImVec2(display_size.x, display_size.y);
|
||||
|
||||
ImGui::NewFrame();
|
||||
|
|
@ -181,7 +181,7 @@ void ImGuiModule::UpdateMousePos()
|
|||
::SetCursorPos(pos.x, pos.y);
|
||||
}
|
||||
|
||||
Point pos = Input::Instance().GetMousePos();
|
||||
Point pos = Input::GetInstance().GetMousePos();
|
||||
io.MousePos = ImVec2(pos.x, pos.y);
|
||||
}
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ void ImGuiModule::UpdateMouseCursor()
|
|||
break;
|
||||
}
|
||||
|
||||
Window::Instance().SetCursor(cursor);
|
||||
Window::GetInstance().SetCursor(cursor);
|
||||
}
|
||||
|
||||
} // namespace imgui
|
||||
|
|
|
|||
|
|
@ -78,14 +78,14 @@ void Button::SetStatus(Status status)
|
|||
|
||||
if (status == Status::Normal)
|
||||
{
|
||||
Window::Instance().SetCursor(CursorType::Arrow);
|
||||
Window::GetInstance().SetCursor(CursorType::Arrow);
|
||||
|
||||
if (mouse_out_callback_)
|
||||
mouse_out_callback_(this);
|
||||
}
|
||||
else if (status == Status::Hover)
|
||||
{
|
||||
Window::Instance().SetCursor(CursorType::Hand);
|
||||
Window::GetInstance().SetCursor(CursorType::Hand);
|
||||
|
||||
if (old_status == Status::Pressed)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ void DebugActor::OnUpdate(Duration dt)
|
|||
}
|
||||
#endif
|
||||
|
||||
const auto& status = Renderer::Instance().GetContext().GetStatus();
|
||||
const auto& status = Renderer::GetInstance().GetContext().GetStatus();
|
||||
|
||||
ss << "Render: " << status.duration.Milliseconds() << "ms" << std::endl;
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ Frame::Frame() {}
|
|||
|
||||
bool Frame::Load(String const& file_path)
|
||||
{
|
||||
TexturePtr texture = TextureCache::Instance().AddOrGetTexture(file_path);
|
||||
TexturePtr texture = TextureCache::GetInstance().AddOrGetTexture(file_path);
|
||||
if (texture->IsValid())
|
||||
{
|
||||
SetTexture(texture);
|
||||
|
|
@ -71,7 +71,7 @@ bool Frame::Load(String const& file_path)
|
|||
|
||||
bool Frame::Load(Resource const& res)
|
||||
{
|
||||
TexturePtr texture = TextureCache::Instance().AddOrGetTexture(res);
|
||||
TexturePtr texture = TextureCache::GetInstance().AddOrGetTexture(res);
|
||||
if (texture->IsValid())
|
||||
{
|
||||
SetTexture(texture);
|
||||
|
|
|
|||
|
|
@ -67,13 +67,13 @@ GifSprite::GifSprite()
|
|||
|
||||
bool GifSprite::Load(String const& file_path)
|
||||
{
|
||||
GifImagePtr image = TextureCache::Instance().AddOrGetGifImage(file_path);
|
||||
GifImagePtr image = TextureCache::GetInstance().AddOrGetGifImage(file_path);
|
||||
return Load(image);
|
||||
}
|
||||
|
||||
bool GifSprite::Load(Resource const& res)
|
||||
{
|
||||
GifImagePtr image = TextureCache::Instance().AddOrGetGifImage(res);
|
||||
GifImagePtr image = TextureCache::GetInstance().AddOrGetGifImage(res);
|
||||
return Load(image);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ Stage::Stage()
|
|||
SetStage(this);
|
||||
|
||||
SetAnchor(Vec2{ 0, 0 });
|
||||
SetSize(Renderer::Instance().GetOutputSize());
|
||||
SetSize(Renderer::GetInstance().GetOutputSize());
|
||||
}
|
||||
|
||||
Stage::~Stage() {}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ void Transition::Init(StagePtr prev, StagePtr next)
|
|||
|
||||
out_stage_ = prev;
|
||||
in_stage_ = next;
|
||||
window_size_ = Renderer::Instance().GetOutputSize();
|
||||
window_size_ = Renderer::GetInstance().GetOutputSize();
|
||||
|
||||
if (in_stage_)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,26 +27,26 @@
|
|||
#ifndef KGE_SYS_LOG
|
||||
#ifdef KGE_DEBUG
|
||||
#define KGE_SYS_LOG(FORMAT, ...) \
|
||||
::kiwano::Logger::Instance().Printf(::kiwano::Logger::Level::System, FORMAT, __VA_ARGS__)
|
||||
::kiwano::Logger::GetInstance().Printf(::kiwano::Logger::Level::System, FORMAT, __VA_ARGS__)
|
||||
#else
|
||||
#define KGE_SYS_LOG __noop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef KGE_WARN
|
||||
#define KGE_WARN(FORMAT, ...) ::kiwano::Logger::Instance().Printf(::kiwano::Logger::Level::Warning, FORMAT, __VA_ARGS__)
|
||||
#define KGE_WARN(FORMAT, ...) ::kiwano::Logger::GetInstance().Printf(::kiwano::Logger::Level::Warning, FORMAT, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#ifndef KGE_ERROR
|
||||
#define KGE_ERROR(FORMAT, ...) ::kiwano::Logger::Instance().Printf(::kiwano::Logger::Level::Error, FORMAT, __VA_ARGS__)
|
||||
#define KGE_ERROR(FORMAT, ...) ::kiwano::Logger::GetInstance().Printf(::kiwano::Logger::Level::Error, FORMAT, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#ifndef KGE_LOG
|
||||
#define KGE_LOG(...) ::kiwano::Logger::Instance().Println(::kiwano::Logger::Level::Info, __VA_ARGS__)
|
||||
#define KGE_LOG(...) ::kiwano::Logger::GetInstance().Println(::kiwano::Logger::Level::Info, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#ifndef KGE_LOGF
|
||||
#define KGE_LOGF(FORMAT, ...) ::kiwano::Logger::Instance().Printf(::kiwano::Logger::Level::Info, FORMAT, __VA_ARGS__)
|
||||
#define KGE_LOGF(FORMAT, ...) ::kiwano::Logger::GetInstance().Printf(::kiwano::Logger::Level::Info, FORMAT, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
namespace kiwano
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ private:
|
|||
{
|
||||
ObjectCreator()
|
||||
{
|
||||
(void)Singleton<_Ty>::Instance();
|
||||
(void)Singleton<_Ty>::GetInstance();
|
||||
}
|
||||
|
||||
inline void Dummy() const {}
|
||||
|
|
@ -46,7 +46,7 @@ private:
|
|||
public:
|
||||
using object_type = _Ty;
|
||||
|
||||
static inline object_type& Instance()
|
||||
static inline object_type& GetInstance()
|
||||
{
|
||||
static object_type instance;
|
||||
creator_.Dummy();
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ Queue<FunctionToPerform> functions_to_perform_;
|
|||
Application::Application()
|
||||
: time_scale_(1.f)
|
||||
{
|
||||
Use(&Renderer::Instance());
|
||||
Use(&Input::Instance());
|
||||
Use(&Director::Instance());
|
||||
Use(&Renderer::GetInstance());
|
||||
Use(&Input::GetInstance());
|
||||
Use(&Director::GetInstance());
|
||||
}
|
||||
|
||||
Application::~Application()
|
||||
|
|
@ -61,8 +61,8 @@ void Application::Run(bool debug)
|
|||
|
||||
if (debug)
|
||||
{
|
||||
Director::Instance().ShowDebugInfo(true);
|
||||
Renderer::Instance().GetContext().SetCollectingStatus(true);
|
||||
Director::GetInstance().ShowDebugInfo(true);
|
||||
Renderer::GetInstance().GetContext().SetCollectingStatus(true);
|
||||
}
|
||||
|
||||
// Everything is ready
|
||||
|
|
@ -70,7 +70,7 @@ void Application::Run(bool debug)
|
|||
|
||||
last_update_time_ = Time::Now();
|
||||
|
||||
Window& window = Window::Instance();
|
||||
Window& window = Window::GetInstance();
|
||||
while (!window.ShouldClose())
|
||||
{
|
||||
while (EventPtr evt = window.PollEvent())
|
||||
|
|
@ -85,15 +85,15 @@ void Application::Run(bool debug)
|
|||
|
||||
void Application::Quit()
|
||||
{
|
||||
Window::Instance().Destroy();
|
||||
Window::GetInstance().Destroy();
|
||||
}
|
||||
|
||||
void Application::Destroy()
|
||||
{
|
||||
// Clear all resources
|
||||
Director::Instance().ClearStages();
|
||||
ResourceCache::Instance().Clear();
|
||||
TextureCache::Instance().Clear();
|
||||
Director::GetInstance().ClearStages();
|
||||
ResourceCache::GetInstance().Clear();
|
||||
TextureCache::GetInstance().Clear();
|
||||
|
||||
for (auto iter = comps_.rbegin(); iter != comps_.rend(); ++iter)
|
||||
{
|
||||
|
|
@ -185,7 +185,7 @@ void Application::Update()
|
|||
|
||||
void Application::Render()
|
||||
{
|
||||
Renderer& renderer = Renderer::Instance();
|
||||
Renderer& renderer = Renderer::GetInstance();
|
||||
renderer.Clear();
|
||||
|
||||
// Before render
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public:
|
|||
* \~chinese
|
||||
* @brief 获取窗口实例
|
||||
*/
|
||||
static Window& Instance();
|
||||
static Window& GetInstance();
|
||||
|
||||
/**
|
||||
* \~chinese
|
||||
|
|
|
|||
|
|
@ -684,7 +684,7 @@ LRESULT CALLBACK WindowImpl::WndProc(HWND hwnd, UINT32 msg, WPARAM wparam, LPARA
|
|||
namespace kiwano
|
||||
{
|
||||
|
||||
Window& Window::Instance()
|
||||
Window& Window::GetInstance()
|
||||
{
|
||||
static win32::WindowImpl instance;
|
||||
return instance;
|
||||
|
|
|
|||
|
|
@ -112,17 +112,17 @@ void Brush::SetOpacity(float opacity)
|
|||
|
||||
void Brush::SetColor(Color const& color)
|
||||
{
|
||||
Renderer::Instance().CreateBrush(*this, color);
|
||||
Renderer::GetInstance().CreateBrush(*this, color);
|
||||
}
|
||||
|
||||
void Brush::SetStyle(LinearGradientStyle const& style)
|
||||
{
|
||||
Renderer::Instance().CreateBrush(*this, style);
|
||||
Renderer::GetInstance().CreateBrush(*this, style);
|
||||
}
|
||||
|
||||
void Brush::SetStyle(RadialGradientStyle const& style)
|
||||
{
|
||||
Renderer::Instance().CreateBrush(*this, style);
|
||||
Renderer::GetInstance().CreateBrush(*this, style);
|
||||
}
|
||||
|
||||
} // namespace kiwano
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ bool Font::Load(String const& file)
|
|||
{
|
||||
try
|
||||
{
|
||||
Renderer::Instance().CreateFontCollection(*this, file);
|
||||
Renderer::GetInstance().CreateFontCollection(*this, file);
|
||||
}
|
||||
catch (std::runtime_error&)
|
||||
{
|
||||
|
|
@ -65,7 +65,7 @@ bool Font::Load(Resource const& resource)
|
|||
{
|
||||
try
|
||||
{
|
||||
Renderer::Instance().CreateFontCollection(*this, resource);
|
||||
Renderer::GetInstance().CreateFontCollection(*this, resource);
|
||||
}
|
||||
catch (std::runtime_error&)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ GifImage::GifImage()
|
|||
|
||||
bool GifImage::Load(String const& file_path)
|
||||
{
|
||||
Renderer::Instance().CreateGifImage(*this, file_path);
|
||||
Renderer::GetInstance().CreateGifImage(*this, file_path);
|
||||
|
||||
if (IsValid())
|
||||
{
|
||||
|
|
@ -70,7 +70,7 @@ bool GifImage::Load(String const& file_path)
|
|||
|
||||
bool GifImage::Load(Resource const& res)
|
||||
{
|
||||
Renderer::Instance().CreateGifImage(*this, res);
|
||||
Renderer::GetInstance().CreateGifImage(*this, res);
|
||||
|
||||
if (IsValid())
|
||||
{
|
||||
|
|
@ -90,7 +90,7 @@ bool GifImage::IsValid() const
|
|||
GifImage::Frame GifImage::GetFrame(uint32_t index)
|
||||
{
|
||||
Frame frame;
|
||||
Renderer::Instance().CreateGifImageFrame(frame, *this, index);
|
||||
Renderer::GetInstance().CreateGifImageFrame(frame, *this, index);
|
||||
return frame;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ void Renderer::SetupComponent()
|
|||
|
||||
win32::ThrowIfFailed(::CoInitialize(nullptr));
|
||||
|
||||
target_window_ = Window::Instance().GetHandle();
|
||||
output_size_ = Window::Instance().GetSize();
|
||||
target_window_ = Window::GetInstance().GetHandle();
|
||||
output_size_ = Window::GetInstance().GetSize();
|
||||
|
||||
d2d_res_ = nullptr;
|
||||
d3d_res_ = nullptr;
|
||||
|
|
@ -197,7 +197,7 @@ void Renderer::CreateTexture(Texture& texture, String const& file_path)
|
|||
hr = E_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (!FileSystem::Instance().IsFileExists(file_path))
|
||||
if (!FileSystem::GetInstance().IsFileExists(file_path))
|
||||
{
|
||||
KGE_WARN(L"Texture file '%s' not found!", file_path.c_str());
|
||||
hr = E_FAIL;
|
||||
|
|
@ -205,7 +205,7 @@ void Renderer::CreateTexture(Texture& texture, String const& file_path)
|
|||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
String full_path = FileSystem::Instance().GetFullPathForFile(file_path);
|
||||
String full_path = FileSystem::GetInstance().GetFullPathForFile(file_path);
|
||||
|
||||
ComPtr<IWICBitmapDecoder> decoder;
|
||||
hr = d2d_res_->CreateBitmapDecoderFromFile(decoder, full_path);
|
||||
|
|
@ -295,7 +295,7 @@ void Renderer::CreateGifImage(GifImage& gif, String const& file_path)
|
|||
hr = E_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (!FileSystem::Instance().IsFileExists(file_path))
|
||||
if (!FileSystem::GetInstance().IsFileExists(file_path))
|
||||
{
|
||||
KGE_WARN(L"Gif texture file '%s' not found!", file_path.c_str());
|
||||
hr = E_FAIL;
|
||||
|
|
@ -303,7 +303,7 @@ void Renderer::CreateGifImage(GifImage& gif, String const& file_path)
|
|||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
String full_path = FileSystem::Instance().GetFullPathForFile(file_path);
|
||||
String full_path = FileSystem::GetInstance().GetFullPathForFile(file_path);
|
||||
|
||||
ComPtr<IWICBitmapDecoder> decoder;
|
||||
hr = d2d_res_->CreateBitmapDecoderFromFile(decoder, full_path);
|
||||
|
|
@ -514,7 +514,7 @@ void Renderer::CreateFontCollection(Font& font, String const& file_path)
|
|||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
if (!FileSystem::Instance().IsFileExists(file_path))
|
||||
if (!FileSystem::GetInstance().IsFileExists(file_path))
|
||||
{
|
||||
KGE_WARN(L"Font file '%s' not found!", file_path.c_str());
|
||||
hr = E_FAIL;
|
||||
|
|
@ -525,7 +525,7 @@ void Renderer::CreateFontCollection(Font& font, String const& file_path)
|
|||
{
|
||||
LPVOID key = nullptr;
|
||||
uint32_t key_size = 0;
|
||||
String full_path = FileSystem::Instance().GetFullPathForFile(file_path);
|
||||
String full_path = FileSystem::GetInstance().GetFullPathForFile(file_path);
|
||||
|
||||
hr = font_collection_loader_->AddFilePaths({ full_path }, &key, &key_size);
|
||||
|
||||
|
|
|
|||
|
|
@ -108,35 +108,35 @@ bool Shape::ContainsPoint(Point const& point, const Matrix3x2* transform) const
|
|||
ShapePtr Shape::CreateLine(Point const& begin, Point const& end)
|
||||
{
|
||||
ShapePtr output = new Shape;
|
||||
Renderer::Instance().CreateLineShape(*output, begin, end);
|
||||
Renderer::GetInstance().CreateLineShape(*output, begin, end);
|
||||
return output;
|
||||
}
|
||||
|
||||
ShapePtr Shape::CreateRect(Rect const& rect)
|
||||
{
|
||||
ShapePtr output = new Shape;
|
||||
Renderer::Instance().CreateRectShape(*output, rect);
|
||||
Renderer::GetInstance().CreateRectShape(*output, rect);
|
||||
return output;
|
||||
}
|
||||
|
||||
ShapePtr Shape::CreateRoundedRect(Rect const& rect, Vec2 const& radius)
|
||||
{
|
||||
ShapePtr output = new Shape;
|
||||
Renderer::Instance().CreateRoundedRectShape(*output, rect, radius);
|
||||
Renderer::GetInstance().CreateRoundedRectShape(*output, rect, radius);
|
||||
return output;
|
||||
}
|
||||
|
||||
ShapePtr Shape::CreateCircle(Point const& center, float radius)
|
||||
{
|
||||
ShapePtr output = new Shape;
|
||||
Renderer::Instance().CreateEllipseShape(*output, center, Vec2{ radius, radius });
|
||||
Renderer::GetInstance().CreateEllipseShape(*output, center, Vec2{ radius, radius });
|
||||
return output;
|
||||
}
|
||||
|
||||
ShapePtr Shape::CreateEllipse(Point const& center, Vec2 const& radius)
|
||||
{
|
||||
ShapePtr output = new Shape;
|
||||
Renderer::Instance().CreateEllipseShape(*output, center, radius);
|
||||
Renderer::GetInstance().CreateEllipseShape(*output, center, radius);
|
||||
return output;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ void ShapeSink::Open()
|
|||
if (!IsOpened())
|
||||
{
|
||||
path_geo_.reset();
|
||||
Renderer::Instance().CreateShapeSink(*this);
|
||||
Renderer::GetInstance().CreateShapeSink(*this);
|
||||
|
||||
win32::ThrowIfFailed(path_geo_->Open(&sink_));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ StrokeStylePtr StrokeStyle::Create(CapStyle cap, LineJoinStyle line_join, const
|
|||
StrokeStylePtr ptr = new (std::nothrow) StrokeStyle;
|
||||
if (ptr)
|
||||
{
|
||||
Renderer::Instance().CreateStrokeStyle(*ptr, cap, line_join, dash_array, dash_size, dash_offset);
|
||||
Renderer::GetInstance().CreateStrokeStyle(*ptr, cap, line_join, dash_array, dash_size, dash_offset);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ void TextLayout::Update()
|
|||
|
||||
if (!text_format_ || (dirty_flag_ & DirtyFlag::DirtyFormat))
|
||||
{
|
||||
Renderer::Instance().CreateTextFormat(*this);
|
||||
Renderer::GetInstance().CreateTextFormat(*this);
|
||||
}
|
||||
|
||||
if (dirty_flag_ & DirtyFlag::DirtyLayout)
|
||||
{
|
||||
Renderer::Instance().CreateTextLayout(*this);
|
||||
Renderer::GetInstance().CreateTextLayout(*this);
|
||||
|
||||
if (text_layout_)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -57,13 +57,13 @@ Texture::~Texture() {}
|
|||
|
||||
bool Texture::Load(String const& file_path)
|
||||
{
|
||||
Renderer::Instance().CreateTexture(*this, file_path);
|
||||
Renderer::GetInstance().CreateTexture(*this, file_path);
|
||||
return IsValid();
|
||||
}
|
||||
|
||||
bool Texture::Load(Resource const& res)
|
||||
{
|
||||
Renderer::Instance().CreateTexture(*this, res);
|
||||
Renderer::GetInstance().CreateTexture(*this, res);
|
||||
return IsValid();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ TextureRenderContextPtr TextureRenderContext::Create()
|
|||
{
|
||||
try
|
||||
{
|
||||
Renderer::Instance().CreateTextureRenderContext(*ptr);
|
||||
Renderer::GetInstance().CreateTextureRenderContext(*ptr);
|
||||
}
|
||||
catch (std::exception)
|
||||
{
|
||||
|
|
@ -49,7 +49,7 @@ TextureRenderContextPtr TextureRenderContext::Create(Size const& desired_size)
|
|||
{
|
||||
try
|
||||
{
|
||||
Renderer::Instance().CreateTextureRenderContext(*ptr, &desired_size);
|
||||
Renderer::GetInstance().CreateTextureRenderContext(*ptr, &desired_size);
|
||||
}
|
||||
catch (std::exception)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ ResourceCache::~ResourceCache()
|
|||
|
||||
bool ResourceCache::LoadFromJsonFile(String const& file_path)
|
||||
{
|
||||
if (!FileSystem::Instance().IsFileExists(file_path))
|
||||
if (!FileSystem::GetInstance().IsFileExists(file_path))
|
||||
{
|
||||
KGE_ERROR(L"ResourceCache::LoadFromJsonFile failed: File not found.");
|
||||
return false;
|
||||
|
|
@ -65,7 +65,7 @@ bool ResourceCache::LoadFromJsonFile(String const& file_path)
|
|||
|
||||
try
|
||||
{
|
||||
String full_path = FileSystem::Instance().GetFullPathForFile(file_path);
|
||||
String full_path = FileSystem::GetInstance().GetFullPathForFile(file_path);
|
||||
ifs.open(full_path.c_str());
|
||||
ifs >> json_data;
|
||||
ifs.close();
|
||||
|
|
@ -116,13 +116,13 @@ bool ResourceCache::LoadFromJson(Json const& json_data)
|
|||
|
||||
bool ResourceCache::LoadFromXmlFile(String const& file_path)
|
||||
{
|
||||
if (!FileSystem::Instance().IsFileExists(file_path))
|
||||
if (!FileSystem::GetInstance().IsFileExists(file_path))
|
||||
{
|
||||
KGE_ERROR(L"ResourceCache::LoadFromXmlFile failed: File not found.");
|
||||
return false;
|
||||
}
|
||||
|
||||
String full_path = FileSystem::Instance().GetFullPathForFile(file_path);
|
||||
String full_path = FileSystem::GetInstance().GetFullPathForFile(file_path);
|
||||
|
||||
pugi::xml_document doc;
|
||||
pugi::xml_parse_result result = doc.load_file(full_path.c_str(), pugi::parse_default, pugi::encoding_auto);
|
||||
|
|
|
|||
Loading…
Reference in New Issue