Autor Tema: Really Good Joypad Tester  (Leído 3536 veces)

MisterN

  • Hero Member
  • *****
  • Mensajes: 650
  • Karma: 4
Really Good Joypad Tester
« en: Agosto 19, 2012, 08:42:29 pm »
This will tell you what button is what, what axis is what, and what hat is what on bennu. This was made with the 360 controller in mind, so all the code is based for the 360.

Version One (only uses console)
Código: [Seleccionar]
/*

BennuGD JoyPad Test

Created By: Nicholas Wolf

Purpose: For showing you what belongs to what on the joypad so that you can use it in the code

*made with the XBOX360 controller in mind

*/

#ifndef __VERSION__
    import "mod_sdlevthandler";
    import "mod_pathfind";
#else
    import "mod_blendop";
    import "mod_text";
    import "mod_grproc";
    import "mod_video";
    import "mod_map";
    import "mod_screen";
    import "mod_path";
    import "mod_rand";
    import "mod_say";
    import "mod_mouse";
    import "mod_scroll";
    import "mod_math";
#endif

IMPORT "mod_debug";
IMPORT "mod_dir";
IMPORT "mod_file";
IMPORT "mod_key";
IMPORT "mod_draw";
IMPORT "mod_string";
IMPORT "mod_proc";
IMPORT "mod_wm";
IMPORT "mod_sys";
IMPORT "mod_joy";
IMPORT "mod_sound";
IMPORT "mod_time";
IMPORT "mod_timers";
IMPORT "mod_cd"

global
    //Joy buttons
        joy_but_0 = 0;
        joy_but_1 = 1;
        joy_but_2 = 2;
        joy_but_3 = 3;
        joy_but_4 = 4;
        joy_but_5 = 5;
        joy_but_6 = 6;
        joy_but_7 = 7;
        joy_but_8 = 8;
        joy_but_9 = 9;
        joy_but_10 = 10;
        joy_but_11 = 11;
        joy_but_12 = 12;
       
        hats[7][22];

process main()
begin
say("Joypads present: "+joy_number());
    loop
        //The buttons
            if(joy_getbutton(0,joy_but_0))
                say("This button is assigned to button 0");
            end
            if(joy_getbutton(0,joy_but_1))
                say("This button is assigned to button 1");
            end
            if(joy_getbutton(0,joy_but_2))
                say("This button is assigned to button 2");
            end
            if(joy_getbutton(0,joy_but_3))
                say("This button is assigned to button 3");
            end
            if(joy_getbutton(0,joy_but_4))
                say("This button is assigned to button 4");
            end
            if(joy_getbutton(0,joy_but_5))
                say("This button is assigned to button 5");
            end
            if(joy_getbutton(0,joy_but_6))
                say("This button is assigned to button 6");
            end
            if(joy_getbutton(0,joy_but_7))
                say("This button is assigned to button 7");
            end
            if(joy_getbutton(0,joy_but_8))
                say("This button is assigned to button 8");
            end
            if(joy_getbutton(0,joy_but_9))
                say("This button is assigned to button 9");
            end
            if(joy_getbutton(0,joy_but_10))
                say("This button is assigned to button 10");
            end
            if(joy_getbutton(0,joy_but_11))
                say("This button is assigned to button 11");
            end
            if(joy_getbutton(0,joy_but_12))
                say("This button is assigned to button 12");
            end
        //The Axis's
            if(joy_getaxis(0,0)<-6);
                say("axis is going left");
            end
            if(joy_getaxis(0,0)>6);
                say("axis is going right");
            end
            if(joy_getaxis(0,1)>6);
                say("axis is going down");
            end
            if(joy_getaxis(0,1)<-6);
                say("axis is going up");
            end
            if(joy_getaxis(0,2)<-6);
                say("axis is going up");
            end
            if(joy_getaxis(0,2)>6);
                say("axis is going down");
            end
            if(joy_getaxis(0,3)>6);
                say("axis is going down");
            end
            if(joy_getaxis(0,3)<-6);
                say("axis is going up");
            end
            if(joy_getaxis(0,4)<-6);
                say("axis is going left");
            end
            if(joy_getaxis(0,4)>6);
                say("axis is going right");
            end
        //The Hats
            hats[y][x]=JOY_GETHAT(y,x);
            if(hats[y][x]!=0)
                say("hats: "+hats[y][x]);
            end
       
        IF (key(_esc) or exit_status)
            exit("goodbye!",0);
        END
    frame; end
end


Version Two (COMING SOON)

gecko

  • Hero Member
  • *****
  • Mensajes: 781
  • Karma: 46
    • Torres Baldi Studio
Re:Really Good Joypad Tester
« Respuesta #1 en: Agosto 20, 2012, 04:59:17 am »
Thanks for sharing! Karma! :)
Torres Baldi Studio
http://torresbaldi.com

JaViS

  • Global Moderator
  • *****
  • Mensajes: 1150
  • Karma: 19
    • Anarkade
Re:Really Good Joypad Tester
« Respuesta #2 en: Enero 31, 2013, 11:05:09 pm »
Really useful!! :D thanks
Working on Anarkade. A couch multiplayer 2D shooter.

josebita

  • Administrator
  • *****
  • Mensajes: 4039
  • Karma: 257
    • BennuGD Mobile Worklog
Re:Really Good Joypad Tester
« Respuesta #3 en: Febrero 01, 2013, 09:13:16 am »
Thanks a lot DoctorN!

MisterN

  • Hero Member
  • *****
  • Mensajes: 650
  • Karma: 4
Re:Really Good Joypad Tester
« Respuesta #4 en: Febrero 01, 2013, 09:56:10 pm »
Im going to make one that will display the information on the screen (as well as the console) at some point so that I can test it on the dreamcast.
werg