Set Renderer::Renderer() to public

Renderer::isReady() is added to check if the renderer is ready.
This commit is contained in:
Kirigaya Kazuto 2017-03-23 14:01:06 +08:00
parent 0ec40c6270
commit 23553b1330
2 changed files with 6 additions and 2 deletions

View File

@ -403,6 +403,11 @@ namespace MiniEngine
return t; return t;
} }
bool Renderer::isReady()
{
return (rnd.get() != nullptr);
}
Window::Window(std::string Title, int Width, int Height, std::initializer_list<RendererType> RendererFlags) throw(ErrorViewer) Window::Window(std::string Title, int Width, int Height, std::initializer_list<RendererType> RendererFlags) throw(ErrorViewer)
{ {
SDL_Window* temp = SDL_CreateWindow(Title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, Width, Height, SDL_WINDOW_SHOWN); SDL_Window* temp = SDL_CreateWindow(Title.c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, Width, Height, SDL_WINDOW_SHOWN);

View File

@ -163,9 +163,8 @@ namespace MiniEngine
Texture loadTexture(std::string FileName) throw(ErrorViewer); Texture loadTexture(std::string FileName) throw(ErrorViewer);
Texture createTexture(int Width, int Height) throw(ErrorViewer); Texture createTexture(int Width, int Height) throw(ErrorViewer);
protected:
/// This function is called by class Window ONLY.
Renderer() = default; Renderer() = default;
bool isReady();
private: private:
std::shared_ptr<SDL_Renderer> rnd; std::shared_ptr<SDL_Renderer> rnd;
friend class Window; friend class Window;