Beispiel #1
0
  static void CreateDefaultBinds() {
    for (DefaultKey key : KeyboardKey.DefaultKeys) {
      CreateStringBind(
          "key_"
              + key.eventend
              + " \"key "
              + key.key
              + ((key.isRight ? " right" : ""))
              + ((key.isLeft ? " left" : ""))
              + ((key.isNumPad ? " numpad" : ""))
              + "\"");
    }
    KeyboardKey.CreateDefaultBinds();
    for (CHandlerEvent it : handlergroup) {
      StringRef buffer = new StringRef();
      it.MakeDefaultBind(buffer);
      CreateStringBind(buffer.value);
    }

    //        /* joystick1, buttons 1-6 */
    //        CreateStringBind("jbutton_0_0 \"stick_0 button 0\" ");
    //        CreateStringBind("jbutton_0_1 \"stick_0 button 1\" ");
    //        CreateStringBind("jbutton_0_2 \"stick_0 button 2\" ");
    //        CreateStringBind("jbutton_0_3 \"stick_0 button 3\" ");
    //        CreateStringBind("jbutton_0_4 \"stick_0 button 4\" ");
    //        CreateStringBind("jbutton_0_5 \"stick_0 button 5\" ");
    //        /* joystick2, buttons 1-2 */
    //        CreateStringBind("jbutton_1_0 \"stick_1 button 0\" ");
    //        CreateStringBind("jbutton_1_1 \"stick_1 button 1\" ");
    //
    //        /* joystick1, axes 1-4 */
    //        CreateStringBind("jaxis_0_0- \"stick_0 axis 0 0\" ");
    //        CreateStringBind("jaxis_0_0+ \"stick_0 axis 0 1\" ");
    //        CreateStringBind("jaxis_0_1- \"stick_0 axis 1 0\" ");
    //        CreateStringBind("jaxis_0_1+ \"stick_0 axis 1 1\" ");
    //        CreateStringBind("jaxis_0_2- \"stick_0 axis 2 0\" ");
    //        CreateStringBind("jaxis_0_2+ \"stick_0 axis 2 1\" ");
    //        CreateStringBind("jaxis_0_3- \"stick_0 axis 3 0\" ");
    //        CreateStringBind("jaxis_0_3+ \"stick_0 axis 3 1\" ");
    //        /* joystick2, axes 1-2 */
    //        CreateStringBind("jaxis_1_0- \"stick_1 axis 0 0\" ");
    //        CreateStringBind("jaxis_1_0+ \"stick_1 axis 0 1\" ");
    //        CreateStringBind("jaxis_1_1- \"stick_1 axis 1 0\" ");
    //        CreateStringBind("jaxis_1_1+ \"stick_1 axis 1 1\" ");
    //
    //        /* joystick1, hat */
    //        CreateStringBind("jhat_0_0_0 \"stick_0 hat 0 1\" ");
    //        CreateStringBind("jhat_0_0_1 \"stick_0 hat 0 2\" ");
    //        CreateStringBind("jhat_0_0_2 \"stick_0 hat 0 4\" ");
    //        CreateStringBind("jhat_0_0_3 \"stick_0 hat 0 8\" ");
  }
