Allegro Blit problem

New to FreeBASIC? Post your questions here.
Post Reply
Dinosaur
Posts: 1481
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Allegro Blit problem

Post by Dinosaur »

Hi all

Occasionally I get an exception error with this statement.
Allegro format is:
Blit(*Source, *Dest, Source X, Source Y, Dest X, Dest Y, Width, Height)
My declaration is as follows:

Code: Select all

Dim As Any Ptr IpOn,IpOff,OpOn,OpOff
Type LED
	bmp(1 To 112)       As Any Ptr
	Nbr(1 To 112)       As Integer
	Show(1 To 112)      As Integer
	Req(1 To 112)       As Integer
	Direction(1 To 112) As Integer
	Button(1 To 112)    As Integer
	StartTime           As UInteger
	Name(1 To 112)      As ZString * 7
End Type
For Xq  = 1 To 112
   Led.bmp(Xq)  = create_bitmap(15,15) 
   Lock_BitMap(Led.Bmp(Xq))                  		
   Led.Name(Xq) = "Led" + Str(Xq)          'give it a unique name
   Tabs.Tryit = RegisterImage(Led.bmp(Xq),Led.Name(Xq),Cgui_IMAGE_BMP, Led.Button(Xq)) 
   If Tabs.Tryit = 0 Then .Level = 2
Next                                    

Then my call to Blit;

Code: Select all

Blit(ipOff,Led.Bmp(Xq),0,0,0,0,15,15)
where Xq is an integer which already creates an exception with the value of 1.

Having spent a lot of time in the past finding the reason for this, (and of course forgetting it) I want to convert this to a FB statement. But no amount of trying the Put statement, can't seem to get the format right.
I thought this should do it, after reading the wiki.

Code: Select all

Put (Led.Bmp(Xq)),0,0,ipOff,0,0,0,0,15,15,PSet
But the error I keep getting is Argument count , ) expected.

Anyone have any suggestions.

Regards
fernando.inf
Posts: 28
Joined: Mar 10, 2009 1:41

Post by fernando.inf »

Don't use Any Ptr, try BITMAP Ptr

Code: Select all

Dim As BITMAP Ptr IpOn,IpOff,OpOn,OpOff
Dinosaur
Posts: 1481
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Post by Dinosaur »

Hi all

That doesn't make any difference, I still get "Exception Access Violation"

Regards

EDIT:
Solved it (again)
I am trying to get away from "Common Shared" for things that can be locally declared and used. Doing that to the Allegro Blit fields is what caused Allegro to spit the dummy.
I had declared them local in some, but left them Global in one other.

However, I am still interested in converting to a PUT statement if that is possible.
Ophelius
Posts: 428
Joined: Feb 26, 2006 1:57

Post by Ophelius »

You can't use Put on an Allegro bitmap.
Post Reply