mirror of
https://github.com/bradgrantham/apple2e.git
synced 2024-09-28 17:55:19 +00:00
print only active axes and buttons in probe
This commit is contained in:
parent
687e80e16e
commit
216f74cc32
@ -11,6 +11,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <cmath>
|
||||||
#include <ao/ao.h>
|
#include <ao/ao.h>
|
||||||
|
|
||||||
#include "gif.h"
|
#include "gif.h"
|
||||||
@ -1782,10 +1783,23 @@ void iterate(const ModeHistory& history, unsigned long long current_byte, float
|
|||||||
const float* axes = glfwGetJoystickAxes(GLFW_JOYSTICK_1, &axis_count);
|
const float* axes = glfwGetJoystickAxes(GLFW_JOYSTICK_1, &axis_count);
|
||||||
const unsigned char* buttons = glfwGetJoystickButtons(GLFW_JOYSTICK_1, &button_count);
|
const unsigned char* buttons = glfwGetJoystickButtons(GLFW_JOYSTICK_1, &button_count);
|
||||||
|
|
||||||
if(false) for(int i = 0; i < axis_count; i++)
|
if(false) {
|
||||||
printf("Axis %d: %f\n", i, axes[i]);
|
static bool printedProbing = false;
|
||||||
if(false)for(int i = 0; i < button_count; i++)
|
if(!printedProbing) {
|
||||||
printf("Button %d: %s\n", i, (buttons[i] == GLFW_PRESS) ? "pressed" : "not pressed");
|
printf("Joystick probing:\n");
|
||||||
|
printedProbing = true;
|
||||||
|
}
|
||||||
|
for(int i = 0; i < axis_count; i++) {
|
||||||
|
if(fabsf(axes[i]) > 0.01) {
|
||||||
|
printf("Axis %d: %f\n", i, axes[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(int i = 0; i < button_count; i++) {
|
||||||
|
if(buttons[i] == GLFW_PRESS) {
|
||||||
|
printf("Button %d: pressed\n", i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(axis_count <= joystick_axis0 || axis_count <= joystick_axis1) {
|
if(axis_count <= joystick_axis0 || axis_count <= joystick_axis1) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user