CAST II Game Engine

   MAIN       FEATURES       SCREENSHOTS       FORUMS       MANUAL       DOWNLOADS       CONTACTS   
Units
Class Hierarchy
Classes, Interfaces and Objects
Types
Enumerations
Variables
Constants
Functions and Procedures
Identifiers

Unit Input

Description

Input unit

(C) 2006 George "Mirage" Bakhtadze. www.casteng.com
The source code may be used under either MPL 1.1 or LGPL 2.1 license. See included license.txt file
Unit contains basic input classes

Classes, Interfaces and Objects

NameDescription
Class TControllerCAST II input controller base class

Types

Overview

CController = of TController;
PBinding = ^TBinding;
TBinding = record BindType: TEventType; BindData: Word; Next: PBinding; end;
TBindingName = ShortString;
TBindingStr = string;
THotkey = type Longword;
TInputDelegate = procedure(EventData: Integer; CustomData: SmallInt) of object;
TInputEvent = packed record EventType: TEventType; EventData: SmallInt; end;
TInputEvents = array of TInputEvent;
TInputFilter = set of TInputFilterElement;
TInputQueryResult = set of TInputQueryResultElement;
TKeyModifiers = set of TKeyModifier;
TMouseState = packed record lX, lY, lZ: LongInt; Buttons: array[0..3] of Byte; end;

Description

CController = of TController;

 

PBinding = ^TBinding;

Pointer to a binding

TBinding = record BindType: TEventType; BindData: Word; Next: PBinding; end;

Binding contains an event type, event data and a pointer to next binding (or nil) to be able to bind a sequense of input events to a single action

TBindingName = ShortString;

 

TBindingStr = string;

Binding string type. Syntax:
BindElement = (<Key><Specifier>)|<Gesture>"^"
Key = A key name
Specifier = ","|"+"|"-"|":" - can be omitted at the end of the binding ("," will be assumed)
Gesture = "MouseMove"|"MouseMoveH"|"MouseMoveV"|"MouseRoll"| "MouseStrokeLeft"|"MouseStrokeRight"|"MouseStrokeUp"|"MouseStrokeDown"| "MouseStrokeLeftUp"|"MouseStrokeRightUp"|"MouseStrokeLeftDown"|"MouseStrokeRightDown" Binding = <BindElement> {<BindElement>}
Specifiers:
, - click
+ - key down
- - key up
: - double click
Examples:
Alt+Q - the binding will be activated when user press Alt, then click (press and release) Q (without releasing Alt)
A,B,C - the binding will be activated when user click A, then B and then C
A+B,A- - the binding will be activated when user press A, then press and release B and then release A
A maximum timeout between two consequent events can be specified when binding

THotkey = type Longword;

Hotkey

TInputDelegate = procedure(EventData: Integer; CustomData: SmallInt) of object;

Type of a method to which an input event sequence can be bound. CustomData is an optional user data. Value of EventData depends on type of event which finishes the sequence (the last one). If it's a keyboard event EventData contains a key code, if it's a mouse event EventData contains event-specific mouse coordinate or both (for btMouseMove event type) in format where low 16 bit is X coordinate and high 16 bit is Y coordinate.

TInputEvent = packed record EventType: TEventType; EventData: SmallInt; end;

Input event. EventData is an event type-specific data such as a key code

TInputEvents = array of TInputEvent;

 

TInputFilter = set of TInputFilterElement;

Input filter

TInputQueryResult = set of TInputQueryResultElement;

Query input results

TKeyModifiers = set of TKeyModifier;

Modifier keys set

TMouseState = packed record lX, lY, lZ: LongInt; Buttons: array[0..3] of Byte; end;

Mouse state data structure. lX, lY and lZ is mouse position at corresponding axis. Buttons - mouse buttons state

Enumerations

TEventType
Possible event types
 btKeyDownSome key (including mouse buttons) was pushed down
 btKeyUpSome previously pressed key was released
 btKeyClickA key was clicked (btKeyDown + btKeyUp)
 btKeyDblClickA key was clicked two times within double click timeout
 btMouseMoveMouse was moved
 btMouseHMoveMouse was moved horizontally
 btMouseVMoveMouse was moved vertically
 btMouseRollMouse wheel was rolled
 btStrokeLeftMouse was moved left at least by MouseStrokeTolerance units
 btStrokeRightMouse was moved right at least by MouseStrokeTolerance units
 btStrokeUpMouse was moved up at least by MouseStrokeTolerance units
 btStrokeDownMouse was moved down at least by MouseStrokeTolerance units
 btStrokeLeftUpMouse was moved left+up at least by MouseStrokeTolerance units
 btStrokeRightUpMouse was moved right+up at least by MouseStrokeTolerance units
 btStrokeLeftDownMouse was moved left+down at least by MouseStrokeTolerance units
 btStrokeRightDownMouse was moved right+down at least by MouseStrokeTolerance units
 btNoneNo event
TInputFilterElement
Input event filters
 ifBoundQuery only events which was bound using BindCommand, BindDelegate or BindPointer
 ifNotBoundQuery all events
TInputQueryResultElement
Query input results elements
 iqrKeyPressedSome key (including mouse buttons) was pressed
 iqrKeyChangedSome key (including mouse buttons) state was changed
 iqrMouseMovedMouse was moved
TKeyModifier
Modifier keys
 kmControlAny CTRL
 kmLControlLeft CTRL
 kmRControlRight CTRL
 kmShiftAny Shift
 kmLShiftLeft Shift
 kmRShiftRight Shift
 kmAltAny Alt
 kmLAltLeft Alt
 kmRAltRight Alt
 kmLWinLeft Win
 kmRWinRight Win
 kmWinAny Win key
TKeyQueryState
Key query states
 kqsUpKey is up
 kqsDownKey is down

Constants

Overview

atBooleanOff = 2;
atBooleanOn = 1;
atBooleanToggle = 3;
atSetByte = 4;
atSetLongWord = 6;
atSetWord = 5;
DefaultTimeout = 500;
MaxEvents = 127;
MouseStrokeTolerance = 3;

Description

atBooleanOff = 2;

Reset a boolean flag

atBooleanOn = 1;

Set a boolean flag

atBooleanToggle = 3;

Toggle a boolean flag

atSetByte = 4;

Set a byte value

atSetLongWord = 6;

Set a long word (four byte) value

atSetWord = 5;

Set a word (two byte) value

DefaultTimeout = 500;

Default value of maximum timeout between two consequent events

MaxEvents = 127;

Maximum simultaneous events

MouseStrokeTolerance = 3;

Amount of mouse move to count it as a stroke

Last modified: Jan 6, 2010
Copyright (C) 2006-2010, casteng.com