Thread: Organizing my Codes.

  1. #1
    Registered User
    Join Date
    Dec 2008
    Location
    California
    Posts
    37

    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()
    }

  2. #2
    The larch
    Join Date
    May 2006
    Posts
    3,573
    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.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  3. #3
    a newbie :p
    Join Date
    Aug 2008
    Location
    Zurich, Switzerland, Switzerland
    Posts
    91
    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...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Escape Codes
    By renurv in forum C++ Programming
    Replies: 2
    Last Post: 01-01-2006, 02:01 PM
  2. codes
    By IfYouSaySo in forum A Brief History of Cprogramming.com
    Replies: 34
    Last Post: 11-18-2005, 03:09 PM
  3. action replay codes
    By c++.prog.newbie in forum Game Programming
    Replies: 2
    Last Post: 02-28-2004, 08:47 AM
  4. Key codes...
    By Supar in forum C++ Programming
    Replies: 3
    Last Post: 03-18-2003, 08:48 PM