A renderer, maybe software or hardware

Introduced properties

fun clear

sdl2 :: SDLRenderer :: clear

Clear the rendering target with the current draw_color
fun copy(texture: SDLTexture, src: nullable SDLRect, dst: nullable SDLRect)

sdl2 :: SDLRenderer :: copy

Copy the rectangle at src from texture to fill the dst at the rendering target
fun destroy

sdl2 :: SDLRenderer :: destroy

Destroy this renderer
fun draw_color: SDLColor

sdl2 :: SDLRenderer :: draw_color

Get the drawing color of this renderer
fun draw_color=(val: SDLColor)

sdl2 :: SDLRenderer :: draw_color=

Set the drawing color
fun draw_color_copy(color: SDLColor)

sdl2 :: SDLRenderer :: draw_color_copy

Copy the drawing color of this renderer in color
fun draw_line(x1: Int, y1: Int, x2: Int, y2: Int)

sdl2 :: SDLRenderer :: draw_line

Draw a line with the current draw_color
fun draw_point(x: Int, y: Int)

sdl2 :: SDLRenderer :: draw_point

Draw a point with the current draw_color
fun draw_rect(rect: SDLRect)

sdl2 :: SDLRenderer :: draw_rect

Draw a rectangle with the current draw_color
fun fill_rect(rect: SDLRect)

sdl2 :: SDLRenderer :: fill_rect

Fill a rectangle with the current draw_color
fun info_copy(out: SDLRendererInfo)

sdl2 :: SDLRenderer :: info_copy

Get the SDLRendererInfo for this renderer
init new(window: SDLWindow, index: Int, flags: SDLRendererFlags): SDLRenderer

sdl2 :: SDLRenderer :: new

Create a new SDLRenderer for the window using the indexth renderer according to flags
fun present

sdl2 :: SDLRenderer :: present

Update the screen with all rendering since the previous call
init software(surface: SDLSurface): SDLRenderer

sdl2 :: SDLRenderer :: software

Create a new software SDLRenderer
fun target: SDLTexture

sdl2 :: SDLRenderer :: target

Get the rendering target of this renderer
fun target=(val: SDLTexture)

sdl2 :: SDLRenderer :: target=

Set the rendering target of this renderer
fun viewport=(rect: SDLRect)

sdl2 :: SDLRenderer :: viewport=

Set the viewport of this renderer

Redefined properties

redef type SELF: SDLRenderer

sdl2 $ SDLRenderer :: SELF

Type of this instance, automatically specialized in every class

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
fun address_is_null: Bool

core :: Pointer :: address_is_null

Is the address behind this Object at NULL?
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
fun clear

sdl2 :: SDLRenderer :: clear

Clear the rendering target with the current draw_color
fun copy(texture: SDLTexture, src: nullable SDLRect, dst: nullable SDLRect)

sdl2 :: SDLRenderer :: copy

Copy the rectangle at src from texture to fill the dst at the rendering target
fun destroy

sdl2 :: SDLRenderer :: destroy

Destroy this renderer
fun draw_color: SDLColor

sdl2 :: SDLRenderer :: draw_color

Get the drawing color of this renderer
fun draw_color=(val: SDLColor)

sdl2 :: SDLRenderer :: draw_color=

Set the drawing color
fun draw_color_copy(color: SDLColor)

sdl2 :: SDLRenderer :: draw_color_copy

Copy the drawing color of this renderer in color
fun draw_line(x1: Int, y1: Int, x2: Int, y2: Int)

sdl2 :: SDLRenderer :: draw_line

Draw a line with the current draw_color
fun draw_point(x: Int, y: Int)

sdl2 :: SDLRenderer :: draw_point

Draw a point with the current draw_color
fun draw_rect(rect: SDLRect)

sdl2 :: SDLRenderer :: draw_rect

Draw a rectangle with the current draw_color
fun fill_rect(rect: SDLRect)

sdl2 :: SDLRenderer :: fill_rect

Fill a rectangle with the current draw_color
fun free

core :: Pointer :: free

Free the memory pointed by this pointer
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
fun info_copy(out: SDLRendererInfo)

sdl2 :: SDLRenderer :: info_copy

Get the SDLRendererInfo for this renderer
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
init new(window: SDLWindow, index: Int, flags: SDLRendererFlags): SDLRenderer

sdl2 :: SDLRenderer :: new

Create a new SDLRenderer for the window using the indexth renderer according to flags
init nul: Pointer

core :: Pointer :: nul

C NULL pointer
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun present

sdl2 :: SDLRenderer :: present

