本文整理汇总了C++中clan::Canvas::reset_blend_state方法的典型用法代码示例。如果您正苦于以下问题:C++ Canvas::reset_blend_state方法的具体用法?C++ Canvas::reset_blend_state怎么用?C++ Canvas::reset_blend_state使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clan::Canvas
的用法示例。
在下文中一共展示了Canvas::reset_blend_state方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
bool App::update()
{
game_time.update();
canvas.clear(clan::Colorf(0.0f,0.0f,0.0f, 0.0f));
rock.set_color(clan::Colorf(1.0f, 1.0f, 1.0f, 0.8f));
rock.draw(canvas, 0.0f, 0.0f);
// Rotate tux
rotation += game_time.get_time_elapsed() * 100.0f;
clan::Angle angle;
angle.set_degrees(rotation);
tux.set_angle(angle);
// Caculate tux position
clan::Pointf circle_center( (float) (canvas.get_width()/2), (float) (canvas.get_height()/2) );
const float radius = 210.0f;
int tux_circle = 12;
tux_position.x = -(radius - tux_radius - tux_circle) * cos( angle.to_radians() / 2.0f );
tux_position.y = (radius - tux_radius - tux_circle) * sin( angle.to_radians()/ 2.0f );
tux_position += circle_center;
tux_position.x -= tux.get_width()/2;
tux_position.y -= tux.get_height()/2;
// Give tux circle blue outer outline, because it looks nice
canvas.fill_circle(tux_position.x + tux_radius, tux_position.y + tux_radius, tux_radius+tux_circle, clan::Colorf(0.0f, 0.0f, 1.0f, 1.0f));
// Make see through border
canvas.set_blend_state(blend_state_off);
canvas.fill_circle(tux_position.x + tux_radius, tux_position.y + tux_radius, tux_radius+tux_circle-2, clan::Colorf(0.0f, 0.0f, 0.0f, 0.0f));
canvas.reset_blend_state();
// Give tux circle blue outline, to mask the alpha channel
canvas.fill_circle(tux_position.x + tux_radius, tux_position.y + tux_radius, tux_radius+2, clan::Colorf(0.0f, 0.0f, 1.0f, 1.0f));
// Draw tux
tux.draw(canvas, tux_position.x, tux_position.y);
// Draw text
font_large.draw_text(canvas, 10-2, 50-2, "ClanLib Layered Window", clan::Colorf(0.1f, 0.1f, 0.1f, 1.0f));
font_large.draw_text(canvas, 10, 50, "ClanLib Layered Window", clan::Colorf::green);
font_small.draw_text(canvas, 60-2, 80-2, "Click mouse on the penguin to exit", clan::Colorf(0.1f, 0.1f, 0.1f, 1.0f));
font_small.draw_text(canvas, 60, 80, "Click mouse on the penguin to exit", clan::Colorf::green);
font_small.draw_text(canvas, 110-2, 110-2, "Drag rock to move window", clan::Colorf(0.1f, 0.1f, 0.1f, 1.0f));
font_small.draw_text(canvas, 110, 110, "Drag rock to move window", clan::Colorf::green);
window.flip(1);
return !quit;
}