-
Organizing my Codes.
I'm creating a 2D SDL game right now and I want to organize everything. Do you think making too many classes and functions under them eats a lot of memory?
instead of making
Code:
while( quit== false)
{
checkinput()
draw()
update()
fpscap()
}
I'll make it.
Code:
while( engine.didquit() )
{
fps.start()
player.checkinput()
sprite.draw()
sprite.update()
fps.cap()
}
-
The two snippets don't appear to do the same thing. For example the second is clearly working with certain objects, whereas with the first this is unclear - globals?
In any case there is no reason to worry about program size. The difference, if any will not be significant and the program itself doesn't seem to be particularly large.
-
nowadays computers are very fast... you are not programming on micro controller where you must pay a serious attention on every "call, jmp, ret" when you create a function...
some programmer try to make their program as readable as possible, as reusable as possible, while holding on OOP rules as strong as they can...