Update class Cursor. Fix compile bug in class Window

This commit is contained in:
Kirigaya Kazuto 2017-05-22 19:17:02 +08:00
parent 52cb15482e
commit 1b2ba7b2d8
2 changed files with 15 additions and 14 deletions

View File

@ -983,33 +983,30 @@ namespace MiniEngine
return _cur.get();
}
//private
void Cursor::_clear()
{
_cur.reset();
}
//static
Cursor Cursor::CreateCursor(Surface surf,Point hotspot)
Cursor::Cursor(Surface surf,Point hotspot)
{
Cursor ns;
SDL_Cursor* cursor=SDL_CreateColorCursor(surf._get(),hotspot.x,hotspot.y);
ns._set(cursor);
return ns;
}
//static
Cursor Cursor::CreateSystemCursor(SystemCursorType type)
Cursor::Cursor(SystemCursorType type)
{
Cursor ns;
ns._set(SDL_CreateSystemCursor(_internal::getSDLSystemCursorFromSystemCursorType(type)));
return ns;
}
//static
Cursor Cursor::GetActiveCursor()
{
Cursor ns;
ns._set(SDL_GetCursor());
ns._set_no_delete(SDL_GetCursor());
return ns;
}
@ -1017,7 +1014,7 @@ namespace MiniEngine
Cursor Cursor::GetDefaultCursor()
{
Cursor ns;
ns._set(SDL_GetDefaultCursor());
ns._set_no_delete(SDL_GetDefaultCursor());
return ns;
}
@ -1028,7 +1025,7 @@ namespace MiniEngine
}
//static
void Cursor::show(bool Settings)
void Cursor::setShow(bool Settings)
{
SDL_ShowCursor(Settings?SDL_ENABLE:SDL_DISABLE);
}
@ -1039,9 +1036,12 @@ namespace MiniEngine
}
void Cursor::activate()
{
if(_get()!=nullptr)
{
SDL_SetCursor(_get());
}
}
void Window::_set(SDL_Window* p)
{

View File

@ -238,13 +238,14 @@ namespace MiniEngine
class Cursor
{
public:
static Cursor CreateSystemCursor(SystemCursorType);
static Cursor CreateCursor(Surface surf,Point hotspot={0,0});
Cursor()=default;
Cursor(SystemCursorType);
Cursor(Surface surf,Point hotspot={0,0});
static Cursor GetActiveCursor();
static Cursor GetDefaultCursor();
static void show(bool);
static void setShow(bool);
static bool isShow();
void activate();
@ -333,7 +334,7 @@ namespace MiniEngine
void _setRenderer(int& refcalc,RendererType Type,Args&&... args)
{
refcalc|=_render_caster(Type);
_setRenderer(args...);
_setRenderer(refcalc,args...);
}
void _setRenderer(int& refcalc,RendererType Type)