Fix Compile Error

This commit is contained in:
Kirigaya Kazuto 2017-04-20 22:09:33 +08:00
parent 07c24d8198
commit 6ed03e3e7d
2 changed files with 20 additions and 20 deletions

View File

@ -509,9 +509,9 @@ namespace MiniEngine
rect.x = rect.y = 0; rect.x = rect.y = 0;
} }
void Renderer::_set(SDL_Renderer* p) void Renderer::_set_sp(std::shared_ptr<SDL_Renderer>& p)
{ {
_rnd.reset(p,SDL_DestroyRenderer); _rnd=p;
} }
void Renderer::_clear() void Renderer::_clear()
@ -521,7 +521,7 @@ namespace MiniEngine
SDL_Renderer* Renderer::_get() SDL_Renderer* Renderer::_get()
{ {
return _rnd.get(); return _rnd.lock().get();
} }
int Renderer::setColor(RGBA pack) int Renderer::setColor(RGBA pack)
@ -749,44 +749,44 @@ namespace MiniEngine
int Renderer::setViewport(Rect viewPort) int Renderer::setViewport(Rect viewPort)
{ {
SDL_Rect rect=viewPort.toSDLRect(); SDL_Rect rect=viewPort.toSDLRect();
return SDL_RenderSetViewport(rnd.lock().get(),&rect); return SDL_RenderSetViewport(_get(),&rect);
} }
int Renderer::setViewport() int Renderer::setViewport()
{ {
return SDL_RenderSetViewport(rnd.lock().get(),NULL); return SDL_RenderSetViewport(_get(),NULL);
} }
Rect Renderer::getViewport() Rect Renderer::getViewport()
{ {
SDL_Rect rect; SDL_Rect rect;
SDL_RenderGetViewport(rnd.lock().get(),&rect); SDL_RenderGetViewport(_get(),&rect);
return Rect(rect); return Rect(rect);
} }
int Renderer::setClipRect(Rect cliparea) int Renderer::setClipRect(Rect cliparea)
{ {
SDL_Rect rect=cliparea.toSDLRect(); SDL_Rect rect=cliparea.toSDLRect();
return SDL_RenderSetClipRect(rnd.lock().get(),&rect); return SDL_RenderSetClipRect(_get(),&rect);
} }
Rect Renderer::getClipRect() Rect Renderer::getClipRect()
{ {
SDL_Rect rect; SDL_Rect rect;
SDL_RenderGetClipRect(rnd.lock().get(),&rect); SDL_RenderGetClipRect(_get(),&rect);
return Rect(rect); return Rect(rect);
} }
/* /*
bool Renderer::isClipEnabled() bool Renderer::isClipEnabled()
{ {
return SDL_RenderIsClipEnabled(rnd.lock().get())==SDL_TRUE; return SDL_RenderIsClipEnabled(_get())==SDL_TRUE;
} }
*/ */
void Renderer::disableClip() void Renderer::disableClip()
{ {
SDL_RenderSetClipRect(rnd.lock().get(),NULL); SDL_RenderSetClipRect(_get(),NULL);
} }
bool Renderer::isReady() bool Renderer::isReady()
@ -947,13 +947,13 @@ namespace MiniEngine
void Window::_setRenderer_Real(Uint32 flags) void Window::_setRenderer_Real(Uint32 flags)
{ {
<<<<<<< HEAD /// Release Previous Renderer
rnd.reset(); _rnd.reset();
rnd.reset(SDL_CreateRenderer(wnd.get(), -1, flags), SDL_DestroyRenderer); /// Set New Renderer
winrnd.rnd=rnd; _rnd.reset(SDL_CreateRenderer(_get(), -1, flags), SDL_DestroyRenderer);
=======
winrnd._rnd.reset(SDL_CreateRenderer(_get(), -1, flags), SDL_DestroyRenderer); /// Set Link of class Renderer with _rnd (in class Window)
>>>>>>> mingw-dev winrnd._set_sp(_rnd);
} }
int Window::showSimpleMessageBox(MessageBoxType type,std::string Title,std::string Message) int Window::showSimpleMessageBox(MessageBoxType type,std::string Title,std::string Message)

View File

@ -235,8 +235,8 @@ namespace MiniEngine
bool isReady(); bool isReady();
private: private:
std::weak_ptr<SDL_Renderer> rnd; std::weak_ptr<SDL_Renderer> _rnd;
void _set(SDL_Renderer*); void _set_sp(std::shared_ptr<SDL_Renderer>& p);
void _clear(); void _clear();
SDL_Renderer* _get(); SDL_Renderer* _get();
friend class Window; friend class Window;
@ -244,7 +244,7 @@ namespace MiniEngine
enum class MessageBoxType { Error, Warning, Information }; enum class MessageBoxType { Error, Warning, Information };
class Window class Window : public NonCopyable
{ {
public: public:
Window(std::string Title, int Width, int Height, std::initializer_list<RendererType> RendererFlags = { RendererType::Accelerated,RendererType::TargetTexture }) throw(ErrorViewer); Window(std::string Title, int Width, int Height, std::initializer_list<RendererType> RendererFlags = { RendererType::Accelerated,RendererType::TargetTexture }) throw(ErrorViewer);