Page 1 of 1
way to make the window forcefully open?
Posted: Tue Sep 12, 2017 8:16 am
by slickytree
im trying to make some kind of window that doesnt close no matter what you do unless you hold a certain button.
is there some kind of love function that makes the window forcefully open by itself or is it just not possible?
code i have so far:
Code: Select all
love.window.setFullscreen(true)
local t = 0
function love.update(dt)
if not love.window.hasFocus() then
-- ??
end
if love.keyboard.isDown('g') then
t = t + dt
if t > 1 then
love.event.quit()
end
end
end
function love.keyreleased(key)
if key == 'g' then
t = 0
end
end
Re: way to make the window forcefully open?
Posted: Tue Sep 12, 2017 8:45 am
by grump
It's not possible to make a window that doesn't close "no matter what you do". You could probably make it harder than usual with some ffi trickery. But it would be system dependent, and frankly. it sounds pretty much like asshole design. Nobody wants a program that behaves like that.
Re: way to make the window forcefully open?
Posted: Tue Sep 12, 2017 12:07 pm
by slime
You can use the
love.quit callback to prevent the game from quitting when certain conditions are met, and
love.event.quit to cause the game to quit.
Re: way to make the window forcefully open?
Posted: Tue Sep 12, 2017 12:21 pm
by slickytree
grump wrote: ↑Tue Sep 12, 2017 8:45 am
It's not possible to make a window that doesn't close "no matter what you do". You could probably make it harder than usual with some ffi trickery. But it would be system dependent, and frankly. it sounds pretty much like asshole design. Nobody wants a program that behaves like that.
yes, i agree that it's a bad design if it's a game of some sort. im using it for myself because some of my siblings peak my pc while im off doing something else. i just use love2d for some childish stuff nowadays tbh lol
slime wrote: ↑Tue Sep 12, 2017 12:07 pm
You can use the
love.quit callback to prevent the game from quitting when certain conditions are met, and
love.event.quit to cause the game to quit.
thanks that helps
Re: way to make the window forcefully open?
Posted: Tue Sep 12, 2017 1:15 pm
by zorg
Using both love.quit and having a borderless window may help; no buttons -> no os-specific exit button.
Re: way to make the window forcefully open?
Posted: Tue Sep 12, 2017 2:05 pm
by grump
slickytree wrote: ↑Tue Sep 12, 2017 12:21 pmyes, i agree that it's a bad design if it's a game of some sort. im using it for myself because some of my siblings peak my pc while im off doing something else. i just use love2d for some childish stuff nowadays tbh lol
It might be enough to prank a bunch of kids. But you said "no matter what you do", and there's no easy way you can prevent someone from opening the task manager or a console and just kill your process. There's also simply Alt-Tab, I don't know if that can be intercepted from a love app.
They only fool-proof "no matter what you do" thing is the lock screen feature of your OS. Or maybe you could install your love app as a password protected screensaver.