Archived

This topic is now archived and is closed to further replies.

Tron3k

Reusable modules

Recommended Posts

Tron3k    660
Hi! My question is: Let''s say you have a bunch of routines you use a lot that are all related (eg. DirectX/OpenGL initialization). You want to be able to reuse them in other projects. Would you put them in a class or a singleton or just leave them as plain old functions? Would you have them as functions in a namespace? For example, I have a class that handles initializing OpenGL and a class that loads my map files. I wasn''t sure if this is the right way to do things, because always calling functions through classes might be slow. I appreciate any input. Firebird Entertainment

Share this post


Link to post
Share on other sites
Daishim    244
I take the approach with some simple data classes, and these data classes hold their visual information like their images. Then I have a main video class that has pointers to these lists and methods where it scans through these lists and checks for things that need to be drawn and where. It''s worked quite well for a couple of projects thus far and a quite rapid method of establishing the base architecture. There really is no right or wrong way, it''s mostly preference and style.

I know only that which I know, but I do not know what I know.

Share this post


Link to post
Share on other sites