const char* SDL_GameControllerGetStringForAxis(SDL_GameControllerAxis axis)
axis | SDL_GameControllerAxisの値 |
#include "SDL.h"
int main(int argc, char* argv[])
{
SDL_Event event;
SDL_bool running = SDL_TRUE;
if (SDL_Init(SDL_INIT_GAMECONTROLLER) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL2初期化エラー : %s¥n", SDL_GetError());
return 1;
}
while (running) {
while (SDL_PollEvent(&event) > 0) {
if (event.type == SDL_QUIT) {
running = SDL_FALSE;
}
if (event.type == SDL_CONTROLLERAXISMOTION) {
const char *axisName = SDL_GameControllerGetStringForAxis((SDL_GameControllerAxis)event.caxis.axis);
int axisValue = event.caxis.value;
SDL_Log("使用軸 : %s¥t軸の値 : %d¥n", axisName, axisValue);
}
}
}
SDL_Quit();
return 0;
}