Difference between revisions of "The Zandalar project"

From CEGUI Wiki - Crazy Eddie's GUI System (Open Source)
Jump to: navigation, search
(Input Aggregator & events)
m
Line 116: Line 116:
 
* injectMouseLeaves
 
* injectMouseLeaves
  
== Original proposition ==
+
= GUI navigation =
a keyboard and mouse. This will imply changing much (if not all) of the existing input architecture.
+
== Use cases ==
 
+
=== Navigate between a set textboxes ===
: injectMouseDown, injectMouseUp), but rather `Input Events`. An `InputEvent` is the basic input unit CEGUI will use, and that is generated from raw input. The input event is a basic POD class (just like the current EventArgs) that contains different information based on where it came from and from what raw input it was generated.
+
Prerequisite: first textbox is focused
 
+
* Press `Tab`
Some examples of input events are:
+
* The next textbox is focused
* MovementInputEvent
+
**  Generated from mouse x/y
+
**  Generated from joystick/thumbstick x/y
+
* PressedInputEvent
+
**  Generated from mouse button
+
**  Generated from keyboard button
+
**  Generated from a gamepad button
+
+
 
+
One can see that this solution leads us to allow a variety of input to be mapped to certain input events. Of course, each different input event will have some specific payload (the button pressed, the x/y coordinates of the movement, etc.).
+
 
+
The user can create new input events inside his custom controls as he sees fit, and just creates handlers for them, and they will be called accordingly by our system in a transparent way.
+
 
+
+
 
+
+
 
+
At the end of the day, the samples that exist now should work (from the functionality point of view) the same way after the input system is replaced.
+

Revision as of 06:27, 9 July 2013

The Zandalar Project is a codename for the new Input archtecture and GUI navigation features.

Input Aggregator & events

Use Cases

The use cases are described by steps. For each step there might be some actions done at different levels:

  • Raw input = the data that comes directly from the input system the application is using (OIS, glfw, etc.).
  • Input Injection = the `InjectedInputReceiver`-ish function called with the right parameters
    • For backwards compatibility-ish, we can persist the same interface(InjectedInputReceiver), but provide in it a default implementation that generates the input events for the current interface's functions.
  • InputEvent = the `InputEvent` type generated from the injected input. This is the final step, and this is fed to the CEGUI library.

Clicking a button using a mouse

Step description Raw input Input Injection InputEvent fed to CEGUI
Move the mouse over the button Mouse movement injectMouseMove/injectMousePosition MovementInputEvent
Press the LMB Mouse button press injectMouseButtonDown(LMB) PressedButtonInputEvent(Mouse_LMB)
Release the LMB Mouse button release injectMouseButtonUp(LMB) ReleasedButtonInputEvent(Mouse_LMB)
The button is clicked (Click event is triggered) N/A N/A N/A

Clicking/activating a button using the keyboard (new feature)

Step description Raw input Input Injection InputEvent fed to CEGUI
Focus the button Uses the use case "Focus a button using the keyboard/gamepad"
Press the ENTER key (1) Key Button press injectKeyDown(Enter) PressedButtonInputEvent(Keyb_Enter)
Release the ENTER key Key Button release injectKeyUp(Enter) ReleasedButtonInputEvent(Keyb_Enter)
The button is clicked (Click event is triggered) N/A N/A N/A

(1) the key will be defined as per the NavigationStrategy (GUINavigation project part). If there is no such key defined, the event will be ignored.

Clicking/activating a button using a gamepad

The same as previous Clicking/activating a button using the keyboard, but with the difference that it uses a Gamepad button instead of a Keyboard one.

Type text into a textbox

Step description Raw input Input Injection InputEvent fed to CEGUI
Focus the textbox Uses the use case "Focus a textbox using the keyboard/gamepad"
Press a character key Char press injectChar(chr) TextInputEvent(chr)
Press a non-character key Key Button press injectKeyDown(key) PressedButtonInputEvent(Keyb_key)
Release a non-character key Key Button release injectKeyUp(key) ReleasedButtonInputEvent(Keyb_key

Scroll horizontally with the mouse wheel

Step description Raw input Input Injection InputEvent fed to CEGUI
Rotate the wheel Wheel rotation delta injectMouseWheelChange(delta) ScrollInputEvent(direction, delta)

Focus a button using the keyboard/gamepad

TODO - This should go into the GUI Navigation part.

Proposed design

Events

For start, the following events will cover all existing functions in the 'InjectedInputReceiver' interface:

Input Event name Data Functions covered
MovementInputEvent
  • Position : Vector2
  • Delta : Vector2
  • injectMouseMove
  • injectMousePosition
PressedButtonInputEvent
  • Button : Buttons Enum/integer or long for maximum flexibility
  • injectMouseButtonDown
  • injectKeyDown
ReleasedButtonInputEvent
  • Button : Buttons Enum/integer or long for maximum flexibility
  • injectMouseButtonUp
  • injectKeyUp
ActivatedInputEvent
  • Count (1+) : int
  • injectMouseButtonClick
  • injectMouseButtonDoubleClick
  • injectMouseButtonTripleClick
TextInputEvent
  • Text : string/char
  • injectChar
ScrollInputEvent
  • Delta : int
  • Direction : ScrollDirection(0 - horizontal, 1 - vertical)
  • injectMouseWheelChange

Unmapped (yet) functions:

  • injectMouseLeaves

GUI navigation

Use cases

Navigate between a set textboxes

Prerequisite: first textbox is focused

  • Press `Tab`
  • The next textbox is focused