Chapter 6. SCI in action

Table of Contents
Event handling in SCI
The Parser
Views and animation in SCI

Event handling in SCI

By Lars Skovlund

Version 1.0, 12. July 1999

This article will deal with the event manager in SCI. Like several other key parts of the interpreter, this one actively communicates with the SCI application. It directly writes to objects of the Event class, but more on that later.

The different input devices are polled differently:

Some parts of the event mechanism (in particular, keyboard management) are very PC specific, and a conversion will no doubt have to take place on other platforms.

Event types and modifiers

There are three types of events, distinguished by their "type" property. The possible values are listed below; they are laid out as a bitfield to allow for selective event retrieval, see later.

0x00 - Null event
0x01 - Mouse button event
0x02 - Mouse button release event
0x04 - Keyboard event
0x40 - Movement (joystick) event

This type is returned to the SCI event managers by the input device drivers along with a "message" and a set of "modifiers". This is the basic event structure, although some event types contain extra information. The latter field is a direct copy of the BIOS shift flags, laid out as follows:

bit 7 - Insert active
bit 6 - Caps lock active
bit 5 - Num lock active
bit 4 - Scroll lock active
bit 3 - Alt key pressed
bit 2 - Ctrl key pressed
bit 1 - Left shift key pressed
bit 0 - Right shift key pressed

It is obvious, then, that these keys by themselves don't generate any keyboard events. They can, however, be combined with other keys or mouse clicks to produce "shift-click" events, for instance.

Notes

[1]

The default FreeSCI event mechanism uses libgii, which is completely event-based.