Liny_@NotePad

沉迷ACG中

hgeGUI组件扩展基本步骤

YOYO posted @ 2009年8月29日 19:19 in 【游戏开发】 with tags HGE gui 组件 , 3156 阅读

扩展步骤:

  • 继承hgeGUIObject
  • 默认构造方法,要带一个int属性用于存放该组件的ID
  • 在构造方法中,对以下属性赋初值: 
    • id:控件的ID
    • bEnable:控件是否可用
    • bStatic:能否接受键盘焦点(false貌似才是可以接受)
    • bVisible:控件是否可见
    • rect:控件作用域(全屏可以设成0, 0, hge->System_GetState(HGE_SCREENWIDTH), hge->System_GetState(HGE_SCREENHEIGHT))
  • 重写Render函数,用于渲染。
  • 如果有键盘操作,重写KeyClick函数,
    如果要默认就可以使用键盘的话,需要让父gui设置默认焦点给该控件:
    gui->SetFocus(id)(可以放在Render函数里)
  • 如果有鼠标操作,重写MouseLButton\MouseRButton等需要的函数
  • 如果有其他update操作,重写Update函数

重写的时候要注意函数参数列表,不要写成重载了 - -

创建步骤:

  • 创建一个hgeGUI*(如果已经有就不用创建了 - -)
  • 创建你的控件,使用pGUI->AddCtrl对其进行控制
  • 在逻辑函数中加入pGUI->Update(pHge->Timer_GetDelta)
  • 在渲染函数中加入pGUI->Render()
sample-paper.com 说:
2023年4月16日 15:35

Our objective would be to cater the requirements of people of all age groups as we intend to publish news classified into General, sample-paper.com Political, Crime, Sports, Entertainment, Education and World News.Our reporting team intends to publish the Education & Recruitment Update for all age groups and present the true picture of the recent events with the inside coverage.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter