ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

Actions.h

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef GUI_ACTIONS_H
00024 #define GUI_ACTIONS_H
00025 
00026 #include "common/scummsys.h"
00027 #include "common/system.h"
00028 #include "gui/Key.h"
00029 
00030 namespace GUI {
00031 
00032 typedef int ActionType;
00033 
00034 class Actions {
00035 
00036 public:
00037     static Actions* Instance();
00038     static void init();
00039     virtual void initInstanceMain(OSystem *mainSystem);
00040     virtual void initInstanceGame();
00041     bool initialized();
00042 
00043     // Actions
00044     virtual bool perform(ActionType action, bool pushed = true) = 0;
00045     bool isActive(ActionType action);
00046     bool isEnabled(ActionType action);
00047     virtual Common::String actionName(ActionType action) = 0;
00048     virtual int size() = 0;
00049 
00050     // Mapping
00051     void beginMapping(bool start);
00052     bool mappingActive();
00053     bool performMapped(unsigned int keyCode, bool pushed);
00054     bool loadMapping();
00055     bool saveMapping();
00056     unsigned int getMapping(ActionType action);
00057     void setMapping(ActionType action, unsigned int keyCode);
00058     Key& getKeyAction(ActionType action);
00059 
00060     // Action domain
00061     virtual Common::String domain() = 0;
00062     virtual int version() = 0;
00063 
00064     virtual ~Actions();
00065 
00066 protected:
00067     Actions();
00068 
00069 protected:
00070     enum {
00071         MAX_ACTIONS = 20
00072     };
00073 
00074     static Actions* _instance;
00075     OSystem *_mainSystem;
00076     Key _key_action[MAX_ACTIONS + 1];
00077     bool _action_enabled[MAX_ACTIONS + 1];
00078     unsigned int _action_mapping[MAX_ACTIONS + 1];
00079     bool _mapping_active;
00080     bool _initialized;
00081 };
00082 
00083 } // namespace GUI
00084 typedef GUI::Actions GUI_Actions;
00085 #endif


Generated on Sat May 18 2019 05:00:54 for ResidualVM by doxygen 1.7.1
curved edge   curved edge