如何在ogre游戏界面添加自己的信息,比如显示某变量的值

如何在ogre游戏界面添加自己的信息,比如显示某变量的值

// 首先在E:/ogre/media/packs的OgreCore.zip里面打开OgreDebugPanel.overlay,然后修改如下: 

Core/ DebugOverlay 

zorder 
500
 
//
 Stats block 
container BorderPanel(Core
/
StatPanel) 

   metrics_mode pixels 
   vert_align bottom 
   left 
5
 
   top 
-107
 
   width 
220
 
   height 
102
 
   material Core
/
StatsBlockCenter 
        border_size 
1 1 1 1
 
        border_material Core
/
StatsBlockBorder 
        border_topleft_uv     
0.0000 1.0000 0.0039 0.9961
 
     border_top_uv         
0.0039 1.0000 0.9961 0.9961
 
     border_topright_uv    
0.9961 1.0000 1.0000 0.9961
 
     border_left_uv        
0.0000 0.9961 0.0039 0.0039
 
     border_right_uv       
0.9961 0.9961 1.0000 0.0039
 
     border_bottomleft_uv 
0.0000 0.0039 0.0039 0.0000
 
        border_bottom_uv      
0.0039 0.0039 0.9961 0.0000
 
     border_bottomright_uv 
0.9961 0.0039 1.0000 0.0000
 

   container Panel(Core
/
BreakPanel) 
   { 
    metrics_mode pixels 
    left 
5
 
    top 
22
 
    width 
210
 
    height 
1
 
    material Core
/
StatsBreak 
   } 
   element TextArea(Core
/
CurrFps) 
   { 
    metrics_mode pixels 
    left 
5
 
    top 
5
 
    width 
90
 
    height 
30
 
    font_name BlueHighway 
    char_height 
19
 
    caption Current FPS: 
    colour_top 
1 1 0.7
 
    colour_bottom 
1 1 0.7
 
   } 
   element TextArea(Core
/
AverageFps) 
   { 
    metrics_mode pixels 
    left 
5
 
    top 
25
 
    width 
90
 
    height 
30
 
    font_name BlueHighway 
    char_height 
16
 
    caption AVERAGE FPS: 
    colour_top 
0.5 0.7 0.5
 
    colour_bottom 
0.3 0.5 0.3
 
   } 
   element TextArea(Core
/
WorstFps) 
   { 
    metrics_mode pixels 
    left 
5
 
    top 
40
 
    width 
90
 
    height 
30
 
    font_name BlueHighway 
    char_height 
16
 
    caption WORST FPS: 
    colour_top 
0.5 0.7 0.5
 
    colour_bottom 
0.3 0.5 0.3
 
   } 
   element TextArea(Core
/
BestFps) 
   { 
    metrics_mode pixels 
    left 
5
 
    top 
55
 
    width 
90
 
    height 
30
 
    font_name BlueHighway 
    char_height 
16
 
    caption BEST FPS: 
    colour_top 
0.5 0.7 0.5
 
    colour_bottom 
0.3 0.5 0.3
 
   } 
   element TextArea(Core
/
NumTris) 
   { 
    metrics_mode pixels 
    left 
5
 
    top 
70
 
    width 
90
 
    height 
30
 
    font_name BlueHighway 
    char_height 
16
 
    caption Triangle Count: 
    colour_top 
0.5 0.7 0.5
 
    colour_bottom 
0.3 0.5 0.3
 
   } 
   element TextArea(Core
/
NumBatches) 
   { 
    metrics_mode pixels 
    left 
5
 
    top 
85
 
    width 
90
 
    height 
30
 
    font_name BlueHighway 
    char_height 
16
 
    caption Batch Count: 
    colour_top 
0.5 0.7 0.5
 
    colour_bottom 
0.3 0.5 0.3
 
   } 
   element TextArea(Core
/
DebugText) 
   { 
    metrics_mode pixels 
    left 
230
 
    top 
70
 
    width 
200
 
    height 
30
 
    font_name BlueHighway 
    char_height 
16
 
    colour_top 
0.5 0.7 0.5
 
    colour_bottom 
0.3 0.5 0.3
 
   } 

