Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cpmpiles, won't run
#1
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:

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.
Reply
#2
If you post things -be sure to post files needed as well.

But if you need fonts -here's small package I made a while ago.

http://forum.qbasicnews.com/viewtopic.php?t=9424
url]http://fbide.sourceforge.net/[/url]
Reply
#3
I see a potential problem with your input method. The "st" variable is not really required, as Get # increments its position automatically...unless the file you're loading has that really weird setup...
\__/)
(='.'=) Copy bunny into your signature to
(")_(") help him gain world domination.
Reply
#4
You can comment out the file loading, thats not the problem. I commented them out and it still did nothing. I am positive that the error comes in the pass by reference.
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.
Reply
#5
If you run it from a batch file with MORE as the last line, you will have plenty of time to read any error messages printed by FBC. Wink
Reply
#6
I does compile. FBC catches nothing, the problem lies after compilation.
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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)