sdl2 :: SDLRenderer
sdl2 :: SDLRenderer :: copy
Copy the rectangle atsrc
from texture
to fill the dst
at the rendering target
sdl2 :: SDLRenderer :: defaultinit
sdl2 :: SDLRenderer :: draw_color_copy
Copy the drawing color of this renderer incolor
sdl2 :: SDLRenderer :: draw_point
Draw a point with the currentdraw_color
sdl2 :: SDLRenderer :: draw_rect
Draw a rectangle with the currentdraw_color
sdl2 :: SDLRenderer :: fill_rect
Fill a rectangle with the currentdraw_color
sdl2 :: SDLRenderer :: info_copy
Get theSDLRendererInfo
for this renderer
sdl2 :: SDLRenderer :: new
Create a newSDLRenderer
for the window
using the index
th renderer according to flags
sdl2 :: SDLRenderer :: present
Update the screen with all rendering since the previous callsdl2 :: SDLRenderer :: software
Create a new softwareSDLRenderer
sdl2 :: SDLRenderer :: target=
Set the rendering target of this renderersdl2 $ SDLRenderer :: SELF
Type of this instance, automatically specialized in every classcore :: 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 :: SDLRenderer :: copy
Copy the rectangle atsrc
from texture
to fill the dst
at the rendering target
core :: Object :: defaultinit
core :: Pointer :: defaultinit
sdl2 :: SDLRenderer :: defaultinit
sdl2 :: SDLRenderer :: draw_color_copy
Copy the drawing color of this renderer incolor
sdl2 :: SDLRenderer :: draw_point
Draw a point with the currentdraw_color
sdl2 :: SDLRenderer :: draw_rect
Draw a rectangle with the currentdraw_color
sdl2 :: SDLRenderer :: fill_rect
Fill a rectangle with the currentdraw_color
sdl2 :: SDLRenderer :: info_copy
Get theSDLRendererInfo
for this renderer
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.
sdl2 :: SDLRenderer :: new
Create a newSDLRenderer
for the window
using the index
th renderer according to flags
core :: Object :: output_class_name
Display class name on stdout (debug only).sdl2 :: SDLRenderer :: present
Update the screen with all rendering since the previous callsdl2 :: SDLRenderer :: software
Create a new softwareSDLRenderer
sdl2 :: SDLRenderer :: target=
Set the rendering target of this renderer
# 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