container Panel(Core
/
LogoPanel) 

   metrics_mode pixels 
   horz_align right 
   vert_align bottom 
   top 
-75
 
   left 
-165
 
   width 
150
 
   height 
75
 
   material Core
/
OgreText 

container BorderPanel(Core
/
yy) 

   metrics_mode pixels 
   vert_align bottom 
   left 
230
 
   top 
-107
 
   width 
220
 
   height 
102
 
   material Core
/
StatsBlockCenter 
        border_size 
1 1 1 1
 
        border_material Core
/
StatsBlockBorder 
        border_topleft_uv     
0.0000 1.0000 0.0039 0.9961
 
     border_top_uv         
0.0039 1.0000 0.9961 0.9961
 
     border_topright_uv    
0.9961 1.0000 1.0000 0.9961
 
     border_left_uv        
0.0000 0.9961 0.0039 0.0039
 
     border_right_uv       
0.9961 0.9961 1.0000 0.0039
 
     border_bottomleft_uv 
0.0000 0.0039 0.0039 0.0000
 
        border_bottom_uv      
0.0039 0.0039 0.9961 0.0000
 
     border_bottomright_uv 
0.9961 0.0039 1.0000 0.0000
 

   element TextArea(Core
/
myinfo1) 
   { 
    metrics_mode pixels 
    left 
5
 
    top 
5
 
    width 
90
 
    height 
30
 
    font_name BlueHighway 
    char_height 
19
 
    caption myinfo1: 
    colour_top 
1 1 0.7
 
    colour_bottom 
1 1 0.7
 
   } 
   element TextArea(Core
/
myinfo2) 
   { 
    metrics_mode pixels 
    left 
5
 
    top 
25
 
    width 
90
 
    height 
30
 
    font_name BlueHighway 
    char_height 
16
 
    caption myinfo2: 
    colour_top 
0.5 0.7 0.5
 
    colour_bottom 
0.3 0.5 0.3
 
   } 
   element TextArea(Core
/
myinfo3) 
   { 
    metrics_mode pixels 
    left 
5
 
    top 
40
 
    width 
90
 
    height 
30
 
    font_name BlueHighway 
    char_height 
16
 
    caption myinfo3: 
    colour_top 
0.5 0.7 0.5
 
    colour_bottom 
0.3 0.5 0.3
 
   } 

}

// A silly example of how you would do a 3D cockpit
//Examples/KnotCockpit
//{
// zorder 100
// entity knot.mesh(hudKnot)
// {
//   position 0 0 -50
//   rotation 0 0 0 0
// }
//
//}

//注意 container BorderPanel(Core/yy) 这部分,是新添加的内容

//同时确保在main.cpp里面的bool frameStarted(const FrameEvent &evt)函数包含如下内容: 

static String mytxt = "mDistance: "
OverlayElement
* guiinfo = OverlayManager::getSingleton().getOverlayElement("Core/myinfo1"
); 
guiinfo
->setCaption(mytxt +
 StringConverter::toString(mDistance)); 

static String mytxt2 = "mDestination: "

OverlayElement
* guiinfo2 = OverlayManager::getSingleton().getOverlayElement("Core/myinfo2"
); 
guiinfo2
->setCaption(mytxt2 +
 StringConverter::toString(mDestination)); 

static String mytxt3 = "mDirection: "

OverlayElement
* guiinfo3 = OverlayManager::getSingleton().getOverlayElement("Core/myinfo3"
); 
guiinfo3
->setCaption(mytxt3 +
 StringConverter::toString(mDirection)); 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/mokt2001/archive/2008/09/21/2957731.aspx

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值