Sign in to follow this  
Followers 0
Assassinbeast

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

6 posts in this topic

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.

0

Share this post


Link to post
Share on other sites

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).

1

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.

1

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 :)!

1

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
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0