本文整理汇总了C++中renderer类的典型用法代码示例。如果您正苦于以下问题:C++ renderer类的具体用法?C++ renderer怎么用?C++ renderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了renderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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:
void
highlight_box_rep::post_display (renderer &ren) {
if (shape == "ring") display_ring (ren);
if (shape == "band") display_band (ren);
ren->set_background (old_bg);
ren->set_pencil (old_pen);
}
示例3: if
void
edit_interface_rep::draw_surround (renderer ren, rectangle r) {
ren->set_background (light_grey);
string medium= get_init_string (PAGE_MEDIUM);
if ((medium == "papyrus") || (medium == "paper"))
ren->clear (max (eb->x2, r->x1), r->y1,
r->x2, min (eb->y2+ 2*pixel, r->y2));
else if (medium == "paper")
ren->clear (r->x1, r->y1, r->x2, min (eb->y1, r->y2));
}
示例4:
void
edit_interface_rep::draw_context (renderer ren, rectangle r) {
int i;
ren->set_color (light_grey);
ren->set_line_style (pixel);
for (i=1; i<N(eb[0]); i++) {
SI y= eb->sy(0)+ eb[0]->sy2(i);
if ((y >= r->y1) && (y < r->y2))
ren->line (r->x1, y, r->x2, y);
}
draw_surround (ren, r);
}
示例5: if
void
highlight_box_rep::pre_display (renderer& ren) {
old_bg = ren->get_background ();
old_pen= ren->get_pencil ();
if (shape == "classic") display_classic (ren);
else if (shape == "rounded") display_rounded (ren, ROUNDED_NORMAL);
else if (shape == "angular") display_rounded (ren, ROUNDED_ANGULAR);
else if (shape == "cartoon") display_rounded (ren, ROUNDED_CARTOON);
else if (shape == "ring");
else if (shape == "band");
else display_classic (ren);
}
示例6: get_renderer
void
edit_interface_rep::draw_post (renderer ren, rectangle r) {
renderer win= get_renderer (this);
win->set_shrinking_factor (sfactor);
ren->set_shrinking_factor (sfactor);
draw_context (ren, r);
draw_env (ren);
draw_selection (ren);
draw_graphics (ren);
draw_cursor (ren); // the text cursor must be drawn over the graphical object
ren->set_shrinking_factor (1);
win->set_shrinking_factor (1);
}
示例7: N
void
poor_stretched_font_rep::draw_fixed (renderer ren, string s, SI x, SI y, SI xk) {
if (ren->is_screen) {
STACK_NEW_ARRAY (xpos, SI, N(s)+1);
get_xpositions (s, xpos, xk);
draw_fixed (ren, s, x, y, xpos);
STACK_DELETE_ARRAY (xpos);
}
else {
ren->set_transformation (scaling (point (1.0, factor), point (0.0, 0.0)));
base->draw_fixed (ren, s, x, y, xk);
ren->reset_transformation ();
}
}
示例8: render
void render(renderer& r) {
auto const w = map_.width();
auto const h = map_.height();
for (int y = 0; y < h; ++y) {
for (int x = 0; x < w; ++x) {
auto const cat = map_.get<map_property::category>(x, y);
using category = yama::tile_category;
switch (cat) {
case category::empty: r.set_color(0, 0, 0); break;
case category::wall: r.set_color(100, 100, 100); break;
case category::floor: r.set_color(200, 200, 200); break;
case category::door: r.set_color(0, 0, 200); break;
case category::corridor: r.set_color(0, 100, 0); break;
case category::stair: r.set_color(255, 0, 0); break;
case category::invalid: r.set_color(100, 100, 200); break;
default: r.set_color(100, 100, 200); break;
}
r.fill_rect(x*16, y*16, 16, 16);
}
}
r.set_color(255, 0, 0);
for (auto const& region : regions_) {
r.draw_rect(region.left*16, region.top*16, region.width()*16, region.height()*16);
}
}
示例9: clear_pattern_rectangles
void
clear_pattern_rectangles (renderer ren, rectangles l) {
while (!is_nil (l)) {
rectangle r (l->item);
ren->clear_pattern (r->x1- ren->ox, r->y1- ren->oy,
r->x2- ren->ox, r->y2- ren->oy);
l= l->next;
}
}
示例10: render
void cg::render(renderer &r, const model &m)
{
r.be(render_operation::triangles(), [&](renderer::primitive &p){
boost::for_each(m.triangles, [&](const model::triangle &t){
add_vertex(p, t.a);
add_vertex(p, t.b);
add_vertex(p, t.c);
});
});
}
示例11: render
//--Implementations
void render()
{
//abort execution here if we are to stop running
if(!keepRunning)
{
cleanUp();
exit(0);
}
//call renderer's render
simRenderer.render();
}
示例12: path
void
edit_graphics_rep::draw_graphical_object (renderer ren) {
if (is_nil (go_box)) set_graphical_object (graphical_object);
if (is_nil (go_box)) return;
SI ox1, oy1, ox2, oy2;
ren->get_clipping (ox1, oy1, ox2, oy2);
SI gx1, gy1, gx2, gy2;
if (find_graphical_region (gx1, gy1, gx2, gy2))
ren->extra_clipping (gx1, gy1, gx2, gy2);
int i;
for (i=0; i<go_box->subnr(); i++) {
box b= go_box->subbox (i);
if ((tree)b=="point" || (tree)b=="curve")
b->display (ren);
else {
rectangles rs;
b->redraw (ren, path (), rs);
}
}
ren->set_clipping (ox1, oy1, ox2, oy2);
}
示例13: postInitialize
bool postInitialize()
{
bool returnVal = true;
//init the entity manager so it can finish what it needs to do after the shaders are in place
simEntities.initialize();
//separate init for old renderer stuff
returnVal = returnVal && simRenderer.initialize();
return returnVal;
}
示例14: while
void
poor_bbb_font_rep::draw_fixed (renderer ren, string s,
SI x, SI y, SI* xpos) {
int i=0;
while (i < N(s)) {
int start= i;
tm_char_forwards (s, i);
string ss= s (start, i);
font_metric fnm;
font_glyphs fng;
int c= index_glyph (ss, fnm, fng);
if (c >= 0) ren->draw (c, fng, start==0? x: x + xpos[start], y);
}
}
示例15: while
void
poor_distorted_font_rep::draw_fixed (renderer ren, string s,
SI x, SI y, SI* xpos) {
int i=0;
while (i < N(s)) {
int start= i;
base->advance_glyph (s, i);
string ss= s (start, i);
font_metric fnm;
font_glyphs fng;
int c= index_glyph (ss, fnm, fng);
if (c >= 0) ren->draw (c, fng, start==0? x: x + xpos[start], y);
}
}