コード例 #1
0
 /// <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
 }
コード例 #2
0
 //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);
     }
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
        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));
            }
        }
コード例 #6
0
 public virtual void Draw(GameTime gameTime, AmSpriteBatch graphics)
 {
 }
コード例 #7
0
 public void StopCamera(AmSpriteBatch graphics)
 {
     graphics.PopMatrix();
 }
コード例 #8
0
 public void StartCamera(AmSpriteBatch graphics)
 {
     graphics.PushMatrix();
 }
コード例 #9
0
 public abstract void Draw(GameTime gameTime, AmSpriteBatch graphics, int x = 0, int y = 0);