Skip to content

Commit

Permalink
Changed controller index to be one based.
Browse files Browse the repository at this point in the history
  • Loading branch information
tgraupmann committed Jul 30, 2013
1 parent 1ee70f8 commit a34b480
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 29 deletions.
2 changes: 1 addition & 1 deletion GameMaker/VirtualController.gmx/Configs/Default.config.gmx
Expand Up @@ -17,7 +17,7 @@
<option_android_arch_mipsr2>True</option_android_arch_mipsr2>
<option_android_arch_mipsr2sf>True</option_android_arch_mipsr2sf>
<option_android_arch_x86>True</option_android_arch_x86>
<option_android_build_version>26</option_android_build_version>
<option_android_build_version>30</option_android_build_version>
<option_android_color_depth>0</option_android_color_depth>
<option_android_display_name>VirtualController</option_android_display_name>
<option_android_flurry_enable>0</option_android_flurry_enable>
Expand Down
Expand Up @@ -25,7 +25,7 @@
<arguments>
<argument>
<kind>1</kind>
<string>varPlayer = 0;
<string>varPlayer = 4;
</string>
</argument>
</arguments>
Expand Down
27 changes: 14 additions & 13 deletions GameMaker/VirtualController.gmx/rooms/room1.room.gmx
Expand Up @@ -8,7 +8,7 @@
<isometric>0</isometric>
<speed>30</speed>
<persistent>0</persistent>
<colour>16744448</colour>
<colour>0</colour>
<showcolour>-1</showcolour>
<code></code>
<enableViews>0</enableViews>
Expand Down Expand Up @@ -40,20 +40,21 @@
<background visible="0" foreground="0" name="" x="0" y="0" htiled="-1" vtiled="-1" hspeed="0" vspeed="0" stretch="0"/>
</backgrounds>
<views>
<view visible="0" objName="" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="&lt;undefined&gt;" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="&lt;undefined&gt;" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="&lt;undefined&gt;" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="&lt;undefined&gt;" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="&lt;undefined&gt;" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="&lt;undefined&gt;" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="&lt;undefined&gt;" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
<view visible="0" objName="&lt;undefined&gt;" xview="0" yview="0" wview="640" hview="480" xport="0" yport="0" wport="640" hport="480" hborder="32" vborder="32" hspeed="-1" vspeed="-1"/>
</views>
<instances>
<instance objName="Controller1" x="672" y="352" name="inst_2A63EE51" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="Controller2" x="1280" y="352" name="inst_E5A7224E" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="Controller3" x="672" y="704" name="inst_B7C1297E" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="Controller4" x="1280" y="704" name="inst_11728EC4" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="Controller1" x="1216" y="704" name="inst_2A63EE51" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="Controller2" x="672" y="416" name="inst_E5A7224E" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="Controller3" x="1216" y="416" name="inst_B7C1297E" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="Controller4" x="672" y="704" name="inst_11728EC4" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="&lt;undefined&gt;" x="992" y="128" name="inst_3F8E99CB" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
</instances>
<tiles/>
<PhysicsWorld>0</PhysicsWorld>
Expand Down
28 changes: 14 additions & 14 deletions GameMaker/VirtualController.gmx/scripts/virtualControllerDraw.gml
Expand Up @@ -11,62 +11,62 @@ else
//show_debug_message("disconnected varPlayer: " + string(varPlayer));
}

if (gamepad_button_check(varPlayer, gp_face3))
if (gamepad_button_check(varPlayer, gp_face3)) //BUTTON_Y
{
draw_sprite(2, -1, x, y);
}

if (gamepad_button_check(varPlayer, gp_face4))
if (gamepad_button_check(varPlayer, gp_face4)) //BUTTON_A
{
draw_sprite(3, -1, x, y);
}

if (gamepad_button_check(varPlayer, gp_face2))
if (gamepad_button_check(varPlayer, gp_face2)) //BUTTON_U
{
draw_sprite(4, -1, x, y);
}

if (gamepad_button_check(varPlayer, gp_padd))
if (gamepad_button_check(varPlayer, gp_padd)) //DPAD_DOWN
{
draw_sprite(6, -1, x, y);
}

if (gamepad_button_check(varPlayer, gp_padl))
if (gamepad_button_check(varPlayer, gp_padl)) //DPAD_LEFT
{
draw_sprite(7, -1, x, y);
}

if (gamepad_button_check(varPlayer, gp_padr))
if (gamepad_button_check(varPlayer, gp_padr)) //DPAD_RIGHT
{
draw_sprite(8, -1, x, y);
}

if (gamepad_button_check(varPlayer, gp_padu))
if (gamepad_button_check(varPlayer, gp_padu)) //DPAD_UP
{
draw_sprite(9, -1, x, y);
}

if (gamepad_button_check(varPlayer, gp_shoulderl))
if (gamepad_button_check(varPlayer, gp_shoulderl)) //LEFT_BUMPER
{
draw_sprite(11, -1, x, y);
}

if (gamepad_button_check(varPlayer, gp_shoulderlb))
if (gamepad_button_check(varPlayer, gp_shoulderlb)) //LEFT_TRIGGER
{
draw_sprite(12, -1, x, y);
}

if (gamepad_button_check(varPlayer, gp_face1))
if (gamepad_button_check(varPlayer, gp_face1)) //BUTTON_O
{
draw_sprite(13, -1, x, y);
}

if (gamepad_button_check(varPlayer, gp_shoulderr))
if (gamepad_button_check(varPlayer, gp_shoulderr)) //RIGHT_BUMPER
{
draw_sprite(15, -1, x, y);
}

if (gamepad_button_check(varPlayer, gp_shoulderrb))
if (gamepad_button_check(varPlayer, gp_shoulderrb)) //RIGHT_TRIGGER
{
draw_sprite(16, -1, x, y);
}
Expand All @@ -81,7 +81,7 @@ varX = gamepad_axis_value(varPlayer, gp_axislh);
varY = gamepad_axis_value(varPlayer, gp_axislv);

//left stick
if (gamepad_button_check(varPlayer, gp_stickl))
if (gamepad_button_check(varPlayer, gp_stickl)) //LEFT_STICK
{
draw_sprite(0, -1, x + axisScaler * (varX * varCos - varY * varSin), y + axisScaler * (varX * varSin + varY * varCos));
}
Expand All @@ -95,7 +95,7 @@ varX = gamepad_axis_value(varPlayer, gp_axisrh);
varY = gamepad_axis_value(varPlayer, gp_axisrv);

//right stick
if (gamepad_button_check(varPlayer, gp_stickr))
if (gamepad_button_check(varPlayer, gp_stickr)) //RIGHT_STICK
{
draw_sprite(1, -1, x + axisScaler * (varX * varCos - varY * varSin), y + axisScaler * (varX * varSin + varY * varCos));
}
Expand Down
Binary file modified GameMaker/VirtualController.gmz
Binary file not shown.

0 comments on commit a34b480

Please sign in to comment.