JackUtils 0.5
Provides simplified Jack API for clients :)
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
Jack Utils Variables Module.

This module allows you to wrap your variable in code to allow it's easy rendering, saving and loading from/to file. More...

Data Structures

struct  ju_varclass
 class of variable. More...
 
struct  ju_var_s
 Variable shared structure. More...
 

Typedefs

typedef struct ju_var_s ju_var_t
 simple wraper...
 

Functions

JU_API ju_var_t ju_var_nil ()
 Creates ZERO variable to show end of variables array. More...
 
JU_API ju_var_t ju_var_float_rw (ju_cstr_t name, float *val, float min, float max)
 Creates modifyable float variable :) More...
 
JU_API ju_var_t ju_var_float_ro (ju_cstr_t name, float *val)
 Creates readonly float variable :) It will not be saved/parsed and changed anyhow! More...
 
JU_API void ju_vars_lock ()
 A common way to protect your variables in multithread world :) ONLY in space between calling ju_vars_lock() and ju_vars_unlock() you may read and modify your variables. More...
 
JU_API void ju_vars_unlock ()
 See ju_vars_lock()! It is important!
 
JU_API int ju_vars_save (ju_cstr_t filename, ju_var_t *vararr)
 Saves your variables into the file. More...
 
JU_API int ju_vars_load (ju_cstr_t filename, ju_var_t *vararr)
 Loads your variables from the file. More...
 
JU_API int ju_vars_draw (jg_ctx_t *u, ju_var_t *vararr, int eh)
 Renders (and probably processes) your variables. More...
 

Detailed Description

This module allows you to wrap your variable in code to allow it's easy rendering, saving and loading from/to file.

Since
jackutils 5.0

Function Documentation

◆ ju_var_float_ro()

JU_API ju_var_t ju_var_float_ro ( ju_cstr_t  name,
float *  val 
)

Creates readonly float variable :) It will not be saved/parsed and changed anyhow!

Parameters
namename of the variable
valPOINTER on value of variable!

◆ ju_var_float_rw()

JU_API ju_var_t ju_var_float_rw ( ju_cstr_t  name,
float *  val,
float  min,
float  max 
)

Creates modifyable float variable :)

Parameters
namename of the variable
valPOINTER on value of variable!
minminimal float value
maxmaximal float value

◆ ju_var_nil()

JU_API ju_var_t ju_var_nil ( )

Creates ZERO variable to show end of variables array.

Returns
ZERO or NULL or NIL (same meaning) variable.

◆ ju_vars_draw()

JU_API int ju_vars_draw ( jg_ctx_t *  u,
ju_var_t vararr,
int  eh 
)

Renders (and probably processes) your variables.

Parameters
uJackGUI context
vararrarray of variables. MUST termitates with ju_var_nil()!
ehheight oh each element!
Returns
0 at sucess.

References ju_var_s::_vp, ju_var_s::name, ju_varclass::render, and ju_varclass::widthratio.

◆ ju_vars_load()

JU_API int ju_vars_load ( ju_cstr_t  filename,
ju_var_t vararr 
)

Loads your variables from the file.

Parameters
filenameself-describing
vararrarray of variables. MUST termitates with ju_var_nil()!
Returns
0 at sucess.

References ju_var_s::_vp, ju_var_s::name, and ju_varclass::parse.

◆ ju_vars_lock()

JU_API void ju_vars_lock ( )

A common way to protect your variables in multithread world :) ONLY in space between calling ju_vars_lock() and ju_vars_unlock() you may read and modify your variables.

Direct acess in one thread without locking, but locking in other, or direct acess everywhere is UNDEFINED BEHAVIOUR.

A cost of lock is much smaller than cost of hours of debugging :) believe me.

◆ ju_vars_save()

JU_API int ju_vars_save ( ju_cstr_t  filename,
ju_var_t vararr 
)

Saves your variables into the file.

Parameters
filenameself-describing
vararrarray of variables. MUST termitates with ju_var_nil()!
Returns
0 at sucess.

References ju_var_s::_vp, ju_var_s::name, and ju_varclass::write.