GAME PROGRAMMING RESOURCES

<< BACK

USING 3IMPACT AS A DLL, DEV-C++ TIPS

  • Register 3Impact game engine, download the distribution file and install it.


  • Browse your hard disk to the
    C:\Program Files\3impact5\3Impact_as_a_DLL\
    folder. Select the DEVCPP folder and copy (Ctrl+C) it.




  • Browse to the
    C:\Program Files\3impact5\
    folder and paste (Ctrl+V) the copied folder there.




  • Rename the new folder to 3ImpactApp.




  • Run Dev-C++ free compiler and select File -> New -> Project from the pull-down menu.


  • Select Empty Project project type, give the new project a proper name (i.e. 3ImpactApp) and select the C++ Project radio button.




  • Browse to the
    C:\Program Files\3impact5\3ImpactApp\
    folder and and click Save to create the project there.




  • Right-click the 3ImpactApp, select Add To Project



    and then double-click the 3ImpactApp.cpp file.




  • Repeat the above action for 3ImpactCode.cpp and dll3Impact.h.


  • Select Project -> Project Options from the pull-down menu, select the General tab and set Win32 GUI as type.




  • Select the Parameters tab and type libdll3impactd.a in the Linker window.




  • IMPORTANT: specify libdll3impact.a instead, if you are going to release (distribute) the compiled project. The libdll3impactd.a library is intended for developing purposes only and cannot be re-distributed.

  • Select the Build Options tab and specify
    C:\Program Files\3impact5\3ImpactWork\
    as executable output directory.




  • The project is now ready to be compiled.


  • The 3ImpactApp.cpp file is an example implementing the main program loop. See the comments in the code for details.


  • The 3ImpactCode.cpp is the actual game. See the comments in the code for details.


  • COMPILING CODE EXAMPLES
    WITH THE DLL VERSION
    OF 3IMPACT GAME ENGINE

  • A number of demos is available as commented source code in the
    C:\Program Files\3impact5\3ImpactDLL
    folder.


  • For each example, the code in the 3ImpactDLL.cpp can be used in place of the 3ImpactCode.cpp in the 3ImpactApp project created as described above.


  • So, simply copy the entire .cpp code of each example to the 3ImpactCode.cpp (replacing all existing code), remove all the #include lines at the top of the code and replace them with the following:

    #include "windows.h"
    #define _3IMPACT_EXTERN
    #define WIN32DLL_API __declspec(dllimport)
    #define CALLMODE_API
    #include "dll3impact.h"


  • Compile and run.