Returns the state of all buttons of the specified joystick.

    Wrapper for:
        const unsigned char* glfwGetJoystickButtons(int joy, int* count);
969564
def get_joystick_buttons(joy):
    
    count_value = ctypes.c_int(0)
    count = ctypes.pointer(count_value)
    result = _glfw.glfwGetJoystickButtons(joy, count)
    return result, count_value.value
1324770
def get_state(self, force_update=False):
        
        # The base implementation using GetBinaryState doesn't work for Maker (always returns 0).
        # So pull the switch state from the atrributes instead
        if force_update or self._state is None:
            return(int(self.maker_attribs.get('switchstate',0)))
        return self._state
184393
function getController(hand, config) {
	const findGamepad = (resolve, reject) => {
		const gamepad = altspace.getGamepads().find((g) => g.mapping === 'steamvr' && g.hand === hand);
		if (gamepad) {
			if(config.logging) console.log("SteamVR input device found", gamepad);
			resolve(gamepad);
		} else {
			if(config.logging) console.log("SteamVR input device not found trying again in 500ms...");
			setTimeout(findGamepad, 500, resolve, reject);
		}
	};

	return new Promise(findGamepad);
}
346298
function () {
    var data = this.data;
    var controllerIndex = data.hand === 'right' ? 0 : data.hand === 'left' ? 1 : 2;
    checkControllerPresentAndSetup(this, GAMEPAD_ID_PREFIX, {index: controllerIndex});
  }
516669
def get_keys_to_action(self):
        """"""
        # keyboard keys in an array ordered by their byte order in the bitmap
        # i.e. right = 7, left = 6, ..., B = 1, A = 0
        buttons = np.array([
            ord('d'),  # right
            ord('a'),  # left
            ord('s'),  # down
            ord('w'),  # up
            ord('\r'), # start
            ord(' '),  # select
            ord('p'),  # B
            ord('o'),  # A
        ])
        # the dictionary of key presses to controller codes
        keys_to_action = {}
        # the combination map of values for the controller
        values = 8 * [[0, 1]]
        # iterate over all the combinations
        for combination in itertools.product(*values):
            # unpack the tuple of bits into an integer
            byte = int(''.join(map(str, combination)), 2)
            # unwrap the pressed buttons based on the bitmap
            pressed = buttons[list(map(bool, combination))]
            # assign the pressed buttons to the output byte
            keys_to_action[tuple(sorted(pressed))] = byte

        return keys_to_action
1208012
function () {
    this.controllerPresent = false;
    this.isControllerPresent = trackedControlsUtils.isControllerPresent; // to allow mock
    this.buttonStates = {};
    this.previousAxis = [];
    this.onModelLoaded = bind(this.onModelLoaded, this);
    this.checkIfControllerPresent = bind(this.checkIfControllerPresent, this);
    this.onGamepadConnected = bind(this.onGamepadConnected, this);
    this.onGamepadDisconnected = bind(this.onGamepadDisconnected, this);
  }
165841
private int getComponentState(JComponent c) {
        if (frame != null) {

            if (frame.isSelected()) {
                return SELECTED;
            }
        }

        return SeaGlassLookAndFeel.getComponentState(c);
    }
248949
private int getComponentState(JComponent c) {
        int state = ENABLED;

        if (!c.isEnabled()) {
            state = DISABLED;
        }

        if (SeaGlassLookAndFeel.selectedUI == this) {
            return SeaGlassLookAndFeel.selectedUIState | SynthConstants.ENABLED;
        }

        AbstractButton button = (AbstractButton) c;
        ButtonModel    model  = button.getModel();

        if (model.isPressed()) {
            if (model.isArmed()) {
                state = PRESSED;
            } else {
                state = MOUSE_OVER;
            }
        }

        if (model.isRollover()) {
            state |= MOUSE_OVER;
        }

        if (model.isSelected()) {
            state |= SELECTED;
        }

        if (c.isFocusOwner() && button.isFocusPainted()) {
            state |= FOCUSED;
        }

        if ((c instanceof JButton) && ((JButton) c).isDefaultButton()) {
            state |= DEFAULT;
        }
        
        return state;
    }
