Represents a screen within a ScreenViewport. More...
Public Member Functions | |
| ScreenView () | |
| Creates a new ScreenView. | |
| Bitmap | GetScreenImage () |
| Gets the back-buffer containing the rendered screen image. | |
| void | Invalidate (Graphics g) |
| Causes this ScreenView to be redrawn in the ScreenViewport by raising the Paint event. | |
| void | Invalidate (Rectangle worldClipRect, Graphics g) |
| Causes this ScreenView to be redrawn in the ScreenViewport by raising the Paint event. | |
| void | Redraw () |
| Renders and invalidates this screen editor. | |
| void | Invalidate () |
| Causes the ScreenViewport to repaint this ScreenView. | |
| void | RenderScreen () |
| Constructs the nametable and renders a game-screen image. This does not involve actually painting the game-screen to the control. | |
| void | Dispose () |
| Frees resources used by this object. | |
Public Attributes | |
| const int | ScreenImageWidth = 256 |
| Gets the width of the screen image. | |
| const int | ScreenImageHeight_Full = 256 |
| Gets the height of the screen image. | |
| const int | ScreenImageHeight_Clipped = 240 |
| Gets the height of an NTSC display. | |
Protected Member Functions | |
| virtual NameTableRenderer | CreateScreenRenderer () |
| This method should be overridden in a derived class that needs to use a custom NameTableRenderer. | |
| virtual void | OnPaint (Graphics g, Rectangle controlClipRect, Rectangle clippedSourceRect) |
| Called to redraw the ScreenView's buffer contents to the containing control. | |
| virtual void | OnGetFocus () |
| Called when this ScreenView gets focus. | |
| virtual void | OnLoseFocus () |
| Called when this ScreenView loses focus. | |
| virtual void | OnBeforeRender () |
| Override this method to do any initialization needed before rendering. | |
| virtual void | OnConstructSpriteList (NameTableRenderer nametable) |
| Override to construct the sprite list. | |
| virtual void | OnClearSpriteList (System.ComponentModel.CancelEventArgs cancel) |
| Override this method if it may be necessary to NOT clear the sprite list. | |
| virtual void | OnConstructNametable () |
| Override this method to provide name-table creation logic. | |
| virtual void | ApplySpritePalette (CompositePalette spritePalette, int paletteIndex) |
| Override this method to change the usage or application of palettes to the backbuffer. Do not override this method to change which colors will be used for sprites. | |
| virtual void | ApplyBgPalette (CompositePalette palette, int paletteIndex) |
| Override this method to change the usage or application of palettes to the backbuffer. Do not override this method to change which colors will be used for backgrounds. | |
| virtual void | OnLoadBgPalette (ReturnEventArgs< CompositePalette > result) |
| Override this method to specify a background palette for the ScreenView. | |
| virtual void | OnLoadSpritePalette (ReturnEventArgs< CompositePalette > result) |
| Override this method to specify a background palette for the ScreenView. | |
| virtual void | CustomRender (Blitter b) |
| Override this method to perform additional rendering after the nametable is rendered. | |
| virtual void | OnAfterRender () |
| Override this method to run logic after the screen render is complete. | |
| virtual void | OnMouseUp (MouseEventArgs e, int screenX, int screenY) |
| Override this method to handle the mouse-up event. | |
| virtual void | OnMouseDown (MouseEventArgs e, int screenX, int screenY) |
| Override this method to handle the mouse-down event. | |
| virtual void | OnMouseMove (MouseEventArgs e, int screenX, int screenY) |
| Override this method to handle the mouse-move event. | |
Protected Attributes | |
| Bitmap | ScreenBitmap |
| The screen image is drawn to this buffer. | |
Properties | |
| bool | IsEmpty [get] |
| Returns true if this is an EmptyScreenView. | |
| CellIndex | GridLocation [get, set] |
| Gets/sets the grid location of this ScreenView within the ScreenViewport. | |
| SmallNameTable | NameTable [get] |
| Gets this ScreenView's nametable. | |
| Bitmap | Patterns [get, set] |
| Gets/sets the background pattern table used in this screen. | |
| Bitmap | SpritePatterns [get, set] |
| Gets/sets the sprite pattern table used in this screen. | |
| ScreenViewport | Viewport [get, set] |
| Gets the ScreenViewport that contains this ScreenView. | |
| Rom | Rom [get] |
| Gets the ROM image to load data from. | |
| bool | HasFocus [get] |
| Returns true if this ScreenView has input focus. | |
| NameTableRenderer | Renderer [get] |
| Gets the NameTableRenderer used by this ScreenView. | |
| byte | SelectionColor [get, set] |
| The color used for the selection rectangle. | |
| Rectangle | Selection [get, set] |
| The location to draw the selection rectangle. Specify Rectangle.Empty to hide the selection rectangle. | |
| Rectangle | WorldBounds [get] |
| Gets the location of this ScreenView within the entire scrollable area of the ScreenViewport. | |
| Rectangle | ScreenBounds [get] |
| Gets the location of this ScreenView within the visible portion of the ScreenViewport. | |
Events | |
| EventHandler | BeforeRender |
| Handle this event to run logic immediately before rendering. | |
| EventHandler< EventArgs < NameTableRenderer > > | ConstructSpriteList |
| Handle this event to supply a list of sprites to render. | |
| EventHandler | AfterRender |
| Handle this event to perform logic immediately after rendering is complete. | |
| EventHandler < System.ComponentModel.CancelEventArgs > | ClearSpriteList |
| Handle this event to prevent the sprite list from being cleared each frame. | |
| EventHandler< ReturnEventArgs < CompositePalette > > | LoadSpritePalette |
| Handle this event to specify a background palette for the ScreenView. | |
| EventHandler< ReturnEventArgs < CompositePalette > > | LoadBgPalette |
| Handle this event to specify a background palette for the ScreenView. | |
| EventHandler | ConstructNametable |
| Handle this event to supply the data used to render the background. | |
| EventHandler< OnPaintEventArgs > | Paint |
| Raised when the ScreenView is drawing its backbuffer to the ScreenViewport control. | |
| EventHandler | GetFocus |
| Raised when this ScreenView recieves input focus. | |
| EventHandler | LoseFocus |
| Raised when this ScreenView loses input focus. | |
Represents a screen within a ScreenViewport.
This class should be inherited to create a game or purpose specific screen view.
| Romulus.Nes.ScreenView.ScreenView | ( | ) |
Creates a new ScreenView.
The ScreenView will create its own back buffer, ScreenRenderer, and blitter.
| virtual void Romulus.Nes.ScreenView.ApplyBgPalette | ( | CompositePalette | palette, | |
| int | paletteIndex | |||
| ) | [protected, virtual] |
Override this method to change the usage or application of palettes to the backbuffer. Do not override this method to change which colors will be used for backgrounds.
| palette | The colors that will be used for backgrounds. | |
| paletteIndex | The location where background palette data should be used. |
This method should not be overridden except in scenarios where you need to change the way that the backbuffer's palette is used. This need could arise from using a custom blitter that uses palettes differently, or from needing to use additional colors in addition to the specified palette.
| virtual void Romulus.Nes.ScreenView.ApplySpritePalette | ( | CompositePalette | spritePalette, | |
| int | paletteIndex | |||
| ) | [protected, virtual] |
Override this method to change the usage or application of palettes to the backbuffer. Do not override this method to change which colors will be used for sprites.
| spritePalette | The colors that will be used for sprites. | |
| paletteIndex | The location where sprite palette data should be used. |
This method should not be overridden except in scenarios where you need to change the way that the backbuffer's palette is used. This need could arise from using a custom blitter that uses palettes differently, or from needing to use additional colors in addition to the specified palette.
| virtual NameTableRenderer Romulus.Nes.ScreenView.CreateScreenRenderer | ( | ) | [protected, virtual] |
This method should be overridden in a derived class that needs to use a custom NameTableRenderer.
| virtual void Romulus.Nes.ScreenView.CustomRender | ( | Blitter | b | ) | [protected, virtual] |
Override this method to perform additional rendering after the nametable is rendered.
This function is not called directly by the ScreenView. Instead, it is called by the NameTableRenderer. Therefore, using a custom NameTableRenderer could potentially affect the behavior or usage of this function.
| void Romulus.Nes.ScreenView.Dispose | ( | ) |
Frees resources used by this object.
| Bitmap Romulus.Nes.ScreenView.GetScreenImage | ( | ) |
Gets the back-buffer containing the rendered screen image.
| void Romulus.Nes.ScreenView.Invalidate | ( | Rectangle | worldClipRect, | |
| Graphics | g | |||
| ) |
Causes this ScreenView to be redrawn in the ScreenViewport by raising the Paint event.
The screen will not be re-rendered. This is a UI-related painting function.
| g | The graphics object the screen will be drawn to. | |
| worldClipRect | A clipping rectangle to be used during painting. |
| void Romulus.Nes.ScreenView.Invalidate | ( | Graphics | g | ) |
Causes this ScreenView to be redrawn in the ScreenViewport by raising the Paint event.
The screen will not be re-rendered. This is a UI-related painting function.
| g | The graphics object the screen will be drawn to. |
| void Romulus.Nes.ScreenView.Invalidate | ( | ) |
Causes the ScreenViewport to repaint this ScreenView.
| virtual void Romulus.Nes.ScreenView.OnAfterRender | ( | ) | [protected, virtual] |
Override this method to run logic after the screen render is complete.
| virtual void Romulus.Nes.ScreenView.OnBeforeRender | ( | ) | [protected, virtual] |
Override this method to do any initialization needed before rendering.
| virtual void Romulus.Nes.ScreenView.OnClearSpriteList | ( | System.ComponentModel.CancelEventArgs | cancel | ) | [protected, virtual] |
Override this method if it may be necessary to NOT clear the sprite list.
| cancel | Use this object to cancel the clearing of the sprite list. |
| virtual void Romulus.Nes.ScreenView.OnConstructNametable | ( | ) | [protected, virtual] |
Override this method to provide name-table creation logic.
| virtual void Romulus.Nes.ScreenView.OnConstructSpriteList | ( | NameTableRenderer | nametable | ) | [protected, virtual] |
Override to construct the sprite list.
| nametable | The nametable to write sprite data to. |
| virtual void Romulus.Nes.ScreenView.OnGetFocus | ( | ) | [protected, virtual] |
Called when this ScreenView gets focus.
| virtual void Romulus.Nes.ScreenView.OnLoadBgPalette | ( | ReturnEventArgs< CompositePalette > | result | ) | [protected, virtual] |
Override this method to specify a background palette for the ScreenView.
| result |
| virtual void Romulus.Nes.ScreenView.OnLoadSpritePalette | ( | ReturnEventArgs< CompositePalette > | result | ) | [protected, virtual] |
Override this method to specify a background palette for the ScreenView.
| result |
| virtual void Romulus.Nes.ScreenView.OnLoseFocus | ( | ) | [protected, virtual] |
Called when this ScreenView loses focus.
| virtual void Romulus.Nes.ScreenView.OnMouseDown | ( | MouseEventArgs | e, | |
| int | screenX, | |||
| int | screenY | |||
| ) | [protected, virtual] |
Override this method to handle the mouse-down event.
| e | The mouse event args for the containing control. | |
| screenX | The mouse position relative to this ScreenView. | |
| screenY | The mouse position relative to this ScreenView. |
| virtual void Romulus.Nes.ScreenView.OnMouseMove | ( | MouseEventArgs | e, | |
| int | screenX, | |||
| int | screenY | |||
| ) | [protected, virtual] |
Override this method to handle the mouse-move event.
| e | The mouse event args for the containing control. | |
| screenX | The mouse position relative to this ScreenView. | |
| screenY | The mouse position relative to this ScreenView. |
| virtual void Romulus.Nes.ScreenView.OnMouseUp | ( | MouseEventArgs | e, | |
| int | screenX, | |||
| int | screenY | |||
| ) | [protected, virtual] |
Override this method to handle the mouse-up event.
| e | The mouse event args for the containing control. | |
| screenX | The mouse position relative to this ScreenView. | |
| screenY | The mouse position relative to this ScreenView. |
| virtual void Romulus.Nes.ScreenView.OnPaint | ( | Graphics | g, | |
| Rectangle | controlClipRect, | |||
| Rectangle | clippedSourceRect | |||
| ) | [protected, virtual] |
Called to redraw the ScreenView's buffer contents to the containing control.
| g | The graphics object used to draw to the control. | |
| controlClipRect | The rectangle one the ScreenViewport that will be drawn to by this ScreenView. | |
| clippedSourceRect | The portion of the buffer that will be drawn to the ScreenViewport. |
| void Romulus.Nes.ScreenView.Redraw | ( | ) |
Renders and invalidates this screen editor.
| void Romulus.Nes.ScreenView.RenderScreen | ( | ) |
Constructs the nametable and renders a game-screen image. This does not involve actually painting the game-screen to the control.
Bitmap Romulus.Nes.ScreenView.ScreenBitmap [protected] |
The screen image is drawn to this buffer.
| const int Romulus.Nes.ScreenView.ScreenImageHeight_Clipped = 240 |
Gets the height of an NTSC display.
| const int Romulus.Nes.ScreenView.ScreenImageHeight_Full = 256 |
Gets the height of the screen image.
| const int Romulus.Nes.ScreenView.ScreenImageWidth = 256 |
Gets the width of the screen image.
CellIndex Romulus.Nes.ScreenView.GridLocation [get, set] |
Gets/sets the grid location of this ScreenView within the ScreenViewport.
bool Romulus.Nes.ScreenView.HasFocus [get] |
Returns true if this ScreenView has input focus.
bool Romulus.Nes.ScreenView.IsEmpty [get] |
Returns true if this is an EmptyScreenView.
SmallNameTable Romulus.Nes.ScreenView.NameTable [get] |
Gets this ScreenView's nametable.
Bitmap Romulus.Nes.ScreenView.Patterns [get, set] |
Gets/sets the background pattern table used in this screen.
NameTableRenderer Romulus.Nes.ScreenView.Renderer [get, protected] |
Gets the NameTableRenderer used by this ScreenView.
Rom Romulus.Nes.ScreenView.Rom [get] |
Gets the ROM image to load data from.
Rectangle Romulus.Nes.ScreenView.ScreenBounds [get] |
Gets the location of this ScreenView within the visible portion of the ScreenViewport.
Rectangle Romulus.Nes.ScreenView.Selection [get, set] |
The location to draw the selection rectangle. Specify Rectangle.Empty to hide the selection rectangle.
byte Romulus.Nes.ScreenView.SelectionColor [get, set] |
The color used for the selection rectangle.
Bitmap Romulus.Nes.ScreenView.SpritePatterns [get, set] |
Gets/sets the sprite pattern table used in this screen.
ScreenViewport Romulus.Nes.ScreenView.Viewport [get, set] |
Gets the ScreenViewport that contains this ScreenView.
Rectangle Romulus.Nes.ScreenView.WorldBounds [get] |
Gets the location of this ScreenView within the entire scrollable area of the ScreenViewport.
| EventHandler Romulus.Nes.ScreenView.AfterRender |
Handle this event to perform logic immediately after rendering is complete.
Although a ScreenViewport can implement behavior by handling this event, the preferred method is creating a class that inherits ScreenView and overrides protected members.
| EventHandler Romulus.Nes.ScreenView.BeforeRender |
Handle this event to run logic immediately before rendering.
Although a ScreenViewport can implement behavior by handling this event, the preferred method is creating a class that inherits ScreenView and overrides protected members.
| EventHandler<System.ComponentModel.CancelEventArgs> Romulus.Nes.ScreenView.ClearSpriteList |
Handle this event to prevent the sprite list from being cleared each frame.
Although a ScreenViewport can implement behavior by handling this event, the preferred method is creating a class that inherits ScreenView and overrides protected members.
| EventHandler Romulus.Nes.ScreenView.ConstructNametable |
Handle this event to supply the data used to render the background.
Although a ScreenViewport can implement behavior by handling this event, the preferred method is creating a class that inherits ScreenView and overrides protected members.
| EventHandler<EventArgs<NameTableRenderer> > Romulus.Nes.ScreenView.ConstructSpriteList |
Handle this event to supply a list of sprites to render.
Although a ScreenViewport can implement behavior by handling this event, the preferred method is creating a class that inherits ScreenView and overrides protected members.
| EventHandler Romulus.Nes.ScreenView.GetFocus |
Raised when this ScreenView recieves input focus.
| EventHandler<ReturnEventArgs<CompositePalette> > Romulus.Nes.ScreenView.LoadBgPalette |
Handle this event to specify a background palette for the ScreenView.
Although a ScreenViewport can implement behavior by handling this event, the preferred method is creating a class that inherits ScreenView and overrides protected members.
| EventHandler<ReturnEventArgs<CompositePalette> > Romulus.Nes.ScreenView.LoadSpritePalette |
Handle this event to specify a background palette for the ScreenView.
Although a ScreenViewport can implement behavior by handling this event, the preferred method is creating a class that inherits ScreenView and overrides protected members.
| EventHandler Romulus.Nes.ScreenView.LoseFocus |
Raised when this ScreenView loses input focus.
| EventHandler<OnPaintEventArgs> Romulus.Nes.ScreenView.Paint |
Raised when the ScreenView is drawing its backbuffer to the ScreenViewport control.
1.7.1