Cpper
C/C++高级工程师 Android高级软件工程师 IT集成工程师 音频工程师 熟悉c,c++,java,c#,py,js,asp等多种语言 程序猿
这是盖莫游戏引擎2.1.2中GUI之2-GUI刷子
该对象提供对2d基本图元的绘制和操作
提供以下功能
1.点绘制
2.线段绘制
3.矩形绘制
4.三角形绘制
5.纹理渲染
以后还会加入更多的功能

其功能大致相当于UI lib中的Graphics,
Glooery中的Renderer
以及GUI Chart中的Graphics!

其接口如下:
////////////////////////////////////////////////////////////
/// 定义引擎GUI刷子(提供简单的几何体绘制操作)
////////////////////////////////////////////////////////////
class G_DLL_API GuiBrush : public Object
{
public:
    
////////////////////////////////////////////////////////
    
/// GUI刷子构造,析构
    
////////////////////////////////////////////////////////
    GuiBrush();
    
virtual ~GuiBrush();
public:
    
////////////////////////////////////////////////////////
    
/// 设置GUI刷子颜色
    
////////////////////////////////////////////////////////
    virtual void SetBrushColor(const Color& color) = 0;
   
    
//////////////////////////////////////////////////////////
    
/// 设置刷子线宽
    
//////////////////////////////////////////////////////////         
    virtual void  SetLineWidth(float width) = 0;
    
virtual float GetMaxLineWidth()const = 0;
    
virtual float GetLineWidth()const = 0;     
   
    
//////////////////////////////////////////////////////////
    
/// 绘制一个点
    
//////////////////////////////////////////////////////////     
    virtual void RenderPoint(const Point& point) = 0;   
    
virtual void RenderPoint(const Vector2f& point) = 0;   
    
virtual void RenderPoint(int x,int y) = 0;   
    
virtual void RenderPoint(float x,float y) = 0;
   
    
////////////////////////////////////////////////////////
    
/// 绘制一个线段
    
////////////////////////////////////////////////////////   
    virtual void RenderLine(const Vector2f& from, const Vector2f& to) = 0;
    
virtual void RenderLine(const Point& from, const Point& to) = 0;
   
    
////////////////////////////////////////////////////////
    
/// 绘制一个矩阵框(填充与否)
    
////////////////////////////////////////////////////////
    virtual void RenderRect(const Recti& rect, bool fill = true= 0;
    
virtual void RenderRect(const Rectf& rect, bool fill = true= 0;
   
    
////////////////////////////////////////////////////////
    
/// 绘制一个三角形
    
////////////////////////////////////////////////////////   
    virtual void RenderTriangle(const Vector2f& p1,const Vector2f& p2,const Vector2f& p3, bool fill = true= 0;
    
virtual void RenderTriangle(const Point& p1,const Point& p2,const Point& p3, bool fill = true= 0;
   
    
//////////////////////////////////////////////////////////
    
/// 绘制一个园,园扇(segments为边数)
    
//////////////////////////////////////////////////////////   
    virtual void RenderCircle(const Vector2f& center,float radius,int segments = 32= 0;
    
virtual void RenderCircleSegment(const Vector2f& center,float radius,float angle1,float angle2,int segments = 32,bool filled = true= 0;

    
////////////////////////////////////////////////////////
    
/// 渲染纹理
    
////////////////////////////////////////////////////////  
    virtual void RenderTexture(float x,float y,float w,float h) = 0;  
    
virtual void RenderTexture(const Rectf& rect) = 0;

    DECLARE_OBJECT(GuiBrush)
};

可以看出比较简单 没有什么复杂的东西!

在GUI部分
引擎还会陆续加入以下对象
1.Widget 基本控件单元
2.Border 控件装饰器
3.Layout 控件布局管理器
4.UIManager UI管理器
5.UIEvent UI消息事件
6.WidgetSort 提供对控件的深度排序
可能还会加入UISurface以提供对控件表面的装饰效果

引擎UI需要达到的高度
1.控件组动态生成(要求源于xml config file)
2.控件自布局
3.灵活简单易用
4.UI引擎和引擎的低聚合
.....
posted on 2010-05-08 09:23 ccsdu2009 阅读(1001) 评论(0)  编辑 收藏 引用 所属分类: Game引擎

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理