Darkstar2
|
|
Posted on: May 12, 2014, 10:34:10 pm |
|
|
Joined: Jan 2014
Posts: 1238
|
The event other -> game end does not work. I placed code in game end event display_set_size(800,600); just for testing...... When starting game in obj create I use HD 1080, it sets it fine, but when game ends it stays at the game's resolution, so the code in game end event is not executed. game start / game end and room create don't work. A temporary solution I would use until it is fixed is creating a controller obj, setting an event destroy code to change back screen resolution and game end. And in a game where that controller obj is called to be destroyed game will end and display resolution changes back. Only problem this won't work if user attempts to exit game by ESC or other means so have to disable exit keys (not practical).
|
|
« Last Edit: May 23, 2014, 07:08:45 pm by Darkstar2 »
|
Logged
|
|
|
|
Josh @ Dreamland
|
|
Reply #1 Posted on: May 17, 2014, 09:16:31 am |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
I never liked how Windows handles screen resolution changes. Any game can change your display to any size, regardless of whether your monitor even reports support for it. Then Windows doesn't take responsibility for restoring it when, say, the game ends or crashes. Anything we do to restore the resolution is just going to fail in certain cases. Really, our only good way of handling it is to throw a global in to keep track of the original display size, throw a global boolean in to denote whether the resolution was changed (and should be restored to this), and then have the display_set_size function do this:
if (!display_size_changed) { display_size_set = true; display_original_width = display_get_width(); display_original_height = display_get_width(); } Then at the end of WinMain, [snip=cpp]if (display_size_changed) display_set_size(display_original_width, display_original_height);[/snip].
I would ask a Windows maintainer to do this, as I can't test if I make this change.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
TheExDeus
|
|
Reply #2 Posted on: May 17, 2014, 10:25:44 am |
|
|
Joined: Apr 2008
Posts: 1860
|
The OP is about Game End not working though. And I just tested it and it really seems to be the case. So game_end() event is never called for now. In code it seems we haven't implemented it as it would need to be called in several places (like callback in response to WM_CLOSE). Someone should add that. I made a ticket: https://github.com/enigma-dev/enigma-dev/issues/722
|
|
« Last Edit: May 17, 2014, 10:29:37 am by TheExDeus »
|
Logged
|
|
|
|
Josh @ Dreamland
|
|
Reply #3 Posted on: May 17, 2014, 11:41:10 am |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
If game_end() is just calling abort(), or exit(0), we have a problem. It should be posting WM_QUIT, which will allow control to reach the end of WinMain.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
daz
|
|
Reply #4 Posted on: May 17, 2014, 11:48:37 am |
|
|
Joined: Jul 2010
Posts: 167
|
If game_end() is just calling abort(), or exit(0), we have a problem. It should be posting WM_QUIT, which will allow control to reach the end of WinMain.
Under Windows, it uses PostQuitMessage ( http://msdn.microsoft.com/en-us/library/windows/desktop/ms644945(v=vs.85).aspx ) Excerpt: The PostQuitMessage function posts a WM_QUIT message to the thread's message queue and returns immediately; the function simply indicates to the system that the thread is requesting to quit at some time in the future.
|
|
|
Logged
|
|
|
|
|
|
Josh @ Dreamland
|
|
Reply #7 Posted on: May 17, 2014, 01:07:15 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
All that has to happen for that is someone iterating over the instances, calling myevent_game_end, after the WinMain loop finishes.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|
Josh @ Dreamland
|
|
Reply #9 Posted on: May 18, 2014, 09:32:44 am |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
If the game end events are performed during the call in GM, our answer's pretty obvious. But that'd mean that calling game_end in the game end event is yet another caveat.
Not that we've had something like that before. *cough* screen_redraw *cough*
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|
Darkstar2
|
|
Reply #11 Posted on: May 23, 2014, 03:53:08 pm |
|
|
Joined: Jan 2014
Posts: 1238
|
As of now the game_end event is still broken and does nothing.
More so the update made things very unstable (game crashing), etc. even after a clean install, wiped temps, wiped programdata.
This latest update completely fucked everything up, nothing displays, as someone else reported.
I have sprites that I placed in the room they don't show, everything is invisible.
|
|
« Last Edit: May 23, 2014, 04:34:33 pm by Darkstar2 »
|
Logged
|
|
|
|
Goombert
|
|
Reply #12 Posted on: May 23, 2014, 04:36:27 pm |
|
|
Location: Cappuccino, CA Joined: Jan 2013
Posts: 2993
|
Yes it was a few simple typos, the fixes are in a pull request already, but Josh has to review it first. https://github.com/enigma-dev/enigma-dev/pull/732
|
|
|
Logged
|
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.
|
|
|
Darkstar2
|
|
Reply #13 Posted on: May 23, 2014, 05:47:09 pm |
|
|
Joined: Jan 2014
Posts: 1238
|
Not only does game_end event does not work but also nothing gets drawn, even if I delete the draw event. By putting draw_self() alone in draw event makes the sprites visible, but never had to do this before, when there is no other code in draw. Hope I didn't open a can of worms lol ! //update: Ok I applied the changes and tested, now the sprites display and I don't have to use the draw_self even in an empty draw event. Now I'm off to try game_end
|
|
« Last Edit: May 23, 2014, 06:09:30 pm by Darkstar2 »
|
Logged
|
|
|
|
|
|