Cpper
C/C++高级工程师 Android高级软件工程师 IT集成工程师 音频工程师 熟悉c,c++,java,c#,py,js,asp等多种语言 程序猿
这是盖莫游戏引擎中的坐标系统和输入系统测试的小例子代码如下所示:
 1 #include <cstdlib>
 2 #include <iostream>
 3 #include <GEngine/Main.hpp>
 4 
 5 using namespace std;
 6 using namespace core; 
 7  
 8 int main(int argc, char *argv[])
 9 {   
10     Device *device = InitDevice("盖莫引擎坐标系统测试");
11     device->SetClearColor(core::Color(80,100,230));
12     int x,y,z;
13     //! 使用Opengl坐标系统 
14     core::CoordinateSystem cs(COORDINATE_OPENGL);
15     device->SetCoordinateSystem(cs);
16     
17     //! 启用2D渲染模式 
18     device->Ortho2D();  
19     //! 获取资源管理器 
20     core::ResourceManager* resmgr = device->GetResourceManager();
21     core::RefPtr<core::Text> defont= resmgr->GetText("default_font"); 
22     
23     char text[255]; 
24     char fpstext[20];
25     float fps = device->GetFPS();
26     BEGIN_LOOP(device);
27         device->GetInput()->GetMousePosition(x,y,z);
28         sprintf(text,"mouse position is :x = %d, y = %d,z = %d",x,y,z);
29         fps = device->GetFPS();
30         sprintf(fpstext,"fps is:%f",fps);
31         defont->Render(20,20,text);
32         defont->Render(540,20,fpstext);
33     END_LOOP(device);
34     
35     device->Close();
36     device->Drop();
37     
38     system("PAUSE");
39     return EXIT_SUCCESS;
40 }
41 

对于opengl坐标系,其原点位于屏幕左下角
当前字体的渲染坐标固定为x轴向右,y轴向下,以屏幕左上角为原点

 

这是贴图 不过看上去帧速有点偏低

posted on 2010-02-09 10:19 ccsdu2009 阅读(219) 评论(0)  编辑 收藏 引用

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