• Advertisement
Sign in to follow this  

Made my own small GameEngine, but how do i reuse it fast?

This topic is 1842 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

Hello.

 

I just made my small gameengine in c++ with sfml, where i have made menus, butttons, gamestates and such.

There are a lot of different files, and some images.

 

So i how do i reuse it when i have to make a new game?

Should i just copy the header files,cpp files, image folders etc into my new project?

If so, that would be tedious like to link every project with sfml... unsure.png

 

Btw, I am using microsoft visual studio express 2010.

Share this post


Link to post
Share on other sites
Advertisement

I bundle my "reusable game engine" into its own library, and then when I make a new game I just link to my game engine library (and any dependencies, like SFML or whatever).

Share this post


Link to post
Share on other sites

The easiest way is to copy the files, but you can also compile it as library, add the headers to your compiler include paths and link your project with it.

Share this post


Link to post
Share on other sites

Make a folder (With /lib/ and /include/) and link it!

 

However, you could have simply chose the "Library" option when creating your Game Engine's project in Visual Studio.

 

Cheers :)!

Share this post


Link to post
Share on other sites

hi, i've catch the same problem before.

so if you want to reuse your code, write it independently. i mean, don't do any render, or use any class, library... like sfml. use basic data structure.

for example: if you want to render a character, create 'Character' class, hold infomation for position(int), name(string), class(string), etc. your class should not have any field like Sprite, Font, Model, or any class from sfml(or any library)

and, for each library you use, create a new class named 'CharacterRender' that render the 'Character' class above. and of course, it should have Sprite, Font, Model...

Edited by ngoaho91

Share this post


Link to post
Share on other sites

Since you're using Visual Studio, why not export the project as a template?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement