Jump to content
  • Advertisement

Archived

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

Tron3k

Reusable modules

This topic is 5832 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
I have classes, functions, and macros in a namespace. If you have just a function, there''s no need to put it in a class.

Share this post


Link to post
Share on other sites
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!