June 2013
Beginner to intermediate
296 pages
6h 50m
English
We implement a new state; the SettingsState which you access through a button on the menu. What is the purpose for the SettingsState in our example? Currently we have the key bindings inside there. Everything we need has already been implemented with the GUI, so we only have to define the actual state.
The constructor of the
SettingsState class one is pretty big so we snip it.
SettingsState::SettingsState(StateStack& stack, Context context) : State(stack, context) , mGUIContainer() { mBackgroundSprite.setTexture(context.textures->get(Textures::TitleScreen)); mBindingButtons[Player::MoveLeft] = std::make_shared<GUI::Button>(...); mBindingLabels[Player::MoveLeft] =std::make_shared<GUI::Label>(...); ... // More buttons and ...Read now
Unlock full access