Can you verify this LoadImageFont problem.

BlitzMax Forums/BlitzMax Programming/Can you verify this LoadImageFont problem.

Chroma(Posted 2009) [#1]
Obviously I've upgraded to 1.33 today and I'm having some problems.

The latest is something as simple as loading an image font. Behold this simple code:

Global ScoreFont:TImageFont = LoadImageFont("seag.ttf",24)
SetImageFont ScoreFont


If I comment out SetImageFont then everything is fine. Otherwise it says it's a null object. I have the font in the right spot. I'm bout to chew my desk in half here...


Chroma(Posted 2009) [#2]
Wait...you can't load an imagefont before you set graphics...MF!


GfK(Posted 2009) [#3]
For one reason or another, the font is not being loaded. LoadImageFont won't throw an error if it can't find the file - you'll only get an error when you try to reference a null object with SetImageFont.

Have you set a graphics mode first?

[edit] No, I see you haven't.


Chroma(Posted 2009) [#4]
yup, funny how simple stuff kicks your butt when you don't code for a few months.

Now I can't remember how to add arrays together!!

I know it's something like

a[] = [1,2,3]

a = a +[4]

Gah...


plash(Posted 2009) [#5]
Now I can't remember how to add arrays together!!

SuperStrict

Framework brl.blitz
Import brl.standardio

Local array1:Int[] = [1, 10, 2, 20]
Local array2:Int[] = [3, 30, 4, 40]
Local array3:Int[]

array3 = array1 + array2

For Local value:Int = EachIn array3
	
	Print("Value: " + String(value))
	
Next


Note that you can't add multi-dimensional arrays together.


Chroma(Posted 2009) [#6]
ok but what i don't get is why people do stuff like Framework brl.blitz, Import brl.standardio.

And how do you know what you need for a bare necessities and where's the documentation on all that?


GfK(Posted 2009) [#7]
ok but what i don't get is why people do stuff like Framework brl.blitz, Import brl.standardio.
Because they only want to include the modules that their game requires, makes the EXE smaller.

And how do you know what you need for a bare necessities and where's the documentation on all that?
Your best bet with that is Framework Assistant. Google it.


xlsior(Posted 2009) [#8]
By default, Blitzmax will import *all* modules under the BRL.mod and PUB.mod folders, even if your program doesn't use all of them.

So, by using a framework and selectively importing the functions that you actually use, you can significantly reduce the size of the .exe file that gets generated.
The easiest way of finding the proper declarations for your program is to download the free Framework Assistant, will will scan your .bmx file and tell you the framework/imports to use. copy & paste, stick it at the top of your program --> smaller executable.

(You can search the forums for a download link for framework assistant)