1
General / Organising program / Shape classes
« on: May 25, 2013, 05:17:26 pm »
First of all I'd like to apologise for asking such a noobish question, but I've spent most of the last two days trying to figure it.
My first problem is I am beginning to understand c++ quite well, and am able to use SFML much better than I could with SDL. However I am really confused as how to split all of my files up effectively and efficiently. At the minute I have everything in one large wall of text. The part that confuses me is how do I make functions that write to the screen, whenever they are in different .cpp files.
My other problem was, I was able to create a button(made with SFML Rectangle class) which responded when it was mouse clicked, so I thought I could convert this into a class and reuse the same button multiple times, when I tried this it got terribly broken (I would paste examples but I've deleted multiple times since.
Could anyone help me out by giving me an example of how to create a class that can draw onto the screen without having to be in the same file?
Thank you in advance to anyone who helps me out, and again apologies for seeming so silly, my head is melted.
My first problem is I am beginning to understand c++ quite well, and am able to use SFML much better than I could with SDL. However I am really confused as how to split all of my files up effectively and efficiently. At the minute I have everything in one large wall of text. The part that confuses me is how do I make functions that write to the screen, whenever they are in different .cpp files.
My other problem was, I was able to create a button(made with SFML Rectangle class) which responded when it was mouse clicked, so I thought I could convert this into a class and reuse the same button multiple times, when I tried this it got terribly broken (I would paste examples but I've deleted multiple times since.
Could anyone help me out by giving me an example of how to create a class that can draw onto the screen without having to be in the same file?
Thank you in advance to anyone who helps me out, and again apologies for seeming so silly, my head is melted.