PollEvent / WaitEvent with GLGraphics()

BlitzMax Forums/BlitzMax Beginners Area/PollEvent / WaitEvent with GLGraphics()

cermit(Posted 2011) [#1]
This is the relevant code, basicly I'm using GLGraphics in a init() function of a type.
' Main Program
Repeat

	' Event
	Repeat
		PollEvent(  )
		Select EventID(  )
			Case EVENT_WINDOWCLOSE
				gl.g.Close(  )
				Print "*** close already!!!"
			Default
				
		End Select
	Until EventID(  ) = 0


	' Render
	gl.render(  )

Until KeyDown( KEY_ESCAPE )


I doesn't work, and I've been looking for examples, tutorials etc on the net. I'm gonna try using WaitEvent however at this particular point I don't want anything to wait so to say.

Edit: Sorry, curse removed.

Last edited 2011


therevills(Posted 2011) [#2]
Do you really need to poll the events? Why not use AppTerminate in your repeat loop?

Repeat
Until KeyDown( KEY_ESCAPE ) or AppTerminate()



cermit(Posted 2011) [#3]
Wow, that's great. I didn't know about AppTerminate(), thank you very much!


cermit(Posted 2011) [#4]
It seems I'll need MaxGUI for retrieving and setting mouse position and have to go with a PollEvent/WaitEvent either way. Still happy to know about AppTerminate() though.

I want to hide the mouse and constantly set its position to the center of the screen to use it for turning the camera. (This is both for window and fullscreen)

I'll be searching for more examples on PollEvent and SetMousePosition() (or whatever the command is) but would be very happy if anyone could show me an example on how to do the above.


Nevermind, forgot the commands I needed are:
MoveMouse( ) and HideMouse( )

This is all I need, thanks again.

Last edited 2011