mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
Merge input backend init and keyboard init
Now that the refresher is part of the client, there's no need to init the backend before the refresher and the keyboard after it.
This commit is contained in:
parent
e8239291a7
commit
84a1766702
3 changed files with 8 additions and 25 deletions
|
@ -41,11 +41,6 @@ typedef struct in_state
|
|||
int *in_speed_state;
|
||||
} in_state_t;
|
||||
|
||||
/*
|
||||
* Keyboard initialisation. Called by the client.
|
||||
*/
|
||||
void IN_KeyboardInit(Key_Event_fp_t fp);
|
||||
|
||||
/*
|
||||
* Updates the state of the input queue
|
||||
*/
|
||||
|
@ -54,7 +49,7 @@ void IN_Update(void);
|
|||
/*
|
||||
* Initializes the input backend
|
||||
*/
|
||||
void IN_BackendInit(in_state_t *in_state_p);
|
||||
void IN_BackendInit(in_state_t *in_state_p, Key_Event_fp_t fp);
|
||||
|
||||
/*
|
||||
* Shuts the backend down
|
||||
|
|
|
@ -178,10 +178,9 @@ VID_LoadRefresh(void)
|
|||
in_state.in_speed_state = &in_speed.state;
|
||||
|
||||
// Initiate the input backend
|
||||
IN_BackendInit (&in_state);
|
||||
IN_BackendInit (&in_state, Do_Key_Event);
|
||||
|
||||
// Initiate keyboard at the input backend
|
||||
IN_KeyboardInit (Do_Key_Event);
|
||||
Key_ClearStates();
|
||||
|
||||
// Declare the refresher as active
|
||||
|
|
|
@ -560,15 +560,15 @@ IN_MLookUp(void)
|
|||
/* ------------------------------------------------------------------ */
|
||||
|
||||
/*
|
||||
* Keyboard initialisation. Called by the client.
|
||||
* Initializes the backend
|
||||
*/
|
||||
void
|
||||
IN_KeyboardInit(Key_Event_fp_t fp)
|
||||
IN_BackendInit(in_state_t *in_state_p, Key_Event_fp_t fp)
|
||||
{
|
||||
Key_Event_fp = fp;
|
||||
in_state = in_state_p;
|
||||
Key_Event_fp = fp;
|
||||
mouse_x = mouse_y = 0;
|
||||
|
||||
/* SDL stuff. Moved here from IN_BackendInit because
|
||||
this must be done after video is initialized. */
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||
have_grab = GLimp_InputIsGrabbed();
|
||||
|
@ -576,16 +576,7 @@ IN_KeyboardInit(Key_Event_fp_t fp)
|
|||
SDL_EnableUNICODE(0);
|
||||
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
|
||||
have_grab = (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_ON);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Initializes the backend
|
||||
*/
|
||||
void
|
||||
IN_BackendInit(in_state_t *in_state_p)
|
||||
{
|
||||
in_state = in_state_p;
|
||||
#endif
|
||||
|
||||
exponential_speedup = Cvar_Get("exponential_speedup", "0", CVAR_ARCHIVE);
|
||||
freelook = Cvar_Get("freelook", "1", 0);
|
||||
|
@ -605,8 +596,6 @@ IN_BackendInit(in_state_t *in_state_p)
|
|||
Cmd_AddCommand("-mlook", IN_MLookUp);
|
||||
Cmd_AddCommand("force_centerview", IN_ForceCenterView);
|
||||
|
||||
mouse_x = mouse_y = 0;
|
||||
|
||||
VID_Printf(PRINT_ALL, "Input initialized.\n");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue