本文整理汇总了C++中renderer::render方法的典型用法代码示例。如果您正苦于以下问题:C++ renderer::render方法的具体用法?C++ renderer::render怎么用?C++ renderer::render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类renderer
的用法示例。
在下文中一共展示了renderer::render方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main_loop
void main_loop()
{
bool quit = false;
while (!quit) {
SDL_Event e;
while (SDL_PollEvent(&e) != 0) {
if (e.type == SDL_QUIT) {
quit = true;
}
}
const double freq = double(bx::getHPFrequency());
const double toMs = 1000.0 / freq;
static int64_t totalMeasureTime = 0;
int64_t measureTimeLast = bx::getHPCounter();
transform_system.update();
solid_quads.draw(transform_system, renderer);
totalMeasureTime = ((bx::getHPCounter() - measureTimeLast) * 0.01 + totalMeasureTime * 0.99);
renderer.begin_frame();
renderer.render();
bgfx::dbgTextPrintf(1, 1, 0x0f, "frame time: %f[ms]", 16.0f);
bgfx::dbgTextPrintf(1, 2, 0x0f, "transform & draw time: %7.3f[ms]", double(totalMeasureTime)*toMs);
bgfx::dbgTextPrintf(1, 3, 0x0f, "total entities: %d", entity_system.count());
renderer.end_frame();
T::main_loop(0.016f);
SDL_Delay(16);
}
shutdown();
}
示例2: render
virtual void render() {
copy_to_inner();
inner->render();
++framesNotPrinted;
int gfps = enabler->calculated_gfps;
if (gfps == 0) gfps = 1;
// send a frame roughly every 128 mibiseconds (1 second = 1024 mibiseconds)
if ((framesNotPrinted * 1024) / gfps <= 128) return;
client_pool::lock lock(clients);
if (!clients.has_clients()) return;
framesNotPrinted = 0;
std::stringstream frame;
frame << gps->dimx << ' ' << gps->dimy << " 0 0 " << gps->dimx << ' ' << gps->dimy << '\n';
unsigned char * sc_ = gps->screen;
for (int y = 0; y < gps->dimy; ++y) {
unsigned char * sc = sc_;
for (int x = 0; x < gps->dimx; ++x) {
unsigned char ch = sc[0];
unsigned char bold = (sc[3] != 0) * 8;
unsigned char translate[] =
{ 0, 4, 2, 6, 1, 5, 3, 7, 8, 12, 10, 14, 9, 13, 11, 15 };
unsigned char fg = translate[(sc[1] + bold) % 16];
unsigned char bg = translate[sc[2] % 16]*16;
frame.put(ch);
frame.put(fg+bg);
sc += 4*gps->dimy;
}
sc_ += 4;
}
clients.broadcast(frame.str());
}
示例3: render
//--Implementations
void render()
{
//abort execution here if we are to stop running
if(!keepRunning)
{
cleanUp();
exit(0);
}
//call renderer's render
simRenderer.render();
}