Update the screen with all rendering since the previous call
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
init software(surface: SDLSurface): SDLRenderer

sdl2 :: SDLRenderer :: software

Create a new software SDLRenderer
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
fun target: SDLTexture

sdl2 :: SDLRenderer :: target

Get the rendering target of this renderer
fun target=(val: SDLTexture)

sdl2 :: SDLRenderer :: target=

Set the rendering target of this renderer
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
fun viewport=(rect: SDLRect)

sdl2 :: SDLRenderer :: viewport=

Set the viewport of this renderer
package_diagram sdl2::SDLRenderer SDLRenderer core::Pointer Pointer sdl2::SDLRenderer->core::Pointer core::Object Object core::Pointer->core::Object ...core::Object ... ...core::Object->core::Object

Ancestors

interface Object

core :: Object

The root of the class hierarchy.

Parents

extern class Pointer

core :: Pointer

Pointer classes are used to manipulate extern C structures.

Class definitions

sdl2 $ SDLRenderer
# A renderer, maybe software or hardware
extern class SDLRenderer `{ SDL_Renderer * `}
	# Create a new `SDLRenderer` for the `window` using the `index`th renderer according to `flags`
	#
	# Use an `index` of `-1` to get the default renderer for the given flags.
	new (window: SDLWindow, index: Int, flags: SDLRendererFlags) `{
		return SDL_CreateRenderer(window, index, flags);
	`}

	# Create a new software `SDLRenderer`
	new software(surface: SDLSurface) `{
		return SDL_CreateSoftwareRenderer(surface);
	`}

	# Destroy this renderer
	fun destroy `{ SDL_DestroyRenderer(self); `}

	# Clear the rendering target with the current `draw_color`
	fun clear `{ SDL_RenderClear(self); `}

	# Copy the rectangle at `src` from `texture` to fill the `dst` at the rendering `target`
	#
	# If `dst` has a different size than `src`, the image will be stretched.
	#
	# If `src == null` the whole source texture will be drawn, and if
	# `dst == null` then the texture will fill the rendering `target`.
	fun copy(texture: SDLTexture, src, dst: nullable SDLRect)
	do
		if src == null then src = new SDLRect.nil
		if dst == null then dst = new SDLRect.nil

		native_copy(texture, src, dst)
	end

	private fun native_copy(texture: SDLTexture, src, dst: SDLRect) `{
		SDL_RenderCopy(self, texture, src, dst);
	`}

	# Update the screen with all rendering since the previous call
	fun present `{ SDL_RenderPresent(self); `}

	# Get the `SDLRendererInfo` for this renderer
	fun info_copy(out: SDLRendererInfo) `{ SDL_GetRendererInfo(self, out); `}

	# Set the drawing color
	fun draw_color=(val: SDLColor) `{
		SDL_SetRenderDrawColor(self, val->r, val->g, val->b, val->a);
	`}

	# Get the drawing color of this renderer
	#
	# The returned `SDLColor` is malloced here and must be freed by the called.
	# For a more efficient usage, it is recommended to use instead `draw_color_copy`.
	fun draw_color: SDLColor
	do
		var color = new SDLColor.malloc
		draw_color_copy color
		return color
	end

	# Copy the drawing color of this renderer in `color`
	fun draw_color_copy(color: SDLColor) `{
		SDL_GetRenderDrawColor(self, &color->r, &color->g, &color->b, &color->a);
	`}

	# Fill a rectangle with the current `draw_color`
	#
	# If `rect.address_is_null` then fills the entire screen.
	fun fill_rect(rect: SDLRect) `{ SDL_RenderFillRect(self, rect); `}

	# Draw a rectangle with the current `draw_color`
	fun draw_rect(rect: SDLRect) `{ SDL_RenderDrawRect(self, rect); `}

	# Draw a point with the current `draw_color`
	fun draw_point(x, y: Int) `{ SDL_RenderDrawPoint(self, x, y); `}

	# Draw a line with the current `draw_color`
	fun draw_line(x1, y1, x2, y2: Int) `{ SDL_RenderDrawLine(self, x1, y1, x2, y2); `}

	# Set the viewport of this renderer
	fun viewport=(rect: SDLRect) `{ SDL_RenderSetViewport(self, rect); `}

	# Get the rendering target of this renderer
	fun target: SDLTexture `{ return SDL_GetRenderTarget(self); `}

	# Set the rendering target of this renderer
	fun target=(val: SDLTexture) `{ SDL_SetRenderTarget(self, val); `}

	# TODO add other renderer related methods:
	#
	# draw_rects
	# draw_lines
end
lib/sdl2/sdl2_base.nit:232,1--324,3