# Palomino - Input Module

©2004,2009 Jim E. Brooks http://www.palomino3d.org

# Contents

- Main Contents

- Overview
- InputQueue
- Joystick

## Overview

[2007/12]

The input module is low-level system-specific code that directly communicates with keyboard and joystick input. It makes input data readily available to the higher-level control module in a (mostly) system-neutral way.

## InputQueue Class

[2004/11]

This is a low-level class that handles keyboard and joystick events from the underlying gfxsys. It enqueues input events, and provides an interface to poll and dequeue them.

Regardless of "queue" being in the name, InputQueue doesn't enqueue joystick events. Rather, InputQueue effectively returns the last joystick event, discarding prior events. The reason is that a noticable delay and jerky response would result if multiple joystick events are queued while rendering a frame, then processed suddenly at the frame's end. On Windows, the InputQueue class does no special action as the Windows joystick driver just samples the joystick's latest state. But the Linux joystick driver queues events, so the InputQueue class has Linux-specific code to discard prior events.

## Joystick

[2008/01]

There are two unrelated Joystick classes (Singletons): input::Joystick and control::Joystick.
This documents input::Joystick.

input::Joystick is a low-level class that is a layer over the system's joystick driver. Its purpose is to read the joystick driver and enqueue joystick events into InputQueue. It doesn't know what to do with joystick events nor which axises/buttons are really used by the application, so it may enqueue superfluous events.

All other joystick functionality (calibration, actions) is placed in the higher-level control::Joystick.

Last modified: Tue May 5 22:28:08 CDT 2009