mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-06 13:11:20 +00:00
43 lines
674 B
R
43 lines
674 B
R
#include "cvar.h"
|
|
|
|
#include "options_util.h"
|
|
#include "CvarRange.h"
|
|
|
|
@implementation CvarRange
|
|
|
|
-(id)initWithCvar:(string)cvname min:(float)_min max:(float)_max step:(float)_step
|
|
{
|
|
self = [super initWithCvar: cvname];
|
|
|
|
min = _min;
|
|
max = _max;
|
|
step = _step;
|
|
|
|
return self;
|
|
}
|
|
|
|
-(void)inc
|
|
{
|
|
local float val = Cvar_GetFloat (name);
|
|
val = min_max_cnt (min, max, step, val, 1);
|
|
Cvar_SetFloat (name, val);
|
|
}
|
|
|
|
-(void)dec
|
|
{
|
|
local float val = Cvar_GetFloat (name);
|
|
val = min_max_cnt (min, max, step, val, 0);
|
|
Cvar_SetFloat (name, val);
|
|
}
|
|
|
|
-(float)value
|
|
{
|
|
return Cvar_GetFloat (name);
|
|
}
|
|
|
|
-(integer)percentage
|
|
{
|
|
return to_percentage(min, max, Cvar_GetFloat (name));
|
|
}
|
|
|
|
@end
|