/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new AmSpriteBatch(GraphicsDevice); game.LoadContent(); // TODO: use this.Content to load your game content here }
//TODO: Later, maybe, bother to check if the tile is in bounds before drawing public void Draw(GameTime gameTime, AmSpriteBatch graphics, int x = 0, int y = 0) { x += (int)Location.X; y += (int)Location.Y; foreach (var layer in Layers) { layer.Draw(gameTime, graphics, x, y); } }
public override void Draw(GameTime gameTime, AmSpriteBatch graphics, int x = 0, int y = 0) { var targetLocation = Target.GetHotSpotLocation("Am/Center"); var screenWidth = AmGameBase.Instance.graphics.PreferredBackBufferWidth; var screenHeight = AmGameBase.Instance.graphics.PreferredBackBufferHeight; var tpos = GetWithinBounds((int)targetLocation.X - screenWidth / 2, (int)targetLocation.Y - screenHeight / 2); graphics.Translate((int)-tpos.X, (int)-tpos.Y); }
public void Draw(GameTime gameTime, AmSpriteBatch graphics, int x = 0, int y = 0) { for (int i = 0; i < Tiles.Length; ++i) { int gx = i % tilemap.GridWidth; int gy = i / tilemap.GridWidth; int rx = gx * tilemap.TileWidth + x; int ry = gy * tilemap.TileHeight + y; int tileData = Tiles[gx, gy]; int tilesheetId = (tileData >> 24) & 0xFF; int tileId = tileData & 0xFFFFFF; if (tilesheetId == 127) { continue; } AmImage2D curTile = tilemap.tilesheets[tilesheetId].GetImage(tileId); graphics.DrawImage(curTile, rx, ry); } }
public virtual void Draw(GameTime gameTime, AmSpriteBatch graphics) { var width = AmGameBase.Instance.graphics.PreferredBackBufferWidth; var height = AmGameBase.Instance.graphics.PreferredBackBufferHeight; ActiveScreen.Draw(gameTime, graphics); if (phase == Phase.FadingOut) { var fadeTime = Math.Min(DateTime.Now.TotalMillisecs() - StartFadingOutTime, FadeOutTime); var fadePer = (float)fadeTime / (float)FadeOutTime; Console.Out.WriteLine("FadeOut% " + fadePer); graphics.FillRectangle(new Rectangle(0, 0, width, height), Color.Black * fadePer); } else if (phase == Phase.FadingIn) { var fadeTime = Math.Min(DateTime.Now.TotalMillisecs() - StartFadingInTime, FadeInTime); var fadePer = (float)fadeTime / (float)FadeInTime; Console.Out.WriteLine("FadeIn% " + (1.0f - fadePer)); graphics.FillRectangle(new Rectangle(0, 0, width, height), Color.Black * (1.0f - fadePer)); } }
public virtual void Draw(GameTime gameTime, AmSpriteBatch graphics) { }
public void StopCamera(AmSpriteBatch graphics) { graphics.PopMatrix(); }
public void StartCamera(AmSpriteBatch graphics) { graphics.PushMatrix(); }
public abstract void Draw(GameTime gameTime, AmSpriteBatch graphics, int x = 0, int y = 0);