ScreenSurface Class
Definition
Section titled “Definition”An object that renders a ICellSurface.
[DataContract][JsonObject(MemberSerialization.OptIn)]public class ScreenSurface : ScreenObject, IDisposable, IScreenSurfaceEditable, IScreenSurface, IScreenObject, IPositionable, IComponentHost, ISurface, ISurfaceSettable, ICellSurfaceResizeInheritance object → ScreenObject
Implements IDisposable, IScreenSurfaceEditable, IScreenSurface, IScreenObject, SadRogue.Primitives.IPositionable, IComponentHost, ISurface, ISurfaceSettable, ICellSurfaceResize
Constructors
Section titled “Constructors”ScreenSurface(int, int)
Section titled “ScreenSurface(int, int)”Creates a new screen object that can render a surface.
public ScreenSurface(int width, int height)Parameters
Section titled “Parameters”width int
The width in cells of the surface.
height int
The height in cells of the surface.
ScreenSurface(int, int, ColoredGlyphBase[])
Section titled “ScreenSurface(int, int, ColoredGlyphBase[])”Creates a new screen object that can render a surface. Uses the specified cells to generate the surface.
public ScreenSurface(int width, int height, ColoredGlyphBase[] initialCells)Parameters
Section titled “Parameters”width int
The width in cells of the surface.
height int
The height in cells of the surface.
initialCells ColoredGlyphBase[]
The initial cells to seed the surface.
ScreenSurface(int, int, int, int)
Section titled “ScreenSurface(int, int, int, int)”Creates a new surface with the specified width and height, with SadRogue.Primitives.Color.Transparent for the background and SadRogue.Primitives.Color.White for the foreground.
public ScreenSurface(int viewWidth, int viewHeight, int totalWidth, int totalHeight)Parameters
Section titled “Parameters”viewWidth int
The visible width of the surface in cells.
viewHeight int
The visible height of the surface in cells.
totalWidth int
The total width of the surface in cells.
totalHeight int
The total height of the surface in cells.
ScreenSurface(IGridView<ColoredGlyphBase>, int, int)
Section titled “ScreenSurface(IGridView<ColoredGlyphBase>, int, int)”Creates a new surface from a grid view. The cells between this object and the grid view are shared.
public ScreenSurface(IGridView<ColoredGlyphBase> surface, int visibleWidth = 0, int visibleHeight = 0)Parameters
Section titled “Parameters”surface IGridView<ColoredGlyphBase>
The surface to use as the source of cells.
visibleWidth int
Optional view width. If 0, the view width matches the width of the surface.
visibleHeight int
Optional view height. If 0, the view width matches the height of the surface.
ScreenSurface(int, int, int, int, ColoredGlyphBase[]?)
Section titled “ScreenSurface(int, int, int, int, ColoredGlyphBase[]?)”Creates a new surface with the specified width and height, with SadRogue.Primitives.Color.Transparent for the background and SadRogue.Primitives.Color.White for the foreground.
public ScreenSurface(int viewWidth, int viewHeight, int totalWidth, int totalHeight, ColoredGlyphBase[]? initialCells)Parameters
Section titled “Parameters”viewWidth int
The width of the surface in cells to show.
viewHeight int
The height of the surface in cells to show.
totalWidth int
The total width of the surface in cells.
totalHeight int
The total height of the surface in cells.
initialCells ColoredGlyphBase[]
The cells to seed the surface with. If null, creates the cell array for you.
ScreenSurface(ICellSurface, IFont?, Point?)
Section titled “ScreenSurface(ICellSurface, IFont?, Point?)”Creates a new screen object wrapping an existing surface.
[JsonConstructor]public ScreenSurface(ICellSurface surface, IFont? font = null, Point? fontSize = null)Parameters
Section titled “Parameters”surface ICellSurface
The surface.
font IFont
The font to use with the surface.
fontSize System.NullableSadRogue.Primitives.Point
The font size.
Fields
Section titled “Fields”MouseState_EnteredWithButtonDown
Section titled “MouseState_EnteredWithButtonDown”A cached value determined by OnMouseEnter(MouseScreenObjectState). true when the mouse entered the surface bounds with the mouse button down.
protected bool MouseState_EnteredWithButtonDownIsMouseOver
Section titled “IsMouseOver”Indicates that the mouse is currently over this console.
protected bool IsMouseOverProperties
Section titled “Properties”ForceRendererRefresh
Section titled “ForceRendererRefresh”When true, forces the Renderer to refresh the backing texture with the latest state of the object.
public bool ForceRendererRefresh { get; set; }DefaultRendererName
Section titled “DefaultRendererName”The name of the default renderer for this object.
public virtual string DefaultRendererName { get; }Renderer
Section titled “Renderer”The renderer used to draw this surface.
[DataMember][JsonConverter(typeof(RendererJsonConverter))]public IRenderer? Renderer { get; protected set; }QuietSurfaceHandling
Section titled “QuietSurfaceHandling”When true, prevents the Surface property from raising events and virtual methods when the surface changes.
[DataMember]public bool QuietSurfaceHandling { get; set; }Surface
Section titled “Surface”The surface this screen object represents.
public ICellSurface Surface { get; set; }IsDirty
Section titled “IsDirty”When true, indicates that the Surface needs to be redrawn; otherwise false.
public bool IsDirty { get; set; }Font used with rendering.
public IFont Font { get; set; }FontSize
Section titled “FontSize”The size of the Font cells applied to the object when rendering.
public Point FontSize { get; set; }A tint used in rendering.
public Color Tint { get; set; }AbsoluteArea
Section titled “AbsoluteArea”The pixel area on the screen this surface occupies.
public Rectangle AbsoluteArea { get; }UsePixelPositioning
Section titled “UsePixelPositioning”Treats the SadRogue.Primitives.IPositionable.Position of the object as if it is pixels and not cells.
public bool UsePixelPositioning { get; set; }WidthPixels
Section titled “WidthPixels”The width of the surface in pixels.
public int WidthPixels { get; }HeightPixels
Section titled “HeightPixels”The height of the surface in pixels.
public int HeightPixels { get; }The total width of the console.
public int Width { get; }Height
Section titled “Height”The total height of the console.
public int Height { get; }ViewWidth
Section titled “ViewWidth”Gets or sets the visible width of the surface in cells.
public int ViewWidth { get; set; }ViewHeight
Section titled “ViewHeight”Gets or sets the visible height of the surface in cells.
public int ViewHeight { get; set; }ViewPosition
Section titled “ViewPosition”The position of the view within the console.
public Point ViewPosition { get; set; }MoveToFrontOnMouseClick
Section titled “MoveToFrontOnMouseClick”When true, this object will move to the front of its parent object when the mouse is clicked.
[DataMember]public bool MoveToFrontOnMouseClick { get; set; }FocusOnMouseClick
Section titled “FocusOnMouseClick”When true, this object will set IsFocused to true when the mouse is clicked.
[DataMember]public bool FocusOnMouseClick { get; set; }Methods
Section titled “Methods”Resize(int, int, int, int, bool)
Section titled “Resize(int, int, int, int, bool)”Resizes the surface to the specified width and height.
public void Resize(int viewWidth, int viewHeight, int totalWidth, int totalHeight, bool clear)Parameters
Section titled “Parameters”viewWidth int
The viewable width of the surface.
viewHeight int
The viewable height of the surface.
totalWidth int
The maximum width of the surface.
totalHeight int
The maximum height of the surface.
clear bool
When true, resets every cell to the DefaultForeground, DefaultBackground and glyph 0.
Resize(int, int, bool)
Section titled “Resize(int, int, bool)”Resizes the surface and view to the specified width and height.
public void Resize(int width, int height, bool clear)Parameters
Section titled “Parameters”width int
The width of the surface and view.
height int
The height of the surface and view.
clear bool
When true, resets every cell to the DefaultForeground, DefaultBackground and glyph 0.
UpdateAbsolutePosition()
Section titled “UpdateAbsolutePosition()”Sets a value for AbsolutePosition based on the SadRogue.Primitives.IPositionable.Position of this instance and the Parent instance.
public override void UpdateAbsolutePosition()Render(TimeSpan)
Section titled “Render(TimeSpan)”Draws the Surface and all SadComponents and Children.
public override void Render(TimeSpan delta)Parameters
Section titled “Parameters”delta TimeSpan
The time that has elapsed since the last call.
Update(TimeSpan)
Section titled “Update(TimeSpan)”Updates the Surface effects and all SadComponents and Children.
public override void Update(TimeSpan delta)Parameters
Section titled “Parameters”delta TimeSpan
The time that has elapsed since this method was last called.
OnIsDirtyChanged()
Section titled “OnIsDirtyChanged()”Called when the IsDirty property changes.
protected virtual void OnIsDirtyChanged()OnFontChanged(IFont, Point)
Section titled “OnFontChanged(IFont, Point)”Called when the Font or FontSize property changes.
protected virtual void OnFontChanged(IFont oldFont, Point oldFontSize)Parameters
Section titled “Parameters”oldFont IFont
The font prior to the change.
oldFontSize SadRogue.Primitives.Point
The font size prior to the change.
OnSurfaceChanged(ICellSurface)
Section titled “OnSurfaceChanged(ICellSurface)”Called when the Surface property is changed.
protected virtual void OnSurfaceChanged(ICellSurface oldSurface)Parameters
Section titled “Parameters”oldSurface ICellSurface
The previous surface.
OnRendererChanged()
Section titled “OnRendererChanged()”Called when the Renderer property is changed.
protected virtual void OnRendererChanged()ToString()
Section titled “ToString()”Returns the value “ScreenSurface”.
public override string ToString()Returns
Section titled “Returns”string
The string “ScreenSurface”.
CallOnHostUpdated()
Section titled “CallOnHostUpdated()”Calls the OnHostUpdated method on components, renderer, and rendersteps.
public void CallOnHostUpdated()Dispose(bool)
Section titled “Dispose(bool)”protected virtual void Dispose(bool disposing)Parameters
Section titled “Parameters”disposing bool
~ScreenSurface()
Section titled “~ScreenSurface()”Disposes Renderer.
protected ~ScreenSurface()Dispose()
Section titled “Dispose()”public void Dispose()OnMouseEnter(MouseScreenObjectState)
Section titled “OnMouseEnter(MouseScreenObjectState)”Raises the MouseEnter event.
protected virtual void OnMouseEnter(MouseScreenObjectState state)Parameters
Section titled “Parameters”state MouseScreenObjectState
Current mouse state in relation to this console.
OnMouseExit(MouseScreenObjectState)
Section titled “OnMouseExit(MouseScreenObjectState)”Raises the MouseExit event.
protected virtual void OnMouseExit(MouseScreenObjectState state)Parameters
Section titled “Parameters”state MouseScreenObjectState
Current mouse state in relation to this console.
OnMouseMove(MouseScreenObjectState)
Section titled “OnMouseMove(MouseScreenObjectState)”Raises the MouseMove event.
protected virtual void OnMouseMove(MouseScreenObjectState state)Parameters
Section titled “Parameters”state MouseScreenObjectState
Current mouse state in relation to this console.
OnMouseLeftClicked(MouseScreenObjectState)
Section titled “OnMouseLeftClicked(MouseScreenObjectState)”Raises the MouseButtonClicked event. Possibly moves the console to the top of it’s parent’s children collection.
protected virtual void OnMouseLeftClicked(MouseScreenObjectState state)Parameters
Section titled “Parameters”state MouseScreenObjectState
Current mouse state in relation to this console.
OnRightMouseClicked(MouseScreenObjectState)
Section titled “OnRightMouseClicked(MouseScreenObjectState)”Raises the MouseButtonClicked event.
protected virtual void OnRightMouseClicked(MouseScreenObjectState state)Parameters
Section titled “Parameters”state MouseScreenObjectState
Current mouse state in relation to this console.
LostMouse(MouseScreenObjectState)
Section titled “LostMouse(MouseScreenObjectState)”Called when the mouse is being used by something else.
public override void LostMouse(MouseScreenObjectState state)Parameters
Section titled “Parameters”state MouseScreenObjectState
The current state of the mouse based on this object.
ProcessMouse(MouseScreenObjectState)
Section titled “ProcessMouse(MouseScreenObjectState)”Processes the mouse.
public override bool ProcessMouse(MouseScreenObjectState state)Parameters
Section titled “Parameters”state MouseScreenObjectState
The mouse state related to this object.
Returns
Section titled “Returns”bool
True when this object should halt further mouse processing..
Events
Section titled “Events”MouseButtonClicked
Section titled “MouseButtonClicked”Raised when a mouse button is clicked on this object.
public event EventHandler<MouseScreenObjectState>? MouseButtonClickedEvent Type
Section titled “Event Type”EventHandler<MouseScreenObjectState>
MouseMove
Section titled “MouseMove”Raised when the mouse moves around the this object.
public event EventHandler<MouseScreenObjectState>? MouseMoveEvent Type
Section titled “Event Type”EventHandler<MouseScreenObjectState>
MouseExit
Section titled “MouseExit”Raised when the mouse exits this object.
public event EventHandler<MouseScreenObjectState>? MouseExitEvent Type
Section titled “Event Type”EventHandler<MouseScreenObjectState>
MouseEnter
Section titled “MouseEnter”Raised when the mouse enters this object.
public event EventHandler<MouseScreenObjectState>? MouseEnter