Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor|libcommon: Reimplemented EventSequence handling in C++
- Loading branch information
1 parent
2a72a26
commit d08e181
Showing
7 changed files
with
385 additions
and
371 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,74 @@ | ||
/**\file g_eventsequence.h | ||
*\section License | ||
* License: GPL | ||
* Online License Link: http://www.gnu.org/licenses/gpl.html | ||
/** | ||
* @file g_eventsequence.h | ||
* Input (keyboard) event sequences. @ingroup libcommon | ||
* | ||
*\author Copyright © 2003-2012 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
*\author Copyright © 2005-2012 Daniel Swanson <danij@dengine.net> | ||
*\author Copyright © 1999 Activision | ||
*\author Copyright © 1993-1996 by id Software, Inc. | ||
* An "event sequence" is a chain of two or more keyboard input events which | ||
* when entered in-sequence trigger a callback when the last event of that | ||
* sequence is received. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* @author Copyright © 2003-2012 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
* @author Copyright © 2005-2012 Daniel Swanson <danij@dengine.net> | ||
* @author Copyright © 1999 Activision | ||
* @author Copyright © 1993-1996 by id Software, Inc. | ||
* | ||
* This program 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 General Public License for more details. | ||
* @par License | ||
* GPL: http://www.gnu.org/licenses/gpl.html | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, | ||
* Boston, MA 02110-1301 USA | ||
* <small>This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 2 of the License, or (at your | ||
* option) any later version. This program 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 General | ||
* Public License for more details. You should have received a copy of the GNU | ||
* General Public License along with this program; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA</small> | ||
*/ | ||
|
||
#ifndef LIBCOMMON_EVENTSEQUENCE_H | ||
#define LIBCOMMON_EVENTSEQUENCE_H | ||
|
||
#include "doomsday.h" | ||
|
||
#if __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* Event Sequences for user input. | ||
* Event sequence arguments (passed to the callback handler). | ||
*/ | ||
typedef int EventSequenceArg; | ||
|
||
#ifndef LIBCOMMON_EVENTSEQUENCE_H | ||
#define LIBCOMMON_EVENTSEQUENCE_H | ||
/** | ||
* Event sequence callback handler. | ||
*/ | ||
typedef int (*eventsequencehandler_t) (int player, const EventSequenceArg* args, int numArgs); | ||
|
||
// Initialize this subsystem. | ||
void G_InitEventSequences(void); | ||
|
||
// Shutdown this subsystem. | ||
void G_ShutdownEventSequences(void); | ||
|
||
/** | ||
* Responds to an input event if determined to be part of a known event | ||
* sequence. | ||
* | ||
* @param ev Ptr to the event to be checked. | ||
* Responds to an input event if determined to be part of a known event sequence. | ||
* | ||
* @return @c true, if the event was 'eaten'. | ||
* @param ev Input event to be processed. | ||
* @return @c true= input event @a ev was 'eaten'. | ||
*/ | ||
int G_EventSequenceResponder(event_t* ev); | ||
|
||
void G_AddEventSequence(const char* sequence, size_t sequenceLength, int (*callback) (const int*, int)); | ||
/** | ||
* Add a new event sequence. | ||
* | ||
* @param sequence Text description of the sequence. | ||
* @param callback Handler function to be called upon sequence completion. | ||
*/ | ||
void G_AddEventSequence(const char* sequence, eventsequencehandler_t callback); | ||
|
||
#if __cplusplus | ||
} // extern "C" | ||
#endif | ||
|
||
#endif /* LIBCOMMON_EVENTSEQUENCE_H */ |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.