本文整理汇总了C#中Microsoft.Xna.Framework.Game类的典型用法代码示例。如果您正苦于以下问题:C# Game类的具体用法?C# Game怎么用?C# Game使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Game类属于Microsoft.Xna.Framework命名空间,在下文中一共展示了Game类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Human
public Human(Game game, SpriteBatch screenSpriteBatch,
PlayerSide playerSide)
: base(game, screenSpriteBatch)
{
string idleTextureName = "";
this.playerSide = playerSide;
if (playerSide == PlayerSide.Left)
{
catapultPosition = new Vector2(140, 332);
idleTextureName = "Textures/Catapults/Blue/blueIdle/blueIdle";
}
else
{
catapultPosition = new Vector2(600, 332);
spriteEffect = SpriteEffects.FlipHorizontally;
idleTextureName = "Textures/Catapults/Red/redIdle/redIdle";
}
Catapult = new Catapult(game, screenSpriteBatch,
idleTextureName, catapultPosition,
spriteEffect,
playerSide == PlayerSide.Left
? false : true, true);
}
示例2: Board
public Board(Game game, int posX = 224, int posY = 64, int width = 384, int height = 384)
: base(game) {
State = EBoardState.Initialize;
Score = 0;
Bounds = new Rectangle(posX, posY, width, height);
}
示例3: InputComponent
public InputComponent(Game game)
: base(game)
{
InteractTrigger = new Trigger<bool>();
ApplyTrigger = new Trigger<bool>();
InventoryTrigger = new Trigger<bool>();
JumpTrigger = new Trigger<bool>();
SlotLeftTrigger = new Trigger<bool>();
SlotRightTrigger = new Trigger<bool>();
SlotTrigger = new Trigger<bool>[SlotTriggerLength];
for (int i = 0; i < SlotTrigger.Length; i++)
SlotTrigger[i] = new Trigger<bool>();
gamepad = new GamePadInput();
keyboard = new KeyboardInput();
mouse = new MouseInput(game);
screenMouse = new MouseScreenInput();
inputDevices = new List<IInputSet>{
gamepad,
keyboard,
mouse
};
screenInputDevices = new List<IScreenInputSet>{
screenMouse
};
}
示例4: ActionScene
public ActionScene(
IController playerOneController,
IController playerTwoController,
Game game,
Texture2D theTexture,
Texture2D backgroundTexture,
Rectangle screenBounds,
SpriteFont font,
Vector2 gameoverPosition)
: this(game, theTexture, backgroundTexture, font, gameoverPosition)
{
this.TwoPlayers = true;
this._player1 = new Player(Game, ref this._actionTexture, new Vector2(x: screenBounds.Width / 3, y: 0), new Rectangle(323, 15, 30, 30), playerOneController);
this._player1.Initialize();
Components.Add(this._player1);
this._scorePlayer2 = new Score(game, font, Color.Red)
{
Position =
new Vector2(
this.Game.Window.ClientBounds.Width - 200, 10)
};
Components.Add(this._scorePlayer2);
this._player2 = new Player(Game, ref this._actionTexture, new Vector2((int)(screenBounds.Width / 1.5), 0), new Rectangle(360, 17, 30, 30), playerTwoController);
this._player2.Initialize();
Components.Add(this._player2);
}
示例5: clsButton
private Texture2D texturaSelecionado; // botão em estado selecionado
#endregion Fields
#region Constructors
public clsButton(Game game, Texture2D TexturaNaoSelecionado, Texture2D TexturaSelecionado, Vector2 Posicao, EventHandler evento)
{
texturaNaoSelecionado = TexturaNaoSelecionado;
texturaSelecionado = TexturaSelecionado;
posicao = Posicao;
eventoClick = evento;
}
示例6: ScreenItem
public ScreenItem(Game game, ApplicationSkin applicationSkin, float x, float y, float width, float height)
: base(game)
{
_position = new Vector2(x, y);
_size = new Vector2(width, height);
skin = applicationSkin;
}
示例7: GameWindow
public GameWindow(Game game, RectangleF frame) : base (frame)
{
if (game == null)
throw new ArgumentNullException("game");
_game = game;
_platform = (MacGamePlatform)_game.Services.GetService(typeof(MacGamePlatform));
//LayerRetainsBacking = false;
//LayerColorFormat = EAGLColorFormat.RGBA8;
this.AutoresizingMask = MonoMac.AppKit.NSViewResizingMask.HeightSizable
| MonoMac.AppKit.NSViewResizingMask.MaxXMargin
| MonoMac.AppKit.NSViewResizingMask.MinYMargin
| MonoMac.AppKit.NSViewResizingMask.WidthSizable;
RectangleF rect = NSScreen.MainScreen.Frame;
clientBounds = new Rectangle (0,0,(int)rect.Width,(int)rect.Height);
// Enable multi-touch
//MultipleTouchEnabled = true;
// Initialize GameTime
_updateGameTime = new GameTime ();
_drawGameTime = new GameTime ();
// Initialize _lastUpdate
_lastUpdate = DateTime.Now;
}
示例8: APNGHelper
public APNGHelper(Game game, string pngFile)
{
this.game = game;
var image = new APNG(pngFile);
numPlays = (int)image.acTLChunk.NumPlays;
baseFrame = new APNGFrame(game, image.DefaultImage);
if (image.IsSimplePNG)
{
CurrentFrame = baseFrame.FrameTexture;
}
else
{
numPlays = (int)image.acTLChunk.NumPlays;
foreach (Frame frame in image.Frames)
{
frameList.Add(new APNGFrame(this.game, frame));
}
sb = new SpriteBatch(this.game.GraphicsDevice);
RenderEachFrame();
CurrentFrame = renderedTextureList[0];
}
}
示例9: Interface
public Interface(Game game)
: base(game)
{
_font = Game.Content.Load<SpriteFont>("Test");
_heartTexture = Game.Content.Load<Texture2D>("heart");
_potionTexture = Game.Content.Load<Texture2D>("potion");
}
示例10: Player
public Player(Game game, Character character)
{
gameRef = (Game1)game;
camera = new Camera(gameRef.ScreenRectangle);
this.character = character;
Sprite.Position = new Vector2(1000, 1000);
}
示例11: Cursor
// this constructor doesn't really do much of anything, just calls the base
// constructor, and saves the contentmanager so it can be used in
// LoadContent.
public Cursor(Game game, ContentManager content)
: base(game)
{
this.content = content;
currentMouseState = Mouse.GetState();
previousMouseState = Mouse.GetState();
}
示例12: ScreenManager
/// <summary>
/// Constructs a new screen manager component.
/// </summary>
public ScreenManager(Game game)
: base(game)
{
// we must set EnabledGestures before we can query for them, but
// we don't assume the game wants to read them.
TouchPanel.EnabledGestures = GestureType.None;
}
示例13: PauseScreenController
public PauseScreenController(Game game, SpriteBatch sb)
: base(game)
{
spriteBatch = sb;
// graphics = new GraphicsDevice(game);
// TODO: Construct any child components here
}
示例14: Cmc
public Cmc(Game game)
: base(game)
{
cmcTextures = new Texture2D[3];
cmcTextures[0] = game.Content.Load<Texture2D>("cmc1");
cmcTextures[1] = game.Content.Load<Texture2D>("cmc2");
cmcTextures[2] = game.Content.Load<Texture2D>("cmc3");
cmcTexels = new Color[3][];
for (int i = 0; i < 3; i++)
{
cmcTexels[i] = new Color[WIDTH * HEIGHT];
cmcTextures[i].GetData<Color>(cmcTexels[i]);
}
cmcChannels = new Color[][] {
new Color[] { new Color(210, 20, 255), new Color(220, 220, 220) }, //Purple and gray for Sweetie Belle
new Color[] { new Color(255, 150, 40), new Color(255, 64, 192) }, //Orange and maroon for Scootaloo
new Color[] { new Color(255, 255, 0), new Color(255, 0, 64) } //Yellow and red for Apple Bloom
};
texture = new Texture2D(device, WIDTH, HEIGHT);
textureColors = new Color[WIDTH * HEIGHT];
PrecalculatePoints();
}
示例15:
public EntitéPhysiqueGraphique(Game jeu, string nomModele, Vector3 position,Vector3 dimension, float intervalMAJ)
:base(jeu,position, intervalMAJ)
{
Dimension = dimension;
NomModèle = nomModele;
Échelle = 1;
}