Add GetRenderer to class Window

This commit is contained in:
Kirigaya Kazuto 2017-11-05 18:53:27 +08:00
parent 002617a557
commit a212f2c1b6
3 changed files with 16 additions and 4 deletions

View File

@ -14,7 +14,7 @@ class Renderer
public:
Renderer() = default;
/// Create a Renderer associated with Window
Renderer(Window& wnd,std::initializer_list<RendererType> RendererFlags = { RendererType::Accelerated,RendererType::TargetTexture });
Renderer(class Window& wnd,std::initializer_list<RendererType> RendererFlags = { RendererType::Accelerated,RendererType::TargetTexture });
/// Create a software Renderer
Renderer(Surface& surf);
~Renderer() = default;
@ -148,7 +148,8 @@ private:
void _clear();
SDL_Renderer* _get() const;
friend class Window;
friend class _internal::Plugin;
};
} /// End of namespace MiniEngine
} /// End of namespace MiniEngine

View File

@ -108,6 +108,13 @@ float Window::getOpacity() const
}
#endif /// End of SDL2 2.0.5 Require.
Renderer Window::getRenderer()
{
Renderer nrnd;
nrnd._set(SDL_GetRenderer(_get()));
return nrnd;
}
/// FIXME: Not Implemented.
void Window::setResizable(bool resizable)
{
@ -248,5 +255,5 @@ bool Window::isScreenKeyboardShown()
{
return SDL_IsScreenKeyboardShown(_get())==SDL_TRUE;
}
} /// End of namespace MiniEngine
} /// End of namespace MiniEngine

View File

@ -6,6 +6,8 @@
#include "MessageBox.h"
#include "Surface.h"
#include "__Plugin.h"
#include "Renderer.h"
namespace MiniEngine
{
class Window
@ -36,6 +38,8 @@ public:
float getOpacity() const;
#endif
class Renderer getRenderer();
/// FIXME: Not Implemented.
void setResizable(bool resizable);
@ -66,5 +70,5 @@ private:
friend class Renderer;
friend class _internal::Plugin;
};
} /// End of namespace MiniEngine
} /// End of namespace MiniEngine