|
GAME PROGRAMMING RESOURCES
<< BACK
|
|
|
USING 3IMPACT AS A DLL BLITZMAX STEP-BY-STEP
Register
3Impact game engine,
download the distribution file and install it.
Download the
BlitzMax module
by Garritt Grandberg and extract the BLITZMAX folder to the
C:\Program Files\3impact5\3Impact_as_a_DLL\
folder on your hard disk.
Browse your hard disk to the C:\Program Files\3impact5\3Impact_as_a_DLL\BLITZMAX\DOCS
folder. Open the 3Impact.chm file and follow the instructions under the "Installation from
3Impact Distribution" section to prepare BlitzMax for compiling and using the 3Impact DLL.
Run BlitzMax and select File -> New... from the
pull-down menu. This will create a new file in the BlitzMax IDE.
Add the follwing lines to the new file:
Strict
Framework _3Impact.Lib
If Not i3ImpactOpen() RuntimeError "Unable to initialize the 3Impact game engine"
If Not i3ImpactSettings(_ISETTINGS(640,480,32,False,True)) RuntimeError "3Impact settings failed"
Local myEngine:bmx_3IEngine=New bmx_3IEngine
' begin 3Impact processing
myEngine.Start()
Type bmx_3IEngine Extends _3IEngine
' called to initialize game variables, load resources, etc
Method _Init()
EndMethod
' the main game loop
Method _Run()
EndMethod
' called when the application exits in order to clean up
Method _Exit()
EndMethod
EndType
You will need to repeat this procedure for the main file in each new project. Alternatively, you may
leave out the "Strict" line (not recommended) and change "Framework" to "Import" (also
not recommended). For information on "Strict" and "Framework" please see the BlitzMax documentation. _ISETTINGS() is
a helper function specific to the BlitzMax version of 3Impact. For information on BlitzMax specific
functionality please see the documentation in the C:\Program Files\3impact5\3Impact_as_a_DLL\BLITZMAX\DOCS folder.
The project is now ready to be compiled but of course, it will not do anything because you have not
added any code. Please see any of the numerous 3Impact BlitzMax examples for implementing code in the
_Init(), _Run(), and _Exit() methods.
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\3Impact_as_a_DLL\BLITZMAX\DEMOS
folder.
An important note is that the demos require the compiled EXE be located in the C:\Program Files\3impact5\3ImpactWork
folder before running. This is due to the resources being located in a subfolder of that directory.
You can do either of two things:
- a) Build the EXE, copy it manually into the 3ImpactWork folder, and run the EXE
- b) Copy the .BMX code file from the demo folder into the 3ImpactWork folder, open the .BMX file
in BlitzMax, and Build & Run it from there
|
|