Exemplo n.º 1
0
void
SliderBox::draw(DrawingContext& gc)
{
  if (globals::developer_mode)
    gc.draw_rect(rect, Color(0, 255, 255));

  if (value == 0)
  {
    gc.print_center(Fonts::chalk_normal, Vector2i(rect.left + rect.get_width()/2, rect.top), "off");
  }
  else
  {
    for(int i = 0; i < m_steps; ++i)
    {
      if (i < value)
        gc.print_left(Fonts::chalk_normal, Vector2i(rect.left + i*(rect.get_width()-12)/m_steps + 6, rect.top), "|");
      //gc.print_left(Fonts::chalk_normal, rect.left + i*(rect.get_width()-12)/20 + 6, rect.top, "l");
    }
  }

  gc.print_left(Fonts::chalk_normal, Vector2i(rect.left, rect.top),
                "[");
  gc.print_right(Fonts::chalk_normal, Vector2i(rect.right, rect.top),
                 "]");
}
Exemplo n.º 2
0
void
StartScreenComponent::draw(DrawingContext& gc)
{
  // Paint the background wood panel
  for(int y = 0; y < gc.get_height(); y += background.get_height())
    for(int x = 0; x < gc.get_width(); x += background.get_width())
      gc.draw(background, Vector2i(x, y));

  gc.draw(blackboard, Vector2i(gc.get_width()/2, gc.get_height()/2));

  int left_x  = gc.get_width()/2 - 150;
  int right_x = gc.get_width()/2 + 150;
  int y = gc.get_height()/2 + 40;

  gc.print_center(Fonts::chalk_large,
                  Vector2i(gc.get_width() /2,
                           gc.get_height()/2 - 230),
                  _(plf.get_levelname()));

  gc.print_left(Fonts::chalk_normal,
                Vector2i(gc.get_width() /2 - 300,
                         gc.get_height()/2 - 170),
                format_description(800 - 200));

  y += 32;
  y += 45;

  gc.print_left (Fonts::chalk_normal, Vector2i(left_x,  y), _("Number of Pingus: "));
  gc.print_right(Fonts::chalk_normal, Vector2i(right_x, y), StringUtil::to_string(plf.get_number_of_pingus()));
  
  gc.print_left (Fonts::chalk_normal, Vector2i(left_x,  (y += 30)), _("Number to Save: "));
  gc.print_right(Fonts::chalk_normal, Vector2i(right_x, y), StringUtil::to_string(plf.get_number_to_save()));
  
  gc.print_left (Fonts::chalk_normal, Vector2i(left_x,  (y += 30)), _("Time: "));
  gc.print_right(Fonts::chalk_normal, Vector2i(right_x, y), time_str);

  gc.print_center(Fonts::chalk_small, 
                  Vector2i(gc.get_width()/2,
                           gc.get_height()/2 + 215),
                  _("Author: ") + plf.get_author());

  if (globals::developer_mode)
  {
    gc.print_center(Fonts::chalk_small, Vector2i(gc.get_width()/2, gc.get_height()-50), plf.get_resname());
  }
}
Exemplo n.º 3
0
void 
Checkbox::draw(DrawingContext& gc)
{
	gc.draw_rect(pos.x, pos.y, pos.x + width, pos.y + height, 
                     Color(0,0,0));
	if (is_checked)
		gc.draw(checkmark, pos);
	
	gc.print_right(Fonts::pingus_small, pos.x, pos.y, label);
}
Exemplo n.º 4
0
void
TimeDisplay::draw (DrawingContext& gc)
{
  if (server->get_plf().get_time() != -1 || globals::developer_mode)
  {
    int time_value = server->get_world()->get_time();
    
    if (server->get_plf().get_time() != -1 && !globals::developer_mode)
    {
      time_value = time_value - server->get_plf().get_time();
    }

    std::string time_string = GameTime::ticks_to_realtime_string(time_value);
    gc.print_right(font, Vector2i(Display::get_width() - 30, 3), time_string, 150);
  }
}
Exemplo n.º 5
0
void
ChoiceBox::draw(DrawingContext& gc)
{
  if (globals::developer_mode)
    gc.draw_rect(rect, Color(0, 255, 255));  

  if (!choices.empty())
  {
    if (current_choice >= 0 && current_choice < int(choices.size()))
    {
      //if (current_choice != 0) 
      gc.print_left(Fonts::chalk_normal,  Vector2i(rect.left, rect.top), "<");

      //if (current_choice != int(choices.size())-1)
      gc.print_right(Fonts::chalk_normal, Vector2i(rect.right, rect.top), ">");

      gc.print_center(Fonts::chalk_normal, Vector2i(rect.left + rect.get_width()/2, rect.top), 
                      choices[current_choice]);
    }
  }
}
Exemplo n.º 6
0
 void draw (DrawingContext& gc)
 {
   gc.print_right(Fonts::chalk_small, Vector2i(x_pos, y_pos), _("skip"));
 }
