CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

csutil/inpnames.h

Go to the documentation of this file.
00001 /*
00002     Crystal Space input library
00003     Copyright (C) 2000 by Andrew Zabolotny <bit@eltech.ru>
00004     Copyright (C) 2002 by Mathew Sutcliffe <oktal@gmx.co.uk>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public
00017     License along with this library; if not, write to the Free
00018     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 */
00020 
00021 #ifndef __CS_UTIL_CSINPUTS_H__
00022 #define __CS_UTIL_CSINPUTS_H__
00023 
00028 #include "iutil/evdefs.h"
00029 #include "iutil/event.h"
00030 #include "csstring.h"
00031 
00032 struct iEvent;
00033 
00034 class csInputDefinition
00035 {
00036 protected:
00037   uint32 modifiersHonored;
00038   csKeyModifiers modifiers;
00039   int containedType;
00040   union
00041   {
00042     struct
00043     {
00044       utf32_char keyCode;
00045       bool codeIsCooked;
00046     } k;
00047     csEventMouseData m;
00048     csEventJoystickData j;
00049   };
00050 
00051   /* @@@ Not implemented, but prolly useful
00052   int CompareModifiers (const csKeyModifiers& m1, 
00053     const csKeyModifiers& m2, uint32 honorModifiers);*/
00054 public:
00055   csInputDefinition ();
00056   csInputDefinition (iEvent* event);
00057 
00058   void SetHonoredModifiers (uint32 honorModifiers = CSMASK_ALLSHIFTS);
00059   uint32 GetHonoredModifiers ();
00060 
00061   bool Parse (const char* string, bool useCooked = true);
00062   csString GetDescription ();
00063   bool FromEvent (iEvent* event, bool useCookedKey = true);
00064 
00065   uint32 ComputeHash ();
00066   static uint32 ComputeEventHash (iEvent* event);
00067   int Compare (const csInputDefinition& def);
00068   int Compare (iEvent* event);
00069 };
00070 
00075 #define CSAXIS_X -1
00076 
00080 #define CSAXIS_Y -2
00081 
00088 int csTypeOfInputDef (const char* str);
00089 
00104 bool csParseKeyDef (const char* str, utf32_char* rawCode,
00105   utf32_char* cookedCode, csKeyModifiers* modifiers);
00106 
00118 csString csGetKeyDesc (utf32_char code, 
00119                               const csKeyModifiers* modifiers,
00120                               bool distinguishModifiers = true);
00121 
00138 bool csParseMouseDef(const char* str, int* x, int* y, 
00139                             int* button, csKeyModifiers* modifiers);
00140 
00156 bool csParseJoystickDef(const char* str, int* x, int* y,
00157   int* button, csKeyModifiers* modifiers);
00158 
00159 /*
00160   @@@ TODO:
00161     csGetMouseDesc
00162     csGetJoystickDesc
00163  */
00164 
00165 #endif // __CS_UTIL_CSINPUTS_H__

Generated for Crystal Space by doxygen 1.2.18