home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue4 / SDL / gcc346 / !SDL / man / SDL_JoystickOpen.3 < prev    next >
Encoding:
Text File  |  2006-09-20  |  2.0 KB  |  79 lines

  1. <!-- manual page source format generated by PolyglotMan v3.0.8+X.Org, -->
  2. <!-- available at http://polyglotman.sourceforge.net/ -->
  3.  
  4. <html>
  5. <head>
  6. <title>"SDL_JoystickOpen"("3") manual page</title>
  7. </head>
  8. <body bgcolor='#efefef' text='black' link='blue' vlink='#551A8B' alink='red'>
  9. <a href='#toc'>Table of Contents</a><p>
  10.  
  11. <h2><a name='sect0' href='#toc0'>Name</a></h2>
  12. SDL_JoystickOpen- Opens a joystick for use. 
  13. <h2><a name='sect1' href='#toc1'>Synopsis</a></h2>
  14. <p>
  15. <b>#include "SDL.h" <p>
  16. </b><b>SDL_Joystick
  17. *<b>SDL_JoystickOpen</b></b>(<b>int index</b>); 
  18. <h2><a name='sect2' href='#toc2'>Description</a></h2>
  19. <p>
  20. Opens a joystick for use within
  21. SDL. The <b>index</b> refers to the N'th joystick in the system. A joystick must
  22. be opened before it game be used. 
  23. <h2><a name='sect3' href='#toc3'>Return Value</a></h2>
  24. <p>
  25. Returns a <b>SDL_Joystick</b> structure
  26. on success. <b>NULL</b> on failure. 
  27. <h2><a name='sect4' href='#toc4'>Examples</a></h2>
  28. <p>
  29. <p>
  30. <br>
  31. <pre>CWSDL_Joystick *joy;
  32. // Check for joystick
  33. if(SDL_NumJoysticks()>0){
  34.   // Open joystick
  35.   joy=SDL_JoystickOpen(0);
  36.   
  37.   if(joy)
  38.   {
  39.     printf("Opened Joystick 0
  40. ");
  41.     printf("Name: %s
  42. ", SDL_JoystickName(0));
  43.     printf("Number of Axes: %d
  44. ", SDL_JoystickNumAxes(joy));
  45.     printf("Number of Buttons: %d
  46. ", SDL_JoystickNumButtons(joy));
  47.     printf("Number of Balls: %d
  48. ", SDL_JoystickNumBalls(joy));
  49.   }
  50.   else
  51.     printf("Couldn't open Joystick 0
  52. ");
  53.   
  54.   // Close if opened
  55.   if(SDL_JoystickOpened(0))
  56.     SDL_JoystickClose(joy);
  57. }
  58. </pre><p>
  59.  
  60. <h2><a name='sect5' href='#toc5'>See Also</a></h2>
  61. <p>
  62. <i><b>SDL_JoystickClose</b></i> 
  63. <!--
  64.   
  65.  <p>
  66.  
  67. <hr><p>
  68. <a name='toc'><b>Table of Contents</b></a><p>
  69. <ul>
  70. <li><a name='toc0' href='#sect0'>Name</a></li>
  71. <li><a name='toc1' href='#sect1'>Synopsis</a></li>
  72. <li><a name='toc2' href='#sect2'>Description</a></li>
  73. <li><a name='toc3' href='#sect3'>Return Value</a></li>
  74. <li><a name='toc4' href='#sect4'>Examples</a></li>
  75. <li><a name='toc5' href='#sect5'>See Also</a></li>
  76. </ul>
  77. </body>
  78. </html>
  79.