696235
function (gamepads) {
    var i;
    var sceneEl = this.sceneEl;
    var trackedControlsSystem = sceneEl.systems['tracked-controls'];
    gamepads = gamepads || []
    // convert from read-only GamepadList
    gamepads = Array.from(gamepads)

    this.gamepads.forEach(function (gamepad) {
      if (gamepads[gamepad.index]) { return; }
      // to pass check in updateControllerListOriginal
      gamepad.pose = true;
      gamepads[gamepad.index] = gamepad;
    });

    this.updateControllerListOriginal(gamepads);
  }
147513
def get_actions(self, run_config, controller):
    """"""
    if not self._initialized:
      return ActionCmd.STEP

    for event in pygame.event.get():
      ctrl = pygame.key.get_mods() & pygame.KMOD_CTRL
      shift = pygame.key.get_mods() & pygame.KMOD_SHIFT
      alt = pygame.key.get_mods() & pygame.KMOD_ALT
      if event.type == pygame.QUIT:
        return ActionCmd.QUIT
      elif event.type == pygame.KEYDOWN:
        if self._help:
          self._help = False
        elif event.key in (pygame.K_QUESTION, pygame.K_SLASH):
          self._help = True
        elif event.key == pygame.K_PAUSE:
          pause = True
          while pause:
            time.sleep(0.1)
            for event2 in pygame.event.get():
              if event2.type == pygame.KEYDOWN:
                if event2.key in (pygame.K_PAUSE, pygame.K_ESCAPE):
                  pause = False
                elif event2.key == pygame.K_F4:
                  return ActionCmd.QUIT
                elif event2.key == pygame.K_F5:
                  return ActionCmd.RESTART
        elif event.key == pygame.K_F4:
          return ActionCmd.QUIT
        elif event.key == pygame.K_F5:
          return ActionCmd.RESTART
        elif event.key == pygame.K_F7:  # Toggle rgb rendering.
          if self._rgb_screen_px and self._feature_screen_px:
            self._render_rgb = not self._render_rgb
            print("Rendering", self._render_rgb and "RGB" or "Feature Layers")
            self.init_window()
        elif event.key == pygame.K_F8:  # Toggle synchronous rendering.
          self._render_sync = not self._render_sync
          print("Rendering", self._render_sync and "Sync" or "Async")
        elif event.key == pygame.K_F9:  # Save a replay.
          self.save_replay(run_config, controller)
        elif event.key in (pygame.K_PLUS, pygame.K_EQUALS) and ctrl:
          self.zoom(1.1)  # zoom in
        elif event.key in (pygame.K_MINUS, pygame.K_UNDERSCORE) and ctrl:
          self.zoom(1 / 1.1)  # zoom out
        elif event.key in (pygame.K_PAGEUP, pygame.K_PAGEDOWN):
          if ctrl:
            if event.key == pygame.K_PAGEUP:
              self._step_mul += 1
            elif self._step_mul > 1:
              self._step_mul -= 1
            print("New step mul:", self._step_mul)
          else:
            self._fps *= 1.25 if event.key == pygame.K_PAGEUP else 1 / 1.25
            print("New max game speed: %.1f" % self._fps)
        elif event.key == pygame.K_F1:
          if self._obs.observation.player_common.idle_worker_count > 0:
            controller.act(self.select_idle_worker(ctrl, shift))
        elif event.key == pygame.K_F2:
          if self._obs.observation.player_common.army_count > 0:
            controller.act(self.select_army(shift))
        elif event.key == pygame.K_F3:
          if self._obs.observation.player_common.warp_gate_count > 0:
            controller.act(self.select_warp_gates(shift))
          if self._obs.observation.player_common.larva_count > 0:
            controller.act(self.select_larva())
        elif event.key in self.cmd_group_keys:
          controller.act(self.control_group(self.cmd_group_keys[event.key],
                                            ctrl, shift, alt))
        elif event.key in self.camera_actions:
          if self._obs:
            controller.act(self.camera_action_raw(
                point.Point.build(
                    self._obs.observation.raw_data.player.camera) +
                self.camera_actions[event.key]))
        elif event.key == pygame.K_ESCAPE:
          if self._queued_action:
            self.clear_queued_action()
          else:
            cmds = self._abilities(lambda cmd: cmd.hotkey == "escape")  # Cancel
            for cmd in cmds:  # There could be multiple cancels.
              assert not cmd.requires_point
              controller.act(self.unit_action(cmd, None, shift))
        else:
          if not self._queued_action:
            key = pygame.key.name(event.key).lower()
            new_cmd = self._queued_hotkey + key
            cmds = self._abilities(lambda cmd, n=new_cmd: (  # pylint: disable=g-long-lambda
                cmd.hotkey != "escape" and cmd.hotkey.startswith(n)))
            if cmds:
              self._queued_hotkey = new_cmd
              if len(cmds) == 1:
                cmd = cmds[0]
                if cmd.hotkey == self._queued_hotkey:
                  if cmd.requires_point:
                    self.clear_queued_action()
                    self._queued_action = cmd
                  else:
                    controller.act(self.unit_action(cmd, None, shift))
      elif event.type == pygame.MOUSEBUTTONDOWN:
        mouse_pos = self.get_mouse_pos(event.pos)
        if event.button == MouseButtons.LEFT and mouse_pos:
          if self._queued_action:
            controller.act(self.unit_action(
                self._queued_action, mouse_pos, shift))
          elif mouse_pos.surf.surf_type & SurfType.MINIMAP:
            controller.act(self.camera_action(mouse_pos))
          else:
            self._select_start = mouse_pos
        elif event.button == MouseButtons.RIGHT:
          if self._queued_action:
            self.clear_queued_action()
          cmds = self._abilities(lambda cmd: cmd.name == "Smart")
          if cmds:
            controller.act(self.unit_action(cmds[0], mouse_pos, shift))
      elif event.type == pygame.MOUSEBUTTONUP:
        mouse_pos = self.get_mouse_pos(event.pos)
        if event.button == MouseButtons.LEFT and self._select_start:
          if (mouse_pos and mouse_pos.surf.surf_type & SurfType.SCREEN and
              mouse_pos.surf.surf_type == self._select_start.surf.surf_type):
            controller.act(self.select_action(
                self._select_start, mouse_pos, ctrl, shift))
          self._select_start = None
    return ActionCmd.STEP
