I want to make triangle buttons, circle buttons, oval buttons, rectangular buttons with rounded corners and many other fancy buttons, because I like buttons.;D
Is there any function in SFML that could check if mouse is located on a *.PNG sprite? Or do I have to use fancy mouse position maths to do so? Or is there another way to push buttons?There is no such function, but you can load an sf::Image and create a 2D bit array of the same size as the image. If a pixel is part of the button, for example by not being transparent in the original image, then set the bit in the 2D array to 1, otherwise leave it as 0. The array itself can be represented by std::vector<bool> (or another container, if you don't like this specialization), and you can map 2D indices to 1D. To check whether the button was clicked, simply check the bit at the corresponding position in your 2D array.
Sorry. I've said I'm new to programming and SFML.Don't learn both at the same time. C++ is a very difficult language, you should at least invest some months into it before using a library. That may sound boring, but it's far less frustrating than having to fight the language again and again during game development. And it will also save you a lot of time.
I would use both! I would load an image, then load a texture from an image, then a sprite for an image and then draw sprites and check for pixels in the image.sf::Image is simpler to use than a 2D bit array, but you shouldn't choose this approach in a bigger project (see my previous posts to know why)...
Don't learn both at the same time. C++ is a very difficult language, you should at least invest some months into it before using a library. That may sound boring, but it's far less frustrating than having to fight the language again and again during game development. And it will also save you a lot of time.My programming history:
Now I use multi-dimensional pointers without a struggleAnd again, BAAM, you're outdated :P
Things I haven't learnt: STLThe STL is the most important part of the standard library. It's something you will use every day, and it simplifies programming tremendously. So it's definitely worth learning.
classesAlso an absolute must as soon as you want to develop own projects.
templates, and inheritance.They're not as crucial as the other points, but also very useful. And their basics are relatively easy to understand once you know classes, but of course they provide endless possibilities.