[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

penguin-input, keyboard configuration, abstract mice




(This message is destined to penguin-input, but I couldn't find it's
 mailing list, odd..)

If this was already settled somewhere, I'm really sorry about my
ignorance.

I was just adding a theme-support to one of my projects, and I
just thought about this, which would make additional mice useful, and
absence of them wouldn't affect anything.

Of course you may think THIS is useless, but I think it's great.

It works like this; a game tells us first what it needs, and then the
input mechanism delivers. There are six kinds of events which a app can
request:

click-event
	Any kind of device which can generate a click.
	Usually a keyboard, mouse or joystick button.


We already have already made all buttons look equal!
This could be divided into button-press and button-release.

About slider-events: (things common to aslider & rslider)
	Slider events can be bound to mouse, keyboard and joystick
	alike, althought aslider is best suited to mouse.
	Sliders have the special property that they return some kind
	of indication of velocity or force. This can be simulated with
	a keyboard, but more about that below.


rslider-event ("relative slider")
	This is useful for any kind of movement in 3D space.
	Once requested, these events report how much it has moved
	either to right (+) or left (-).

	With the mouse this is trivial as one can just report the
	mouse-generated events, but with joysticks and keyboards
	some emulation is needed.

	With joysticks one possible implementation could be to read the
	joystick position every x milliseconds and use that value in the
	event.

	Keyboards could operate in two different modes (user selectable?) 
	accelerated and	linear. Here too one way to implement this could
	be to check every y milliseconds while a key is held, and report
	some predefined value as the delta. The other, accelerated, way
	would be to increase that value for every successive check that
	the key is held. Simple stuff.
	Of course, keyboards need two buttons for this, but another way
	would be to have four buttons like "HJKL" and have "JK" move
	slowly to right/left and "HL" to move fast.

	Look below in the example for how these are used.
	

aslider-event ("absolute slider" or "cumulative relative slider")
	This is an extension of rslider-events suitable for pointers.
	Instead of reporting how much the slider has moved, it reports
	how much it has moved from the original spot.
	This slider needs to be set bounds.

	I discourage the use of this (in my project, but for pplay this
	may not be the case).


global-click-event
global-aslider-event
global-rslider-event
	These three are exactly like the above "non-global" events.
	The only exception is that "non-global" events are per-player,
	and these are per-machine.


Here's an example extracted from my original documentation. Sorry it's in
Scheme... Do not worry about the extra numbers at the end :)

(This is for sliders)
  EXAMPLE:
        ;; Implements a per-player mouse pointer
        (add-aslider-event "aim left/right" 11)
        (add-aslider-event "aim up/down"    12)

        ;; This one is for game controls (640x480 resolution)
        (set-aslider-bounds 0 639
          (add-global-aslider-event "pointer left/right" 23))
        (set-aslider-bounds 0 479
          (add-global-aslider-event "pointer up/down"    24))

        ;; Now we'll do some descent-like navigation
        (add-rslider-event "turn left/right"    13)
        (add-rslider-event "turn up/down"       14)
        (add-rslider-event "slide left/right"   15)
        (add-rslider-event "slide up/down"      16)
        (add-rslider-event "forward/backward"   17)

        ;; Now this is meant for those with lots of mice
        ;; Of course it has to be used with keyboard-only play,
        ;; but this would be something with a mouse
        (add-rslider-event "scroll map horizontal" 25)
        (add-rslider-event "scroll map vertically" 26)


(This is for click-events)
  EXAMPLE:
        ;; Allows a key mapping such as:
        ;; space        fire primary weapon             (tag 1)
        ;; alt          fire concussion missile         (tag 3)
        ;; X            fire secondary weapon           (tag 2)
        ;; Z            select next primary weapon      (tag 4)
        ;; C            select next secondary weapon    (tag 10)
        ;; 1-5 (option) select primary weapon directly  (tags 5-9)

        (add-click-event "fire weapon" 1 2 0)
        (add-click-event "concussion missile" 3 1 0)
        (add-click-event "cycle primary" 4 1 0)
        (add-click-event "select primary weapon" 5 0 5)
        (add-click-event "cycle secondary" 10 1 0)
        (add-click-event "remote detonate" 22 1 0)

        ;; Now some global click events
        (add-global-click-event "pause game" 18)
        (add-global-click-event "save game"  19)
        (add-global-click-event "load game"  20)
        (add-global-click-event "end game"   21)