C# Class Paint.BaseGame

Base game - derived from the MonoGame Game class and acts as a base class for our separate 'paint' and 'playback' apps
Inheritance: Microsoft.Xna.Framework.Game
Afficher le fichier Open project: RandolphBurt/MonoGame-iOS-SimplePaint

Protected Properties

Свойство Type Description
BackgroundColor Color
Canvas ICanvas
CanvasTouchPoints List
DeviceScale int
GraphicsDeviceManager GraphicsDeviceManager
GraphicsDisplay IGraphicsDisplay
ImageStateData ImageStateData
InMemoryCanvasRenderTarget Microsoft.Xna.Framework.Graphics.RenderTarget2D
InMemoryToolboxRenderTarget Microsoft.Xna.Framework.Graphics.RenderTarget2D
InitialDraw bool
SpriteBatch Microsoft.Xna.Framework.Graphics.SpriteBatch
ToolBox IToolBox
ToolboxLayoutDefinition Paint.ToolboxLayout.ToolboxLayoutDefinition

Méthodes publiques

Méthode Description
BaseGame ( ImageStateData imageStateData, ToolboxLayoutDefinition toolboxLayoutDefinition, int deviceScale ) : System

Initializes a new instance of the Paint.BaseGame class.

Méthodes protégées

Méthode Description
BlankRenderTarget ( RenderTarget2D renderTarget ) : void

Blanks the render target.

CheckToolboxCollision ( ITouchPoint touchPoint ) : bool

Checks whether the user has touched inside the toolbox

ConvertGestureType ( GestureType gestureType ) : TouchType

Converts a MonoGame.GestureType into our TouchType representation

ConvertScreenTouchToCanvasTouch ( TouchPointSizeColour screenTouchPoint ) : TouchPointSizeColour

Converts the screen touchpoint to a canvas touchpoint - i.e. alters the position of the touch to take into account the position and size of the toolbox

CreateRenderTargets ( ) : void

Creates the canvas.

CreateToolbox ( ) : IToolBox

Creates the toolbox.

Draw ( GameTime gameTime ) : void

Called everytime we need to redraw the screen

Initialize ( ) : void

Enable the capturing of gestures on the device

LoadContent ( ) : void

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

Private Methods

Méthode Description
DrawCanvasOnScreen ( ) : void

Draws the canvas on screen.

DrawToolboxOnScreen ( ) : void

Draws the toolbox on screen.

Method Details

BaseGame() public méthode

Initializes a new instance of the Paint.BaseGame class.
public BaseGame ( ImageStateData imageStateData, ToolboxLayoutDefinition toolboxLayoutDefinition, int deviceScale ) : System
imageStateData ImageStateData ImageSaveData
toolboxLayoutDefinition Paint.ToolboxLayout.ToolboxLayoutDefinition Layout of the toolbox
deviceScale int Layout of the toolbox
Résultat System

BlankRenderTarget() protected méthode

Blanks the render target.
protected BlankRenderTarget ( RenderTarget2D renderTarget ) : void
renderTarget Microsoft.Xna.Framework.Graphics.RenderTarget2D /// Render target. ///
Résultat void

CheckToolboxCollision() protected méthode

Checks whether the user has touched inside the toolbox
protected CheckToolboxCollision ( ITouchPoint touchPoint ) : bool
touchPoint ITouchPoint
Résultat bool

ConvertGestureType() protected méthode

Converts a MonoGame.GestureType into our TouchType representation
protected ConvertGestureType ( GestureType gestureType ) : TouchType
gestureType GestureType /// The monogame gesture type. ///
Résultat TouchType

ConvertScreenTouchToCanvasTouch() protected méthode

Converts the screen touchpoint to a canvas touchpoint - i.e. alters the position of the touch to take into account the position and size of the toolbox
protected ConvertScreenTouchToCanvasTouch ( TouchPointSizeColour screenTouchPoint ) : TouchPointSizeColour
screenTouchPoint TouchPointSizeColour
Résultat TouchPointSizeColour

CreateRenderTargets() protected méthode

Creates the canvas.
protected CreateRenderTargets ( ) : void
Résultat void

CreateToolbox() protected abstract méthode

Creates the toolbox.
protected abstract CreateToolbox ( ) : IToolBox
Résultat IToolBox

Draw() protected méthode

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 ///
Résultat void

Initialize() protected méthode

Enable the capturing of gestures on the device
protected Initialize ( ) : void
Résultat void

LoadContent() protected méthode

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
Résultat void

Property Details

BackgroundColor protected_oe property

Background color for our app
protected Color BackgroundColor
Résultat Color

Canvas protected_oe property

Where we draw our picture - the canvas/paper/drawing board
protected ICanvas Canvas
Résultat ICanvas

CanvasTouchPoints protected_oe property

Keeps track of all touch/gestures made on the canvas since the last Draw command- is then reset after handled by the Draw.
protected List CanvasTouchPoints
Résultat List

DeviceScale protected_oe property

The device scale/resolution. 1 = normal. 2 = retina.
protected int DeviceScale
Résultat int

GraphicsDeviceManager protected_oe property

Our monogame GrahicsDeviceManager handles all the rendering
protected GraphicsDeviceManager GraphicsDeviceManager
Résultat GraphicsDeviceManager

GraphicsDisplay protected_oe property

The graphics texture map - contains all our graphics for buttons etc
protected IGraphicsDisplay GraphicsDisplay
Résultat IGraphicsDisplay

ImageStateData protected_oe property

The image state data. height/width of image and details of save points (undo/redo state)
protected ImageStateData,Paint ImageStateData
Résultat ImageStateData

InMemoryCanvasRenderTarget protected_oe property

An in memory render target - as the user draws on the canvas then so we update this rendertarget. Then each 'draw cycle' we render this to the screen.
protected RenderTarget2D,Microsoft.Xna.Framework.Graphics InMemoryCanvasRenderTarget
Résultat Microsoft.Xna.Framework.Graphics.RenderTarget2D

InMemoryToolboxRenderTarget protected_oe property

An in memory render target for holding the toolbox Then each 'draw cycle' we render this to the screen.
protected RenderTarget2D,Microsoft.Xna.Framework.Graphics InMemoryToolboxRenderTarget
Résultat Microsoft.Xna.Framework.Graphics.RenderTarget2D

InitialDraw protected_oe property

Simply tracks whether this is the very first time we are drawing the canvas - if so then we need to draw everything on each control/tool.
protected bool InitialDraw
Résultat bool

SpriteBatch protected_oe property

The sprite batch handles all the drawing to the render targets / screen
protected SpriteBatch,Microsoft.Xna.Framework.Graphics SpriteBatch
Résultat Microsoft.Xna.Framework.Graphics.SpriteBatch

ToolBox protected_oe property

The tool box - contains all our controls/buttons for the user to interact with the app
protected IToolBox ToolBox
Résultat IToolBox

ToolboxLayoutDefinition protected_oe property

Defines the layout of all the controls in the toolbox
protected ToolboxLayoutDefinition,Paint.ToolboxLayout ToolboxLayoutDefinition
Résultat Paint.ToolboxLayout.ToolboxLayoutDefinition