Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: keeping window separated  (Read 1283 times)

0 Members and 1 Guest are viewing this topic.

phufhi

  • Newbie
  • *
  • Posts: 8
    • View Profile
keeping window separated
« on: December 05, 2011, 10:18:02 pm »
Hello,


I am new to SFML, and I have a question about my code (it is for a game I'm making).
Currently, I have not included window in any of my classes. Only my main function has the window.
This leads to event-handling functions that take an events and draw functions that return a shape.
Some objects contain multiple shapes, which have to be drawn with a for loop. If I have multiple of these in a vector, I need two for loops.
My question is: Is this bad programming practice?
I originally thought it would be more organised this way, but I'm not sure if this will make everything more difficult later on.
Also, could it affect performance (speed & memory usage) because of all the passing of events and shapes? Is it worth changing?
I am not that far in the project, and if I will ever change it, now is probably the time.

Thanks in advance :D,


Phu


PS: what about timers? Should I have one central timer and pass it's value or should I have a timer for each object?
PPS: sorry for the many questions. :P

 

anything