Module: SDL2::Hints
- Defined in:
- hint.c,
hint.c
Overview
This module enables you to get and set configuration hints.
Constant Summary
- DEFAULT =
low priority, used fro default values
INT2NUM(SDL_HINT_DEFAULT)
- NORMAL =
medium priority, overrided by an environment variable
INT2NUM(SDL_HINT_NORMAL)
- OVERRIDE =
high priority, this priority overrides the value by environment variables
INT2NUM(SDL_HINT_OVERRIDE)
Class Method Summary collapse
-
.[]=(*args) ⇒ Boolean
Set the value of a hint.
-
.clear ⇒ nil
Clear all hints set by Hints.[]=.
-
.[](hint) ⇒ String?
Get the value of a hint.
Class Method Details
.[]=(hint, value) ⇒ Boolean .[]=(hint, priority: , value) ⇒ Boolean
Set the value of a hint.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'hint.c', line 65
static VALUE Hints_s_aset(int argc, VALUE* argv, VALUE self)
{
VALUE name, pri, value;
rb_scan_args(argc, argv, "21", &name, &pri, &value);
if (argc == 2) {
value = pri;
return INT2BOOL(SDL_SetHint(StringValueCStr(name), StringValueCStr(value)));
} else {
Check_Type(pri, T_HASH);
return INT2BOOL(SDL_SetHintWithPriority(StringValueCStr(name),
StringValueCStr(value),
NUM2INT(rb_hash_aref(pri, sym_priority))));
}
return Qnil;
}
|
.clear ⇒ nil
Clear all hints set by []=.
18 19 20 21 22 |
# File 'hint.c', line 18
static VALUE Hints_s_clear(VALUE self)
{
SDL_ClearHints();
return Qnil;
}
|
.[](hint) ⇒ String?
33 34 35 36 37 38 39 40 |
# File 'hint.c', line 33
static VALUE Hints_s_aref(VALUE self, VALUE name)
{
const char* value = SDL_GetHint(StringValueCStr(name));
if (value)
return utf8str_new_cstr(value);
else
return Qnil;
}
|