Exemple #1
0
NewGameView::NewGameView(ViewManager * gvm) : View(gvm)
{
  buttons.resize(BUTTON_COUNT);
  
  buttons[OPTIONS_OK] = Button::buildBistate("Ok", 252, 179, LSI(NEWGAME, 2));
  buttons[OPTIONS_CANCEL] = Button::buildBistate("Cancel", 171, 179, LSI(NEWGAME, 3));
  
  const auto* face = FontFaces::MediumBold::BROWN_START;
  
  buttons[OPTIONS_DIFFICULTY] = Button::buildOffsetted("Difficulty", 251, 39, LSI(NEWGAME,4));
  buttons[OPTIONS_OPPONENTS] = Button::buildOffsetted("Opponents", 251, 66, LSI(NEWGAME,5));
  buttons[OPTIONS_LAND_SIZE] = Button::buildOffsetted("Land Size", 251, 93, LSI(NEWGAME,6));
  buttons[OPTIONS_MAGIC] = Button::buildOffsetted("Magic", 251, 120, LSI(NEWGAME,7));
  
  buttons[OPTIONS_DIFFICULTY]->setTextInfo(TextInfo("", face));
  buttons[OPTIONS_OPPONENTS]->setTextInfo(TextInfo("", face));
  buttons[OPTIONS_LAND_SIZE]->setTextInfo(TextInfo("", face));
  buttons[OPTIONS_MAGIC]->setTextInfo(TextInfo("", face));
  
  buttons[OPTIONS_DIFFICULTY]->setAction([&](){ settings.group(SETTING_DIFFICULTY).next(); updateLabelsOptions(); });
  buttons[OPTIONS_OPPONENTS]->setAction([&](){ settings.group(SETTING_OPPONENTS).next(); updateLabelsOptions(); });
  buttons[OPTIONS_LAND_SIZE]->setAction([&](){ settings.group(SETTING_LAND_SIZE).next(); updateLabelsOptions(); });
  buttons[OPTIONS_MAGIC]->setAction([&](){ settings.group(SETTING_MAGIC_POWER).next(); updateLabelsOptions(); });
  
  updateLabelsOptions();
}
 /**
  * Add text into the draw list
  */
 unsigned int FontStashAdapter::addText( std::string text, int x, int y,
                                 std::string font_name, Color color, float font_size, float spacing, float blur ) {
     /* Remember where the index of this text in the vector */
     unsigned int text_entry_id = static_cast<unsigned int>(texts.size());
     
     int font_ID = fonsGetFontByName(context, font_name.c_str() );
     texts.push_back( TextInfo( text, x, y, font_ID, color, font_size, spacing, blur ) );
     
     return text_entry_id;
 }