Gama C Library
Gama C API Documentation
scale.h File Reference

Defines the theme and functionality for a scale (slider) widget. More...

#include "../animate.h"
#include "../collision.h"
#include "../draw.h"

Go to the source code of this file.

Data Structures

struct  gmwScaleTheme
 Structure defining the visual theme for a scale (slider) widget. More...

Functions

int gmw_scale_anim (double x, double y, double width, double height, double *value, double *anim)
 Creates and renders an animated scale (slider) widget that can be manipulated with the mouse.

Variables

gmwScaleTheme gmwScale
 Global scale theme instance with default values.

Detailed Description

Defines the theme and functionality for a scale (slider) widget.

This file provides structures for customizing the appearance of a slider control and a function to render an interactive slider that allows users to select a value within a range.

Function Documentation

◆ gmw_scale_anim()

int gmw_scale_anim ( double x,
double y,
double width,
double height,
double * value,
double * anim )

Creates and renders an animated scale (slider) widget that can be manipulated with the mouse.

This function draws a slider, tracks mouse interaction to update its value, and animates the knob's position.

Parameters
xThe x-coordinate of the scale's center.
yThe y-coordinate of the scale's center.
widthThe width of the scale track.
heightThe height of the scale track.
valuePointer to a double to store the current scale value (0.0 to 1.0). This value is updated by user interaction.
animPointer to a double for the animated visual position of the knob. If NULL, value is used for the knob's position (non-animated).
Returns
1 if the scale is currently being actively manipulated (mouse button down and hovering), 0 otherwise.

Variable Documentation

◆ gmwScale

gmwScaleTheme gmwScale
Initial value:
= {.enabled = 1,
.scale = 1.0,
.background = 0x3A2A3AE0,
.border = 0x7F4F7FFF,
.focussed = {.scale = 1.03, .border = 0xAA77AAFF},
.active = {.scale = 0.97, .border = 0x7F4F7FFF},
.knob = 0xAA77AAFF,
.knob_border = 0x6F3F6FFF,
.border_width = 0.01,
.step = 0.0}

Global scale theme instance with default values.