46 .background = 0x3A2A3AE0,
48 .focussed = {.scale = 1.05, .border = 0xAA77AAFF},
49 .active = {.scale = 0.95, .border = 0x7F4F7FFF},
51 .knob_border = 0x6F3F6FFF,
52 .border_width = 0.01};
83 double dist =
sqrt(dx * dx + dy * dy);
85 int hovered = dist <= radius;
87 int active = hovered &&
gm_mouse.down;
95 double nx = 0.0, ny = 0.0;
99 dx = dx / dist * radius;
100 dy = dy / dist * radius;
120 double knob_radius = draw_radius * 0.3;
125 x + vpos->
x * draw_radius, y + vpos->
y * draw_radius, knob_radius,
Provides utility functions for animating numerical values using various easing effects.
void gm_anim_ease_out_cubic(double *value, double target, double t)
Animates a value towards a target with a cubic ease-out effect.
Definition animate.h:80
void gm_anim_ease_out_quad(double *value, const double target, double t)
Animates a value towards a target with a quadratic ease-out effect.
Definition animate.h:56
uint32_t gmColor
Type definition for color values, stored as a 32-bit unsigned integer. The color components are packe...
Definition color.h:13
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:84
int gmw_joystick(double x, double y, double radius, gmPos *pos)
Creates and renders a joystick widget that can be manipulated with the mouse (non-animated version).
Definition joystick.h:145
gmwJoystickTheme gmwJoystick
Global joystick theme instance with default values.
Definition joystick.h:43
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:71
double sqrt(double x)
Calculates the square root of x.
Definition math.h:339
struct _gmMouse gm_mouse
Definition mouse.h:32
Represents a 2D position or vector.
Definition position.h:8
double x
Definition position.h:9
double y
Definition position.h:9
Structure defining the visual theme for a joystick widget.
Definition joystick.h:17
double border_width
Definition joystick.h:37
double scale
Definition joystick.h:20
gmColor background
Definition joystick.h:21
gmColor knob
Definition joystick.h:34
gmColor knob_border
Definition joystick.h:35
gmColor border
Definition joystick.h:22
int enabled
Definition joystick.h:18