Esempio n. 1
0
        public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            spritepos.X = (float)(spritepos.X);
            spritepos.Y = (float)(spritepos.Y);

            //Console.WriteLine(spritepos.X + " " + spritepos.Y + " | " + position.X + " " + position.Y);
            DMIManager.DrawSpriteBatch(client.spriteBatch, client, icon, icon_state, spritepos, dir);

            client.spriteBatch.End();
        }
Esempio n. 2
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            virtualScreen.BeginCapture();
            GraphicsDevice.Clear(Color.White);
            Texture2D texture1px = new Texture2D(graphics.GraphicsDevice, 1, 1);

            texture1px.SetData(new Color[] { Color.Black });
            //GraphicsDevice.Viewport = new Viewport(0,0,adjustedrange,adjustedrange);
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, eye.InverseTransform);
            var adjustedrange = (view_range * 2 + 1) * 32;

            GraphicsDevice.Viewport = new Viewport(0, 0, adjustedrange, adjustedrange);

            for (float x = -30; x < 30; x++)
            {
                Rectangle rectangle = new Rectangle((int)(0 + x * 32), 0, 1, 800);
                spriteBatch.Draw(texture1px, rectangle, Color.Black);
                drawCount++;
            }
            for (float y = -30; y < 30; y++)
            {
                Rectangle rectangle = new Rectangle(0, (int)(0 + y * 32), 800, 1);
                spriteBatch.Draw(texture1px, rectangle, Color.Black);
                drawCount++;
            }


            var yy = 1;
            var ii = 1;

            string[] states    = new string[] { "floor", "white", "plating", "bar" };
            Vector2  drawfield = new Vector2(32 * 32, 32 * 32);

            for (var i = 1; i <= 10000; i++)
            {
                if (i % 256 == 0)
                {
                    //DMIManager.GetSpriteBatch(this, "TestFiles/human.dmi", "fatbody_s", new Vector2(32f, 32f), dir: Wiggle[cdir]);
                    //DMIManager.GetSpriteBatch(this, "TestFiles/spacerat.dmi", "rat_brown", new Vector2(64f, 32f), dir: Wiggle[cdir]);
                    //DMIManager.DrawSpriteBatch(spriteBatch, this, "TestFiles/robots.dmi", "mommi", new Vector2(32f * (float)ii, 32f * (float)yy), dir: Wiggle[cdir]);
                    DMIManager.DrawSpriteBatch(spriteBatch, this, "TestFiles/robots.dmi", "mommi", new Vector2(32f * (float)ii, 32f * (float)yy), dir: Wiggle[cdir]);
                }
                drawCount++;
                if (i % 20 == 0)
                {
                    yy++;
                    ii = 1;
                }
                else
                {
                    ii++;
                }
                if (ii > drawfield.X)
                {
                    if (yy > drawfield.Y)
                    {
                        break;
                    }
                    continue;
                }
                //DMIManager.GetSpriteBatch(this, "TestFiles/human.dmi", "fatbody_s", new Vector2(32f, 32f), dir: Wiggle[cdir]);
                //DMIManager.GetSpriteBatch(this, "TestFiles/spacerat.dmi", "rat_brown", new Vector2(64f, 32f), dir: Wiggle[cdir]);
                //DMIManager.DrawSpriteBatch(spriteBatch, this, "TestFiles/robots.dmi", "mommi", new Vector2(32f * (float)ii, 32f * (float)yy), dir: Wiggle[cdir]);
                //DMIManager.DrawSpriteBatch(spriteBatch, this, "TestFiles/robots.dmi", "mommi", new Vector2(32f * (float)ii, 32f * (float)yy), dir: Wiggle[cdir]);
                var rand  = new Random();
                int state = rand.Next(states.Length);

                DMIManager.DrawSpriteBatch(spriteBatch, this, "TestFiles/floors.dmi", "floor", new Vector2(32f * (float)ii, 32f * (float)yy), 0);
                drawCount++;
            }
            for (float x = -300; x < 300; x++)
            {
                Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int)(0 + x * 32), 0, 1, 800);
                spriteBatch.Draw(texture1px, rectangle, Microsoft.Xna.Framework.Color.Black);
                drawCount++;
            }
            for (float y = -300; y < 300; y++)
            {
                Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, (int)(0 + y * 32), 800, 1);
                spriteBatch.Draw(texture1px, rectangle, Microsoft.Xna.Framework.Color.Black);
                drawCount++;
            }
            mob.Draw(spriteBatch, gameTime);

            spriteBatch.End();
            virtualScreen.EndCapture();

            GraphicsDevice.Clear(Color.Black);
            spriteBatch.Begin();
            virtualScreen.Draw(spriteBatch);
            spriteBatch.End();
            base.Draw(gameTime);
        }