Property definitions

sdl2 $ SDLColor :: defaultinit
# 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