Window API

Being able to detect if the Roblox Player window is Minimized, FullScreen, LostFocus, etc etc
would be a valuable asset.

Side note, anyone know if there’s a way currently to detect if the window is minimized? (other than using TextFits hack)
some uses:

If minimized, TextFits works like poop because… the window is minimized so it has no idea if the text fits
pause menus would be good too if you lost focus
even just showing an afk dialog for players who are out of focus


You could try to find a way to see if the mouse is on the screen. I’m not even sure if that would work, though.

Check the dimension of the display? (With GUIs and I think you can do it with a mouse).

Doesnt update when minimized


Focus also works with things other than textboxes

	local UserInput = game:GetService("UserInputService")
		if Object.UserInputType == Enum.UserInputType.Focus then
			print("Gained focus of something")
		if Object.UserInputType == Enum.UserInputType.Focus then
			print("lost focus of something")

I’ve heard you can determine if the window was minimized based on whether or not RenderStepped is firing.

This is also true

Happens with the window losing focus as well…

RenderStepped doesn’t fire on minimize? that’ll create some really weird glitches for my game, thanks for telling me :open_mouth:

Happens with the window losing focus as well…[/quote]

there’s a UserInputService thingie for focus, my game uses it

Yeah, don’t use RenderStepped for things that aren’t directly tied to render frames.

After all, that’s what what the event does, fire when the game goes to render a frame, and it doesn’t need to render when minimized. The game also renders at a lower frequency in some scenarios, such as when it’s not the focused window, so you can’t rely on it to fire at a constant frequency. Basically all you should use RenderStepped for is updating User Input state such as the camera / handling keyboard controls, and for updating non-physical detail effects.

And on the actual topic:

This is not a good idea. Having such an API encourages platform specific nonsense that makes your game break on unexpected platforms. Sure, you can put such an API to good use, but it’s a breakage of your game waiting to happen when the Roblox Player is ported to another platform or whatever that has slightly different behavior in that area.

Detecting Not/Focused is as far as an API in that area should go. You’re controlling the game or you aren’t, other details about the Roblox Player status should be irrelevant to how your game functions.

1 Like