コード例 #1
0
  public static void printControllers() {
    int i = 0;
    for (Controller c : Controllers.getControllers()) {
      System.out.println("Controller #" + i + ": " + c.getName());
      i += 1;
    }

    if (Controllers.getControllers().size == 0) {
      System.out.println("Controllers: No controllers attached");
    }
  }
コード例 #2
0
ファイル: IngameScreen.java プロジェクト: blevine0001/space
  public void show() {
    GameInputProcessor inputProcessor = new GameInputProcessor();
    Gdx.input.setInputProcessor(inputProcessor);
    System.out.println(Controllers.getControllers().size + ":O");

    // weapon of player might has changed while in shop
    player.weapon = Res.weapons.get(player.currentWeapon).getCurrent();
  }
コード例 #3
0
ファイル: DeathGame.java プロジェクト: 0x17/DeathJam
  private void processGamepad() {
    for (Controller controller : Controllers.getControllers()) {
      final float MOV_THRESHOLD = 0.25f;
      float xaxis = controller.getAxis(1);
      float yaxis = -controller.getAxis(0);
      if (Math.abs(xaxis) < MOV_THRESHOLD) xaxis = 0f;
      if (Math.abs(yaxis) < MOV_THRESHOLD) yaxis = 0f;
      player.move(xaxis, 0);
      player.move(0, yaxis);

      if (controller.getButton(0)) player.useShield();
    }
  }
コード例 #4
0
ファイル: Bdx.java プロジェクト: colepram/bdx
  public static void init() {
    time = 0;
    profiler = new Profiler();
    display = new Display();
    scenes = new ArrayListScenes();
    sounds = new Sounds();
    music = new Music();
    mouse = new Mouse();
    gamepads = new ArrayListNamed<Gamepad>();

    for (int i = 0; i < Controllers.getControllers().size; i++) {
      gamepads.add(new Gamepad(i));
    }

    imaps = new InputMaps();
    keyboard = new Keyboard();
    fingers = new ArrayList<Finger>();
    components = new ArrayList<Component>();
    matShaders = new HashMap<String, ShaderProgram>();

    allocatedFingers = new ArrayList<Finger>();
    for (int i = 0; i < 10; ++i) {
      allocatedFingers.add(new Finger(i));
    }

    Gdx.input.setInputProcessor(new GdxProcessor(keyboard, mouse, allocatedFingers, gamepads));

    com.badlogic.gdx.graphics.glutils.ShaderProgram.pedantic = false;

    shaderProvider = new BDXShaderProvider();
    modelBatch = new ModelBatch(shaderProvider);
    spriteBatch = new SpriteBatch();
    spriteBatch.setBlendFunction(Gdx.gl.GL_SRC_ALPHA, Gdx.gl.GL_ONE_MINUS_SRC_ALPHA);
    frameBuffer = new RenderBuffer(spriteBatch);
    tempBuffer = new RenderBuffer(spriteBatch);
    advancedLightingOn = true;
  }
コード例 #5
0
  public void init() {
    disposed = false;
    camera.translate(400 - camera.position.x, 590 - camera.position.y);
    player.init(80, 600, camera);

    combo = new KeyCombo("lurdlurdba");
    while (!main_theme.isPlaying()) {
      main_theme.play();
      main_theme.setVolume(player.master_volume);
      main_theme.setLooping(true);
    }

    tilemap = new TileMap("zone1_act3.mapa");
    options = false;
    volume = false;
    current_option = 0;
    item_counter = 0;
    can_control = true;
    next_stage = false;
    transition_angle = 0f;
    changed_screen = false;
    stage_transition_alpha = 1;
    item_alpha = 0f;

    menu_press = false;
    down_press = false;
    up_press = false;
    ok_press = false;
    cancel_press = false;

    tilemap.edit_mode = false;

    next_stage_door = new Rectangle(1760, 1030, 200, 180);

    cannons = new Cannon[0];
    itens = new Item[2];
    masters = new Master[2];

    itens[0] = new Item(item_texture, 2115, 1125, item_sound, item_sound);
    itens[1] = new Item(item_texture, 580, 320, item_sound, item_sound);

    num_itens = itens.length;

    gamepad = null;
    try {
      gamepad = Controllers.getControllers().get(0);
    } catch (Exception e) {
    }

    if (player.gamepad == null && gamepad != null) {
      player.gamepad = gamepad;
    }
    if (player.gamepad != null && gamepad == null) {
      player.gamepad = null;
    }

    messages = new Message[1];
    messages[0] = new Message(870, 400, "There are secrets everywhere", 10);

    String message1[] = {
      "Look at you all jumpy and stuff",
      "Think you can jump off this ledge?",
      "Well what am i saying off course you can",
      "You just passed the jumping level",
      "The question is...",
      "How will you get up again?",
      "Go on..."
    };
    masters[0] = new Master(master_texture, 650, 504, message1, "GET DOWN BOE!", 40, false);

    String message2[] = {
      "Really good, I am impressed",
      "On how long it took you",
      "I bet you can't even find the exit",
      "Haha"
    };
    masters[1] =
        new Master(master_texture, 1875, 126, message2, "GEEZ LOUIS MAN, GO UP!", 40, false);

    start_time = System.currentTimeMillis();
    timer = 0;
  }
コード例 #6
0
 /** @return */
 public static Controller getFirstControllerOrNull() {
   Array<Controller> controllers = Controllers.getControllers();
   Controller controller = (controllers.size > 0) ? controllers.first() : null;
   return controller;
 }
コード例 #7
0
 /**
  * @param controller
  * @return
  */
 public int indexOf(Controller controller) {
   return Controllers.getControllers().indexOf(controller, true);
 }