drawing best practice

BlitzMax Forums/BlitzMax Programming/drawing best practice

Cruis.In(Posted 2013) [#1]
Hey guys ol' cruis here again with a quick question.

If I have a list of objects in a list. Each object is an entity in the world, so say each object is a car.

The draw is a method()

so in my updateall function I have

for local car:tcars = eachin list

car.draw()

I am wondering, this really means that each object is using its own draw method to draw itself correct? Is that a memory hog? I mean is it a best practice?

Or should I use a function to draw car? So that all the cars in the list, are drawn by one function call, which is written to draw anything within the list.

thanks


Jesse(Posted 2013) [#2]
that is incorrect. A method in essence is a function. The only difference is that the method access the object fields directly and can only be accessed through the object itself. So if it's a function or a method, it will be just as efficient.

Last edited 2013


Cruis.In(Posted 2013) [#3]
thanks