Skip to content

Textures

willmexe edited this page Dec 27, 2021 · 3 revisions

Namespace: Fjord.Modules.Graphics

class: texture

Texture

NOTE: Any method that returns the texture class returns itself for method chaining!

Set_Texture

  • Function
void set_texture(string path) 
  • Example
texture.set_texture("Player.png")

This Example will set the texture for the texture class to a 'Player.png' image in the assets/images folder.

Set_Texture

  • Function
texture set_texture(IntPtr tex)
  • Example
texture.set_texture(player_intptr_texture)

This Example will set the texture for the texture class to a already existing sdl2 intptr texture.

Get_Texture

  • Function
IntPtr get_texture()
  • Example
IntPtr intptr_texture = texture.get_texture()

This Example will return the sdl2 intptr texture from the texture class.

Set_Origin

  • Function
texture set_origin(V2 origin)
  • Example
texture.set_origin(new V2(0, 0))

This Example sets the origin of the texture to the top left of the texture.

Set_Origin

  • Function
texture set_origin(draw_origin set_origin)
  • Example
texture.set_origin(draw_origin.TOP_LEFT)

This Example sets the origin of the texture to the top left using the draw_origin enumerator. This overload is prefered to using the V2 as it updates with the texture scaling.

Get_Origin

  • Function
V2 get_origin()
  • Example
V2 texture_origin = texture.get_origin()

This Example returns the origin of the texture.

Set_Scale

  • Function
texture set_scale(V2f scale)
  • Example
texture.set_scale(new V2f(2, 2))

This Example sets the scale of the texture to 2x of it's original size.

Get_Scale

  • Function
V2f get_scale()
  • Example
V2f texture_scale = texture.get_scale()

This Example returns the scale of the texture.

Set_Fliptype

  • Function
texture set_fliptype(flip_type flip)
  • Example
texture.set_fliptype(flip_type.horizontal)

This Example flips the texture horizontally when drawn.

Get_Fliptype

  • Function
flip_type get_fliptype()
  • Example
flip_type texture_fliptype = texture.get_fliptype()

This Example returns the fliptype of the texture.

Set_Angle

  • Function
texture set_angle(double angle)
  • Example
texture.set_angle(90)

This Example rotates the texture 90 degrees.

Get_Angle

  • Function
texture get_angle(double angle)
  • Example
double texture_angle = texture.get_angle()

This Example returns the texture angle.

Set_Alpha

  • Function
texture set_alpha(int alpha)
  • Example
texture.set_alpha(100)

This Example will make the texture semi-transparent.

Get_Alpha

  • Function
int get_alpha()
  • Example
int texture_alpha = texture.get_alpha()

This Example returns the texture alpha.

Set_Depth

  • Function
texture set_depth(int depth)
  • Example
texture.set_depth(20)

This Example sets the draw depth of the texture. Higher is closer the the camera.

Get_Depth

  • Function
int get_depth()
  • Example
int texture_depth = texture.get_depth()

This Example returns the texture depth.

Get_Size

  • Function
V2 get_size()
  • Example
V2 texture_size = texture.get_size()

This Example returns the scaled texture size with the texture scaling. Eg. the size it will be drawn as to the screen.

Get_Texture_Size

  • Function
V2 get_texture_size()
  • Example
V2 texture_texture_size = texture.get_texture_size()

This Example returns the raw size of the texture without scaling.