本文整理汇总了C++中DrawingContext::pop_target方法的典型用法代码示例。如果您正苦于以下问题:C++ DrawingContext::pop_target方法的具体用法?C++ DrawingContext::pop_target怎么用?C++ DrawingContext::pop_target使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DrawingContext
的用法示例。
在下文中一共展示了DrawingContext::pop_target方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
Spotlight::draw(DrawingContext& context)
{
context.push_target();
context.set_target(DrawingContext::LIGHTMAP);
light->set_color(color);
light->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
light->set_angle(angle);
light->draw(context, position, 0);
//lightcone->set_angle(angle);
//lightcone->draw(context, position, 0);
context.set_target(DrawingContext::NORMAL);
lights->set_angle(angle);
lights->draw(context, position, 0);
base->set_angle(angle);
base->draw(context, position, 0);
center->draw(context, position, 0);
lightcone->set_angle(angle);
lightcone->draw(context, position, LAYER_FOREGROUND1 + 10);
context.pop_target();
}
示例2: roundf
void
TileMap::draw(DrawingContext& context)
{
// skip draw if current opacity is 0.0
if (current_alpha == 0.0) return;
context.push_transform();
if(draw_target != DrawingContext::NORMAL) {
context.push_target();
context.set_target(draw_target);
}
if(drawing_effect != 0) context.set_drawing_effect(drawing_effect);
if (editor_active) {
if(current_alpha != 1.0) {
context.set_alpha(current_alpha);
}
} else {
context.set_alpha(current_alpha/2);
}
/* Force the translation to be an integer so that the tiles appear sharper.
* For consistency (i.e., to avoid 1-pixel gaps), this needs to be done even
* for solid tilemaps that are guaranteed to have speed 1.
* FIXME Force integer translation for all graphics, not just tilemaps. */
float trans_x = roundf(context.get_translation().x);
float trans_y = roundf(context.get_translation().y);
context.set_translation(Vector(int(trans_x * speed_x),
int(trans_y * speed_y)));
Rectf draw_rect = Rectf(context.get_translation(),
context.get_translation() + Vector(SCREEN_WIDTH, SCREEN_HEIGHT));
Rect t_draw_rect = get_tiles_overlapping(draw_rect);
Vector start = get_tile_position(t_draw_rect.left, t_draw_rect.top);
Vector pos;
int tx, ty;
for(pos.x = start.x, tx = t_draw_rect.left; tx < t_draw_rect.right; pos.x += 32, ++tx) {
for(pos.y = start.y, ty = t_draw_rect.top; ty < t_draw_rect.bottom; pos.y += 32, ++ty) {
int index = ty*width + tx;
assert (index >= 0);
assert (index < (width * height));
if (tiles[index] == 0) continue;
const Tile* tile = tileset->get(tiles[index]);
assert(tile != 0);
tile->draw(context, pos, z_pos);
} /* for (pos y) */
} /* for (pos x) */
if(draw_target != DrawingContext::NORMAL) {
context.pop_target();
}
context.pop_transform();
}
示例3:
void
Light::draw(DrawingContext& context)
{
context.push_target();
context.set_target(DrawingContext::LIGHTMAP);
sprite->draw(context, Sector::current()->player->get_pos(), 0);
context.pop_target();
}
示例4:
void
MrCandle::draw(DrawingContext& context) {
BadGuy::draw(context);
if (!frozen) {
context.push_target();
context.set_target(DrawingContext::LIGHTMAP);
candle_light->draw(context, bbox.get_middle(), 0);
context.pop_target();
}
}
示例5:
void
LiveFire::draw(DrawingContext& context)
{
//Draw the Sprite.
sprite->draw(context, get_pos(), LAYER_OBJECTS);
//Draw the light
context.push_target();
context.set_target(DrawingContext::LIGHTMAP);
lightsprite->draw(context, get_bbox().get_middle(), 0);
context.pop_target();
}
示例6:
void
Lantern::draw(DrawingContext& context){
//Draw the Sprite.
MovingSprite::draw(context);
//Let there be light.
context.push_target();
context.set_target(DrawingContext::LIGHTMAP);
lightsprite->draw(context, bbox.get_middle(), 0);
context.pop_target();
}
示例7:
void
TreeWillOWisp::draw(DrawingContext& context)
{
sprite->draw(context, get_pos(), layer);
context.push_target();
context.set_target(DrawingContext::LIGHTMAP);
sprite->draw(context, get_pos(), layer);
context.pop_target();
}
示例8:
void
WillOWisp::draw(DrawingContext& context)
{
sprite->draw(context, get_pos(), LAYER_OBJECTS);
context.push_target();
context.set_target(DrawingContext::LIGHTMAP);
sprite->draw(context, get_pos(), LAYER_OBJECTS);
context.pop_target();
}
示例9:
void
BonusBlock::draw(DrawingContext& context){
// do the regular drawing first
Block::draw(context);
// then Draw the light if on.
if(sprite->get_action() == "on") {
Vector pos = get_pos() + (bbox.get_size().as_vector() - lightsprite->get_size()) / 2;
context.push_target();
context.set_target(DrawingContext::LIGHTMAP);
context.draw_surface(lightsprite, pos, 10);
context.pop_target();
}
}
示例10:
void
WillOWisp::draw(DrawingContext& context)
{
sprite->draw(context, get_pos(), layer);
context.push_target();
context.set_target(DrawingContext::LIGHTMAP);
sprite->draw(context, get_pos(), layer);
lightsprite->draw(context, bbox.get_middle(), 0);
context.pop_target();
}
示例11:
void
Light::draw(DrawingContext& context)
{
context.push_target();
context.set_target(DrawingContext::LIGHTMAP);
sprite->set_color(color);
sprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
sprite->set_angle(90); // FIXME: color won't get applied for angle=0
sprite->draw(context, position, 0);
context.pop_target();
}
示例12:
void
Star::draw(DrawingContext& context){
//Draw the Sprite.
MovingSprite::draw(context);
//Draw the light when dark
context.get_light( get_bbox().get_middle(), &light );
if (light.red + light.green + light.blue < 3.0){
MovingSprite::draw(context);
context.push_target();
context.set_target(DrawingContext::LIGHTMAP);
lightsprite->draw(context, get_bbox().get_middle(), 0);
context.pop_target();
}
}
示例13:
void
Explosion::draw(DrawingContext& context)
{
//Draw the Sprite.
sprite->draw(context, get_pos(), LAYER_OBJECTS+40);
//Explosions produce light (if ambient light is not maxed)
context.get_light( get_bbox().get_middle(), &light);
if (light.red + light.green + light.blue < 3.0){
context.push_target();
context.set_target(DrawingContext::LIGHTMAP);
lightsprite->draw(context, get_bbox().get_middle(), 0);
context.pop_target();
}
}
示例14:
void
Flower::draw(DrawingContext& context)
{
//Draw the Sprite.
sprite->draw(context, get_pos(), LAYER_OBJECTS, drawing_effect);
//Draw the light when dark
context.get_light( get_bbox().get_middle(), &light );
if (light.red + light.green + light.blue < 3.0){
context.push_target();
context.set_target(DrawingContext::LIGHTMAP);
lightsprite->draw(context, get_bbox().get_middle(), 0);
context.pop_target();
}
}
示例15:
void
Kugelblitz::draw(DrawingContext& context)
{
sprite->draw(context, get_pos(), layer);
//Only draw light in dark areas
context.get_light( get_bbox().get_middle(), &light );
if (light.red + light.green < 2.0){
context.push_target();
context.set_target(DrawingContext::LIGHTMAP);
sprite->draw(context, get_pos(), layer);
lightsprite->draw(context, get_bbox().get_middle(), 0);
context.pop_target();
}
}