Making TileMax into a Mod

BlitzMax Forums/BlitzMax Programming/Making TileMax into a Mod

_Skully(Posted 2009) [#1]
Ok,

I have all of TileMax engine code wrapped up in its own file and encapsulated in types..

Is making this into a MOD as simple as adding Module Skully.TileMax and some ModuleInfo lines?


Ked(Posted 2009) [#2]
For the most part.


_Skully(Posted 2009) [#3]
Whats the least part?


Brucey(Posted 2009) [#4]
for the name Skully.TileMax, it should go here :

...BlitzMax/mod/skully.mod/tilemax.mod/tilemax.bmx


_Skully(Posted 2009) [#5]
Thanks Brucey


_Skully(Posted 2009) [#6]
OK, now its telling me it cant find the interface... grrr

Off to the docs I guess


REDi(Posted 2009) [#7]
Did you build modules? and did it build without error?


Brucey(Posted 2009) [#8]
Assuming you've put it in the right place, and named the module correctly, then built the module, you should be able to use either Framework or Import.

Typos and location tend to be the obvious things that need fixing.
Also, if you lower-case all the folder and file names, it can help (especially if you are intending to go cross-platform at some point).

on the command-line in the BlitzMax/bin folder you can run this :
bmk makemods -a skully.tilemax

If that doesn't appear to do anything, it's either in the wrong location, or it isn't called that :-)


_Skully(Posted 2009) [#9]
Ok... case was the issue; however, now I see that mods have to specifically import other modules since its telling me that "Identifier TLink not found" is there an easy way to locate what module contains what?


Brucey(Posted 2009) [#10]
F1 on the keyword to bring up some text in the statusbar. F1 again to open the module docs - at the top of which is the name of the module.

It's usually quick enough just to keep adding what is missing until it stops complaining :-)

Of course, if you add the imports as you go, then it's not an issue at all...


_Skully(Posted 2009) [#11]
What am I expecting to see as output from bmk makemod?

I'm getting nothing


xlsior(Posted 2009) [#12]
What am I expecting to see as output from bmk makemod?

I'm getting nothing


In that case you either don't have it in the right location, or it can't find any BMX (or c) files in the directory.

You should get one or more lines giving compile info. for example, when I do a bmk makemods -a bah.regex, I see this:

C:\Code\BlitzMax\bin>bmk makemods -a bah.regex
Compiling:pcre_chartables.c
Compiling:pcre_compile.c
Compiling:pcre_config.c
Compiling:pcre_dfa_exec.c
Compiling:pcre_exec.c
Compiling:pcre_fullinfo.c
Compiling:pcre_get.c
Compiling:pcre_globals.c
Compiling:pcre_info.c
Compiling:pcre_maketables.c
Compiling:pcre_newline.c
Compiling:pcre_ord2utf8.c
Compiling:pcre_refcount.c
Compiling:pcre_study.c
Compiling:pcre_tables.c
Compiling:pcre_try_flipped.c
Compiling:pcre_valid_utf8.c
Compiling:pcre_version.c
Compiling:pcre_xclass.c
Compiling:pcre_ucd.c
Compiling:common.bmx
flat assembler version 1.67.36 (210399 kilobytes memory)
3 passes, 16036 bytes.
Compiling:regex.bmx
flat assembler version 1.67.36 (210283 kilobytes memory)
4 passes, 42537 bytes.
Archiving:regex.debug.win32.x86.a
ar: creating C:/Code/BlitzMax/mod/bah.mod/regex.mod/regex.debug.win32.x86.a
Compiling:pcre_chartables.c
Compiling:pcre_compile.c
Compiling:pcre_config.c
Compiling:pcre_dfa_exec.c
Compiling:pcre_exec.c
Compiling:pcre_fullinfo.c
Compiling:pcre_get.c
Compiling:pcre_globals.c
Compiling:pcre_info.c
Compiling:pcre_maketables.c
Compiling:pcre_newline.c
Compiling:pcre_ord2utf8.c
Compiling:pcre_refcount.c
Compiling:pcre_study.c
Compiling:pcre_tables.c
Compiling:pcre_try_flipped.c
Compiling:pcre_valid_utf8.c
Compiling:pcre_version.c
Compiling:pcre_xclass.c
Compiling:pcre_ucd.c
Compiling:common.bmx
flat assembler version 1.67.36 (208363 kilobytes memory)
3 passes, 1725 bytes.
Compiling:regex.bmx
flat assembler version 1.67.36 (208203 kilobytes memory)
5 passes, 13161 bytes.
Archiving:regex.release.win32.x86.a
ar: creating C:/Code/BlitzMax/mod/bah.mod/regex.mod/regex.release.win32.x86.a



Also, note that you'll need to compile the module twice:
once with bmk makemods -a and once with bmk makemods -a -h to create a version that works in threaded programs as well.


_Skully(Posted 2009) [#13]
Hmmm...this is really strange

I have it folderized as mentioned by Brucey above ( mod/skully.mod/tilemax.mod/tilemax.bmx), as lower cased. Its module name is skully.tilemax in the file as well.

Once, it gave me an error and now its like nothing happens ever... even if I purposefully place an error in the file...hmmm

ok a little error trapping/reporting in this would be nice

Oh well, it can wait... its all modular now and works with include


Pete Rigz(Posted 2009) [#14]
What happens when you simply compile the module in the ide?


plash(Posted 2009) [#15]
Post the header to your module.


_Skully(Posted 2009) [#16]
Compiles fine but no joy on the
bmk makemods -a skully.tilemax



slenkar(Posted 2009) [#17]
a simpler way of doing it is to alter the tilemax file, change it back and press CTRL-D


_Skully(Posted 2009) [#18]
I got it.. my BlitzMax installation was pooched somehow... I renamed my old installation and re-installed and it built just fine :)


_Skully(Posted 2009) [#19]
Isn't that just sweet...

I thought it was something I mis-understood... glad to know my brain still works ;)

SuperStrict

Import skully.tilemax
Global ScreenWidth:Int = 1024
Global ScreenHeight:Int = 768
Global ScreenDepth:Int = 32
Global screenRefresh:Int = 60

SetGraphicsDriver GLMax2DDriver()
Graphics ScreenWidth,ScreenHeight,ScreenDepth,screenRefresh
SetImageFont Null

Global TMax:tilemax=New tilemax
Global F:FPS=New FPS
TMax.LoadLevel("Media/Maps/default/")
TMax.Currentlevel.editmode=False
Local t:TileSet=TileSet(TMax.TileSets.Last())

While Not KeyDown(KEY_ESCAPE)
	Cls
	TMax.DrawMap(0,0,ScreenWidth,ScreenHeight,%0111)	' Draw background layers
	TMax.DrawImageArea(t.Image,ScreenWidth/2-16,ScreenHeight/2-16,32,32,4*32,7*32,32,32)	' lets draw a smily face
	TMax.DrawMap(0,0,ScreenWidth,ScreenHeight,%1000)	' Draw foreground layer
	DrawText F.RunFPS(),0,0								' This is where the actors will get drawn
	If KeyDown(KEY_DOWN) TMax.FocusY:+1
	If KeyDown(KEY_UP) TMax.FocusY:-1
	If KeyDown(KEY_LEFT) TMax.FocusX:-1
	If KeyDown(KEY_RIGHT) TMax.FocusX:+1
	TMax.MoveOnMap(TMax.FocusMapTile,TMax.FocusX,TMax.FocusY)	
	Flip 0
Wend


Works!