bznext input library planning

Place all meeting requests / announcements here...
Post Reply
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5173
Joined: Fri Dec 13, 2002 4:11 am
Location: https://discord.gg/NN9uAvx
Contact:

bznext input library planning

Post by JeffM » Sun Apr 11, 2004 7:04 pm

working out the new input lib. Just wanted to put my thought here for coment.

The basic idea is thus;

There is an input manager class that gives out pointers to input "function" classes.

A Function is defined as a logical input action in the program, such as "fire a shot", or "foreward/backward speed". These functins are bound to specific item(s) on a device.

Devices are not exposed to the calling application but managed by the input manager.

A function binds to a device and one or 2 items to bind to, depending on the input type that is required. For button type input a single item is requierd. This can return a state from 0 to 1. For axis type states, up to 2 items may be required, for a min and max state of -1 to +1. Some devices may ignore the second paramater if they provided full range input ( mice/joystics ).

Data from functions can be had 2 ways.

1) polling. The calling application can expicidly ask the state of a function at any time by calling a method in the function class.

2) listening. The calling application may install a listener class in the function that will be called any time the state of that function changes.

The values returned by the function can be in parametric ( -1 to +1), Raw Relitive or Raw Absolute. The 2 raw items will simply return the device coordinates, and are usefull for things such as mice for cursors. Functions can also have there input state reset to a fixed value.

Inside the input manager all functions will be updated by installed listeners that are called one each event. The basic events will be handeld by an oger listener that will service the mouse and keyboard devices. SDL can be used to get the status of any joystick devices.

The manager will be able to read in a config file and bind any function specified in it. There can only be one function class per function name. But there can be multiple functions that use the same devices/items. i.e. you can have 2 things bound to the same key. Binding of keys should also allow for key modifyer combinations ( alt+F1).

I don't know if arbitrary key combos need to be supported as functions, like making shoot be A+D+F, that seems kinda overboard.

The input manager will also provide a way to iterate the devices and sub items for doing a config type menu. It can also poll the state of any device so that the "press the key you want" items can be done in a menu.

comments? sugestions? questions? stuff I forgot?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest