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
local UserInput = game:GetService("UserInputService")
UserInput.InputBegan:connect(function(Object)
if Object.UserInputType == Enum.UserInputType.Focus then
print("Gained focus of something")
end
end)
UserInput.InputEnded:connect(function(Object)
if Object.UserInputType == Enum.UserInputType.Focus then
print("lost focus of something")
end
end)
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.
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.