Exemplo n.º 7
0
void
ResultScreenComponent::draw(DrawingContext& gc)
{
  // Paint the background wood panel
  for(int y = 0; y < gc.get_height(); y += background.get_height())
    for(int x = 0; x < gc.get_width(); x += background.get_width())
      gc.draw(background, Vector2i(x, y));

  gc.draw(blackboard, Vector2i(gc.get_width()/2, gc.get_height()/2));

  gc.print_center(Fonts::chalk_large,
                  Vector2i(gc.get_width()/2,
                           Display::get_height()/2 - 200),
                  _(result.plf.get_levelname()));

  if (result.success())
  {
    gc.print_center(Fonts::chalk_large,
                    Vector2i(gc.get_width()/2,
                             Display::get_height()/2 - 140),
                    _("Success!"));
    /*gc.print_center(Fonts::pingus_small, gc.get_width()/2, gc.get_height()-30,
      "..:: Press Space to continue ::..");*/
  }
  else
  {
    gc.print_center(Fonts::chalk_large,
                    Vector2i(gc.get_width()/2, Display::get_height()/2 - 140),
                    _("Failure!"));
    /*gc.print_center(Fonts::pingus_normal, gc.get_width()/2, gc.get_height()-30,
      "..:: Press Space to retry the level ::..");*/
  }

  std::string message;
  if (result.success())
  {
    if (result.killed == 0 && result.saved == result.total)
      message = _("Perfect! You saved everyone possible - great!");
    else if (result.killed == 0)
      message = _("No-one got killed, pretty good work.");
    else if (result.saved == result.needed)
      message = _("You saved exactly what you needed - you made it, but\n"
                  "maybe you can do better?");
    else if (result.killed >= 5)
      message = _("Not everybody was saved, but still good work!");
    else
      message = _("What can I say, you made it - congratulations!");
  }
  else
  {
    if (result.killed == result.total)
      message = _("You killed everybody, not good.");
    else if (result.saved == 0)
      message = _("No-one got saved - I know you can do better.");
    else if (result.saved > 0)
      message = _("You didn't save enough, but you saved a few.  Next\n"
                  "time you might do better.");
    else if (result.saved + 1 >= result.needed)
      message = _("Only one more and you would have made it - try again!");
    else if (result.saved + 5 >= result.needed)
      message = _("Only a handful more and you would have made it - try again!");
    else
      message = _("Better luck next time!");
  }
  gc.print_center(Fonts::chalk_normal, Vector2i(gc.get_width()/2, gc.get_height()/2 - 70), message);

  int left_x  = gc.get_width()/2 - 100;
  int right_x = gc.get_width()/2 + 100;
  int y = Display::get_height()/2 + 10;

  gc.print_left(Fonts::chalk_normal,  Vector2i(left_x,  y), _("Saved: "));
  gc.print_right(Fonts::chalk_normal, Vector2i(right_x, y), StringUtil::to_string(result.saved)
                 + "/" + StringUtil::to_string(result.needed));;

  gc.print_left(Fonts::chalk_normal,  Vector2i(left_x,  (y+=30)), _("Died: "));
  gc.print_right(Fonts::chalk_normal, Vector2i(right_x, y), StringUtil::to_string(result.killed));

  gc.print_left(Fonts::chalk_normal,  Vector2i(left_x, (y+=30)), _("Time left: "));
  gc.print_right(Fonts::chalk_normal, Vector2i(right_x, y), time_str);
}
Exemplo n.º 8
0
 void draw (DrawingContext& gc)
 {
   gc.print_right(Fonts::chalk_small, x_pos, y_pos, SKIP_TEXT);
 }