Gama C Library
Gama C API Documentation
Loading...
Searching...
No Matches
switch.h File Reference
#include "../animate.h"
#include "../collision.h"
#include "../draw.h"

Go to the source code of this file.

Data Structures

struct  gmwSwitchTheme
 Structure defining the visual theme for a switch widget. More...

Functions

int gmw_switch_anim (double x, double y, double width, double height, int *value, double *anim)
 Creates and renders an animated switch widget that toggles on click.
int gmw_switch (double x, double y, double width, double height, int *value)
 Creates and renders a switch widget that toggles on click.

Variables

gmwSwitchTheme gmwSwitch
 Global switch theme instance with default values.

Function Documentation

◆ gmw_switch()

int gmw_switch ( double x,
double y,
double width,
double height,
int * value )

Creates and renders a switch widget that toggles on click.

Parameters
xThe x-coordinate of the switch's center.
yThe y-coordinate of the switch's center.
widthThe width of the switch.
heightThe height of the switch.
valuePointer to an integer to store the switch state (0=off, 1=on).
Returns
1 if the switch was clicked (toggled), 0 otherwise.

◆ gmw_switch_anim()

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

Creates and renders an animated switch widget that toggles on click.

Parameters
xThe x-coordinate of the switch's center.
yThe y-coordinate of the switch's center.
widthThe width of the switch.
heightThe height of the switch.
valuePointer to an integer to store the switch state (0=off, 1=on).
animPointer to a double for animated visual position (can be NULL to use value).
Returns
1 if the switch was clicked (toggled), 0 otherwise.

Variable Documentation

◆ gmwSwitch

gmwSwitchTheme gmwSwitch

Global switch theme instance with default values.