C# Класс Paint.BaseGame

Base game - derived from the MonoGame Game class and acts as a base class for our separate 'paint' and 'playback' apps
Наследование: Microsoft.Xna.Framework.Game
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
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

Открытые методы

Метод Описание
BaseGame ( ImageStateData imageStateData, ToolboxLayoutDefinition toolboxLayoutDefinition, int deviceScale ) : System

Initializes a new instance of the Paint.BaseGame class.

Защищенные методы

Метод Описание
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

Приватные методы

Метод Описание
DrawCanvasOnScreen ( ) : void

Draws the canvas on screen.

DrawToolboxOnScreen ( ) : void

Draws the toolbox on screen.

Описание методов

BaseGame() публичный Метод

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
Результат System

BlankRenderTarget() защищенный Метод

Blanks the render target.
protected BlankRenderTarget ( RenderTarget2D renderTarget ) : void
renderTarget Microsoft.Xna.Framework.Graphics.RenderTarget2D /// Render target. ///
Результат void

CheckToolboxCollision() защищенный Метод

Checks whether the user has touched inside the toolbox
protected CheckToolboxCollision ( ITouchPoint touchPoint ) : bool
touchPoint ITouchPoint
Результат bool

ConvertGestureType() защищенный Метод

Converts a MonoGame.GestureType into our TouchType representation
protected ConvertGestureType ( GestureType gestureType ) : TouchType
gestureType GestureType /// The monogame gesture type. ///
Результат TouchType

ConvertScreenTouchToCanvasTouch() защищенный Метод

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
Результат TouchPointSizeColour

CreateRenderTargets() защищенный Метод

Creates the canvas.
protected CreateRenderTargets ( ) : void
Результат void

CreateToolbox() защищенный абстрактный Метод

Creates the toolbox.
protected abstract CreateToolbox ( ) : IToolBox
Результат IToolBox

Draw() защищенный Метод

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 ///
Результат void

Initialize() защищенный Метод

Enable the capturing of gestures on the device
protected Initialize ( ) : void
Результат void

LoadContent() защищенный Метод

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
Результат void

Описание свойств

BackgroundColor защищенное свойство

Background color for our app
protected Color BackgroundColor
Результат Color

Canvas защищенное свойство

Where we draw our picture - the canvas/paper/drawing board
protected ICanvas Canvas
Результат ICanvas

CanvasTouchPoints защищенное свойство

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
Результат List

DeviceScale защищенное свойство

The device scale/resolution. 1 = normal. 2 = retina.
protected int DeviceScale
Результат int

GraphicsDeviceManager защищенное свойство

Our monogame GrahicsDeviceManager handles all the rendering
protected GraphicsDeviceManager GraphicsDeviceManager
Результат GraphicsDeviceManager

GraphicsDisplay защищенное свойство

The graphics texture map - contains all our graphics for buttons etc
protected IGraphicsDisplay GraphicsDisplay
Результат IGraphicsDisplay

ImageStateData защищенное свойство

The image state data. height/width of image and details of save points (undo/redo state)
protected ImageStateData,Paint ImageStateData
Результат ImageStateData

InMemoryCanvasRenderTarget защищенное свойство

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
Результат Microsoft.Xna.Framework.Graphics.RenderTarget2D

InMemoryToolboxRenderTarget защищенное свойство

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
Результат Microsoft.Xna.Framework.Graphics.RenderTarget2D

InitialDraw защищенное свойство

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
Результат bool

SpriteBatch защищенное свойство

The sprite batch handles all the drawing to the render targets / screen
protected SpriteBatch,Microsoft.Xna.Framework.Graphics SpriteBatch
Результат Microsoft.Xna.Framework.Graphics.SpriteBatch

ToolBox защищенное свойство

The tool box - contains all our controls/buttons for the user to interact with the app
protected IToolBox ToolBox
Результат IToolBox

ToolboxLayoutDefinition защищенное свойство

Defines the layout of all the controls in the toolbox
protected ToolboxLayoutDefinition,Paint.ToolboxLayout ToolboxLayoutDefinition
Результат Paint.ToolboxLayout.ToolboxLayoutDefinition