Skip to content

Create Overlays

MrScautHD edited this page Oct 28, 2023 · 5 revisions

Create Overlay

To create an overlay, you simply need to create a new class that extends from the Overlay class.

public class MyOverlay : Overlay {
    
    public MyOverlay(string name) : base(name) { }

    protected override void Init() {
        base.Init();
    }

    protected override void Update() {
        base.Update();
    }

    protected override void AfterUpdate() {
        base.AfterUpdate();
    }
    
    protected override void FixedUpdate() {
        base.FixedUpdate();
    }

    protected override void Draw() { }
}

Enable Overlay

Create a new MyOverlay object (the class you've crafted) and activate it with ease.

public class MyGame : Game {
    
    public MyGame(GameSettings settings) : base(settings) { }

    protected override void Init() {
        base.Init();

        MyOverlay myOverlay = new MyOverlay("name");
        myOverlay.Enabled = true;
        OverlayManager.AddOverlay(myOverlay);
    }
}
Clone this wiki locally