コード例 #1
0
void
Player::draw (SceneContext& sc)
{
  //light.set_blend_func(GL_SRC_ALPHA, GL_ONE);
  //light.set_scale(4.0f);

  flashlight.set_blend_func(GL_SRC_ALPHA, GL_ONE);
  flashlight.set_scale(2.0f);

  flashlighthighlight.set_blend_func(GL_SRC_ALPHA, GL_ONE);
  flashlighthighlight.set_scale(2.0f);

  if (1)
    { // draw the 'stand-on' tile
      sc.highlight().fill_rect(Rect(Point(int(pos.x)/32 * 32, (int(pos.y)/32 + 1) * 32),
                                    Size(32, 32)),
                               Color(1.0f, 0.0f, 0.0f, 0.5f), 10000.0f);
    }

  //sc.highlight().draw(flashlighthighlight, pos - Vector(40, 80), 100.0f);
  //sc.light().draw(flashlight, pos - Vector(40, 80), 100.0f);
  sprite.draw(sc.color(), pos, z_pos);

  Entity* obj = find_useable_entity();
  if (obj)
    {
      std::string use_str = "[" + obj->get_use_verb() + "]";
      sc.highlight().draw(use_str, obj->get_pos().x, obj->get_pos().y - 150, 1000);
    }
  
  // Draw weapon at the 'Weapon' attachment point
  Sprite3D::PointID id = sprite.get_attachment_point_id("Weapon");
  sc.push_modelview();
  sc.translate(pos.x, pos.y);
  sc.mult_modelview(sprite.get_attachment_point_matrix(id));
  weapon->draw(sc);
  sc.pop_modelview();
}
コード例 #2
0
void
GraphicContextState::pop(SceneContext& sc) const
{
  sc.pop_modelview();
}