Handling Window Events With Custom Fps Control
Posted 05 March 2010 - 12:51 PM
I made custom FPS control for my game. (Please do not comment on that. I wanted and I did it. Its not the case here.)
I have a function game_wait() that does some events I desire and then run sleep() until the end of a frame.
The only problem with it is that the game no longer handles window events (Esc, closing, alt+F4, etc.) as my game runs my function in a loop.
I could of course just add to my function checking for all the important combinations e.g. "if (keyboard_check(vk_alt) && keyboard_check(vk_f4) ) game_end();" but I was hoping for a different automatic way.
Is there anything I can do to tell the game to run window events itself e.g. with a single call of built-in function? Maybe with a DLL? Anyone got any idea?
Posted 05 March 2010 - 04:51 PM
That wasnt my problem. I know how to write a GML code to handle window events and make it work.
What Im looking for is function (or something) that will handle everything without me having to specify exact key combinations and checks.
Posted 05 March 2010 - 07:05 PM
There is no built-in gm function for that.
I'm sure someone could create some dll to hack into the runner and reroute io_handle to also handle those keys, but that's a lot of effort, for something that's easy to do.
Posted 05 March 2010 - 07:52 PM
Im just a little worried coding it myself.
Im not sure if I remember right but wasnt there some way to disable key combinations for applications in Windows?
Id just feel safer using default window handling call rather than hard coding it in my game.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users