10-13-2005, 05:23 AM
This code will compile, but it won't run. I'm not too familiar with how Freebasic uses pointer and pases by reference, but this is my code:
I know that I had something similar to this running before, butI can't put my finger on the problem.
EDIT by MOD: please use code tags for pasting src code -looks nicer and easier to distinguish srccode from the rest
Code:
DECLARE SUB setup
DECLARE SUB cprint (text as string, x as integer, y as integer, x2 as integer, y2 as integer, colour as integer, fontnum as integer, array() as integer)
screenres 800, 600, 24, 0, 1
DIM SHARED buffer(480001) as integer 'offscreen buffer faster than page swapping
DIM SHARED buffer2(480001) as integer 'an
dim shared font(25,95, 5) as integer 'can load up to 25 fonts at once
dim shared fontnames(25) as string
setup
cprint "Hello World!", 10,10,100,100,rgb(24,53,65),2, @buffer()
SUB setup
OPEN "system.fnt" FOR BINARY AS #1
OPEN "newage.fnt" FOR BINARY AS #2
OPEN "roman.fnt" FOR BINARY AS #3
st = 1
FOR l = 0 TO 95
FOR x = 0 TO 5
GET #1, st, font(0,l, x)
GET #2, st, font(1,l, x)
GET #3, st, font(2,l, x)
st = st + 2
NEXT
NEXT
CLOSE
cls
GET (0,0) - (799,599), buffer
GET (0,0) - (799,599), buffer2
end sub
SUB cprint (text as string, x as integer, y as integer, x2 as integer, y2 as integer, colour as integer, fontnum as integer, array() as integer)
IF ucase$(left$(text,3)) = "IMG" THEN
ELSE
IF y2 > y + 8 THEN y2 = y + 8
FOR ll = 1 TO LEN(text)
l = ASC(MID$(text, ll, 1)) - 33
IF l <> 62 AND l > -1 THEN
FOR a = x TO x + 5
IF a = x2 THEN EXIT SUB
LINE array, (a, y)-(a, y2), colour, , font(fontnum, l, a - x)
NEXT
END IF
x = x + 6
NEXT
END IF
END SUB
I know that I had something similar to this running before, butI can't put my finger on the problem.
EDIT by MOD: please use code tags for pasting src code -looks nicer and easier to distinguish srccode from the rest
f you play a Microsoft CD backwards you can hear demonic voices. The scary part is that if you play it forwards it installs Windows.