GFX
  • Docs
  • API
Search Results for

    Show / Hide Table of Contents
    • Genesis.Core
      • AssetManager
      • Game
      • GameElement
      • GameEventHandler
      • GenesisWindow
      • IGameBehavior
      • Input
      • Layer
      • Light
      • Scene
      • Scene3D
      • SceneEventHandler
      • SceneSizeEvenHandler
      • Storage
      • Utils
    • Genesis.Core.Behaviors
      • AnimationBehavior
      • CameraFlags
      • CharacterController2D
      • ControllerPreset
      • MoveDirection
      • MovementFlags
      • SpriteMovementController
    • Genesis.Core.Behaviors.Physics2D
      • BufferedSpriteCollider
      • PhysicsBox2D
      • PhysicsPolygon2D
      • Rigidbody2D
    • Genesis.Core.Behaviors.Physics3D
      • BoxCollider
      • CapsuleCollider
      • ConvexHullBehavior
      • QubeConvexHull
      • SphereCollider
      • StaticMeshBehavior
    • Genesis.Core.Behaviors._3D
      • Stance
      • ThirdpersonCharacterController
    • Genesis.Core.GameElements
      • BufferedSprite
      • CameraElement
      • Element3D
      • Empty
      • Model
      • ParticleBuffers
      • ParticleDeffinition
      • ParticleEmitter
      • Qube
      • RectElement
      • Skybox
      • Sprite
      • SpriteShapeDeffinition
      • Terrain2D
      • Terrain3D
      • TerrainData
    • Genesis.Graphics
      • Animation
      • Camera
      • CameraType
      • Face
      • Font
      • Framebuffer
      • Glyphe
      • IRenderDevice
      • Material
      • MaterialBuffer
      • Mesh
      • PerspectiveCamera
      • Shader
      • ShaderProgram
      • TexCoords
      • Texture
      • Viewport
    • Genesis.Graphics.Animation3D
      • Animation
      • Animator
      • AssimpNodeData
      • Bone
      • KeyPosition
      • KeyRotation
      • KeyScale
      • ModelMesh
      • boneinfo
      • vertex
    • Genesis.Graphics.Physics
      • BulletDebugRenderer
    • Genesis.Graphics.RenderDevice
      • ClassicGL
      • GLRenderer
    • Genesis.Graphics.Shaders.OpenGL
      • AnimatedModelShader
      • BasicShader
      • DiffuseLightning
      • DiffuseNormalLightning
      • DiffuseNormalShader
      • DiffuseShader
      • DiffuseSolidShader
      • MVPRectShader
      • MVPShader
      • MVPSolidShader
      • ParticleShader
      • ScreenShader
      • SkyboxShader
      • SpriteShader
      • TerrainShader
      • WireframeShader
    • Genesis.Graphics.Shapes
      • BufferedSpriteShape
      • FrameShape
      • GlypheShape
      • LineShape
      • PlaneShape
      • QubeShape
      • RectShape
      • Shape
      • SpriteShape
    • Genesis.Math
      • Matrix4x4
      • NoisePoint
      • PerlinNoise
      • Rect
      • Vec3
    • Genesis.Physics
      • Aabb
      • HitResult
      • MatrixSet
      • MouseRay2
      • PhysicHandler
      • PhysicHandlerEvent
      • PhysicPropeterys
      • PhysicsBehavior
      • PhysicsBehaviorEvent
      • PhysicsHandler2D
      • PhysicsHandler3D
      • Raycast
    • Genesis.UI
      • Canvas
      • ImageButton
      • Label
      • ListItem
      • ListItemBehavior
      • ListSelector
      • ListSelectorBehavior
      • Panel
      • ProgressBar
      • UIEvent
      • UIParseHandler
      • UIParser
      • Widget

    Class Canvas

    Represents a canvas for organizing and rendering UI widgets.

    Inheritance
    object
    Canvas
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Genesis.UI
    Assembly: Genesis.dll
    Syntax
    public class Canvas

    Constructors

    Canvas(string, Vec3, Vec3)

    Creates a new instance of the Canvas class.

    Declaration
    public Canvas(string name, Vec3 location, Vec3 size)
    Parameters
    Type Name Description
    string name

    The name of the canvas.

    Vec3 location

    The location of the canvas.

    Vec3 size

    The size of the canvas.

    Properties

    Enabled

    Gets or sets a value indicating whether the canvas is enabled.

    Declaration
    public bool Enabled { get; set; }
    Property Value
    Type Description
    bool

    Location

    Gets or sets the location of the canvas.

    Declaration
    public Vec3 Location { get; set; }
    Property Value
    Type Description
    Vec3

    Name

    Gets or sets the name of the canvas.

    Declaration
    public string Name { get; set; }
    Property Value
    Type Description
    string

    Size

    Gets or sets the size of the canvas.

    Declaration
    public Vec3 Size { get; set; }
    Property Value
    Type Description
    Vec3

    Widgets

    Gets or sets the list of widgets contained within the canvas.

    Declaration
    public List<Widget> Widgets { get; set; }
    Property Value
    Type Description
    List<Widget>

    Methods

    AddWidget(Widget)

    Adds a widget to the canvas.

    Declaration
    public void AddWidget(Widget entity)
    Parameters
    Type Name Description
    Widget entity

    CenterWidget(Canvas, Widget)

    Centers the widget in the middle of the canvas.

    Declaration
    public static void CenterWidget(Canvas canvas, Widget widget)
    Parameters
    Type Name Description
    Canvas canvas

    The canvas instance.

    Widget widget

    The widget to be centered.

    GetBounds()

    Returns the bounds of the canvas.

    Declaration
    public Rect GetBounds()
    Returns
    Type Description
    Rect

    The bounds of the canvas.

    GetScreenBounds()

    Returns the screen bounds of the canvas.

    Declaration
    public Rect GetScreenBounds()
    Returns
    Type Description
    Rect

    The screen bounds of the canvas.

    GetWidget(string)

    Returns a widget with the specified name, searching within entities and their children.

    Declaration
    public Widget GetWidget(string name)
    Parameters
    Type Name Description
    string name

    The name to search for.

    Returns
    Type Description
    Widget

    The widget with the specified name, or null if not found.

    LoadCanvas(string, AssetManager, UIParser)

    Loads a canvas from a specified JSON file using a UI parser and asset manager.

    Declaration
    public static Canvas LoadCanvas(string File, AssetManager assets, UIParser parser)
    Parameters
    Type Name Description
    string File

    Path to the JSON file containing canvas configuration.

    AssetManager assets

    Asset manager for managing resources such as images, fonts, etc.

    UIParser parser

    UI parser that contains the logic for parsing the JSON data.

    Returns
    Type Description
    Canvas

    The created canvas based on the JSON configuration.

    LoadWidget(JObject, AssetManager, UIParser)

    Loads a widget from provided JSON data using a UI parser and asset manager.

    Declaration
    public static Widget LoadWidget(JObject data, AssetManager assets, UIParser parser)
    Parameters
    Type Name Description
    JObject data

    JSON data containing the configuration of the widget to be created.

    AssetManager assets

    Asset manager for managing resources such as images, fonts, etc.

    UIParser parser

    UI parser that contains the logic for parsing the JSON data.

    Returns
    Type Description
    Widget

    The created widget based on the JSON data.

    OnDispose(Game, Scene)

    Disposes of the canvas.

    Declaration
    public void OnDispose(Game game, Scene scene)
    Parameters
    Type Name Description
    Game game

    The game instance.

    Scene scene

    The scene instance.

    OnInit(Game, Scene)

    Initializes the canvas.

    Declaration
    public void OnInit(Game game, Scene scene)
    Parameters
    Type Name Description
    Game game

    The game instance.

    Scene scene

    The scene instance.

    OnRender(Game, IRenderDevice, Scene)

    Renders the canvas.

    Declaration
    public void OnRender(Game game, IRenderDevice renderDevice, Scene scene)
    Parameters
    Type Name Description
    Game game

    The game instance.

    IRenderDevice renderDevice

    The render device.

    Scene scene

    The scene instance.

    OnUpdate(Game, Scene)

    Updates the canvas.

    Declaration
    public void OnUpdate(Game game, Scene scene)
    Parameters
    Type Name Description
    Game game

    The game instance.

    Scene scene

    The scene instance.

    In this article
    Back to top Generated by DocFX