Jump to content

alt+tab crashing


drarem
 Share

Recommended Posts

When i create a FPS template, open up the 01 FPS controller sample, then change it to fullscreen and run it. I hit Alt-Tab and it crashes. What is going on, or is there a work around?

 

I'm thinking anywhere from somehow hiding the title bar and container, to maybe hooking the alt-tab in a key event, changing it to non full-screen so it can alt-tab safely.

 

Help please?

 

thanks.

Link to comment
Share on other sites

Windows 10 right? Because with Win8.1, I did not have this issue. It also happens when you call window->minimize in C++, but it's more noticeable when you alt-tab from fullscreen mode even if you pause the world like this:

 

 // Check to see if the window is active.

// Pause the game if it's not.

if (window->Active())

{

// Update the world.

world->Update();

}

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

In the default script, you can use -fullscreen launch option to enable fullscreen. But yeah, I feel that the issue is when the window is minimized as alt-tabbing in windowed mode does not crash, but alt-tabbing from fullscreen does, which Windows auto minimize the window.

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

Okay, the quick fix is to do check to see if the window is minimized and skip rendering if it is:

	--Render the world
if window:Minimized()==false then
	world:Render()
end

 

You should also add this check in the FPS player script so the game doesn't take control of the mouse when its minimized:

	--Mouse look
self.currentMousePos = window:GetMousePosition()
if window:Minimized()==false then
	window:SetMousePosition(Math:Round(context:GetWidth()/2), Math:Round(context:GetHeight()/2))
end

 

I will add a built-in check in the engine as well.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Doing so will prevent additional code in scripts such as a check for preventing the mouse locking to the center when minimized Also, I'd make sure it flushes any keys and mouse clicks before the world gets unpaused.

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...