|
GAME
PROGRAMMING RESOURCES
<<
BACK
|
|
|
USING 3IMPACT AS A DLL
VISUAL C++.NET 2005 Express STEP-BY-STEP
Register 3Impact
game engine, download the distribution file
and install it.
Follow these instructions to setup your
installation of Visual C++ 2005 Express to be able to use the platform SDK (only need to do this part once on a machine)
Run Microsoft Visual C++ 2005 Express and select File -> New -> Project
.
Select Win32 project type, then select the Win32 Console Application
template and name the new project 3ImpactApp.
Make sure the Location is the folder named 3impact5. This is
the main folder for the engine and it is typically installed inside the C:\Program
Files folder. Click OK to continue.
On the next screen, select Application Setting on the left hand side and change Application Type to Windows Application then click the Finish
button.
Close Visual C++ and browse your hard disk to the
C:\Program Files\3impact5\3Impact_as_a_DLL\VCPP
folder. Select all the files in the folder and copy (Ctrl+C) them.
Browse to your newly created project folder
C:\Program Files\3impact5\3ImpactApp\3ImpactApp
and paste (Ctrl+V) the files there. Confirm that you want to overwrite
the existing 3ImpactApp.cpp file.
Run Visual C++ again, open the newly create 3ImpactApp workspace.
Right-click the yellow Source Files folder, select Add -> Add
Existing Items.
and then double-click the 3ImpactCode.cpp file.
Then right-click the yellow Header Files folder, select Add
->Add Existing Items...
and then double-click the dll3Impact.h file.
Select Project -> Properties... Set Configuration in the top left
corner to Debug then under Configuration Properties select General and set Character Set to Use Multi-Byte Character Set
Select Debugging and type C:\PROGRAM FILES\3impact5\3ImpactWork\3ImpactApp.exe
as Command and
C:\PROGRAM FILES\3impact5\3ImpactWork\
as working directory.
Select Linker -> General and type
C:\PROGRAM FILES\3impact5\3ImpactWork\3ImpactApp.exe
as output file.

Select Linker -> Command Line and type dll3impactd.lib in
the Addition Options list.
Then switch to Release settings (see top/left of dialog box) and set
executable for debug session, working directory and output file name to the
same paths used for the Debug settings, but make sure you add the
re-distributable dll3impact.lib
library version to the Additonal Options list, and not the
dll3impactd.lib, which is intended for developing purposes only and cannot be
re-distributed.
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 "stdafx.h"
#define _3IMPACT_EXTERN
#define WIN32DLL_API __declspec(dllimport)
#define CALLMODE_API
#include "dll3impact.h"
Compile and run.
|
|