User Interface Dr Scott Schaefer User Interface Make

  • Slides: 25
Download presentation
User Interface Dr. Scott Schaefer

User Interface Dr. Scott Schaefer

User Interface • • Make it simple/easy to do common tasks Don’t obscure the

User Interface • • Make it simple/easy to do common tasks Don’t obscure the FOV Simpler is typically better Consistency is important!

Diablo

Diablo

Warcraft 3

Warcraft 3

World of Warcraft

World of Warcraft

Quake 3

Quake 3

Quake 4

Quake 4

Madden ‘ 09

Madden ‘ 09

Game Control • Must consider single/multi-player aspect • Single player? • Networked multi-player? •

Game Control • Must consider single/multi-player aspect • Single player? • Networked multi-player? • Multi-player same machine? • Platform limitations

Game Control: Keyboard/Mouse • Connected to every PC but lacking on most other platforms

Game Control: Keyboard/Mouse • Connected to every PC but lacking on most other platforms • Fine for single player or multi-player networked • Lots of buttons!

Game Control: Joystick • Found on most consoles • Can also be connect to

Game Control: Joystick • Found on most consoles • Can also be connect to PC via USB • Win NT supports 2 joysticks • Later versions support 16 joysticks

Game Control: Others

Game Control: Others

Joystick Programming with Win 32 #include <windows. h> #include <mmsystem. h> int joy. Get.

Joystick Programming with Win 32 #include <windows. h> #include <mmsystem. h> int joy. Get. Num. Devs ( void ) • Returns: number of joysticks supported by driver (not number connected to machine)

