SDL
2.0
|
Go to the source code of this file.
Macros | |
#define | SCREEN_WIDTH 512 |
#define | SCREEN_HEIGHT 320 |
Functions | |
static SDL_Texture * | LoadTexture (SDL_Renderer *renderer, const char *file, SDL_bool transparent) |
void | loop (void *arg) |
SDL_bool | WatchGameController (SDL_GameController *gamecontroller) |
int | main (int argc, char *argv[]) |
Variables | |
struct { | |
int x | |
int y | |
} | button_positions [] |
struct { | |
int x | |
int y | |
double angle | |
} | axis_positions [] |
SDL_Renderer * | screen = NULL |
SDL_bool | retval = SDL_FALSE |
SDL_bool | done = SDL_FALSE |
SDL_Texture * | background |
SDL_Texture * | button |
SDL_Texture * | axis |
#define SCREEN_HEIGHT 320 |
Definition at line 32 of file testgamecontroller.c.
Referenced by WatchGameController().
#define SCREEN_WIDTH 512 |
Definition at line 31 of file testgamecontroller.c.
Referenced by WatchGameController().
|
static |
Definition at line 70 of file testgamecontroller.c.
References SDL_PixelFormat::BytesPerPixel, SDL_Surface::format, NULL, SDL_Surface::pixels, SDL_CreateTextureFromSurface, SDL_FreeSurface, SDL_GetError, SDL_LoadBMP, SDL_LOG_CATEGORY_APPLICATION, SDL_LogError, SDL_SetColorKey, and SDL_TRUE.
Referenced by WatchGameController().
Definition at line 98 of file testgamecontroller.c.
References SDL_ControllerAxisEvent::axis, axis_positions, SDL_ControllerButtonEvent::button, button_positions, SDL_Event::caxis, SDL_Event::cbutton, done, i, SDL_Event::key, SDL_KeyboardEvent::keysym, NULL, retval, SDL_ALPHA_OPAQUE, SDL_CONTROLLER_AXIS_MAX, SDL_CONTROLLER_BUTTON_MAX, SDL_CONTROLLERAXISMOTION, SDL_CONTROLLERBUTTONDOWN, SDL_CONTROLLERBUTTONUP, SDL_FLIP_NONE, SDL_GameControllerGetAttached, SDL_GameControllerGetAxis, SDL_GameControllerGetButton, SDL_GameControllerGetStringForAxis, SDL_GameControllerGetStringForButton, SDL_KEYDOWN, SDL_Log, SDL_PollEvent, SDL_PRESSED, SDL_QUIT, SDL_RenderClear, SDL_RenderCopy, SDL_RenderCopyEx, SDL_RenderPresent, SDL_SetRenderDrawColor, SDL_TRUE, SDLK_ESCAPE, SDL_ControllerButtonEvent::state, SDL_Keysym::sym, SDL_Event::type, and SDL_ControllerAxisEvent::value.
Referenced by WatchGameController().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 246 of file testgamecontroller.c.
References SDL_Event::cdevice, device, i, NULL, SDL_assert, SDL_CONTROLLERDEVICEADDED, SDL_FALSE, SDL_FINGERDOWN, SDL_free, SDL_GameControllerAddMappingsFromFile, SDL_GameControllerClose, SDL_GameControllerFromInstanceID, SDL_GameControllerGetJoystick, SDL_GameControllerMappingForIndex, SDL_GameControllerNameForIndex, SDL_GameControllerNumMappings, SDL_GameControllerOpen, SDL_GetError, SDL_Init, SDL_INIT_GAMECONTROLLER, SDL_INIT_JOYSTICK, SDL_INIT_VIDEO, SDL_IsGameController, SDL_JoystickGetDeviceGUID, SDL_JoystickGetDeviceProduct, SDL_JoystickGetDeviceVendor, SDL_JoystickGetGUIDString, SDL_JoystickInstanceID, SDL_JoystickNameForIndex, SDL_Log, SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, SDL_LogError, SDL_LogSetPriority, SDL_MOUSEBUTTONDOWN, SDL_NumJoysticks, SDL_QUIT, SDL_QuitSubSystem, SDL_TRUE, SDL_WaitEvent, SDL_Event::type, WatchGameController(), and SDL_ControllerDeviceEvent::which.
SDL_bool WatchGameController | ( | SDL_GameController * | gamecontroller | ) |
Definition at line 168 of file testgamecontroller.c.
References done, LoadTexture(), loop(), NULL, retval, SCREEN_HEIGHT, SCREEN_WIDTH, SDL_ALPHA_OPAQUE, SDL_CreateRenderer, SDL_CreateWindow, SDL_DestroyRenderer, SDL_DestroyWindow, SDL_FALSE, SDL_free, SDL_GameControllerName, SDL_GetError, SDL_Log, SDL_LOG_CATEGORY_APPLICATION, SDL_LogError, SDL_malloc, SDL_RaiseWindow, SDL_RenderClear, SDL_RenderPresent, SDL_RenderSetLogicalSize, SDL_SetRenderDrawColor, SDL_SetTextureColorMod, SDL_snprintf, SDL_strlen, SDL_TRUE, and SDL_WINDOWPOS_CENTERED.
Referenced by main().
double angle |
Definition at line 55 of file testgamecontroller.c.
SDL_Texture * axis |
Definition at line 67 of file testgamecontroller.c.
Referenced by HandleJoystickAxis(), SDL_GameControllerGetStringForAxis(), SDL_GameControllerGetStringForButton(), SDL_GameControllerIgnoreDevicesExceptChanged(), SDL_JoystickGetAxis(), SDL_JoystickGetAxisInitialState(), SDL_PrivateGameControllerAxis(), SDL_PrivateGameControllerParseElement(), SDL_PrivateJoystickAxis(), and WatchJoystick().
const { ... } axis_positions[] |
Referenced by loop().
SDL_Texture* background |
Definition at line 67 of file testgamecontroller.c.
Referenced by WatchJoystick().
SDL_Texture * button |
Definition at line 67 of file testgamecontroller.c.
Referenced by SDL_BApp::_HandleMouseButton(), button_messagebox(), GetMouseClickState(), SDL_GameControllerIgnoreDevicesExceptChanged(), SDL_JoystickGetButton(), SDL_PrivateGameControllerButton(), SDL_PrivateGameControllerParseElement(), SDL_PrivateJoystickButton(), SDL_PrivateSendMouseButton(), SDL_ShowSimpleMessageBox(), and WatchJoystick().
const { ... } button_positions[] |
Referenced by loop().
Definition at line 66 of file testgamecontroller.c.
Referenced by loop(), and WatchGameController().
Definition at line 65 of file testgamecontroller.c.
Referenced by add_audio_device(), loop(), main(), render(), SDL_AtomicCAS(), SDL_AtomicCASPtr(), SDL_BuildAudioTypeCVTFromFloat(), SDL_BuildAudioTypeCVTToFloat(), SDL_CondBroadcast(), SDL_CondSignal(), SDL_CondWaitTimeout(), SDL_GetAudioDeviceName(), SDL_GetNumAudioDevices(), SDL_GetPowerInfo(), SDL_GetQueuedAudioSize(), SDL_GL_LoadLibrary(), SDL_GL_MakeCurrent(), SDL_GL_SetAttribute(), SDL_JoystickGetBall(), SDL_NewAudioStream(), SDL_ResampleAudioStream(), SDL_ReserveSpaceInDataQueue(), SDL_SemPost(), SDL_SemTryWait(), SDL_SemWait(), SDL_SemWaitTimeout(), SDL_SetWindowOpacity(), SDL_ShowMessageBox(), SDL_snprintf(), SDL_TryLockMutex(), SDL_utf8strlen(), SDL_vsscanf(), SDL_Vulkan_LoadLibrary(), SW_RenderCopyEx(), TestWaitTimeout(), and WatchGameController().
SDL_Renderer* screen = NULL |
Definition at line 64 of file testgamecontroller.c.
Referenced by WatchJoystick().
int x |
Definition at line 36 of file testgamecontroller.c.
int y |
Definition at line 36 of file testgamecontroller.c.