当前位置: 首页>>代码示例>>C#>>正文


C# KeyboardState.IsCtrlDown方法代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.Input.KeyboardState.IsCtrlDown方法的典型用法代码示例。如果您正苦于以下问题:C# KeyboardState.IsCtrlDown方法的具体用法?C# KeyboardState.IsCtrlDown怎么用?C# KeyboardState.IsCtrlDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Xna.Framework.Input.KeyboardState的用法示例。


在下文中一共展示了KeyboardState.IsCtrlDown方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawLogic


//.........这里部分代码省略.........
					// Delete normal tiles from start to end
					if (mDrawMode.Has(EDrawMode.Fill) && mDrawMode.HasNot(EDrawMode.Animation)) {
						SetCells(startPoint, endPoint, TileCell.Empty);
						if (MenuSettingsOneTimeFill.Checked) {
							MenuToolStripDrawFillButton.PerformClick();
						}
						// Delete single tile
					} else if (mDrawMode.HasNot(EDrawMode.Animation)) {
						SetCell(startPoint, TileCell.Empty, false);
						// Delete a animation cell
					} else if (mDrawMode.Has(EDrawMode.Animation)) {
						mTileMap.AnimationLayer.SetCell(startPoint, null);
					}

					// Draw a normal tile
				} else if (mDrawMode.Has(EDrawMode.Draw) && mDrawMode.HasNot(EDrawMode.Rotate | EDrawMode.NotTilesetMode | EDrawMode.Flipping)) {
					// Nee a valid texture selection
					if (mTextureRect.Width > 0 || mTextureRect.Height > 0) {
						// Draw more than once?
						if (mDrawMode.Has(EDrawMode.Fill)) {
							// Draw from start to end
							SetCellGroups(startPoint, endPoint);
							if (MenuSettingsOneTimeFill.Checked) {
								MenuToolStripDrawFillButton.PerformClick();
							}
						} else {
							// Draw a single tile
							SetCellGroup(startPoint, false);
						}
					}
					// Draw a collision tile
				} else if (mDrawMode.Has(EDrawMode.Collision)) {
					// Get type of collision
					var drawType = ECollisionType.NotMoveable;
					if (mNewState.IsCtrlDown() || GetCapsLock) {
						drawType = ECollisionType.Moveable;
					} else if (mNewState.IsShiftDown() || GetScrollLock) {
						drawType = ECollisionType.Water;
					} else if (mNewState.IsKeyDown(XnaKeys.LeftAlt) /* || GetNumLock*/) {
						drawType = ECollisionType.Underwater;
					}

					// Fill collisions from start to end?
					if (mDrawMode.Has(EDrawMode.Fill)) {
						var baseType = mTileMap.CollisionLayer.GetCell(startPoint.X, startPoint.Y);
						for (var x = startPoint.X; x < endPoint.X; x++) {
							for (var y = startPoint.Y; y < endPoint.Y; y++) {
								if (MenuSettingsFillSameTexture.Checked && mTileMap.CollisionLayer.GetCell(x, y) != baseType) {
									continue;
								}
								mTileMap.CollisionLayer.SetCell(x, y, drawType);
							}
						}
						if (MenuSettingsOneTimeFill.Checked) {
							MenuToolStripDrawFillButton.PerformClick();
						}
					} else {
						// Just a single draw
						mTileMap.CollisionLayer.SetCell(startPoint, drawType);
					}
				}
			}

			if (mCurrentLayer == -1) {
				return;
			}

			if ((mMouseOnMapRightButton || mMouseOnMapLeftButton) && mDrawMode.Has(EDrawMode.Rotate) && mDrawMode.HasNot(EDrawMode.NotTilesetMode | EDrawMode.Flipping | EDrawMode.Collision)) {
				var cell = mTileMap.Layers[mCurrentLayer].GetCell(startPoint.X, startPoint.Y);
				if (cell.IsEqualTo(TileCell.Empty) == false && cell.TextureSource.TextureIndex != string.Empty && CanRotate(startPoint)) {
					var rotation = (mMouseOnMapRightButton ? 1.5f : -1.5f);
					if (mNewState.IsCtrlDown()) {
						rotation /= 10f;
					}
					cell.Rotation += rotation;
					if (cell.Rotation >= 6f || cell.Rotation <= -6f) {
						cell.Rotation = 0f;
					}
					mTileMap.Layers[mCurrentLayer].SetCell(startPoint, cell);

					Debug.WriteLine("Rotation: " + cell.Rotation);
				}
			} else if (mMouseOnMapLeftButton && mDrawMode.Has(EDrawMode.Autotile) && mDrawMode.HasNot(EDrawMode.Rotate | EDrawMode.Erase | EDrawMode.Collision)) {
				if (mDrawMode.Has(EDrawMode.Fill)) {
					for (var x = startPoint.X; x < endPoint.X; x++) {
						for (var y = startPoint.Y; y < endPoint.Y; y++) {
							UpdateAutoTiles(new Point2D(x, y), true);
						}
					}

					if (MenuSettingsOneTimeFill.Checked) {
						MenuToolStripDrawFillButton.PerformClick();
					}
				} else {
					UpdateAutoTiles(startPoint, true);
				}
			} else if (mMouseOnMapLeftButton && mDrawMode.Has(EDrawMode.Animation) && mDrawMode.HasNot(EDrawMode.Rotate | EDrawMode.Erase | EDrawMode.Collision)) {
				mTileMap.AnimationLayer.SetCell(startPoint, mPreviewAnimation);
			}
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:101,代码来源:frmEditor.cs


注:本文中的Microsoft.Xna.Framework.Input.KeyboardState.IsCtrlDown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。