2014-03-15 16:59:03 +00:00
|
|
|
// Emacs style mode select -*- C++ -*-
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
2022-03-03 19:24:46 +00:00
|
|
|
// Copyright (C) 2006-2022 by Sonic Team Junior.
|
2014-03-15 16:59:03 +00:00
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/// \file
|
|
|
|
/// \brief System specific interface stuff.
|
|
|
|
|
|
|
|
#ifndef __sdlmain__
|
|
|
|
#define __sdlmain__
|
|
|
|
|
|
|
|
extern SDL_bool consolevent;
|
|
|
|
extern SDL_bool framebuffer;
|
|
|
|
|
2014-07-26 07:06:00 +00:00
|
|
|
#include "../m_fixed.h"
|
2022-11-14 03:37:08 +00:00
|
|
|
#include "../i_gamepad.h"
|
2014-07-26 07:06:00 +00:00
|
|
|
|
2022-11-14 03:37:08 +00:00
|
|
|
// SDL info about all controllers
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
boolean started; // started
|
|
|
|
int lastindex; // last gamepad ID
|
2014-07-26 07:06:00 +00:00
|
|
|
|
2022-11-14 03:37:08 +00:00
|
|
|
SDL_GameController *dev;
|
|
|
|
SDL_Joystick *joydev;
|
2018-12-14 08:58:07 +00:00
|
|
|
|
2022-11-14 03:37:08 +00:00
|
|
|
gamepad_t *info; // pointer to gamepad info
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2022-11-14 03:37:08 +00:00
|
|
|
struct {
|
|
|
|
Uint16 large_magnitude;
|
|
|
|
Uint16 small_magnitude;
|
|
|
|
Uint32 expiration, time_left;
|
|
|
|
} rumble;
|
|
|
|
} ControllerInfo;
|
|
|
|
|
|
|
|
#define GAMEPAD_INIT_FLAGS (SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER)
|
|
|
|
|
|
|
|
void I_UpdateControllers(void);
|
|
|
|
|
|
|
|
void I_ControllerDeviceAdded(INT32 which);
|
|
|
|
void I_ControllerDeviceRemoved(void);
|
|
|
|
|
|
|
|
void I_HandleControllerButtonEvent(SDL_ControllerButtonEvent evt, Uint32 type);
|
|
|
|
void I_HandleControllerAxisEvent(SDL_ControllerAxisEvent evt);
|
|
|
|
|
|
|
|
INT32 I_GetControllerIndex(SDL_GameController *dev);
|
|
|
|
void I_CloseInactiveController(SDL_GameController *dev);
|
|
|
|
void I_CloseInactiveHapticDevice(SDL_Haptic *dev);
|
|
|
|
|
|
|
|
void I_ToggleControllerRumble(boolean unpause);
|
2018-12-14 06:45:18 +00:00
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
void I_GetConsoleEvents(void);
|
|
|
|
|
|
|
|
void SDLforceUngrabMouse(void);
|
|
|
|
|
2016-11-03 08:43:57 +00:00
|
|
|
// Needed for some WIN32 functions
|
|
|
|
extern SDL_Window *window;
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
#endif
|