/usr/include/crystalspace-2.0/iutil/binder.h is in libcrystalspace-dev 2.0+dfsg-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | /*
Copyright (C) 2003, 04 by Mathew Sutcliffe <oktal@gmx.co.uk>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __CS_IUTIL_BINDER_H__
#define __CS_IUTIL_BINDER_H__
/**\file
* Input binder interface
*/
#include "csutil/scf_interface.h"
struct iEvent;
struct iEventHandler;
struct iConfigFile;
class csInputDefinition;
/**
* SCF interface for csInputBinder,
* used to bind input events (keypress, button press, mouse move,
* etc.) to commands which are represented by an unsigned integer. It is
* up to the application to specify the meaning of a command value.
* <p>
* Example:
* \code
* enum MyCommand = { Walk, Shoot, Jump, LookX, LookY };
* ...
* csRef<iInputBinder> binder = ...;
* binder->BindButton (csInputDefinition ("ctrl"), Shoot);
* binder->BindAxis (csInputDefinition ("mousex"), LookX);
* ...
* if (binder->Button (Shoot))
* ...
* else
* {
* DoSomething (binder->Axis (LookX), binder->Axis (LookY));
* }
* \endcode
*/
struct iInputBinder : public virtual iBase
{
SCF_INTERFACE(iInputBinder, 2,0,0);
/**
* Get a pointer to the embedded iEventHander.
* \remarks This class has to be registered with the event queue:
* EventQueue->RegisterListener(InputBinder->QueryHandler (), CSMASK_Input);
* to get working Axis() and Button() methods.
*/
virtual iEventHandler* QueryHandler () = 0;
/// Returns the status of the given button command.
virtual bool Button (unsigned cmd) = 0;
/// Returns the position of the given axis command.
virtual int Axis (unsigned cmd) = 0;
/**
* Bind a button event to a button command.
* \param def Describes the physical button to bind to.
* \param cmd The ID of the command to bind.
* \param toggle If true, button status is only toggled on keydown events.
* \remarks Note that cmd is used as an array index so the numbers you use
* should be consecutive, starting with 0. Also note that there must be
* a 1:1 mapping between buttons and commands, that is, a button cannot
* issue multiple commands, and the same command cannot be bound to multiple
* buttons. If you require this, you must handle it in your application.
* Binding a button (or command) will remove any previous bindings
* involving the button or command.
*/
virtual void BindButton (csInputDefinition const& def, unsigned int cmd,
bool toggle = false) = 0;
/**
* Bind an axis motion event to an axis command.
* \param def Describes the physical axis to bind to.
* \param cmd The ID of the command to bind.
* \param sensitivity A multiplier for the axis command.
* \remarks Note that cmd is used as an array index so the numbers you use
* should be consecutive, starting with 0.
*/
virtual void BindAxis (csInputDefinition const& def, unsigned int cmd,
int sensitivity = 1) = 0;
/// Remove a binding.
virtual bool UnbindButton (unsigned cmd) = 0;
/// Remove a binding.
virtual bool UnbindAxis (unsigned cmd) = 0;
/// Remove all bindings.
virtual void UnbindAll() = 0;
/// Load bindings from a configuration file.
virtual void LoadConfig (iConfigFile *, const char *subsection = 0) = 0;
/// Save bindings to a configuration file.
virtual void SaveConfig (iConfigFile *, const char *subsection = 0) = 0;
};
#endif // __CS_IUTIL_BINDER_H__
|