How can I detect when a user have closed a window created with GLUT? Otherwise GLUT will keep working in the background. Is there any multiplatform solution?
Thanks in advance!
How can I detect when a user have closed a window created with GLUT? Otherwise GLUT will keep working in the background. Is there any multiplatform solution?
Thanks in advance!
I took the code from Phoenix as a working example. Here's what you need:Or:Code:glfwGetWindowParam(GLFW_OPENED) = 1Code:repeat // Main loop here.. until glfwGetWindowParam(GLFW_OPENED) <> 1;
Annother solution would be SimpleDirectmediaLayer (SDL)
-> www.libsdl.org
Robert, that paramether is very helpful, thanks! About the second code, I had the idea it was not possible to use your own loop, instead GLUT requires using its events... how do you initialize GLUT to run your own loop?
waran, I'm trying not to use SDL, it would be another library to learn and integrate and I have had enough with DX and GLUT
Thanks!
Hey, FPC can't find the glfwGetWindowParam() function. I placed gl, glu and glut in the uses clause. In which unit is it located? :?
The unit you need is glfw and I think it's a default in the distribution of FPC. Else you can get it here. And basically from there all you do is event snoop. Try looking at Phoenix's phxScreen unit for insights into how Andreaz does it; best method I've seen yet and MPL licensed (free for commercial use). Or you could always make your own unit to handle the window management.
Robert, glfw can't be used since cronodragon probably uses glut for window management
Cronodragon, instead of using glut then use glfw. I find it to be far easier to work with
Peregrinus, expectavi pedes meos in cymbalis
Nullus norvegicorum sole urinat
Oh ok, thanks! GLFW looks so cool, I'm checking the reference. It also allows threads, that's what I wanted in the first place!
Does someone have glfw.dll? The download doesn't bring it, I don't know how to compile it (seems to require some sort of C compiler), and I can't find one that works in Internet :cry:
Lessee if mine works for you. This DLL is for the 2.5 API version, so I included the same version header unit just in case it differs from the latest.
http://thewickedflea.freepgs.com/glfw.zip
Bookmarks