Add fwd-event.h with forward declarations of event.h

This commit is contained in:
Kp 2015-10-09 02:46:10 +00:00
parent e8a4a25639
commit 78de0ac119
23 changed files with 76 additions and 46 deletions

View file

@ -18,6 +18,7 @@
#include "window.h"
#include "u_mem.h"
#include "dxxerror.h"
#include "event.h"
struct window
{

View file

@ -6,13 +6,14 @@
*/
// Event header file
#ifndef _EVENT_H
#define _EVENT_H
#pragma once
#include "fwd-event.h"
#include "maths.h"
#ifdef __cplusplus
typedef enum event_type
enum event_type : unsigned
{
EVENT_IDLE = 0,
EVENT_QUIT,
@ -45,7 +46,7 @@ typedef enum event_type
EVENT_UI_LISTBOX_MOVED,
EVENT_UI_LISTBOX_SELECTED,
EVENT_UI_USERBOX_DRAGGED
} event_type;
};
// A vanilla event. Cast to the correct type of event according to 'type'.
struct d_event
@ -62,7 +63,7 @@ struct d_change_event : d_event
{
int citem;
d_change_event(const int c) :
d_event(d_event{EVENT_NEWMENU_CHANGED}), citem(c)
d_event{EVENT_NEWMENU_CHANGED}, citem(c)
{
}
};
@ -71,40 +72,11 @@ struct d_select_event : d_event
{
int citem;
d_select_event(const int c) :
d_event(d_event{EVENT_NEWMENU_SELECTED}), citem(c)
d_event{EVENT_NEWMENU_SELECTED}, citem(c)
{
}
};
int event_init();
// Sends input events to event handlers
void event_poll();
void event_flush();
// Set and call the default event handler
int call_default_handler(const d_event &event);
// Send an event to the front window as first priority, then to the windows behind if it's not modal (editor), then the default handler
void event_send(const d_event &event);
// Sends input, idle and draw events to event handlers
void event_process();
void event_enable_focus();
void event_disable_focus();
static inline void event_toggle_focus(int activate_focus)
{
if (activate_focus)
event_enable_focus();
else
event_disable_focus();
}
// See how long we were idle for
void event_reset_idle_seconds();
fix event_get_idle_seconds();
#endif
#endif

View file

@ -0,0 +1,47 @@
/*
* This file is part of the DXX-Rebirth project <http://www.dxx-rebirth.com/>.
* It is copyright by its individual contributors, as recorded in the
* project's Git history. See COPYING.txt at the top level for license
* terms and a link to the Git history.
*/
#pragma once
struct d_event;
struct d_create_event;
struct d_change_event;
struct d_select_event;
#ifdef __cplusplus
enum event_type : unsigned;
int event_init();
// Sends input events to event handlers
void event_poll();
void event_flush();
// Set and call the default event handler
int call_default_handler(const d_event &event);
// Send an event to the front window as first priority, then to the windows behind if it's not modal (editor), then the default handler
void event_send(const d_event &event);
// Sends input, idle and draw events to event handlers
void event_process();
void event_enable_focus();
void event_disable_focus();
static inline void event_toggle_focus(int activate_focus)
{
if (activate_focus)
event_enable_focus();
else
event_disable_focus();
}
// See how long we were idle for
void event_reset_idle_seconds();
#endif

View file

@ -29,7 +29,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <SDL_keysym.h>
#include "pstypes.h"
#include "maths.h"
#include "event.h"
#include "fwd-event.h"
#define KEY_BUFFER_SIZE 16
#define KEY_REPEAT_DELAY 400

View file

@ -18,6 +18,7 @@
#ifdef __cplusplus
#include <cassert>
#include "window.h"
#include "event.h"
struct SDL_MouseButtonEvent;
struct SDL_MouseMotionEvent;

View file

@ -26,7 +26,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#pragma once
#include "dxxsconf.h"
#include "event.h"
#include "fwd-event.h"
#include "fmtcheck.h"
#include "u_mem.h"

View file

@ -16,7 +16,7 @@
#pragma once
#include "event.h"
#include "fwd-event.h"
#include "gr.h"
#include "console.h"

View file

@ -23,14 +23,11 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#ifndef _INFERNO_H
#define _INFERNO_H
#pragma once
#include <algorithm>
#include "fwd-event.h"
#include "ntstring.h"
struct d_event;
#if defined(__APPLE__) || defined(macintosh)
#define KEY_MAC(x) x
#else
@ -73,5 +70,3 @@ extern int MacHog;
// Default event handler for everything except the editor
int standard_handler(const d_event &event);
#endif

View file

@ -25,7 +25,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#pragma once
#include "event.h"
#include "fwd-event.h"
#ifdef __cplusplus
#include <cstdint>

View file

@ -51,6 +51,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "centers.h"
#include "piggy.h"
#include "u_mem.h"
#include "event.h"
#include "compiler-make_unique.h"

View file

@ -51,6 +51,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "hudmsg.h"
#include "cntrlcen.h"
#include "gauges.h"
#include "event.h"
#include "key.h"
#include "fuelcen.h"
#include "sounds.h"

View file

@ -31,6 +31,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "fuelcen.h"
#include "screens.h"
#include "inferno.h"
#include "event.h"
#include "segment.h"
#include "editor.h"
#include "editor/esegment.h"

View file

@ -35,6 +35,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "eswitch.h"
#include "segment.h"
#include "dxxerror.h"
#include "event.h"
#include "gameseg.h"
#include "wall.h"
#include "medwall.h"

View file

@ -31,6 +31,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "inferno.h"
#include "window.h"
#include "segment.h"
#include "event.h"
#include "gr.h"
#include "ui.h"
#include "editor.h"

View file

@ -31,6 +31,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "screens.h"
#include "inferno.h"
#include "segment.h"
#include "event.h"
#include "editor.h"
#include "editor/esegment.h"
#include "editor/medmisc.h"

View file

@ -34,6 +34,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "editor/esegment.h"
#include "segment.h"
#include "dxxerror.h"
#include "event.h"
#include "gameseg.h"
#include "textures.h"
#include "screens.h"

View file

@ -31,6 +31,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "gr.h" // For canves, font stuff
#include "ui.h" // For UI_GADGET stuff
#include "object.h" // For robot_bms
#include "event.h"
#include "dxxerror.h"
#include "objpage.h"
#include "bm.h"

View file

@ -37,6 +37,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "textures.h" // For NumTextures
#include "dxxerror.h"
#include "key.h"
#include "event.h"
#include "gamesave.h"
#include "mission.h"

View file

@ -18,6 +18,7 @@
#include <time.h>
#include <SDL.h>
#include "window.h"
#include "event.h"
#include "console.h"
#include "args.h"
#include "gr.h"

View file

@ -50,6 +50,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "timer.h"
#include "render.h"
#include "laser.h"
#include "event.h"
#include "screens.h"
#include "textures.h"
#include "slew.h"

View file

@ -50,6 +50,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "physfsx.h"
#include "physfs_list.h"
#include "bm.h"
#include "event.h"
#if defined(DXX_BUILD_DESCENT_II)
#include "movie.h"
#endif

View file

@ -51,6 +51,7 @@
#include "hudmsg.h"
#include "switch.h"
#include "automap.h"
#include "event.h"
#include "playsave.h"
#include "gamefont.h"
#include "rbaudio.h"

View file

@ -51,6 +51,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "weapon.h"
#include "render.h"
#include "gameseq.h"
#include "event.h"
#include "robot.h"
#include "gauges.h"
#include "newdemo.h"