Hello I am a beginner in c++ and sdl2 as you could see on the title. I am working on the graphical version of my game and when I run the game it starts immediately but instead of the game immediately starting, I want to display a really simple menu to begin with, with a play button so that when the window opens I can click on the play button with the mouse cursor and then the game starts. I don't need help for the code itself but for understanding how I can do it (like the logic). (sorry for my bad english, my mother tongue is french)
-AffichageGraphique.cpp is for displaying windows and images
-JeuGraphique.cpp have access to all the elements of the game and tells AffichageGraphique.cpp what to display on the window.
I am planning on adding in the data file :
- a png for the menu background
- two png's for the play button with two different shades so that it can make a visual effect when I put the cursor on the button
- a png for a title "bomberman"
That's it for now.
So what I'm thinking of doing is adding a function to display the menu (afficherMenu) in my JeuGraphique.cpp. I'll use gimp to know the position of the cursor on the play button so that i can do two cases to change the button shade when the cursor is on it and to run the game if we click on it. I don't know what else to add
In my initFenetre function in my AffichageGraphique.cpp file I want to load the menu png's, I don't know what else to change. The menu and the window have the same size 800*600 pixels.
So I'll be really grateful if someone gives me an idea of how to start and what I can change in my AffichageGraphique.cpp and JeuGraphique.cpp files in order to display a menu.