// Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
using System;
using ClassicalSharp.Gui.Widgets;
using OpenTK.Input;
namespace ClassicalSharp.Gui.Screens {
/// Represents a container of widgets and other 2D elements.
/// May cover the entire game window.
public abstract class Screen : GuiElement {
public Screen(Game game) : base(game) {
}
bool handlesAll;
/// Whether this screen handles all mouse and keyboard input.
/// This prevents the client from interacting with the world.
public virtual bool HandlesAllInput { get { return handlesAll; } protected set { handlesAll = value; } }
/// Whether this screen completely and opaquely covers the game world behind it.
public virtual bool BlocksWorld { get { return false; } }
/// Whether this screen hides the normal in-game hud.
public virtual bool HidesHud { get { return false; } }
/// Whether the normal in-game hud should be drawn over the top of this screen.
public virtual bool RenderHudAfter { get { return false; } }
/// Called when the game window is resized.
public abstract void OnResize(int width, int height);
protected ClickHandler LeftOnly(Action action) {
if (action == null) return (g, w, btn, x, y) => {};
return (g, w, btn, x, y) => {
if (btn != MouseButton.Left) return;
action(g, w);
};
}
}
}