Joystick Programming with Win 32 MMResult joy. Get. Dev. Caps ( int id, JOYCAPS*

Joystick Programming with Win 32 MMResult joy. Get. Dev. Caps ( int id, JOYCAPS* cap, int size ) • id: id of the joystick being tested (-1 through 15) • cap: pointer to a JOYCAP structure • size: size of structure pointed to by cap • Returns: JOYERR_NOERROR if no error

Joystick Programming with Win 32 • typedef struct { short w. Mid; short w.

Joystick Programming with Win 32 • typedef struct { short w. Mid; short w. Pid; char sz. Pname[MAXPNAMELEN]; unsigned int w. Xmin, w. Xmax, w. Ymin, w. Ymax, w. Zmin, w. Zmax; unsigned int w. Num. Buttons; unsigned int w. Period. Min, w. Period. Max; unsigned int w. Rmin, w. Rmax, w. Umin, w. Umax, w. Vmin, w. Vmax; unsigned int w. Caps; unsigned int w. Max. Axes; unsigned int w. Num. Axes; unsigned int w. Max. Buttons; char sz. Reg. Key[MAXPNAMELEN]; char sz. OEMVx. D[MAX_JOYSTICKOEMVXDNAME]; } JOYCAPS;

Joystick Programming with Win 32 • typedef struct { short w. Mid; short w.

Joystick Programming with Win 32 • typedef struct { short w. Mid; short w. Pid; char sz. Pname[MAXPNAMELEN]; unsigned int w. Xmin, w. Xmax, w. Ymin, w. Ymax, w. Zmin, w. Zmax; unsigned int w. Num. Buttons; unsigned int w. Period. Min, w. Period. Max; unsigned int w. Rmin, w. Rmax, w. Umin, w. Umax, w. Vmin, w. Vmax; unsigned int w. Caps; unsigned int w. Max. Axes; unsigned int w. Num. Axes; number of unsigned int w. Max. Buttons; char sz. Reg. Key[MAXPNAMELEN]; char sz. OEMVx. D[MAX_JOYSTICKOEMVXDNAME]; } JOYCAPS; buttons

Joystick Programming with Win 32 • typedef struct { short w. Mid; short w.

Joystick Programming with Win 32 • typedef struct { short w. Mid; short w. Pid; char sz. Pname[MAXPNAMELEN]; unsigned int w. Xmin, w. Xmax, w. Ymin, w. Ymax, w. Zmin, w. Zmax; unsigned int w. Num. Buttons; unsigned int w. Period. Min, w. Period. Max; unsigned int w. Rmin, w. Rmax, w. Umin, w. Umax, w. Vmin, w. Vmax; unsigned int w. Caps; unsigned int w. Max. Axes; unsigned int w. Num. Axes; min/max bounds unsigned int w. Max. Buttons; char sz. Reg. Key[MAXPNAMELEN]; “hat” controllers char sz. OEMVx. D[MAX_JOYSTICKOEMVXDNAME]; } JOYCAPS; for

Joystick Programming with Win 32 MMResult joy. Get. Pos. Ex ( int id, JOYINFOEX*

Joystick Programming with Win 32 MMResult joy. Get. Pos. Ex ( int id, JOYINFOEX* info) • id: id of the joystick being tested (-1 through 15) • info: pointer to a JOYINFOEX structure • Returns: JOYERR_NOERROR if no error JOYERR_UNPLUGGED if joystick not connected

Joystick Programming with Win 32 • typedef struct { int dw. Size; int dw.

Joystick Programming with Win 32 • typedef struct { int dw. Size; int dw. Flags; int dw. Xpos, dw. Ypos, dw. Zpos; int dw. Rpos, dw. Upos, dw. Vpos; int dw. Button. Number; int dw. POV; int dw. Reserved 1; int dw. Reserved 2; } JOYINFOEX;

Joystick Programming with Win 32 • typedef struct { int dw. Size; int dw.

Joystick Programming with Win 32 • typedef struct { int dw. Size; int dw. Flags; int dw. Xpos, dw. Ypos, dw. Zpos; int dw. Rpos, dw. Upos, dw. Vpos; int dw. Button. Number; int dw. POV; MUST be sizeof( JOYINFOEX) int dw. Reserved 1; int dw. Reserved 2; } JOYINFOEX;

Joystick Programming with Win 32 • typedef struct { int dw. Size; int dw.

Joystick Programming with Win 32 • typedef struct { int dw. Size; int dw. Flags; int dw. Xpos, dw. Ypos, dw. Zpos; int dw. Rpos, dw. Upos, dw. Vpos; int dw. Button. Number; int dw. POV; SHOULD be JOY_RETURNALL int dw. Reserved 1; int dw. Reserved 2; } JOYINFOEX;

Joystick Programming with Win 32 • typedef struct { int dw. Size; int dw.

Joystick Programming with Win 32 • typedef struct { int dw. Size; int dw. Flags; int dw. Xpos, dw. Ypos, dw. Zpos; int dw. Rpos, dw. Upos, dw. Vpos; int dw. Button. Number; int dw. POV; position of “hat” controllers int dw. Reserved 1; int dw. Reserved 2; } JOYINFOEX;

Joystick Programming with Win 32 • typedef struct { int dw. Size; int dw.

Joystick Programming with Win 32 • typedef struct { int dw. Size; int dw. Flags; int dw. Xpos, dw. Ypos, dw. Zpos; int dw. Rpos, dw. Upos, dw. Vpos; int dw. Button. Number; int dw. POV; bit array with bit set if int dw. Reserved 1; button currently pressed int dw. Reserved 2; } JOYINFOEX;

Joystick Programming with Win 32 • typedef struct { int dw. Size; int dw.

Joystick Programming with Win 32 • typedef struct { int dw. Size; int dw. Flags; int dw. Xpos, dw. Ypos, dw. Zpos; int dw. Rpos, dw. Upos, dw. Vpos; int dw. Button. Number; int dw. POV; number of buttons pressed int dw. Reserved 1; int dw. Reserved 2; } JOYINFOEX;

Joystick Programming with Win 32 • typedef struct { int dw. Size; int dw.

Joystick Programming with Win 32 • typedef struct { int dw. Size; int dw. Flags; int dw. Xpos, dw. Ypos, dw. Zpos; int dw. Rpos, dw. Upos, dw. Vpos; int dw. Button. Number; int dw. POV; angle of POV controller int dw. Reserved 1; int dw. Reserved 2; } JOYINFOEX;