0ad/source/lib/input.h
Ykkrosh 4b06ebd52d Add basic help page into the main menu.
Add buttons to open the web site and IRC.
Tentatively allow Atlas to be launched from the menu.
Add some shutdown functions to support relaunching into Atlas without
having to restart the whole process.

This was SVN commit r7714.
2010-07-07 21:47:31 +00:00

66 lines
2.2 KiB
C

/* Copyright (c) 2010 Wildfire Games
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* SDL input redirector; dispatches to multiple handlers and allows
* record/playback of events.
*/
#ifndef INCLUDED_INPUT
#define INCLUDED_INPUT
#include "lib/external_libraries/sdl_fwd.h"
// input handler return values.
enum InReaction
{
// (the handlers' return values are checked and these
// 'strange' values might bring errors to light)
// pass the event to the next handler in the chain
IN_PASS = 4,
// we've handled it; no other handlers will receive this event.
IN_HANDLED = 2
};
typedef InReaction (*InHandler)(const SDL_Event_*);
// register an input handler, which will receive all subsequent events first.
// events are passed to other handlers if handler returns IN_PASS.
extern void in_add_handler(InHandler handler);
// remove all registered input handlers
extern void in_reset_handlers();
// send event to each handler (newest first) until one returns true
extern void in_dispatch_event(const SDL_Event_* event);
extern void in_dispatch_recorded_events();
extern LibError in_record(const char* fn);
extern LibError in_playback(const char* fn);
extern void in_stop(void);
#endif // #ifndef INCLUDED_INPUT