288807
private CommonControlState getButtonType(Which state) {
        switch (state) {

        case BACKGROUND_DISABLED:
            return CommonControlState.DISABLED;

        case BACKGROUND_ENABLED:
            return CommonControlState.ENABLED;

        case BACKGROUND_PRESSED:
        case BACKGROUND_SELECTED:
            return CommonControlState.PRESSED;

        case FOREGROUND_ENABLED:
        case FOREGROUND_PRESSED:
        case FOREGROUND_SELECTED:
        case FOREGROUND_ENABLED_EDITABLE:
            return CommonControlState.ENABLED;

        case FOREGROUND_DISABLED:
        case FOREGROUND_DISABLED_EDITABLE:
            return CommonControlState.DISABLED;
        }

        return null;
    }
1203702
function (gamepadId) {
    var gamepad = gamepadSupport.gamepads[gamepadId];

    // Update all the buttons (and their corresponding labels) on screen.
    window.tester.updateButton(gamepad.buttons[0], gamepadId, 'button-1');
    window.tester.updateButton(gamepad.buttons[1], gamepadId, 'button-2');
    window.tester.updateButton(gamepad.buttons[2], gamepadId, 'button-3');
    window.tester.updateButton(gamepad.buttons[3], gamepadId, 'button-4');

    window.tester.updateButton(gamepad.buttons[4], gamepadId,
        'button-left-shoulder-top');
    window.tester.updateButton(gamepad.buttons[6], gamepadId,
        'button-left-shoulder-bottom');
    window.tester.updateButton(gamepad.buttons[5], gamepadId,
        'button-right-shoulder-top');
    window.tester.updateButton(gamepad.buttons[7], gamepadId,
        'button-right-shoulder-bottom');

    window.tester.updateButton(gamepad.buttons[8], gamepadId, 'button-select');
    window.tester.updateButton(gamepad.buttons[9], gamepadId, 'button-start');

    window.tester.updateButton(gamepad.buttons[10], gamepadId, 'stick-1');
    window.tester.updateButton(gamepad.buttons[11], gamepadId, 'stick-2');

    window.tester.updateButton(gamepad.buttons[12], gamepadId, 'button-dpad-top');
    window.tester.updateButton(gamepad.buttons[13], gamepadId, 'button-dpad-bottom');
    window.tester.updateButton(gamepad.buttons[14], gamepadId, 'button-dpad-left');
    window.tester.updateButton(gamepad.buttons[15], gamepadId, 'button-dpad-right');

    // Update all the analogue sticks.
    window.tester.updateAxis(gamepad.axes[0], gamepadId,
        'stick-1-axis-x', 'stick-1', true);
    window.tester.updateAxis(gamepad.axes[1], gamepadId,
        'stick-1-axis-y', 'stick-1', false);
    window.tester.updateAxis(gamepad.axes[2], gamepadId,
        'stick-2-axis-x', 'stick-2', true);
    window.tester.updateAxis(gamepad.axes[3], gamepadId,
        'stick-2-axis-y', 'stick-2', false);

    // Update extraneous buttons.
    var extraButtonId = gamepadSupport.TYPICAL_BUTTON_COUNT;
    while (typeof gamepad.buttons[extraButtonId] !== 'undefined') {
      window.tester.updateButton(gamepad.buttons[extraButtonId], gamepadId,
          'extra-button-' + extraButtonId);

      extraButtonId++;
    }

    // Update extraneous axes.
    var extraAxisId = gamepadSupport.TYPICAL_AXIS_COUNT;
    while (typeof gamepad.axes[extraAxisId] !== 'undefined') {
      window.tester.updateAxis(gamepad.axes[extraAxisId], gamepadId,
          'extra-axis-' + extraAxisId);

      extraAxisId++;
    }

  }
