Mouse events

Archives Forums/Blitz3D SDK Programming/Mouse events

Moraldi(Posted 2007) [#1]
I am not sure if this is a bug but after a call to
bbGraphics3D(ClientWidth(Desktop()), ClientHeight(Desktop()), 0, GFX_WINDOWEDSCALED)
then I cannot catch Mouse events from the EventID()


skidracer(Posted 2007) [#2]
Do you mean something like this?

' emits Blitz3DSDK events via BlitzMax event system

' using a combination of bbSetBlitz3DEventCallback and EnablePolledInput

Import blitz3d.blitz3dsdk

Strict

Function BBEventHandler(hwnd,msg,wp,lp) "C"
	bbSystemEmitOSEvent hwnd,msg,wp,lp,Null
	Return -1
End Function

bbSetBlitz3DEventCallback(Int Byte Ptr BBEventHandler)

bbBeginBlitz3D()

bbGraphics3D 800,600,0,2

Local cube=bbCreateCube()
Local light=bbCreateLight()
Local camera=bbCreateCamera()

bbPositionEntity camera,0,0,-4

EnablePolledinput

While Not KeyDown(KEY_ESCAPE)
	If PollEvent()
		DebugLog CurrentEvent.ToString()
	EndIf
	bbTurnEntity cube,1,2,3
	bbRenderWorld
	bbText 20,20,"mouse:"+MouseX()+","+MouseY()
	bbFlip 
Wend



Moraldi(Posted 2007) [#3]
Thanks skidracer.
I forgot to setup an event handler for use with the SDK. Works fine now.
Correct me if I am wrong but:
bbSystemEmitOSEvent is undocumented. I mean that if I use the Super Strict directive then I am getting a compiler error.
I suppose that is:
hwnd:int, msg:int, wp:int, lp:int
Which window handle passed to BBEventHandler. Only the main window handle of a BlitzMax app?
What is the meaning of the "C" or "Win32" strings?. Are there any others? ("C++" for example?)
Is BBEventHandler a global system variable of the SDK?