当前位置: 首页>>代码示例>>C++>>正文


C++ renderer::set_color方法代码示例

本文整理汇总了C++中renderer::set_color方法的典型用法代码示例。如果您正苦于以下问题:C++ renderer::set_color方法的具体用法?C++ renderer::set_color怎么用?C++ renderer::set_color使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在renderer的用法示例。


在下文中一共展示了renderer::set_color方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

void
edit_interface_rep::draw_graphics (renderer ren) {
  if (got_focus || full_screen) {
    cursor cu= get_cursor();
    if (over_graphics(cu->ox, cu->oy) && inside_active_graphics ()) {
      eval ("(graphics-reset-context 'graphics-cursor)");
      draw_graphical_object (ren);
      string tm_curs= as_string (eval ("graphics-texmacs-pointer"));
      if (tm_curs != "none") {
	if (tm_curs == "graphics-cross") {
	  ren->set_line_style (pixel);
	  ren->set_color (red);
	  ren->line (cu->ox, cu->oy-5*pixel, cu->ox, cu->oy+5*pixel);
	  ren->line (cu->ox-5*pixel, cu->oy, cu->ox+5*pixel, cu->oy);
        }
	else if (tm_curs == "graphics-cross-arrows") {
	  static int s= 6*pixel, a= 2*pixel;
	  ren->set_line_style (pixel);
	  ren->set_color (red);
	  ren->line (cu->ox, cu->oy-s, cu->ox, cu->oy+s);
	  ren->line (cu->ox-s, cu->oy, cu->ox+s, cu->oy);
	  ren->line (cu->ox, cu->oy-s,cu->ox-a, cu->oy-s+a);
	  ren->line (cu->ox, cu->oy-s, cu->ox+a, cu->oy-s+a);
	  ren->line (cu->ox, cu->oy+s, cu->ox-a, cu->oy+s-a);
	  ren->line (cu->ox, cu->oy+s, cu->ox+a, cu->oy+s-a);
	  ren->line (cu->ox-s, cu->oy, cu->ox-s+a, cu->oy+a);
	  ren->line (cu->ox-s, cu->oy, cu->ox-s+a, cu->oy-a);
	  ren->line (cu->ox+s, cu->oy, cu->ox+s-a, cu->oy+a);
	  ren->line (cu->ox+s, cu->oy, cu->ox+s-a, cu->oy-a);
        }
      }
    }
    else eval ("(graphics-reset-context 'text-cursor)");
  }
}
开发者ID:Easycker,项目名称:itexmacs,代码行数:35,代码来源:edit_repaint.cpp

示例2:

void
edit_interface_rep::draw_selection (renderer ren) {
  if (!is_nil (locus_rects)) {
    ren->set_color (rgb_color (32, 160, 96));
    ren->draw_rectangles (locus_rects);
  }
  if (made_selection && !is_nil (selection_rects)) {
    ren->set_color (table_selection? rgb_color (192, 0, 255): red);
#ifdef QTTEXMACS
    ren->draw_selection (selection_rects);
#else
    ren->draw_rectangles (selection_rects);
#endif
  }
}
开发者ID:Easycker,项目名称:itexmacs,代码行数:15,代码来源:edit_repaint.cpp

示例3: 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);
        }
    }
开发者ID:bkentel,项目名称:yama,代码行数:30,代码来源:level.hpp


注:本文中的renderer::set_color方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。