![]() |
AVS joystick control
A short while ago I came across winstick. A program to control your winamp with a joystick.
I saw it mimicks keyboard keys, which gave me the idea it could be used to control AVS. I have worked out a little scheme, a list how to set it up and a test.avs. Klique here. I hope at least some of you have a gamepad. Well, check it out and tell me what you think. |
with open source avs we might be able to add a good joystick/gamepad support which would eliminate the need to share the keyboard with winamp
|
I tend to believe that priority on open source AVS is and should not be joystick input. For real multi-tasking however it seem inevitable. One should be able to type and control AVS with a joystick at the same time
Until it happens the keyboard still has plenty of keys left. Maybe not enough to use whole a second controller, but one could give up some winamp hotkeys. For now it works. I wonder however if any AVS-user has either a logitech dual action or sidewinder. |
I only recommended it because it has the look of a 10 minute job (not literally... read 'only needs small code changes') and would be very useful for making avs games. (the main thing always putting me off is the bad keyb support)
|
The highly responsive keyboard is annoying.
You made me think and here is an improvement. q1=band(q2,(getkbmouse(79))); q2=bnot(getkbmouse(79)); if(equal(q1, 1), assign(q3, q3+1), 0); reg01=(q3|0)&1; Now reg01 goes on and off by pressing o. I've worked it out in the new example file, which can be found here. Thanks for making me think. |
my method:
code: I used this in Oil Grease Is Not Black in Preset Pack 2. I wanted to attach it, but you can't attach presets in edit mode anymore. I hate doubleposting so I'll post a link to PP2 instead.. http://www.deviantart.com/download/12533150/ |
i normally stick with something simpler like this:
code: pressedonce is 1 the frame that the user first pushes the key down and is otherwise 0. also for doing time independant moves (i.e. a quake style camera walk) use: code: again, short and sweet :) |
Quote:
|
wouldn't this even be a bit faster:
? 'pressedonce' is 1 during the frame you press the key, from the following frame on it's 0 again.code: Well, atleast that's what i always use... |
Its debateable which would be faster (I'd guess at mine by a few clock cycles), but the difference would be slim anyway.
2 assignments + 2 getkbmouse + band + bnot against 3 assignments + 1 getkbmouse + below speed isnt that much of an issue... i just wanted to point out a tidier solution rather than a faster one. none of this code is particularly slow or time critical. |
counter
So a on/off switch could be this counter with an &1 added to it.
orcode: Nice. Or are there even better ways to do this?code: |
Avoid using those ifs when you dont need to.
counter = if(below(oldg,g),counter+1,counter); could be counter = counter + below(oldg,g); which is better as it avoids the if which is slower than the + anyway, so dodging the + with if isnt a speed boost. Whats the & 1 for? you want it to toggle from 0 to 1? I'm not sure if its faster but I think it is tidier to use: code: I'm not sure but I think & and | are pretty slow 'cos of rounding to int, likewise %, floor etc. The %2 can be replaced by &1 if it is faster... The other thing is that this can be expanded to 'toggle' between 0,1,2 or 0,1,2,3 and so on, by changing the final %2 for %3 or %4 etc... very useful for complicated menus. The most comprehensive menu I have released on a preset is on this one: http://www.deviantart.com/deviation/13908660/ Although its prolly full of bad coding practice, as all presets are, it shows some of this in use, like the color switchers and click buttons etc. |
Thanks for the +-instead-of-if tip. Never looked at it from this angle.
Quote:
I'm not sure either, but the difference between | & and % seems negliable (and the numbers used are integers already, I'd guess that it shouldn't take long to recognise). The extended 'toggle' is an advantage, though. I was thinking about making something like a menu for the joystick control, so you'd see what you're doin, your example will be a great help. :) |
A menu is rather irritating actually, so I dismissed it.
Made a little avi in which i use my gamepad. Except for reencoding it to 3ivX, it's all AVS. Reactions appreciated. |
firstly. the video is huge.
secondly. why not post the avs preset and ape or whatever? I'll give you another reply in 3 minutes when i have finished downloading your huge video. -------- It uses Winstick? Thats so useful... a prerequisite for an avs preset that can be nicely wrapped into an installer .exe and requires no effort from the user. Joystick presets are the way to go!!! ¬ Seriously though, its pretty cool, but for reasons outlined above, not practical for an avs pack. I guess its awesome for VJ'ing though. |
Thanks for your comment.
Quote:
Quote:
Quote:
But indeed an installer would be nice. I don't think it's impossible. Quote:
Though, the xbox360 will get a gamepad controlled visualizer, called lightsynth, which might change things. I guess you don't want to download there videos. Quote:
|
yeah. glad you appreciated the humour and didnt take offense :)
any file > 500k is huge on dialup i'm on 1meg and that took a long time to dl. and for that short a video... that is pretty huge, and not even at a justifyable quality. i have videos of episodes of tv series that big or smaller :) and not just cartoons. anyway, this does look cool. its just a shame there isnt inbuilt joystick control... if avs was really open we could add it :) |
another improvement for avs! mpeg's/other types of non-M$ video file formats!!! :D
|
| All times are GMT. The time now is 22:16. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.