XMLGameEngine is a VGDL (video game description language) and an engine for running games completely contained within an XML file.
Keys are bound in states, never in objects. An object names what it can do; a state binds a key to that name:
<object name="paddle1">
<actions>
<action name="up"><move direction="up">step</move></action>
</actions>
</object>
...
<state name="playing">
<inputs>
<input><button>w</button><button>up</button><trigger object="paddle1" action="up" /></input>
</inputs>
</state>
So remapping a key is one edit in one state, a key can do different things in different states, and one action name can mean different things on different objects.
button="w"; several keys for the same commands are a <button> each, first.a-z, num0-num9, numpad0-numpad9, f1-f15, space, enter, escape, backspace, tab, left, right, up, down, home, end, pageup, pagedown, insert, delete, pause, lshift, rshift, lcontrol, rcontrol, lalt, ralt, and a few more in engine/keys.cpp.mouse.left, mouse.right, mouse.middle; for two pads pad1.a, .b, .x, .y, .lb, .rb, .back, .start, .up, .down, .left, .right (and pad2.), named for an Xbox pad. A pad’s directions are its d-pad or its left stick past halfway.<keys> set at the top of <states>, taken with <inputs keys="walk"> (several: a <keys>walk</keys> each). The state’s own inputs go over the set’s, key by key.on= picks which moment an <input> answers:
on= |
Runs its commands |
|---|---|
press (or left out) |
as the key goes down; held verbs (<move>, <accelerate>, <thrust>, <turn>) stay on until it is let go |
hold |
every frame while it is down, each time as one press |
release |
once, as it is let go |
<input button="space" on="hold"><trigger object="arrow" action="charge" from="ready" /></input>
<input button="space" on="release"><trigger object="arrow" action="putt" from="ready" /></input>
<input>.hold and release answer only a press made in the current state: Space held from the title into the game neither charges nor strikes.<inc> adds power and a <smallest> keeps it at 100; let go, a <set> gives the ball its speed.<input axis="mouse.x"> (or mouse.y, pad1.x, pad1.y, pad2.x, pad2.y) runs its <trigger> whenever that control moves, and a <track /> in the action puts the object where it points: its middle at the mouse, or as far across as the stick is pushed, kept in the window. That is the Atari’s paddle controller.
<action name="steer"><track /></action>
...
<input axis="mouse.x"><trigger object="bucket" action="steer" /></input>
<trigger>s, in a state’s own <inputs>. A trigger’s from= look is kept.xgegui’s own window) reads the mouse only.<move> records its direction’s step while down. On every key change the velocity along that axis is worked out from both directions, so Down held and Up tapped cancel, and two axes make a diagonal. A key on one axis leaves the other alone: walking does not stop a fall.<accelerate>, <thrust>, <turn> are held the same way but add each frame, so what was gained stays when let go. <drag> gives thrust a top speed.<hop>, <jump>, <leap>, <fire>, a state change) run only on a real press. Two hops in one frame keep the later.<facing> faces the last key’s way; with keys of both axes held, the diagonal, and a <fire> follows it.