Skip to content
Robert Wallis edited this page May 23, 2017 · 13 revisions

Screen

Members
Properties
Methods

Members

Properties

IScreenManager ScreenManager - Automatically set to the ScreenGameComponent when ScreenGameComponent.Register is used to manage the Screen.

public IScreenManager ScreenManager { get; internal set; }

bool IsInitialized - Indicates whether or not the class has been initialized

public bool IsInitialized { get; private set; }

bool IsVisible - Indicates whether the screen class is visible or not.

If IsVisible is true, then the Screen will receive Update and Draw messages.

public bool IsVisible { get; set; }

Methods

void Show() - A method that will hide the current screen using the Hide() methods as well as find the screen that is referenced by the generic T. If found it will initialize it and make it visible. A screen will not be found if it has not been registered in the ScreenComponent Class

public void Show<T>() where T : Screen
{
    Show<T>(true);
}

void Show(bool hideThis) - An overloaded method that accepts a Boolean parameter. If true it will hide the screen and if false it will not hide the current screen.

public void Show<T>(bool hideThis) where T : Screen
{
    var screen = FindScreen<T>();
    screen.Show();

    if (hideThis)
        Hide();
}

void Show() - Initializes and makes the screen visible

public void Show()
{
    if (!IsInitialized)
        Initialize();

    IsVisible = true;
}

Virtual Methods

The screen class defines the four basic Monogame virtual methods(LoadContent(), UnloadContent(), Update() and Draw()) that should be overridden in its the classes that derive from it.

moved

Clone this wiki locally