コード例 #1
0
ファイル: Interface.cpp プロジェクト: octol/kexx2
void Interface::draw(sdlc::Font& font, sdlc::Screen& screen)
{
    // player 1
    int e = player_state_.energy(1);
    int eMax = player_state_.energy_max(1);
    int s = player_state_.score(1);

    if (!e) {
        screen.print(20, 440, "dead", font);
    } else {
        draw_energy(20, 440, e, eMax, font, screen);
    }

    draw_score(20, 20, s, font, screen);
    draw_weapons(20, 40, player_state_, 1, font, screen);

    // player 2
    e = player_state_.energy(2);
    eMax = player_state_.energy_max(2);
    s = player_state_.score(2);
    if (num_of_players_ >= 2) {
        if (!e) {
            screen.print(560, 440, "dead", font);
        } else {
            draw_energy(560, 440, e, eMax, font, screen);
        }

        draw_score(400, 20, s, font, screen);
        draw_weapons(400, 40, player_state_, 2, font, screen);
    }
}
コード例 #2
0
ファイル: draw_gl.c プロジェクト: Chelovecheggg/libvisual
void
draw_scene(void)
{
  if (point_general->changement) {
    recalc_perspective();
    if (point_general->effect > EFFECT_NUMBER - 1) {
      point_general->effect = 0;
      if (gen_gl_texture(knotbg))
        upload_gl_texture(background_image);
      use_gl_texture(knotbg);
    }
    if (point_general->effect == 4) {
      if (gen_gl_texture(tunnel))
        upload_gl_texture(tunnel_image);
      use_gl_texture(tunnel);
    }
    if (point_general->effect == 5) {
      if (gen_gl_texture(tentacle))
        upload_gl_texture(tentacle_image);
      use_gl_texture(tentacle);
    }
    if (point_general->effect == 6) {
      if (gen_gl_texture(twist))
        upload_gl_texture(twist_image);
      if (gen_gl_texture(twistbg))
		upload_gl_texture(background_image);
      use_gl_texture(twist);
    }
    if (point_general->effect == 7) {
      if (gen_gl_texture(texchild))
        upload_gl_texture(child_image);
      if (gen_gl_texture(childbg))
        upload_gl_texture(energy_image);
      use_gl_texture(texchild);
    }
    if (point_general->effect == 8) {
      if (gen_gl_texture(energy))
        upload_gl_texture(energy_image);
      use_gl_texture(energy);
    }
    point_general->changement = FALSE;
  }
  switch (point_general->effect) {
    case 0:
      if (!point_general->init)
        init_effect();
      glDisable(GL_LIGHTING);
      draw_knot();
      break;
    case 1:
      if (!point_general->init)
        init_effect();
      glDisable(GL_LIGHTING);
      draw_spectrum();
      break;
    case 2:
      if (!point_general->init)
        init_effect();
      glEnable(GL_LIGHTING);
      draw_face();
      break;
    case 3:
      if (!point_general->init)
        init_effect();
      glDisable(GL_LIGHTING);
      draw_glthreads();
      break;
    case 4:
      if (!point_general->init)
        init_effect();
      glDisable(GL_LIGHTING);
      draw_tunnel();
      break;
    case 5:
      if (!point_general->init)
        init_effect();
      glDisable(GL_LIGHTING);
      draw_tentacles();
      break;
    case 6:
      if (!point_general->init)
        init_effect();
      glDisable(GL_LIGHTING);
      draw_twist();
      break;
    case 7:
      if (!point_general->init)
        init_effect();
      glDisable(GL_LIGHTING);
      draw_child();
      break;
    case 8:
      if (!point_general->init)
        init_effect();
      glDisable(GL_LIGHTING);
      draw_energy();
      break;
    default:
      break;
  }
}