/// <summary>
		/// 创建指定类型的拼图渲染器。
		/// </summary>
		/// <param name="rendererType">拼图渲染器的类型。</param>
		/// <param name="deviceManager">设备管理器。</param>
		public static JigsawRenderer CreateRenderer(JigsawRendererType rendererType, DeviceManager deviceManager)
		{
			switch (rendererType)
			{
				case JigsawRendererType.Effect:
					return new JigsawEffectRenderer(deviceManager);
				default:
					return new JigsawSimpleRenderer(deviceManager);
			}
		}
        /// <summary>
        /// 创建指定类型的拼图渲染器。
        /// </summary>
        /// <param name="rendererType">拼图渲染器的类型。</param>
        /// <param name="deviceManager">设备管理器。</param>
        public static JigsawRenderer CreateRenderer(JigsawRendererType rendererType, DeviceManager deviceManager)
        {
            switch (rendererType)
            {
            case JigsawRendererType.Effect:
                return(new JigsawEffectRenderer(deviceManager));

            default:
                return(new JigsawSimpleRenderer(deviceManager));
            }
        }
Exemplo n.º 3
0
		/// <summary>
		/// 拼图渲染器被改变的事件。
		/// </summary>
		private void rbtnSample_CheckedChanged(object sender, EventArgs e)
		{
			if (rbtnSample.Checked)
			{
				this.RendererType = JigsawRendererType.Simple;
			}
			else
			{
				this.RendererType = JigsawRendererType.Effect;
			}
		}
Exemplo n.º 4
0
 /// <summary>
 /// 拼图渲染器被改变的事件。
 /// </summary>
 private void rbtnSample_CheckedChanged(object sender, EventArgs e)
 {
     if (rbtnSample.Checked)
     {
         this.RendererType = JigsawRendererType.Simple;
     }
     else
     {
         this.RendererType = JigsawRendererType.Effect;
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// 初始化 <see cref="GameManager"/> 类的新实例。
 /// </summary>
 /// <param name="devices">设备管理器。</param>
 public GameManager(DeviceManager devices, JigsawRenderPanel renderPanel, JigsawRendererType rendererType)
 {
     this.devices     = devices;
     this.renderPanel = renderPanel;
     // 初始化设备。
     this.renderPanel.Devices = devices;
     this.renderPanel.Paint  += this.renderPanel_Paint;
     this.renderTarget        = devices.RenderTarget;
     // 初始化画刷。
     selectionRectBrush = new SolidColorBrush(renderTarget, Color.Black);
     selectionRectStyle = new StrokeStyle(this.devices.D2DFactory,
                                          new StrokeStyleProperties()
     {
         DashStyle = DashStyle.Dash
     });
     this.RendererType = rendererType;
 }
Exemplo n.º 6
0
		/// <summary>
		/// 初始化 <see cref="GameManager"/> 类的新实例。
		/// </summary>
		/// <param name="devices">设备管理器。</param>
		public GameManager(DeviceManager devices, JigsawRenderPanel renderPanel, JigsawRendererType rendererType)
		{
			this.devices = devices;
			this.renderPanel = renderPanel;
			// 初始化设备。
			this.renderPanel.Devices = devices;
			this.renderPanel.Paint += this.renderPanel_Paint;
			this.renderTarget = devices.RenderTarget;
			// 初始化画刷。
			selectionRectBrush = new SolidColorBrush(renderTarget, Color.Black);
			selectionRectStyle = new StrokeStyle(this.devices.D2DFactory,
				new StrokeStyleProperties() { DashStyle = DashStyle.Dash });
			this.RendererType = rendererType;
		}