Property definitions

sdl2 $ SDLRect :: defaultinit
# A rectangle
extern class SDLRect `{SDL_Rect *`}
	# Get a null rectangle (on the C side), should be used only internally
	new nil `{ return NULL; `}

	# Allocate the memory for a new `SDLRect`, it must then be freed with `free`
	new malloc`{ return malloc(sizeof(SDL_Rect)); `}

	# Allocate the memory for a new `SDLRect` and fill it with `x`, `y`, `w` and `h`
	#
	# As with `malloc`, the new instances must then be freed with `free`.
	new (x, y, w, h: Int)
	do
		var rect = new SDLRect.malloc
		rect.set(x, y, w, h)
		return rect
	end

	# Set this instance's `x`, `y`, `w` and `h`
	fun set(x, y, w, h: Int)
	do
		self.x = x
		self.y = y
		self.w = w
		self.h = h
	end

	# X coordinate of the top left corner
	fun x: Int `{ return self->x; `}

	# Set the X coordinate of the top left corner
	fun x=(val: Int) `{ self->x = val; `}

	# Y coordinate of the top left corner
	fun y: Int `{ return self->y; `}

	# Set the Y coordinate of the top left corner
	fun y=(val: Int) `{ self->y = val; `}

	# Width of this rectangle
	fun w: Int `{ return self->w; `}

	# Set the width of this rectangle
	fun w=(val: Int) `{ self->w = val; `}

	# Height of this rectangle
	fun h: Int `{ return self->h; `}

	# Set the height of this rectangle
	fun h=(val: Int) `{ self->h = val; `}

	# TODO implement other `SDLRect` related methods:
	#
	# SDL_EnclosePoints
	# SDL_HasIntersection
	# SDL_IntersectRect
	# SDL_IntersectRectAndLine
	# SDL_PointInRect
	# SDL_RectEmpty
	# SDL_RectEquals
	# SDL_UnionRect
end
lib/sdl2/sdl2_base.nit:472,1--533,3