Windows Forms control that allows a user to scroll around large game areas. More...
Public Member Functions | |
| ScreenViewport () | |
| Creates a new ScreenViewport. | |
| virtual ScreenView | CreateNewScreenView () |
| Override this method in a derived class to return a custom or derived ScreenView. (This method should not be called explicitly.). | |
| virtual bool | ShouldLoadScreen (CellIndex cellLocation) |
| Override this method to identify which screens should be loaded and which screens should be empty. | |
| void | ReevaluateEmptyScreens () |
| This method re-evaluates which screens should be empty. | |
| void | InvalidateWorld (Rectangle worldRect) |
| Invalidates a rectangle in world coordinates. | |
| void | ScrollScreen (int screensX, int screensY) |
| Scrolls the view by the specified number of screens. | |
| void | ScrollView (int dx, int dy) |
| Scrolls the view by the specified number of pixels. | |
| void | SetViewportLocation (Point location) |
| Sets the rectangle of the game area that is visible. | |
| void | SetFocus (ScreenView view) |
| Sets which ScreenView has focus. | |
| void | RequestUnfocus () |
Causes no ScreenViews to have focus. Same effect as calling SetFocus(null). | |
| void | BeginUpdate () |
| Prevents the ScreenViewport from drawing until EndUpdate is called. | |
| void | EndUpdate () |
| To be called after calling BeginUpdate, when any necessary updates have been made. | |
| void | RedrawAll () |
| Rerenders and repaints all screens. | |
| void | Redraw (Predicate< ScreenView > condition) |
| Rerenders and repaints all screens that meet the specified condition. | |
| void | Redraw (CellIndex cellLocation) |
| Redraws and repaints a single screen. | |
| Rectangle | ConvertWorldToControl (Rectangle rect) |
| Converts world coordinates to control coordinates. | |
| Rectangle | ConvertControlToWorld (Rectangle rect) |
| Converts control coordinates to world coordinates. | |
| Point | ConvertWorldToControl (Point p) |
| Converts world coordinates to control coordinates. | |
| Point | ConvertControlToWorld (Point p) |
| Converts control coordinates to world coordinates. | |
Protected Member Functions | |
| virtual ScreenViewCellType | GetCellType () |
| Called when creating the ScreenViewPort. Override to specify a ScreenViewCellType other than the default. The returned value should not change throughout the lifetime of the ScreenViewport object. | |
| virtual Padding | GetCellPadding () |
| Called when creating the ScreenViewPort. Override to specify a padding other than the default. The returned value should not change throughout the lifetime of the ScreenViewport object. | |
| virtual void | OnRemovingScreen (EventArgs< ScreenView > e) |
| Override this method to handle the RemovingScreen event. | |
| virtual void | OnAddingScreen (EventArgs< ScreenView > e) |
| Override this method to handle the AddedScreen event. | |
| override bool | ProcessCmdKey (ref Message msg, Keys keyData) |
| Causes the CmdKeyPressed event to be raised in response to ProcessCmdKey. | |
| override void | OnPaint (PaintEventArgs e) |
| Override to handle the Paint event. | |
| void | OnPaintScans (RectangleF[] scans, PaintEventArgs e) |
| Override to handle the PaintScans event. | |
| void | OnWorldViewChanged () |
| Override to handle the WorldViewChanged event. | |
| override void | OnMouseDown (MouseEventArgs e) |
| Routes MouseDown event and handles scrolling. | |
| override void | OnResize (EventArgs e) |
| Infrastructure. Handles Resize event. | |
| override void | OnMouseMove (MouseEventArgs e) |
| Routes MouseMove event and handles scrolling. | |
| override void | OnMouseUp (MouseEventArgs e) |
| Routes MouseUp event and handles scrolling. | |
Properties | |
| ScreenViewCellType | CellType [get] |
| Gets the cell type used in this ScreenViewport. | |
| Size | CellSize [get] |
| Gets the size of the cells in this ScreenViewport. | |
| Padding | CellPadding [get] |
| Gets the amount of space that will appear around each screen image. | |
| ScreenViewManager | Screens [get] |
| Gets the ScreenViewManager used by this control. | |
| bool | AllowUserScroll [get, set] |
| If true, the user can drag with the middle mouse button (or the left button while holding the specified scroll key) to scroll the view around. | |
| Keys | ScrollKeys [get, set] |
| Specifies which keys the user should hold whil dragging the mouse to scroll with the left mouse button. | |
| int | ScrollSpeed [get, set] |
| Gets/sets the speed at which the control will be scrolled by the mouse. A value of 1 indicates the view will scroll at the same speed the mouse is moved. | |
| System.Drawing.Rectangle | WorldViewport [get] |
| Gets the rectangle of the game area that is visible. | |
| Rom | Rom [get, set] |
| Gets/sets the ROM associated with this control. | |
| ScreenView | FocusedScreenView [get] |
| Gets the ScreenView that has input focus. | |
Events | |
| EventHandler< EventArgs < ScreenView > > | AddedScreen |
| Raised after a screen is added to the ScreenViewport. | |
| EventHandler< EventArgs < ScreenView > > | RemovingScreen |
| Raised before a screen is removed from the ScreenViewport. | |
| KeyEventHandler | CmdKeyPressed |
| Raised when a command key is pressed. | |
| EventHandler< EventArgs < System.Drawing.Point > > | WorldViewChanged |
| Raised when the location of the viewport changes. | |
Windows Forms control that allows a user to scroll around large game areas.
The ScreenViewport class should be inherited and customized to create a game-specific viewing/editing control. This generally also requires a customized ScreenView class.
| Romulus.Nes.ScreenViewport.ScreenViewport | ( | ) |
Creates a new ScreenViewport.
| void Romulus.Nes.ScreenViewport.BeginUpdate | ( | ) |
Prevents the ScreenViewport from drawing until EndUpdate is called.
| Rectangle Romulus.Nes.ScreenViewport.ConvertControlToWorld | ( | Rectangle | rect | ) |
Converts control coordinates to world coordinates.
| rect | Control coordinates to convert. |
| Point Romulus.Nes.ScreenViewport.ConvertControlToWorld | ( | Point | p | ) |
Converts control coordinates to world coordinates.
| p | Control coordinates to convert. |
| Point Romulus.Nes.ScreenViewport.ConvertWorldToControl | ( | Point | p | ) |
Converts world coordinates to control coordinates.
| p | World coordinates to convert. |
| Rectangle Romulus.Nes.ScreenViewport.ConvertWorldToControl | ( | Rectangle | rect | ) |
Converts world coordinates to control coordinates.
| rect | World coordinates to convert. |
| virtual ScreenView Romulus.Nes.ScreenViewport.CreateNewScreenView | ( | ) | [virtual] |
Override this method in a derived class to return a custom or derived ScreenView. (This method should not be called explicitly.).
| void Romulus.Nes.ScreenViewport.EndUpdate | ( | ) |
To be called after calling BeginUpdate, when any necessary updates have been made.
| virtual Padding Romulus.Nes.ScreenViewport.GetCellPadding | ( | ) | [protected, virtual] |
Called when creating the ScreenViewPort. Override to specify a padding other than the default. The returned value should not change throughout the lifetime of the ScreenViewport object.
| virtual ScreenViewCellType Romulus.Nes.ScreenViewport.GetCellType | ( | ) | [protected, virtual] |
Called when creating the ScreenViewPort. Override to specify a ScreenViewCellType other than the default. The returned value should not change throughout the lifetime of the ScreenViewport object.
| void Romulus.Nes.ScreenViewport.InvalidateWorld | ( | Rectangle | worldRect | ) |
Invalidates a rectangle in world coordinates.
| worldRect | The invalid rectangle. |
| virtual void Romulus.Nes.ScreenViewport.OnAddingScreen | ( | EventArgs< ScreenView > | e | ) | [protected, virtual] |
Override this method to handle the AddedScreen event.
| e | Specifies the screenview the event is for. |
| override void Romulus.Nes.ScreenViewport.OnMouseDown | ( | MouseEventArgs | e | ) | [protected] |
Routes MouseDown event and handles scrolling.
| e | Event args. |
| override void Romulus.Nes.ScreenViewport.OnMouseMove | ( | MouseEventArgs | e | ) | [protected] |
Routes MouseMove event and handles scrolling.
| e | Event args. |
| override void Romulus.Nes.ScreenViewport.OnMouseUp | ( | MouseEventArgs | e | ) | [protected] |
Routes MouseUp event and handles scrolling.
| e | Event args. |
| override void Romulus.Nes.ScreenViewport.OnPaint | ( | PaintEventArgs | e | ) | [protected] |
Override to handle the Paint event.
| e | Arguments to the Paint event. |
| void Romulus.Nes.ScreenViewport.OnPaintScans | ( | RectangleF[] | scans, | |
| PaintEventArgs | e | |||
| ) | [protected] |
Override to handle the PaintScans event.
| scans | The invalid scans. | |
| e | Arguments to the PaintScans event. |
| virtual void Romulus.Nes.ScreenViewport.OnRemovingScreen | ( | EventArgs< ScreenView > | e | ) | [protected, virtual] |
Override this method to handle the RemovingScreen event.
| e | Specifies the screenview the event is for. |
| override void Romulus.Nes.ScreenViewport.OnResize | ( | EventArgs | e | ) | [protected] |
Infrastructure. Handles Resize event.
| e | Event args. |
| void Romulus.Nes.ScreenViewport.OnWorldViewChanged | ( | ) | [protected] |
Override to handle the WorldViewChanged event.
| override bool Romulus.Nes.ScreenViewport.ProcessCmdKey | ( | ref Message | msg, | |
| Keys | keyData | |||
| ) | [protected] |
Causes the CmdKeyPressed event to be raised in response to ProcessCmdKey.
| msg | ||
| keyData |
| void Romulus.Nes.ScreenViewport.Redraw | ( | CellIndex | cellLocation | ) |
Redraws and repaints a single screen.
| cellLocation | The location of the screen to redraw. |
| void Romulus.Nes.ScreenViewport.Redraw | ( | Predicate< ScreenView > | condition | ) |
Rerenders and repaints all screens that meet the specified condition.
| condition | The condition to test screens for. |
| void Romulus.Nes.ScreenViewport.RedrawAll | ( | ) |
Rerenders and repaints all screens.
| void Romulus.Nes.ScreenViewport.ReevaluateEmptyScreens | ( | ) |
This method re-evaluates which screens should be empty.
For example, if a different level is loaded into an existing ScreenViewport, and it is not the same shape as the previous level, this method should be called to re-asses which screens have content.
| void Romulus.Nes.ScreenViewport.RequestUnfocus | ( | ) |
Causes no ScreenViews to have focus. Same effect as calling SetFocus(null).
| void Romulus.Nes.ScreenViewport.ScrollScreen | ( | int | screensX, | |
| int | screensY | |||
| ) |
Scrolls the view by the specified number of screens.
| screensX | The number of screen widths to scroll the view. | |
| screensY | The number of screen heights to scroll the view. |
| void Romulus.Nes.ScreenViewport.ScrollView | ( | int | dx, | |
| int | dy | |||
| ) |
Scrolls the view by the specified number of pixels.
| dx | The distance to scroll the view. | |
| dy | The distance to scroll the view. |
| void Romulus.Nes.ScreenViewport.SetFocus | ( | ScreenView | view | ) |
Sets which ScreenView has focus.
| view | The view to get focus, or null to have no focused view. |
| void Romulus.Nes.ScreenViewport.SetViewportLocation | ( | Point | location | ) |
Sets the rectangle of the game area that is visible.
| location |
| virtual bool Romulus.Nes.ScreenViewport.ShouldLoadScreen | ( | CellIndex | cellLocation | ) | [virtual] |
Override this method to identify which screens should be loaded and which screens should be empty.
| cellLocation | The map location to test. |
bool Romulus.Nes.ScreenViewport.AllowUserScroll [get, set] |
If true, the user can drag with the middle mouse button (or the left button while holding the specified scroll key) to scroll the view around.
Padding Romulus.Nes.ScreenViewport.CellPadding [get] |
Gets the amount of space that will appear around each screen image.
Size Romulus.Nes.ScreenViewport.CellSize [get] |
Gets the size of the cells in this ScreenViewport.
ScreenViewCellType Romulus.Nes.ScreenViewport.CellType [get] |
Gets the cell type used in this ScreenViewport.
ScreenView Romulus.Nes.ScreenViewport.FocusedScreenView [get] |
Gets the ScreenView that has input focus.
Rom Romulus.Nes.ScreenViewport.Rom [get, set] |
Gets/sets the ROM associated with this control.
ScreenViewManager Romulus.Nes.ScreenViewport.Screens [get] |
Gets the ScreenViewManager used by this control.
Keys Romulus.Nes.ScreenViewport.ScrollKeys [get, set] |
Specifies which keys the user should hold whil dragging the mouse to scroll with the left mouse button.
int Romulus.Nes.ScreenViewport.ScrollSpeed [get, set] |
Gets/sets the speed at which the control will be scrolled by the mouse. A value of 1 indicates the view will scroll at the same speed the mouse is moved.
System.Drawing.Rectangle Romulus.Nes.ScreenViewport.WorldViewport [get] |
Gets the rectangle of the game area that is visible.
| EventHandler<EventArgs<ScreenView> > Romulus.Nes.ScreenViewport.AddedScreen |
Raised after a screen is added to the ScreenViewport.
Screens are added to the control when they are scrolled into view.
| KeyEventHandler Romulus.Nes.ScreenViewport.CmdKeyPressed |
Raised when a command key is pressed.
| EventHandler<EventArgs<ScreenView> > Romulus.Nes.ScreenViewport.RemovingScreen |
Raised before a screen is removed from the ScreenViewport.
Screens are removed from the control when they are scrolled out of view.
| EventHandler<EventArgs<System.Drawing.Point> > Romulus.Nes.ScreenViewport.WorldViewChanged |
Raised when the location of the viewport changes.
1.7.1