Class Texture
D class that wraps SDL_Texture
storing textures in the VRAM
dsdl.Texture
stores a 2D image out of pixels with a width
and height
, where each pixel stored in the
GPU RAM (VRAM) according to its defined dsdl.PixelFormat
. A dsdl.Texture
is associated with its
dsdl.Renderer
, and can only be operated with/by it.
Constructors
Name | Description |
this
(sdlTexture, isOwner, userRef)
|
Constructs a dsdl.Texture from a vanilla SDL_Texture* from bindbc-sdl
|
this
(renderer, pixelFormat, access, size)
|
Creates a blank dsdl.Texture in the VRAM, which wraps SDL_CreateTexture
|
this
(renderer, surface)
|
Creates a dsdl.Texture in the VRAM from a dsdl.Surface , which wraps SDL_CreateTextureFromSurface
|
Fields
Name | Type | Description |
sdlTexture
|
sdl.render.SDL_Texture* | Internal SDL_Texture pointer
|
Properties
Name | Type | Description |
access [get]
|
TextureAccess | Wraps SDL_QueryTexture which gets the dsdl.TextureAccess of the dsdl.Texture
|
alphaMod [get]
|
ubyte | Wraps SDL_GetTextureAlphaMod which gets the alpha multiplier of the dsdl.Texture
|
alphaMod [set]
|
ubyte | Wraps SDL_SetTextureAlphaMod which sets the alpha multiplier of the dsdl.Texture
|
blendMode [get]
|
BlendMode | Wraps SDL_GetTextureBlendMode which gets the dsdl.Texture 's dsdl.BlendMode defining drawing
|
blendMode [set]
|
BlendMode | Wraps SDL_SetTextureBlendMode which sets the dsdl.Texture 's dsdl.BlendMode defining drawing
|
colorMod [get]
|
ubyte[3] | Wraps SDL_GetTextureColorMod which gets the color multipliers of the dsdl.Texture
|
colorMod [set]
|
ubyte[3] | Wraps SDL_SetTextureColorMod which sets the color multipliers of the dsdl.Texture
|
height [get]
|
uint | Wraps SDL_QueryTexture which gets the height of the dsdl.Texture in pixels
|
mod [get]
|
Color | Gets the color and alpha multipliers of the dsdl.Texture that wraps SDL_GetTextureColorMod and
SDL_GetTextureAlphaMod
|
mod [set]
|
Color | Sets the color and alpha multipliers of the dsdl.Texture that wraps SDL_SetTextureColorMod and
SDL_SetTextureAlphaMod
|
pixelFormat [get]
|
const(PixelFormat) | Wraps SDL_QueryTexture which gets the dsdl.PixelFormat of the dsdl.Texture
|
scaleMode [get]
|
ScaleMode | Wraps SDL_GetTextureScaleMode (from SDL 2.0.12) which gets the texture's scaling mode
|
scaleMode [set]
|
ScaleMode | Wraps SDL_SetTextureScaleMode (from SDL 2.0.12) which sets the texture's scaling mode
|
size [get]
|
uint[2] | Wraps SDL_QueryTexture which gets the size of the dsdl.Texture in pixels
|
width [get]
|
uint | Wraps SDL_QueryTexture which gets the width of the dsdl.Texture in pixels
|
Methods
Name | Description |
bindGL
()
|
Wraps SDL_GL_BindTexture which binds the texture in OpenGL
|
opEquals
(rhs)
|
Equality operator overload
|
toHash
()
|
Gets the hash of the dsdl.Texture
|
toString
()
|
Formats the dsdl.Texture into its construction representation: "dsdl.Texture(<sdlTexture>)"
|
unbindGL
()
|
Wraps SDL_GL_UnbindTexture which unbinds the texture in OpenGL
|
update
(pixels, pitch)
|
Wraps SDL_UpdateTexture which updates the entire dsdl.Texture 's pixel data
|
update
(rect, pixels, pitch)
|
Wraps SDL_UpdateTexture which updates the dsdl.Texture 's pixel data at a certain dsdl.Rect boundary
|
Example
auto renderer = new dsdl.Renderer(...);
auto surface = new dsdl.Surface(...);
auto texture = new dsdl.Texture(renderer, surface);