tresinformal / drakkar

The tresinformal video game called 'Drakkar'
GNU General Public License v3.0
11 stars 4 forks source link

Add title to options screen #640

Open richelbilderbeek opened 1 year ago

richelbilderbeek commented 1 year ago

In big letters.

Test is here:

  //#define FIX_ISSUE_640
  #ifdef FIX_ISSUE_640
  // (640) Add a title
  {
    game_options options; //Cannot be const
    // The line below modifies the game_options,
    // as it will initialize the text with a font,
    // that is taken from the game_options' resources:
    // getting the sf::Font by reference is non-const
    const sf::Text title_text{
      create_title_text(options)
    };
    assert(title_text.getString() == "Drakkar.io");
    assert(title_text.getCharacterSize() > 20); //Bigger is OK
  }
  #endif // FIX_ISSUE_640

There is also a FIX_ISSUE_640 in options_view::show:

  #ifdef FIX_ISSUE_640
  {
    const sf::Text& get_title_text(*this);
    m_window.draw(title_text);
  }
  #endif // FIX_ISSUE_640

It should work and look nice :-)