Skip to content

Roof

Extends: Node2D

Description

A Roof is a Dungeondraft asset instance of what the user sees as a roof from the RoofTool. See Asset Instance.

Properties

Texture TilesTexture
Texture RidgeTexture
Texture EdgeTexture
Texture HipTexture
bool shade
Vector2 sunDirection
float shadeContrast
Vector2[] points
float width
Line2D ridge
Line2D edge
Line2D[] hips
Dictionary sides
int type
bool isHighlighted
bool isSelected
Rect2 Rect
Rect2 GlobalRect

Methods

Dictionary Save ( bool copy = false )
void Load ( Dictionary data )
void SetSunlight ( bool enabled, float angle, float contrast )
void SetTileTexture ( Texture tiles )
void Set ( Vector2[] points, float width, int type )
Color CalculateBrightness ( Vector2 direction )
bool IsMouseWithin ( )
void Highlight ( bool value )
void Select ( bool bvalue )

Property Descriptions

  • Texture TilesTexture:
    Main texture of the Roof. Do not modify directly. Calling SetTileTexture() to modify.

  • Texture RidgeTexture:
    Ridge texture of the Roof. Do not modify directly. Calling SetTileTexture() to modify.

  • Texture EdgeTexture:
    Edge texture of the Roof. Do not modify directly. Calling SetTileTexture() to modify.

  • Texture HipTexture:
    Hip texture of the Roof. Do not modify directly. Calling SetTileTexture() to modify.

  • bool shade:
    Property determining if this Roof is shaded. Call SetSunlight() instead.

  • Vector2 sunDirection:
    Property determining the direction of the sun. Call SetSunlight() instead.

  • float shadeContrast:
    Property determining the contrast of the sun shading. Call SetSunlight() instead.

  • Vector2[] points:
    Points of the Roof. Calling Set() to modify.

  • float width:
    Width of the Roof. Calling Set() to modify.

  • Line2D ridge:
    The ridge of the Roof.

  • Line2D edge:
    The outer edge of the Roof.

  • Line2D[] hips:
    An array of lines representing the hips of the Roof.


  • int type:
    The type of the roof. 0 = Gable, 1 = Hip, 2 = Dormer.

  • bool isHighlighted:
    Determines if the Roof is highlighted. Read only, call Highlight() instead to set.

  • bool isSelected:
    Determines if the Roof is visually selected. Read only, call Select() instead to set.

  • Rect2 Rect:
    The local Rect2 enclosing the Roof. DO NOT MODIFY.

  • Rect2 GlobalRect:
    The global Rect2 enclosing the Roof. DO NOT MODIFY.

Method Descriptions

  • Dictionary Save ( bool copy = false ):
    Save the Roof into the save file format and return it as a Dictionary. The param copy is only used by copy-pasting feature of Dungeondraft.

  • void Load ( Dictionary data ):
    Load a saved Roof data. Used by a saved map file to load existing roofs.


  • void SetTileTexture ( Texture tiles ):
    Set the main roof texture, and Dungeondraft will automatically figure out the other textures needed.

  • void Set ( Vector2[] points, float width, int type ):
    Must be called after creation of the Roof to set the options of the Roof. Valid options of the parameter type are 0 = Gable, 1 = Hip, 2 = Dormer.


  • bool IsMouseWithin ( ):
    Checks if the mouse cursor is over the Roof. Only used by the SelectTool.


  • void Select ( bool bvalue ):
    Visually select the Roof. Does not mean it is selected in the SelectTool.