Beispiel #2
0
  static void CreateLayout() {
    int i;
    /* Create the buttons for the Keyboard */

    AddKeyButtonEvent(PX(0), PY(0), BW, BH, "ESC", "esc", Keyboard.KBD_KEYS.KBD_esc);
    for (i = 0; i < 12; i++)
      AddKeyButtonEvent(
          PX(2 + i), PY(0), BW, BH, combo_f[i].title, combo_f[i].entry, combo_f[i].key);
    for (i = 0; i < 14; i++)
      AddKeyButtonEvent(PX(i), PY(1), BW, BH, combo_1[i].title, combo_1[i].entry, combo_1[i].key);

    AddKeyButtonEvent(PX(0), PY(2), BW * 2, BH, "TAB", "tab", Keyboard.KBD_KEYS.KBD_tab);
    for (i = 0; i < 12; i++)
      AddKeyButtonEvent(
          PX(2 + i), PY(2), BW, BH, combo_2[i].title, combo_2[i].entry, combo_2[i].key);

    AddKeyButtonEvent(PX(14), PY(2), BW * 2, BH * 2, "ENTER", "enter", Keyboard.KBD_KEYS.KBD_enter);

    caps_lock_event =
        AddKeyButtonEvent(
            PX(0), PY(3), BW * 2, BH, "CLCK", "capslock", Keyboard.KBD_KEYS.KBD_capslock);
    for (i = 0; i < 12; i++)
      AddKeyButtonEvent(
          PX(2 + i), PY(3), BW, BH, combo_3[i].title, combo_3[i].entry, combo_3[i].key);

    AddKeyButtonEvent(PX(0), PY(4), BW * 2, BH, "SHIFT", "lshift", Keyboard.KBD_KEYS.KBD_leftshift);
    for (i = 0; i < 11; i++)
      AddKeyButtonEvent(
          PX(2 + i), PY(4), BW, BH, combo_4[i].title, combo_4[i].entry, combo_4[i].key);
    AddKeyButtonEvent(
        PX(13), PY(4), BW * 3, BH, "SHIFT", "rshift", Keyboard.KBD_KEYS.KBD_rightshift);

    /* Last Row */
    AddKeyButtonEvent(PX(0), PY(5), BW * 2, BH, "CTRL", "lctrl", Keyboard.KBD_KEYS.KBD_leftctrl);
    AddKeyButtonEvent(PX(3), PY(5), BW * 2, BH, "ALT", "lalt", Keyboard.KBD_KEYS.KBD_leftalt);
    AddKeyButtonEvent(PX(5), PY(5), BW * 6, BH, "SPACE", "space", Keyboard.KBD_KEYS.KBD_space);
    AddKeyButtonEvent(PX(11), PY(5), BW * 2, BH, "ALT", "ralt", Keyboard.KBD_KEYS.KBD_rightalt);
    AddKeyButtonEvent(PX(14), PY(5), BW * 2, BH, "CTRL", "rctrl", Keyboard.KBD_KEYS.KBD_rightctrl);

    /* Arrow Keys */
    int XO = 17;
    int YO = 0;

    AddKeyButtonEvent(
        PX(XO + 0), PY(YO), BW, BH, "PRT", "printscreen", Keyboard.KBD_KEYS.KBD_printscreen);
    AddKeyButtonEvent(
        PX(XO + 1), PY(YO), BW, BH, "SCL", "scrolllock", Keyboard.KBD_KEYS.KBD_scrolllock);
    AddKeyButtonEvent(PX(XO + 2), PY(YO), BW, BH, "PAU", "pause", Keyboard.KBD_KEYS.KBD_pause);
    AddKeyButtonEvent(
        PX(XO + 0), PY(YO + 1), BW, BH, "INS", "insert", Keyboard.KBD_KEYS.KBD_insert);
    AddKeyButtonEvent(PX(XO + 1), PY(YO + 1), BW, BH, "HOM", "home", Keyboard.KBD_KEYS.KBD_home);
    AddKeyButtonEvent(
        PX(XO + 2), PY(YO + 1), BW, BH, "PUP", "pageup", Keyboard.KBD_KEYS.KBD_pageup);
    AddKeyButtonEvent(
        PX(XO + 0), PY(YO + 2), BW, BH, "DEL", "delete", Keyboard.KBD_KEYS.KBD_delete);
    AddKeyButtonEvent(PX(XO + 1), PY(YO + 2), BW, BH, "END", "end", Keyboard.KBD_KEYS.KBD_end);
    AddKeyButtonEvent(
        PX(XO + 2), PY(YO + 2), BW, BH, "PDN", "pagedown", Keyboard.KBD_KEYS.KBD_pagedown);
    AddKeyButtonEvent(PX(XO + 1), PY(YO + 4), BW, BH, "\u0018", "up", Keyboard.KBD_KEYS.KBD_up);
    AddKeyButtonEvent(PX(XO + 0), PY(YO + 5), BW, BH, "\u001B", "left", Keyboard.KBD_KEYS.KBD_left);
    AddKeyButtonEvent(PX(XO + 1), PY(YO + 5), BW, BH, "\u0019", "down", Keyboard.KBD_KEYS.KBD_down);
    AddKeyButtonEvent(
        PX(XO + 2), PY(YO + 5), BW, BH, "\u001A", "right", Keyboard.KBD_KEYS.KBD_right);

    XO = 0;
    YO = 7;
    /* Numeric KeyPad */
    num_lock_event =
        AddKeyButtonEvent(PX(XO), PY(YO), BW, BH, "NUM", "numlock", Keyboard.KBD_KEYS.KBD_numlock);
    AddKeyButtonEvent(PX(XO + 1), PY(YO), BW, BH, "/", "kp_divide", Keyboard.KBD_KEYS.KBD_kpdivide);
    AddKeyButtonEvent(
        PX(XO + 2), PY(YO), BW, BH, "*", "kp_multiply", Keyboard.KBD_KEYS.KBD_kpmultiply);
    AddKeyButtonEvent(PX(XO + 3), PY(YO), BW, BH, "-", "kp_minus", Keyboard.KBD_KEYS.KBD_kpminus);
    AddKeyButtonEvent(PX(XO + 0), PY(YO + 1), BW, BH, "7", "kp_7", Keyboard.KBD_KEYS.KBD_kp7);
    AddKeyButtonEvent(PX(XO + 1), PY(YO + 1), BW, BH, "8", "kp_8", Keyboard.KBD_KEYS.KBD_kp8);
    AddKeyButtonEvent(PX(XO + 2), PY(YO + 1), BW, BH, "9", "kp_9", Keyboard.KBD_KEYS.KBD_kp9);
    AddKeyButtonEvent(
        PX(XO + 3), PY(YO + 1), BW, BH * 2, "+", "kp_plus", Keyboard.KBD_KEYS.KBD_kpplus);
    AddKeyButtonEvent(PX(XO), PY(YO + 2), BW, BH, "4", "kp_4", Keyboard.KBD_KEYS.KBD_kp4);
    AddKeyButtonEvent(PX(XO + 1), PY(YO + 2), BW, BH, "5", "kp_5", Keyboard.KBD_KEYS.KBD_kp5);
    AddKeyButtonEvent(PX(XO + 2), PY(YO + 2), BW, BH, "6", "kp_6", Keyboard.KBD_KEYS.KBD_kp6);
    AddKeyButtonEvent(PX(XO + 0), PY(YO + 3), BW, BH, "1", "kp_1", Keyboard.KBD_KEYS.KBD_kp1);
    AddKeyButtonEvent(PX(XO + 1), PY(YO + 3), BW, BH, "2", "kp_2", Keyboard.KBD_KEYS.KBD_kp2);
    AddKeyButtonEvent(PX(XO + 2), PY(YO + 3), BW, BH, "3", "kp_3", Keyboard.KBD_KEYS.KBD_kp3);
    AddKeyButtonEvent(
        PX(XO + 3), PY(YO + 3), BW, BH * 2, "ENT", "kp_enter", Keyboard.KBD_KEYS.KBD_kpenter);
    AddKeyButtonEvent(PX(XO), PY(YO + 4), BW * 2, BH, "0", "kp_0", Keyboard.KBD_KEYS.KBD_kp0);
    AddKeyButtonEvent(
        PX(XO + 2), PY(YO + 4), BW, BH, ".", "kp_period", Keyboard.KBD_KEYS.KBD_kpperiod);

    XO = 10;
    YO = 8;

    //        /* Joystick Buttons/Texts */
    //        /* Buttons 1+2 of 1st Joystick */
    //        AddJButtonButton(PX(XO),PY(YO),BW,BH,"1" ,0,0);
    //        AddJButtonButton(PX(XO+2),PY(YO),BW,BH,"2" ,0,1);
    //        /* Axes 1+2 (X+Y) of 1st Joystick */
    //        CJAxisEvent * cjaxis=AddJAxisButton(PX(XO+1),PY(YO),BW,BH,"Y-",0,1,false,NULL);
    //        AddJAxisButton  (PX(XO+1),PY(YO+1),BW,BH,"Y+",0,1,true,cjaxis);
    //        cjaxis=AddJAxisButton  (PX(XO),PY(YO+1),BW,BH,"X-",0,0,false,NULL);
    //        AddJAxisButton  (PX(XO+2),PY(YO+1),BW,BH,"X+",0,0,true,cjaxis);
    //
    //        if (joytype==JOY_2AXIS) {
    //            /* Buttons 1+2 of 2nd Joystick */
    //            AddJButtonButton(PX(XO+4),PY(YO),BW,BH,"1" ,1,0);
    //            AddJButtonButton(PX(XO+4+2),PY(YO),BW,BH,"2" ,1,1);
    //            /* Buttons 3+4 of 1st Joystick, not accessible */
    //            AddJButtonButton_hidden(0,2);
    //            AddJButtonButton_hidden(0,3);
    //
    //            /* Axes 1+2 (X+Y) of 2nd Joystick */
    //            cjaxis=	AddJAxisButton(PX(XO+4),PY(YO+1),BW,BH,"X-",1,0,false,NULL);
    //                    AddJAxisButton(PX(XO+4+2),PY(YO+1),BW,BH,"X+",1,0,true,cjaxis);
    //            cjaxis=	AddJAxisButton(PX(XO+4+1),PY(YO+0),BW,BH,"Y-",1,1,false,NULL);
    //                    AddJAxisButton(PX(XO+4+1),PY(YO+1),BW,BH,"Y+",1,1,true,cjaxis);
    //            /* Axes 3+4 (X+Y) of 1st Joystick, not accessible */
    //            cjaxis=	AddJAxisButton_hidden(0,2,false,NULL);
    //                    AddJAxisButton_hidden(0,2,true,cjaxis);
    //            cjaxis=	AddJAxisButton_hidden(0,3,false,NULL);
    //                    AddJAxisButton_hidden(0,3,true,cjaxis);
    //        } else {
    //            /* Buttons 3+4 of 1st Joystick */
    //            AddJButtonButton(PX(XO+4),PY(YO),BW,BH,"3" ,0,2);
    //            AddJButtonButton(PX(XO+4+2),PY(YO),BW,BH,"4" ,0,3);
    //            /* Buttons 1+2 of 2nd Joystick, not accessible */
    //            AddJButtonButton_hidden(1,0);
    //            AddJButtonButton_hidden(1,1);
    //
    //            /* Axes 3+4 (X+Y) of 1st Joystick */
    //            cjaxis=	AddJAxisButton(PX(XO+4),PY(YO+1),BW,BH,"X-",0,2,false,NULL);
    //                    AddJAxisButton(PX(XO+4+2),PY(YO+1),BW,BH,"X+",0,2,true,cjaxis);
    //            cjaxis=	AddJAxisButton(PX(XO+4+1),PY(YO+0),BW,BH,"Y-",0,3,false,NULL);
    //                    AddJAxisButton(PX(XO+4+1),PY(YO+1),BW,BH,"Y+",0,3,true,cjaxis);
    //            /* Axes 1+2 (X+Y) of 2nd Joystick , not accessible*/
    //            cjaxis=	AddJAxisButton_hidden(1,0,false,NULL);
    //                    AddJAxisButton_hidden(1,0,true,cjaxis);
    //            cjaxis=	AddJAxisButton_hidden(1,1,false,NULL);
    //                    AddJAxisButton_hidden(1,1,true,cjaxis);
    //        }
    //
    //        if (joytype==JOY_CH) {
    //            /* Buttons 5+6 of 1st Joystick */
    //            AddJButtonButton(PX(XO+8),PY(YO),BW,BH,"5" ,0,4);
    //            AddJButtonButton(PX(XO+8+2),PY(YO),BW,BH,"6" ,0,5);
    //        } else {
    //            /* Buttons 5+6 of 1st Joystick, not accessible */
    //            AddJButtonButton_hidden(0,4);
    //            AddJButtonButton_hidden(0,5);
    //        }
    //
    //        /* Hat directions up, left, down, right */
    //        AddJHatButton(PX(XO+8+1),PY(YO),BW,BH,"UP",0,0,0);
    //        AddJHatButton(PX(XO+8+0),PY(YO+1),BW,BH,"LFT",0,0,3);
    //        AddJHatButton(PX(XO+8+1),PY(YO+1),BW,BH,"DWN",0,0,2);
    //        AddJHatButton(PX(XO+8+2),PY(YO+1),BW,BH,"RGT",0,0,1);
    //
    //        /* Labels for the joystick */
    //        if (joytype ==JOY_2AXIS) {
    //            new CTextButton(PX(XO+0),PY(YO-1),3*BW,20,"Joystick 1");
    //            new CTextButton(PX(XO+4),PY(YO-1),3*BW,20,"Joystick 2");
    //            new CTextButton(PX(XO+8),PY(YO-1),3*BW,20,"Disabled");
    //        } else if(joytype ==JOY_4AXIS || joytype == JOY_4AXIS_2) {
    //            new CTextButton(PX(XO+0),PY(YO-1),3*BW,20,"Axis 1/2");
    //            new CTextButton(PX(XO+4),PY(YO-1),3*BW,20,"Axis 3/4");
    //            new CTextButton(PX(XO+8),PY(YO-1),3*BW,20,"Disabled");
    //        } else if(joytype == JOY_CH) {
    //            new CTextButton(PX(XO+0),PY(YO-1),3*BW,20,"Axis 1/2");
    //            new CTextButton(PX(XO+4),PY(YO-1),3*BW,20,"Axis 3/4");
    //            new CTextButton(PX(XO+8),PY(YO-1),3*BW,20,"Hat/D-pad");
    //        } else if ( joytype==JOY_FCS) {
    //            new CTextButton(PX(XO+0),PY(YO-1),3*BW,20,"Axis 1/2");
    //            new CTextButton(PX(XO+4),PY(YO-1),3*BW,20,"Axis 3");
    //            new CTextButton(PX(XO+8),PY(YO-1),3*BW,20,"Hat/D-pad");
    //        } else if(joytype == JOY_NONE) {
    //            new CTextButton(PX(XO+0),PY(YO-1),3*BW,20,"Disabled");
    //            new CTextButton(PX(XO+4),PY(YO-1),3*BW,20,"Disabled");
    //            new CTextButton(PX(XO+8),PY(YO-1),3*BW,20,"Disabled");
    //        }

    /* The modifier buttons */
    AddModButton(PX(0), PY(14), 50, 20, "Mod1", 1);
    AddModButton(PX(2), PY(14), 50, 20, "Mod2", 2);
    AddModButton(PX(4), PY(14), 50, 20, "Mod3", 3);
    /* Create Handler buttons */
    int xpos = 3;
    int ypos = 11;
    for (CHandlerEvent hit : handlergroup) {
      new CEventButton(PX(xpos * 3), PY(ypos), BW * 3, BH, hit.ButtonName(), hit);
      xpos++;
      if (xpos > 6) {
        xpos = 3;
        ypos++;
      }
    }
    /* Create some text buttons */
    //	new CTextButton(PX(6),0,124,20,"Keyboard Layout");
    //	new CTextButton(PX(17),0,124,20,"Joystick Layout");

    bind_but.action = new CCaptionButton(180, 330, 0, 0);

    bind_but.event_title = new CCaptionButton(0, 350, 0, 0);
    bind_but.bind_title = new CCaptionButton(0, 365, 0, 0);

    /* Create binding support buttons */

    bind_but.mod1 = new CCheckButton(20, 410, 60, 20, "mod1", BC_Mod1);
    bind_but.mod2 = new CCheckButton(20, 432, 60, 20, "mod2", BC_Mod2);
    bind_but.mod3 = new CCheckButton(20, 454, 60, 20, "mod3", BC_Mod3);
    bind_but.hold = new CCheckButton(100, 410, 60, 20, "hold", BC_Hold);

    bind_but.next = new CBindButton(250, 400, 50, 20, "Next", BB_Next);

    bind_but.add = new CBindButton(250, 380, 50, 20, "Add", BB_Add);
    bind_but.del = new CBindButton(300, 380, 50, 20, "Del", BB_Del);

    bind_but.save = new CBindButton(400, 450, 50, 20, "Save", BB_Save);
    bind_but.exit = new CBindButton(450, 450, 50, 20, "Exit", BB_Exit);

    bind_but.bind_title.Change("Bind Title", null);
  }