In memory of Ben “bushing” Byer, who passed away on Monday, February 8th, 2016.

Changes

Jump to navigation Jump to search
243 bytes added ,  20:23, 16 August 2010
no edit summary
Line 7: Line 7:  
/**
 
/**
 
     @file  main.c
 
     @file  main.c
     @note  ANSI c99 compliance. Published under the GPL 3 license (see license.txt for more info)
+
     @note  Published under the GPL 3 license (see license.txt for more info)
 
*/
 
*/
    
//standard includes
 
//standard includes
 
#include <stdlib.h>
 
#include <stdlib.h>
#include <string.h>
  −
#include <time.h>
     −
#include "fontmap.h"
+
#include "fontmap.h" //for display purpose
    
#ifndef GEKKO
 
#ifndef GEKKO
Line 33: Line 31:  
/*
 
/*
 
   define an array of pointer of joysticks, for games with one player, use just a SDL_Joystick*
 
   define an array of pointer of joysticks, for games with one player, use just a SDL_Joystick*
   SDL_NumJoysticks and a malloc is also a good alternative
+
   SDL_NumJoysticks and a malloc is also a good alternative for variable number of joysticks at runtime (not usual thougth)
 
*/
 
*/
 
#define JOYNUMS 4
 
#define JOYNUMS 4
Line 266: Line 264:  
if( event.jaxis.axis == 0)  
 
if( event.jaxis.axis == 0)  
 
{
 
{
/* Left-right movement code goes here */
+
/* Left and right movement (according to jaxis_value) of the nunchuck stick or left analogic stick of the classic pad*/
 
}
 
}
    
if( event.jaxis.axis == 1)  
 
if( event.jaxis.axis == 1)  
 
{
 
{
/* Up-Down movement code goes here */
+
/* Up and Down movement (according to jaxis_value) of the nunchuck stick or left analogic stick of the classic pad */
 
}
 
}
   Line 280: Line 278:  
}
 
}
 
 
 +
//Infra Red is mapped as a mouse
 
if( event.type == SDL_MOUSEMOTION ) {
 
if( event.type == SDL_MOUSEMOTION ) {
 
p1_x = event.motion.x;  
 
p1_x = event.motion.x;  
Line 287: Line 286:  
         } //end of pool event
 
         } //end of pool event
 
 
fontmap_printf( jaxis_which * (FONTMAP_SIZE * offset_x), FONTMAP_SIZE * (SDL_JoystickNumButtons(joysticks[jaxis_which]) + offset_y), screen, "W %d A %d V %.4d", jaxis_which, jaxis_axis, jaxis_value);
   
fontmap_printf( jaxis_which * (FONTMAP_SIZE * offset_x), FONTMAP_SIZE * (SDL_JoystickNumButtons(joysticks[jaxis_which]) + offset_y + 2), screen, "IR X %d IR Y %d", p1_x, p1_y);
 
fontmap_printf( jaxis_which * (FONTMAP_SIZE * offset_x), FONTMAP_SIZE * (SDL_JoystickNumButtons(joysticks[jaxis_which]) + offset_y + 2), screen, "IR X %d IR Y %d", p1_x, p1_y);
 +
fontmap_printf( jaxis_which * (FONTMAP_SIZE * offset_x), FONTMAP_SIZE * (SDL_JoystickNumButtons(joysticks[jaxis_which]) + offset_y), screen, "AXIS MOTION %d\nAXIS %d\nVALUE %.4d", jaxis_which, jaxis_axis, jaxis_value);
 
 
 
// The hat report the Directional PAD status  
 
// The hat report the Directional PAD status  
Line 348: Line 347:  
     }
 
     }
 
}
 
}
 +
    
</source>
 
</source>
99

edits

Navigation menu