933699
def on_click(self, button, button_state, cursor_x, cursor_y):
        
        self.isdragging = False
        if button == glut.GLUT_LEFT_BUTTON and button_state == glut.GLUT_UP:
            # Left button released
            self.lastrot = copy.copy(self.thisrot)  # Set Last Static Rotation To Last Dynamic One
        elif button == glut.GLUT_LEFT_BUTTON and button_state == glut.GLUT_DOWN:
            # Left button clicked down
            self.lastrot = copy.copy(self.thisrot)  # Set Last Static Rotation To Last Dynamic One
            self.isdragging = True  # Prepare For Dragging
            mouse_pt = arcball.Point2fT(cursor_x, cursor_y)
            self.arcball.click(mouse_pt)  # Update Start Vector And Prepare For Dragging
        elif button == glut.GLUT_RIGHT_BUTTON and button_state == glut.GLUT_DOWN:
            # If a mouse click location was requested, return it to caller
            if hasattr(self, 'event_port'):
                self.mouseclick_port = self.event_port
                del self.event_port
            if hasattr(self, 'mouseclick_port'):
                self.send_mouseclick_to_caller(cursor_x, cursor_y)
        elif button == glut.GLUT_MIDDLE_BUTTON and button_state == glut.GLUT_DOWN:
            # If a mouse click location was requested, return it to caller
            if hasattr(self, 'event_port'):
                self.mouseclick_port = self.event_port
                del self.event_port
            if hasattr(self, 'mouseclick_port'):
                self.send_mouseclick_to_caller(cursor_x, cursor_y, button='middle')
        glut.glutPostRedisplay()
1077672
def readBUTTONCONDACTIONSs(self):
        
        out = []
        while 1:
            action = self.readBUTTONCONDACTION()
            if action:
                out.append(action)
            else:
                break
        return out
773248
def get_state(self):
        
        D = {}
        for key in self._state_props:
            D[key] = getattr(self, key)
        return D
217724
def buttons(self, master):
        

        subframe = tk.Frame(master)
        subframe.pack(side=tk.RIGHT)

        ttk.Button(
            subframe,
            text="OK",
            width=10,
            command=self.ok,
            default=tk.ACTIVE
        ).pack(side=tk.LEFT, padx=5, pady=5)

        ttk.Button(
            subframe,
            text="Cancel",
            width=10,
            command=self.cancel,
            default=tk.ACTIVE
        ).pack(side=tk.LEFT, padx=5, pady=5)

        self.bind("<Return>", self.ok)
        self.bind("<Escape>", self.cancel)
599148
def buttons(self):
        
        all_buttons = []
        for buttons in self._buttons.values():
            all_buttons += buttons
        return all_buttons