Create MiniEngine_Widget.h

This commit is contained in:
Kirigaya Kazuto 2017-03-02 12:18:59 +08:00 committed by GitHub
parent c3d477b818
commit 085ec1ca56

55
MiniEngine_Widget.h Normal file
View File

@ -0,0 +1,55 @@
#pragma once
#include "MiniEngine.h"
#include <functional>
class Brush : public MiniEngine::Renderer
{
public:
void setArea(MiniEngine::Rect Area);
int copy(MiniEngine::Texture t, MiniEngine::Rect src, MiniEngine::Rect dst);
int copyTo(MiniEngine::Texture t, MiniEngine::Rect dst);
int copyTo(MiniEngine::Texture t, MiniEngine::Point lupoint);
int copyFill(MiniEngine::Texture t,MiniEngine::Rect src);
int copyFullFill(MiniEngine::Texture t);
private:
MiniEngine::Rect area;
};
class Board
{
public:
Board(MiniEngine::Window wnd,MiniEngine::Rect Area);
Brush getBrush();
private:
MiniEngine::Rect area,fullwnd;
};
class Drawable
{
public:
virtual void draw(Brush& brush)=0;
virtual ~Drawable()=default;
};
class Interactive
{
public:
virtual void handle(SDL_Event e,int& running,int& update)=0;
};
class ButtonBase : public Drawable, public Interactive
{
public:
ButtonBase();
void setTextureNormal(MiniEngine::Texture Normal);
void setTextureMouseover(MiniEngine::Texture Mouseover);
void setTextureClicked(MiniEngine::Texture Clicked);
void setRect(MiniEngine::Rect SensorArea);
virtual void draw(Brush& brush);
virtual void handle(SDL_Event e,int& running,int& update);
private:
int status;
MiniEngine::Texture t1,t2,t3;
MiniEngine::Rect rect;
};