38 .background = 0x3A2A3AE0,
40 .focussed = {.scale = 1.05, .border = 0xAA77AAFF},
41 .active = {.scale = 0.95, .border = 0x7F4F7FFF},
43 .knob_border = 0x6F3F6FFF,
44 .border_width = 0.01};
70 double dist = sqrt(dx * dx + dy * dy);
72 int hovered = dist <= radius;
74 int active = hovered &&
gm_mouse.down;
82 double nx = 0.0, ny = 0.0;
86 dx = dx / dist * radius;
87 dy = dy / dist * radius;
107 double knob_radius = draw_radius * 0.3;
112 x + vpos->
x * draw_radius, y + vpos->
y * draw_radius, knob_radius,
Functions for animating values with various easing functions.
void gm_anim_ease_out_cubic(double *value, double target, double t)
Starts very fast and decelerates cubically to the target. More pronounced than quad.
Definition animate.h:66
void gm_anim_ease_out_quad(double *value, const double target, double t)
Starts fast and decelerates quadratically to the target. More pronounced than spring.
Definition animate.h:45
unsigned int gmColor
Type definition for color values in RGBA format.
Definition color.h:8
Functions for drawing shapes, text, and images.
int32_t gm_draw_circle(double center_x, double center_y, double radius, gmColor c)
Draws a circle.
Definition draw.h:76
struct _gmMouse gm_mouse
Definition gapi.h:19
int gmw_joystick(double x, double y, double radius, gmPos *pos)
Creates and renders a joystick widget that can be manipulated with the mouse.
Definition joystick.h:128
gmwJoystickTheme gmwJoystick
Global joystick theme instance with default values.
Definition joystick.h:35
int gm_joystick_anim(double x, double y, double radius, gmPos *pos, gmPos *vpos)
Creates and renders an animated joystick widget that can be manipulated with the mouse.
Definition joystick.h:58
double x
Definition position.h:5
double y
Definition position.h:5
Structure defining the visual theme for a joystick widget.
Definition joystick.h:9
double border_width
Definition joystick.h:29
double scale
Definition joystick.h:12
gmColor background
Definition joystick.h:13
gmColor knob
Definition joystick.h:26
gmColor knob_border
Definition joystick.h:27
gmColor border
Definition joystick.h:14
int enabled
Definition joystick.h:10