Please help: Framework + Import commands

BlitzMax Forums/BlitzMax Programming/Please help: Framework + Import commands

salric(Posted 2005) [#1]
Hello all,

I'm experiencing a lot of frustration trying to get my head around the framework and import commands. I don't want to package every .mod under the sun within my application; however I'm unable to create a basic framework + import command set that works; I expect this has something to do with dependencies - and perhaps even the order of the included modules.

ie.

Framework BRL.blitz
Import BRL.max2d
Import BRL.system
Import BRL.audio
Import BRL.system
Import BRL.oggloader
Import BRL.math
Import BRL.random
Import BRL.bmploader

Const gwidth=640,gheight=480,gdepth=32

Graphics gwidth,gheight,gdepth

gives you a "Graphics mode does not exist" in the input/output console, however reports no issues on a "full" compile (ie. with no framework or import commands)

Is there a reliable way (i.e. a set of procedures) one can build a framework/import command list?

I would appreciate if someone could explain in detail these commands (i.e. beyond what's in the standard documentation), how they relate to the compiler, and most importantly, exactly what steps one would take to build a framework/import command list for a project.

Thanking you in advance.


skidracer(Posted 2005) [#2]
this is a good starting point as featured in the firepaint demo:
Framework BRL.GLMax2D

Import BRL.Basic
Import BRL.System
Import BRL.FreeAudioAudio
Import BRL.PNGLoader 
Import BRL.WAVLoader



salric(Posted 2005) [#3]
Thank you for your reply; I have a few more questions:

1) are the module names case sensistive?
2) is the order of the module names important
3) why does the example I have provided not work?
4) How do I determine dependances of the modules?

Any more information would be very much appreciated...


EOF(Posted 2005) [#4]
1) no
2) I don't think so
3) Try Import BRL.GLMax2D intead of Import BRL.max2d
4) The way I do it is to F1 over the command to bring up the help file reference. Then, I scroll to the top to find the module name.

Example command:

Millisecs()

F1 over that command then look at the top of the help file.
You see 'System'. Therefore, Millisecs() needs the BRL.System module importing.

There are still a few things which might trip you up though.
For example, if you load PNG images you need to remember to include the BRL.PNGLoader module.


RGR(Posted 2005) [#5]
Actually you question yourself why do I use a computer if I have to do everything by hand... ;-)
I wrote a pre-compiler for Blitz3D to avoid (besides some other advantages) that I always had to import complete libraries if I only needed 1 or 2 Functions. So this one kept track of all needed Functions and Globals, etc and created two includefiles and changed the main file accordingly. Saved a lot of time and work...
This seems to be even more important to have for BMax sooner or later.


Dreamora(Posted 2005) [#6]
Yepp.
Problem is there are some imports which can't be done by a computer, for example the image format loader, as a pc can't know what you load especially if you don't hardcode media stuff.

Best thing, at the moment, is if you write your own general frameworks ... for example under pub.mod an own "2d_framework.mod" in whichs bmx you put all the imports you need in a 2d game.

afterwards you can simply do a framework "pub.2d_framework" and thats it :)
no more searching etc.


RGR(Posted 2005) [#7]
which can't be done by a computer, for example the image format loader
I saved this problem in an other way years ago.
Everytime I wrote a new Function I added comment lines following End Function if needed. This was then interpreted by the pre-compiler so it "knew" which functions, Templates with Globals, etc it had to include
example:
;* Filepath\ThisGlobalTemplate.bbg
;+ UsedFunction.bb
;+ AnotherNeededFunction.bb

Some of it could be replaced today. I wrote some algorythms that find the used Functions with most possible syntax exceptions themselves for instance.

But a lot of things were time saving as well. For instance saving to write Field in Types 1000s of times. In Lines after Type (B3D B+) there could only follow a line with Field until the line End Type was reached (Or a comment or an empty line). So why write "Field" each time? This was done by the pre-compiler... A computer program can do this: Read a text, interpret it and save programmers time.
Okay we are here in BMax Forum and this has changed also - there's more than Field now - but if I would plan and think about it... maybe F would do it instead and maybe M for Method. There's always a solution. I read somewhere "The only limit is your imagination" *Edited* This was a Blitz 3D Slogan - but I think they dropped it - at least I couldn't find it
Anyway - everything the computer could do it should do...