Skip to main content
gamedev.net
🔒 Locked

Hide #ifndef code

Started by TechnoCore Nov 1, 2004 at 3:44 AM 3 replies 500+ views
Original Post
TechnoCore
TechnoCore
Hi! Im currently working on a particle-engine, and a particle-editor tool in vc++ 7. Since i dont want to clutter the engine-code with alot of editor specifics, i've used defines to make two separate builds. Is there a way to auto-hide all #defined code that is not currently in use (in other words not defined) ? I've seen this in other editors. Thanks, T!
//TechnoCore
TechnoCore
TechnoCore
Thanks Pete.
I've red the thread, and the article inside it.
I guess i already new that defines are easily making a mess of any code.

I can't however change what i've started now. My code is about 7000 rows now. But it only contains one #define, called _PARTICLE_EDITOR, so it isn't really that cluttred.
I have re-written it three times already, and learned alot from that. But I feel I don't have the time to rewrite it a fourth time ;)

There's just so many options on how to arrange the code in c++, and it feels like it's going to take me like 5 years to grasp just all basic concepts in it.

Still I've seen that it's possible to hide all not-used code in other editors. Surely VC++ must support that?

//TechnoCore
Teknofreek
Teknofreek
It sounds to me like the natural solution to your problem would be to make the particle engine and the particle editor two seperate projects. You could either make the engine code a project that you include in your editor solution, or you could make the engine a static lib that your editor links with, or you could make the engine a dll.

Doing things this way will also help you down the road when you want to create one, or more, games that also use your particle engine :)

-John
John
TechnoCore
TechnoCore
I think you are right, John. Next time i'm starting a project i will be more careful how I set things up. It was just that when i started this project I had so little experience with objectoriented thinking.
At the start in this project my code grew horrible to a horrible mess, mostly because im always trying to optimize things to soon.

Im wondering in general, If I have my engine, and my editor. I do want my editor to be able to reach every single variable inside the engine, but i dont want the engine to be all cluttred with access-functions only used by the editor. What is a good way to set things up then?

//TechnoCore

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.