// Wii2Vars.c
// Show Wiimote Variables onscreen
#include <acknex.h>
#include <default.c>
#include <ackwii.h>
fps_max = 60 ;
WIIMOTE buffer ; // defines a new buffer
WIIMOTE buffer2 ;
var howManyR_Wii = 0 ; // wiimote_getdevices()
var who_wii_R = 0 ; // wiimote_handle(var)
var who_wii_R2 = 0 ;
var who_wii_R3 = 0 ;
var who_wii_R4 = 0 ;
var wii_R_On = 0 ; // wiimote_connected(var)
var wii_R_On2 = 0 ;
var wii_R_On3 = 0 ;
var wii_R_On4 = 0 ;
var vibe1 = 1 ;
var vibe2 = 1 ;
PANEL* panButtons =
{
digits( 60, 10, "Wii Buttons", Arial#28b, 1, 0 ) ;
digits( 60, 40, "# of Wiis Online = %0.f", Arial#18b, 1, howManyR_Wii ) ;
// digits( 60, 60, "NULL = %0.f", Arial#18b, 1, NULL ) ;
digits( 60, 80, "WiiMote Handle = %0.f", Arial#18b, 1, who_wii_R ) ;
digits( 60, 100, "WiiMote Connected? = %0.f", Arial#18b, 1, wii_R_On ) ;
digits( 60, 120, "A button = %0.f", Arial#18b, 1, buffer.buttons.butA ) ;
digits( 60, 140, "WiiStick Angle Tilt = %0.f", Arial#18b, 1, buffer.angle1.tilt ) ;
digits( 60, 160, "WiiStick Angle Roll = %0.f", Arial#18b, 1, buffer.angle1.roll ) ;
// digits( 60, 180, "NULL = %0.f", Arial#18b, 1, NULL ) ;
digits( 60, 200, "Wii2 Buttons", Arial#28b, 1, 0 ) ;
// digits( 60, 220, "NULL = %0.f", Arial#18b, 1, NULL ) ;
digits( 60, 240, "WiiMote2 Connected? = %0.f", Arial#18b, 1, wii_R_On2 ) ;
digits( 60, 260, "WiiMote2 Handle = %0.f", Arial#18b, 1, who_wii_R2 ) ;
digits( 60, 280, "A button = %0.f", Arial#18b, 1, buffer2.buttons.butA ) ;
digits( 60, 300, "WiiStick2 Angle Tilt = %0.f", Arial#18b, 1, buffer2.angle1.tilt ) ;
digits( 60, 320, "WiiStick2 Angle Roll = %0.f", Arial#18b, 1, buffer2.angle1.roll ) ;
// digits( 60, 340, "NULL = %0.f", Arial#18b, 1, NULL ) ;
red = 1 ; green = 1 ; blue = 1 ; // Change Text color to black
flags = VISIBLE;
}
PANEL* panMoButtons =
{
digits( 300, 10, "Wii3 Buttons", Arial#28b, 1, 0 ) ;
// digits( 300, 60, "NULL = %0.f", Arial#18b, 1, NULL ) ;
digits( 300, 80, "WiiMote3 Handle = %0.f", Arial#18b, 1, who_wii_R3 ) ;
digits( 300, 100, "WiiMote3 Connected? = %0.f", Arial#18b, 1, wii_R_On3 ) ;
// digits( 300, 120, "A button = %0.f", Arial#18b, 1, buffer3.buttons.butA ) ;
// digits( 300, 140, "WiiStick Angle Tilt = %0.f", Arial#18b, 1, buffer3.angle1.tilt ) ;
// digits( 300, 160, "WiiStick Angle Roll = %0.f", Arial#18b, 1, buffer3.angle1.roll ) ;
// digits( 300, 180, "NULL = %0.f", Arial#18b, 1, NULL ) ;
digits( 300, 200, "Wii4 Buttons", Arial#28b, 1, 0 ) ;
// digits( 300, 220, "NULL = %0.f", Arial#18b, 1, NULL ) ;
digits( 300, 240, "WiiMote4 Connected? = %0.f", Arial#18b, 1, wii_R_On4 ) ;
digits( 300, 260, "WiiMote4 Handle = %0.f", Arial#18b, 1, who_wii_R4 ) ;
// digits( 300, 280, "A button = %0.f", Arial#18b, 1, buffer4.buttons.butA ) ;
// digits( 300, 300, "WiiStick4 Angle Tilt = %0.f", Arial#18b, 1, buffer4.angle1.tilt ) ;
// digits( 300, 320, "WiiStick4 Angle Roll = %0.f", Arial#18b, 1, buffer4.angle1.roll ) ;
// digits( 300, 340, "NULL = %0.f", Arial#18b, 1, NULL ) ;
red = 1 ; green = 1 ; blue = 1 ; // Change Text color to black
flags = VISIBLE;
}
action update_Earth()
{
my.scale_x = .5 ; my.scale_y = .5 ; my.scale_z = .5 ;
while ( who_wii_R )
{
my.z = -( buffer.angle1.tilt ) / 2 ;
my.y = -( buffer.angle1.roll ) / 2 ;
wait(1);
}
}
void main()
{
level_load("") ; // Load empty Level
wait(1);
sky_color.red = 255 ; sky_color.green = 255 ; sky_color.blue = 255 ;
who_wii_R = wiimote_handle(1) ;
who_wii_R2 = wiimote_handle(2) ;
who_wii_R3 = wiimote_handle(3) ;
who_wii_R4 = wiimote_handle(4) ;
wait(2);
// if ( !who_wii_R )
// {
// printf( "No WiiMote connected!" ) ;
// sys_exit( "G'bye Y'all" ) ;
// }
// else
// {
ent_create("earth.mdl", vector( 100, -30, 20 ), update_Earth) ; // Create Earth Model
while( who_wii_R )
{
howManyR_Wii = wiimote_getdevices() ; // Return the number of Wiimotes online
wait(1);
wiimote_status( who_wii_R, buffer ) ; // Copy all the Wiimote Variables to a Struct named "buffer"
wiimote_status( who_wii_R2, buffer2 ) ;
wii_R_On = wiimote_connected( who_wii_R ) ; // Are Wii Connected? Query by Handle Name
wii_R_On2 = wiimote_connected( who_wii_R2 ) ;
if ( wii_R_On && vibe1 )
{
wiimote_vibration( who_wii_R, 1 ) ; // Turn the vibration on (1)
wait(100) ; // Shake until thoroughly agitated
wiimote_vibration( who_wii_R, 0 ) ; // Turn the vibration off (0)
vibe1 = 0 ; // and never do it again
}
if ( wii_R_On2 && vibe2 )
{
wiimote_vibration( who_wii_R2, 1 ) ; // Turn the vibration on (1)
wait(100) ; // Shake until thoroughly agitated
wiimote_vibration( who_wii_R2, 0 ) ; // Turn the vibe off (0)
vibe2 = 0 ; // and never do it again
}
}
// }
}