3Impact in a MAxGui window?

BlitzMax Forums/MaxGUI Module/3Impact in a MAxGui window?

Nikko(Posted 2006) [#1]
Hi,

I'm new to Blitzmax, and I try to bind Maxgui with 3Impact.

The idea is to open a 3Impact window in a Maxgui window in order to control 3impact from MAxgui gadgets.

Local w:TGadget = CreateWindow("Easy GL Cube in a GUI window", 10, 10, 1024+10, 768+10 )
Local c:TGadget = CreateCanvas(0,0,w.ClientWidth(),w.ClientHeight(),w,0)
Local hwnd:Int = QueryGadget(c,QUERY_HWND)
If Not i3ImpactOpen(hwnd,hwnd) RuntimeError "Unable to initialize the 3Impact game engine"


THE PROBLEM!

You always use BYTE PTR for passing the HWND to i3ImpactOpen, that generate an error "Unable to convert from Int to Byte Ptr" at compile.

Why using Byte PTR when windows handles are int?

I'm stuck


Gabriel(Posted 2006) [#2]
So cast it to a Byte Ptr.

Local hwnd:Byte Ptr=Byte Ptr(QueryGadget(c,QUERY_HWND))



Nikko(Posted 2006) [#3]
It works... I need to practice more Blitzmax :)

Thanks for the quick answer it was amazing fast.

btw the fixed code is

Local w:TGadget = CreateWindow("Easy GL Cube in a GUI window", 10, 10, 1024+10, 768+10 )
Local c:TGadget = CreateCanvas(0,0,w.ClientWidth(),w.ClientHeight(),w,0)

Local hwnd:Byte Ptr=Byte Ptr(QueryGadget(c,QUERY_HWND))

If Not i3ImpactOpen(hwnd,hwnd) RuntimeError "Unable to initialize the 3Impact game engine"

If Not i3ImpactSettings(_ISETTINGS(w.ClientWidth(),w.ClientHeight(),32,False,True)) RuntimeError "Settings failed"



Gabriel(Posted 2006) [#4]
Great, and no problem. 3Impact is a nice little engine, I had fun with that.