core :: Pointer :: address_is_null
Is the address behind this Object at NULL?core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
sdl2 :: SDLColor :: defaultinit
core :: Object :: defaultinit
core :: Pointer :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: output_class_name
Display class name on stdout (debug only).
# A color
extern class SDLColor `{ SDL_Color *`}
# Allocate the memory for a new `SDLColor`, it must then be freed with `free`
new malloc `{ return malloc(sizeof(SDL_Color)); `}
# Allocate the memory for a new `SDLColor` and fill it with `r`, `g`, `b` and `a`
#
# As with `malloc`, the new instances must then be freed with `free`.
new (r, g, b, a: Int)
do
var color = new SDLColor.malloc
color.set(r, g, b, a)
return color
end
# Set this instance's `r`, `g`, `b` and `a`
fun set(r, g, b, a: Int)
do
self.r = r
self.g = g
self.b = b
self.a = a
end
# The red component of this color `[0..255]`
fun r: Int `{ return self->r; `}
# Set the red component of this color `[0..255]`
fun r=(val: Int) `{ self->r = val; `}
# The green component of this color `[0..255]`
fun g: Int `{ return self->g; `}
# Set the green component of this color `[0..255]`
fun g=(val: Int) `{ self->g = val; `}
# The blue component of this color `[0..255]`
fun b: Int `{ return self->b; `}
# Set the blue component of this color `[0..255]`
fun b=(val: Int) `{ self->b = val; `}
# The alpha component of this color `[0..255]`
fun a: Int `{ return self->a; `}
# Set the ralpha component of this color `[0..255]`
fun a=(val: Int) `{ self->a = val; `}
# TODO implement the related `SDL_Palette` and related methods
end
lib/sdl2/sdl2_base.nit:326,1--375,3