December 2015
Beginner to intermediate
522 pages
11h 21m
English
The main menu of any game out there is a major vein in terms of application flow, even though it's mostly overlooked. It's time we took a stab at building one, albeit a very simplistic version, starting as always with the header file:
class State_MainMenu : public BaseState{
public:
...
void MouseClick(EventDetails* l_details);
private:
sf::Text m_text;
sf::Vector2f m_buttonSize;
sf::Vector2f m_buttonPos;
unsigned int m_buttonPadding;
sf::RectangleShape m_rects[3];
sf::Text m_labels[3];
};The unique method to this class is the MouseClick. Since we're dealing with a menu here, predictably enough it will be used to process mouse input. For private data members, we have a text variable for the title, size, position and padding ...
Read now
Unlock full access