本文整理汇总了C++中Font::BeginDrawing方法的典型用法代码示例。如果您正苦于以下问题:C++ Font::BeginDrawing方法的具体用法?C++ Font::BeginDrawing怎么用?C++ Font::BeginDrawing使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Font
的用法示例。
在下文中一共展示了Font::BeginDrawing方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tmain
//.........这里部分代码省略.........
sceneCenter = Vec3f(volume.width, volume.height, volume.depth) * 0.5f;
sceneScale = Length(sceneCenter) * 2.0f;
printf("\nUploading data (%d, %d, %d) to GPU: ", volume.width, volume.height, volume.depth);
fflush(stdout);
double uploadTime = GetTime();
uploadTime = GetTime() - uploadTime;
Load3dTexture(volume);
printf("%.2f msec\n", uploadTime * 1000.0);
}
FPSCamera cam;
if(!camConfigs.GetConfig(string(sceneName),cam))
cam.SetPos(sceneCenter);
OrbitingCamera ocam;
ocam.Reset(sceneCenter, sceneScale);
FrameCounter frmCounter;
float lastFrameTime = 0.0f;
double lastTime = GetTime();
while(window.PollEvents()) {
frmCounter.NextFrame();
if(window.KeyUp(Key_esc)) break;
if(window.KeyDown('C')) {
if(orbiting) ocam.Reset(sceneCenter, sceneScale);
else cam.SetPos(sceneCenter);
cam.ang = 0;
cam.pitch = 0;
}
if(window.KeyDown('P')) {
camConfigs.AddConfig(string(sceneName),cam);
Saver("cameras.dat") & camConfigs;
cam.Print();
}
if(window.KeyDown('O')) {
if(orbiting) cam.SetPos(ocam.pos);
else ocam.Reset(cam.pos, -sceneScale);
orbiting ^= 1;
printf("Orbiting: %s\n", orbiting? "true" : "false");
}
if(window.KeyDown('P')) {
camConfigs.AddConfig(string(sceneName),cam);
Saver("scenes/cameras.dat") & camConfigs;
cam.Print();
}
float tspeed = speed * lastFrameTime * 20.0f;
lastFrameTime = GetTime() - lastTime;
lastTime = GetTime();
if(orbiting)
MoveCamera(ocam, window, tspeed);
else
MoveCamera(cam, window, tspeed);
for(int n = 1; n <= 8; n++) if(window.KeyDown('0' + n))
{ threads = n; printf("Threads: %d\n", threads); }
if(window.KeyDown(Key_f1)) nPlanes *= 2;
if(window.KeyDown(Key_f2)) nPlanes /= 2;
if(window.KeyDown(Key_f2)) { gVals[1]^=1; printf("Val 1 %s\n", gVals[1]?"on" : "off"); }
if(window.KeyDown(Key_f3)) { gVals[2]^=1; printf("Val 2 %s\n", gVals[2]?"on" : "off"); }
if(window.KeyDown(Key_f4)) { gVals[3]^=1; printf("Photons visible %s\n", gVals[3]?"on" : "off"); }
if(window.KeyDown(Key_f5)) { gVals[4]^=1; printf("Photon tracing %s\n", gVals[4]?"on" : "off"); }
if(window.KeyDown(Key_f6)) { gVals[5]^=1; printf("Scene complexity visualization %s\n",gVals[5]?"on":"off"); }
if(window.KeyDown(Key_f7)) { gVals[6]^=1; printf("Advanced shading %s\n",gVals[6]?"on":"off"); }
if(window.KeyDown(Key_f8)) { gVals[7]^=1; printf("Reflections 7 %s\n",gVals[7]?"on":"off"); }
if(window.KeyDown(Key_f9)) { gVals[8]^=1; printf("Node tasks visualization 8 %s\n",gVals[8]?"on":"off"); }
if(window.KeyDown(Key_f10)) { gVals[9]^=1; printf("Antialiasing 4x %s\n",gVals[9]?"on":"off"); }
if(window.KeyDown(Key_f1)) { gVals[0]^=1; printf("Traversing from 8x8: %s\n", gVals[0]?"on" : "off"); }
nPlanes = Clamp(nPlanes, 16, 2048);
static float animPos = 0;
if(window.Key(Key_space)) animPos+=0.025f;
double time = GetTime();
Camera camera = orbiting?(Camera)ocam : (Camera)cam;
time = GetTime() - time;
RenderVolume(camera, float(resx) / resy, nPlanes);
double fps = double(unsigned(frmCounter.FPS() * 100)) * 0.01;
font.BeginDrawing(resx,resy);
font.SetSize(Vec2f(30, 20));
font.PrintAt(Vec2f(5, 25), "FPS: ", fps, " Planes: ", nPlanes);
font.FinishDrawing();
window.SwapBuffers();
}
return 0;
}