comparison TaskManager/Test/test_render/Pad.cpp @ 221:d61fded0729e

Cameraの設定、Makefile 修正
author gongo@gendarme.local
date Tue, 10 Feb 2009 01:47:12 +0900
parents
children
comparison
equal deleted inserted replaced
220:29e338dbc280 221:d61fded0729e
1 #include <stdio.h>
2 #include "Keyboard.h"
3 #include "Joystick.h"
4
5 /**
6 * Joystick があればそれを使い、
7 * 無ければキーボードを返す
8 */
9 Pad*
10 create_controller(void)
11 {
12 if (SDL_NumJoysticks()) {
13 SDL_Joystick *joy = SDL_JoystickOpen(0);
14 if (!joy) {
15 printf("%s: failed to open joystick", __FUNCTION__);
16 printf("Instead use Keyboard\n");
17 return new Keyboard;
18 } else {
19 printf("Use Joystick\n");
20 return new Joystick(joy);
21 }
22 } else {
23 printf("Use Keyboard\n");
24 return new Keyboard;
25 }
26 }