"Questions that don't deserve their own thread" thread
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: "Questions that don't deserve their own thread" thread
what's the difference beetwen particle and shaders effect ?
Re: "Questions that don't deserve their own thread" thread
So, I have no idea if this was asked already somewhere and honestly, I don't even know if it's my system, love, or plainly me.
So, take this code: (sorry for the moon)
Simple enough right?
The problem I have is that, when I now press space (or any button really) for a bit longer, it will work correctly for the time I have space down, then, when I release it, it will still register as isdown for a while, however quickly switching around between down and up (as if I would press the key really really quickly). The longer I keep the key down, the longer the repeat is happening afterwards.
Any ideas of what's happening? Shouldn't, as soon as I release the key, grab_mode be false? What am I missing?
(I'm on Linux btw.)
(I also have tried a version with on love.keypressed -> grab_mode = true / love.keyreleased -> grab_mode = false with the same phenomena)
So, take this code: (sorry for the moon)
Code: Select all
love.draw = ->
if grab_mode
g.print "Grab Mode", 10, 40
grab_mode = false
love.update = (dt) ->
if k.isDown "space"
grab_mode = true
The problem I have is that, when I now press space (or any button really) for a bit longer, it will work correctly for the time I have space down, then, when I release it, it will still register as isdown for a while, however quickly switching around between down and up (as if I would press the key really really quickly). The longer I keep the key down, the longer the repeat is happening afterwards.
Any ideas of what's happening? Shouldn't, as soon as I release the key, grab_mode be false? What am I missing?
(I'm on Linux btw.)
(I also have tried a version with on love.keypressed -> grab_mode = true / love.keyreleased -> grab_mode = false with the same phenomena)
Re: "Questions that don't deserve their own thread" thread
They are completely different.paul54000 wrote:what's the difference beetwen particle and shaders effect ?
Particles are sprites that Löve controls according to the parameters you give. Try e.g. APE to edit them (there was another recent particle editor but I don't have the URL handy)
Shaders are OpenGL-based programs that you write in GLSL ([open]GL Shader Language).
See http://blogs.love2d.org/content/beginners-guide-shaders for an introduction to one of the kinds of shaders.
Re: "Questions that don't deserve their own thread" thread
Sorry for the double post. This thread kind of invites it.
How many FPS does your program have? Does disabling vsync help?
Sounds like auto-repeat goes faster than your frame rate, and the events keep piling up in the event queue. I don't know why that happens; I would have said that all pending events should be processed at once every frame.partnano wrote:The problem I have is that, when I now press space (or any button really) for a bit longer, it will work correctly for the time I have space down, then, when I release it, it will still register as isdown for a while, however quickly switching around between down and up (as if I would press the key really really quickly). The longer I keep the key down, the longer the repeat is happening afterwards.
Any ideas of what's happening? Shouldn't, as soon as I release the key, grab_mode be false? What am I missing?
How many FPS does your program have? Does disabling vsync help?
- Positive07
- Party member
- Posts: 1014
- Joined: Sun Aug 12, 2012 4:34 pm
- Location: Argentina
Re: "Questions that don't deserve their own thread" thread
Why aren't you using [wiki]love.keypressed[/wiki] and [wiki]love.keyreleased[/wiki] which are actually triggered on pressing and release? They are there so that you can easily switch state.
[wiki]love.keyboard.isDown[/wiki] is there for things that are updated constantly like player movement which doesn't really change abruptly with the state of the key.
Still as pgimeno said, you may still have problems if the repeat is too high, or vsync interferes, or a frame takes too much time. Put [wiki]love.keypressed[/wiki] and [wiki]love.keyreleased[/wiki] should be called for each event... so you shouldn't find problems there
[wiki]love.keyboard.isDown[/wiki] is there for things that are updated constantly like player movement which doesn't really change abruptly with the state of the key.
Still as pgimeno said, you may still have problems if the repeat is too high, or vsync interferes, or a frame takes too much time. Put [wiki]love.keypressed[/wiki] and [wiki]love.keyreleased[/wiki] should be called for each event... so you shouldn't find problems there
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
- zorg
- Party member
- Posts: 3468
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: "Questions that don't deserve their own thread" thread
Unless you're creating a typing game (and imo even then) i'd recommend disabling keyrepeat, because it's horrid for a game; just code it yourself (set a key to true in love.keypressed, false in love.keyreleased, and in update, check the state and do stuff with it; should work fine), and then the OS's one won't interfere with yours.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Re: "Questions that don't deserve their own thread" thread
First off, thanks for the replies!Positive07 wrote: Still as pgimeno said, you may still have problems if the repeat is too high, or vsync interferes, or a frame takes too much time. Put [wiki]love.keypressed[/wiki] and [wiki]love.keyreleased[/wiki] should be called for each event... so you shouldn't find problems there
Yeah, apparently my auto-repeat is a bit too fast for the event queue...
However, I got the same problems with keypressed/keyreleased (tried the exact version you mentioned as well with the same problems)
Is there a way to turn off the OS auto-repeat for love? All I could find was love.keyboard.setRepeat, which should be off by default, as far as documentation says.
With vsync off it kinda works, but then (both versions, keypressed/keyreleased) the key doesn't register consistently and flickers off every few frames, which is kinda strange as well?
By now I'm mainly curious of what's happening, I can obviously work around it...
Re: "Questions that don't deserve their own thread" thread
That kind of sounds as if your keyboard driver is for some reason sending keypressed/keyreleased events on every key repeat. Can you add a counter that counts the keyreleased events when you hold a key pressed, and tell us if it increases?partnano wrote:With vsync off it kinda works, but then (both versions, keypressed/keyreleased) the key doesn't register consistently and flickers off every few frames, which is kinda strange as well?
By now I'm mainly curious of what's happening, I can obviously work around it...
By the way, this question did deserve its own thread. I'll ask the moderators if it can be split.
Re: "Questions that don't deserve their own thread" thread
Well, it most definitely has something to do with the keyrepeat, both keypressed and keyreleased counters stay the same, they are both increasing while I'm holding down the key (shouldn't they both just trigger once on one keypress?) and both continue to increase for a while after releasing the key as well, in the same speed as when holding the key.pgimeno wrote:That kind of sounds as if your keyboard driver is for some reason sending keypressed/keyreleased events on every key repeat. Can you add a counter that counts the keyreleased events when you hold a key pressed, and tell us if it increases?
Welp, didn't think this would be such an .. issue haha
I'll keep it here for now, unless a separate thread really is requested?
Re: "Questions that don't deserve their own thread" thread
Yes, normally only keypressed increases while you hold the key, and keyreleased only does when you release it. And then keypressed only gets repeats when you set love.keyboard.setKeyRepeat(true). Something's fishy with the keyboard driver. Or maybe with the keyboard itself. What's your CPU? ia32? ia64? Others? What distro? What's your keyboard model? Are you using xkb?
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 10 guests