C# Class Paint.PaintApp

The main application class just inherits from the monogame:Game class Override a few key methods and away we go...
Inheritance: BaseGame, IRenderTargertHandler
Show file Open project: RandolphBurt/MonoGame-iOS-SimplePaint Class Usage Examples

Public Methods

Method Description
ForceSaveAndExit ( ) : void

Forces the immediate Shutdown and saving of state on this thread We must not change thread because we are probably going into the background and therefore the main UI thread will not come alive again until the app is back in teh foreground again

PaintApp ( IPictureIOManager pictureIOManager, IFilenameResolver filenameResolver, ImageStateData imageStateData, IUIBusyMessage saveBusyMessageDisplay, ToolboxLayoutDefinition toolboxLayoutDefinition, int deviceScale ) : System

Initializes a new instance of the Paint.PaintApp class. Instantiate our GraphicsDeviceManager and establish where the content folder is

RestoreSavePoint ( int savePoint ) : void

Restore the image held in the specified save point to the canvas/display

StoreSavePoint ( int savePoint ) : void

Save the canvas/display to the specified save-point (undo/redo render target).

Protected Methods

Method Description
CreateRenderTargets ( ) : void

Creates the render targets (including all the undo buffers).

CreateToolbox ( ) : IToolBox

Creates the toolbox.

Draw ( GameTime gameTime ) : void

Called everytime we need to redraw the screen

LoadContent ( ) : void

We load any content we need at the beginning of the application life cycle. Also anything that needs initialising is done here

Update ( GameTime gameTime ) : void

Called often. Allows us to handle any user input (gestures on screen) and/or game time related work - e.g. moving an animation character based on elapsed time since last called etc

Private Methods

Method Description
CreatePictureStateManager ( ) : void

Creates the picture state manager.

HandleInput ( ) : void

Handles any user input. Collect all gestures made since the last 'update' - stores these ready to be handled by the Canvas for drawing

InitiateShutdown ( ) : void

Initiates the shutdown process. We will display a 'busy' form/window -- we pass in a delegate/action to be run once the form has displayed

RenderImage ( RenderTarget2D target, RenderTarget2D source ) : void

Renders a specific source RenderTarget on to a specific target RenderTarget

SaveAndExit ( ) : void

Saves all the data and then exits.

Method Details

CreateRenderTargets() protected method

Creates the render targets (including all the undo buffers).
protected CreateRenderTargets ( ) : void
return void

CreateToolbox() protected method

Creates the toolbox.
protected CreateToolbox ( ) : IToolBox
return IToolBox

Draw() protected method

Called everytime we need to redraw the screen
protected Draw ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime /// Allows you to monitor time passed since last draw ///
return void

ForceSaveAndExit() public method

Forces the immediate Shutdown and saving of state on this thread We must not change thread because we are probably going into the background and therefore the main UI thread will not come alive again until the app is back in teh foreground again
public ForceSaveAndExit ( ) : void
return void

LoadContent() protected method

We load any content we need at the beginning of the application life cycle. Also anything that needs initialising is done here
protected LoadContent ( ) : void
return void

PaintApp() public method

Initializes a new instance of the Paint.PaintApp class. Instantiate our GraphicsDeviceManager and establish where the content folder is
public PaintApp ( IPictureIOManager pictureIOManager, IFilenameResolver filenameResolver, ImageStateData imageStateData, IUIBusyMessage saveBusyMessageDisplay, ToolboxLayoutDefinition toolboxLayoutDefinition, int deviceScale ) : System
pictureIOManager IPictureIOManager Picture IO Manager
filenameResolver IFilenameResolver Filename Resolver
imageStateData ImageStateData ImageSaveData
saveBusyMessageDisplay IUIBusyMessage Class for dsplaying the 'Busy - saving' message
toolboxLayoutDefinition Paint.ToolboxLayout.ToolboxLayoutDefinition Layout of the toolbox
deviceScale int The device scale/resolution. 1 = normal. 2 = retina.
return System

RestoreSavePoint() public method

Restore the image held in the specified save point to the canvas/display
public RestoreSavePoint ( int savePoint ) : void
savePoint int specific save point we wish to restore
return void

StoreSavePoint() public method

Save the canvas/display to the specified save-point (undo/redo render target).
public StoreSavePoint ( int savePoint ) : void
savePoint int specific save point we wish to use to store the canvas
return void

Update() protected method

Called often. Allows us to handle any user input (gestures on screen) and/or game time related work - e.g. moving an animation character based on elapsed time since last called etc
protected Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime /// Allows you to monitor time passed since last draw ///
return void