|
|
@ -64,14 +64,12 @@ static void framebuffer_size_callback(GLFWwindow* window, int width, int height) |
|
|
|
static void draw_joystick(Joystick* j, int x, int y, int width, int height) |
|
|
|
static void draw_joystick(Joystick* j, int x, int y, int width, int height) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int i; |
|
|
|
int i; |
|
|
|
int axis_width, axis_height; |
|
|
|
const int axis_height = 3 * height / 4; |
|
|
|
int button_width, button_height; |
|
|
|
const int button_height = height / 4; |
|
|
|
|
|
|
|
|
|
|
|
axis_width = width / j->axis_count; |
|
|
|
if (j->axis_count) |
|
|
|
axis_height = 3 * height / 4; |
|
|
|
{ |
|
|
|
|
|
|
|
const int axis_width = width / j->axis_count; |
|
|
|
button_width = width / j->button_count; |
|
|
|
|
|
|
|
button_height = height / 4; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < j->axis_count; i++) |
|
|
|
for (i = 0; i < j->axis_count; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -89,6 +87,11 @@ static void draw_joystick(Joystick* j, int x, int y, int width, int height) |
|
|
|
x + (i + 1) * axis_width, |
|
|
|
x + (i + 1) * axis_width, |
|
|
|
y + 5 + (int) (value * (axis_height - 5))); |
|
|
|
y + 5 + (int) (value * (axis_height - 5))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (j->button_count) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
const int button_width = width / j->button_count; |
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < j->button_count; i++) |
|
|
|
for (i = 0; i < j->button_count; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -103,6 +106,7 @@ static void draw_joystick(Joystick* j, int x, int y, int width, int height) |
|
|
|
y + axis_height + button_height); |
|
|
|
y + axis_height + button_height); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void draw_joysticks(GLFWwindow* window) |
|
|
|
static void draw_joysticks(GLFWwindow* window) |
|
|
|
{ |
|
|
|
{ |
|
|
|