Exemplo n.º 1
1
        internal APNGFrame(GraphicsDevice graphicsDevice, Frame frame)
        {
            if (frame.fcTLChunk != null)
            {
                X = (int) frame.fcTLChunk.XOffset;
                Y = (int) frame.fcTLChunk.YOffset;
                Width = (int) frame.fcTLChunk.Width;
                Height = (int) frame.fcTLChunk.Height;
                BlendOp = frame.fcTLChunk.BlendOp;
                DisposeOp = frame.fcTLChunk.DisposeOp;
                DelayTime = new TimeSpan(
                    TimeSpan.TicksPerSecond*frame.fcTLChunk.DelayNum/frame.fcTLChunk.DelayDen);
            }
            else
            {
                X = 0;
                Y = 0;
                Width = frame.IHDRChunk.Width;
                Height = frame.IHDRChunk.Height;
                BlendOp = BlendOps.APNGBlendOpSource;
                DisposeOp = DisposeOps.APNGDisposeOpNone;
                DelayTime = TimeSpan.Zero;
            }

            // frame.GetStream() is not seekable, so we build a new MemoryStream.
            FrameTexture = Texture2D.FromStream(
                graphicsDevice, new MemoryStream(frame.GetStream().ToArray()));
            MultiplyAlpha(FrameTexture);
        }
Exemplo n.º 2
1
        public override void DrawObjects(GraphicsDevice graphicDevice, SpriteBatch spriteBatch, ContentManager content)
        {
            graphicDevice.Clear(Color.CornflowerBlue);
            SpriteFont newFont = content.Load<SpriteFont>(@"Fonts/Text");

            spriteBatch.Begin();

            this.controlScreenBackgroundPosition = new Vector2(0, 0);
            spriteBatch.Draw(this.controlScreenBackgroundTexture, this.controlScreenBackgroundPosition, Color.White);

            if (this.controlScreenItems.Count < 1)
            {
                // Back planket and text;
                this.buttonPosition = new Vector2(840, 660);
                this.controlScreenItems.Add(new MenuItems(this.button, this.buttonPosition, "Back", newFont, false));
            }

            this.controlScreenItems[this.selectedEntry].Selected = true;
            foreach (var item in this.controlScreenItems)
            {
                item.DrawMenuItems(spriteBatch, new Color(248, 218, 127));
            }

            this.DrawCursor(spriteBatch);
            spriteBatch.End();
        }
Exemplo n.º 3
1
		/// <summary>
		/// The constructor is private: loading screens should
		/// be activated via the static Load method instead.
		/// </summary>
		private LoadingScreen (ScreenManager screenManager,bool loadingIsSlow, 
				GameScreen[] screensToLoad)
			{
			this.loadingIsSlow = loadingIsSlow;
			this.screensToLoad = screensToLoad;

			TransitionOnTime = TimeSpan.FromSeconds (0.5);

			// If this is going to be a slow load operation, create a background
			// thread that will update the network session and draw the load screen
			// animation while the load is taking place.
			if (loadingIsSlow) {
				backgroundThread = new Thread (BackgroundWorkerThread);
				backgroundThreadExit = new ManualResetEvent (false);

				graphicsDevice = screenManager.GraphicsDevice;

				// Look up some services that will be used by the background thread.
				IServiceProvider services = screenManager.Game.Services;

				networkSession = (NetworkSession)services.GetService (
							typeof(NetworkSession));

				messageDisplay = (IMessageDisplay)services.GetService (
							typeof(IMessageDisplay));
			}
		}
Exemplo n.º 4
1
        /// <summary>
        /// Checks the mouse's position set in the in-game world plane.
        /// </summary>
        /// <param name="mousePosition">Mouse's position on screen</param>
        /// <param name="camera">Camera object</param>
        /// <param name="device">Graphics device used in rendering</param>
        /// <returns></returns>
        public static Vector3 getMouseWorldPosition(Vector2 mousePosition,CameraAndLights camera,GraphicsDevice device)
        {
            Vector3 nearsource = new Vector3(mousePosition,0f);
            Vector3 farsource = new Vector3(mousePosition,CameraAndLights.nearClip);

            Vector3 nearPoint = device.Viewport.Unproject(nearsource,
                                                          camera.projectionMatrix,
                                                          camera.viewMatrix,
                                                          Matrix.Identity);

            Vector3 farPoint = device.Viewport.Unproject(farsource,
                                                         camera.projectionMatrix,
                                                         camera.viewMatrix,
                                                         Matrix.Identity);

            // Create a ray from the near clip plane to the far clip plane.
            Vector3 direction = farPoint - nearPoint;
            direction.Normalize();
            Ray pickRay = new Ray(nearPoint,direction);

            Plane floor = new Plane(new Vector3(0f,1f,0f),0f);

            float denominator = Vector3.Dot(floor.Normal,pickRay.Direction);
            float numerator = Vector3.Dot(floor.Normal,pickRay.Position) + floor.D;
            float dist = -(numerator / denominator);

            Vector3 mouseWorldPos = nearPoint + direction * dist;

            return mouseWorldPos * new Vector3(1f,0f,1f);
        }
Exemplo n.º 5
1
        /// <summary>
        /// Player constructor.
        /// </summary>
        /// <param name="color"></param>
        public Player(Alliance alliance, Color color, Point startLocation)
        {
            Game1.GetInstance().players.AddLast(this);
            this.device = Game1.GetInstance().GraphicsDevice;
            this.alliance = alliance;
            this.startLocation = startLocation;
            if (!this.alliance.members.Contains(this)) this.alliance.members.AddLast(this);
            this.color = color;

            selectionTex = Game1.GetInstance().Content.Load<Texture2D>("Selection");
            selectedTex = Game1.GetInstance().Content.Load<Texture2D>("Selected");

            units = new CustomArrayList<Unit>();
            buildings = new CustomArrayList<Building>();
            hud = new HUD(this, color);
            resources = 100000;

            meleeStore = new MeleeStore(this);
            rangedStore = new RangedStore(this);
            fastStore = new FastStore(this);

            arrowManager = new ArrowManager();

            lightTexture = Game1.GetInstance().Content.Load<Texture2D>("Fog/Light");

            MouseManager.GetInstance().mouseClickedListeners += ((MouseClickListener)this).OnMouseClick;
            MouseManager.GetInstance().mouseReleasedListeners += ((MouseClickListener)this).OnMouseRelease;
            MouseManager.GetInstance().mouseMotionListeners += ((MouseMotionListener)this).OnMouseMotion;
            MouseManager.GetInstance().mouseDragListeners += ((MouseMotionListener)this).OnMouseDrag;
        }
Exemplo n.º 6
0
        // Methods
        public static void init(GraphicsDevice graphDev, SpriteBatch spriteBatch)
        {
            pointTexture = new Texture2D(graphDev, 1, 1, false, SurfaceFormat.Color);
            pointTexture.SetData<Color>(new Color[] { defaultColor });

            sb = spriteBatch;
        }
Exemplo n.º 7
0
        /// <summary>
        /// Renders the bounding box for debugging purposes.
        /// </summary>
        /// <param name="box">The box to render.</param>
        /// <param name="graphicsDevice">The graphics device to use when rendering.</param>
        /// <param name="view">The current view matrix.</param>
        /// <param name="projection">The current projection matrix.</param>
        /// <param name="color">The color to use drawing the lines of the box.</param>
        public static void Render(
            BoundingBox box,
            GraphicsDevice graphicsDevice,
            Matrix view,
            Matrix projection,
            Color color)
        {
            if (box.Min == box.Max)
            {
                return;
            }

            if (effect == null)
            {
                effect = new BasicEffect(graphicsDevice)
                             {TextureEnabled = false, VertexColorEnabled = true, LightingEnabled = false};
            }

            Vector3[] corners = box.GetCorners();
            for (int i = 0; i < 8; i++)
            {
                verts[i].Position = corners[i];
                verts[i].Color = color;
            }

            effect.View = view;
            effect.Projection = projection;

            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();
                graphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.LineList, verts, 0, 8, indices, 0,
                                                         indices.Length/2);
            }
        }
Exemplo n.º 8
0
 public TrophyScreen(GameWorld3D game)
 {
     _game           = game.Game;
     _graphicsDevice = game.GraphicsDevice;
     _gameWorld3D    = game;
     Initialize();
 }
Exemplo n.º 9
0
 internal void SetTextures(GraphicsDevice device)
 {
   Threading.EnsureUIThread();
   if (this._dirty == 0)
     return;
   for (int index = 0; index < this._textures.Length; ++index)
   {
     int num = 1 << index;
     if ((this._dirty & num) != 0)
     {
       Texture texture = this._textures[index];
       GL.ActiveTexture((TextureUnit) (33984 + index));
       if (this._targets[index] != (TextureTarget) 0 && (texture == null || this._targets[index] != texture.glTarget))
         GL.BindTexture(this._targets[index], 0);
       if (texture != null)
       {
         this._targets[index] = texture.glTarget;
         GL.BindTexture(texture.glTarget, texture.glTexture);
       }
       this._dirty &= ~num;
       if (this._dirty == 0)
         break;
     }
   }
   this._dirty = 0;
 }
Exemplo n.º 10
0
        private static Texture2D CreateWhitePixel(GraphicsDevice graphicsDevice)
        {
            whitePixel = new Texture2D(graphicsDevice, 1, 1);
            whitePixel.SetData(new[] { Color.White });

            return whitePixel;
        }
Exemplo n.º 11
0
        public SceneGraph(GraphicsDevice graphicsDevice)
        {
            GraphicsDevice = graphicsDevice;

            //init RootNode
            RootNode = new SceneNode { Position = new Vector2(0, 0), Rotation = 0.0f, Scale = new Vector2(0, 0) };
        }
Exemplo n.º 12
0
            public TileMap3D(GraphicsDevice graphicsDevice, ContentManager contentManager, int width, int height)
            {
                this.GraphicsDevice = graphicsDevice;
                Wall = contentManager.Load<Model>("Models/TileMap3D/Wall");
                FloorTile = contentManager.Load<Model>("Models/TileMap3D/FloorTile");
                Dirt = contentManager.Load<Model>("Models/TileMap3D/Dirt");
                Cleaner = contentManager.Load<Model>("Models/TileMap3D/Cleaner");

                ((BasicEffect)Wall.Meshes[0].Effects[0]).EnableDefaultLighting();
                ((BasicEffect)FloorTile.Meshes[0].Effects[0]).EnableDefaultLighting();
                ((BasicEffect)Dirt.Meshes[0].Effects[0]).EnableDefaultLighting();
                ((BasicEffect)Cleaner.Meshes[0].Effects[0]).EnableDefaultLighting();
                foreach (BasicEffect effect in Cleaner.Meshes[0].Effects)
                    effect.Tag = effect.DiffuseColor;
                foreach (BasicEffect effect in FloorTile.Meshes[0].Effects)
                    effect.Tag = effect.DiffuseColor;

                dss.DepthBufferEnable = true;
                dss.DepthBufferFunction = CompareFunction.LessEqual;
                dss.DepthBufferWriteEnable = true;
                rs.CullMode = CullMode.CullCounterClockwiseFace;
                ss.AddressU = TextureAddressMode.Wrap;
                ss.AddressV = TextureAddressMode.Wrap;
                ss.Filter = TextureFilter.Anisotropic;

                Camera = new Camera(graphicsDevice.Viewport.AspectRatio, graphicsDevice);
            }
Exemplo n.º 13
0
        //===========================================================
        // Structures and Variables
        //===========================================================

        //===========================================================
        // Overridden Particle System Functions
        //===========================================================

        //===========================================================
        // Initialization Functions
        //===========================================================
        public override void AutoInitialize(GraphicsDevice cGraphicsDevice, ContentManager cContentManager, SpriteBatch cSpriteBatch)
        {
            InitializeSpriteParticleSystem(cGraphicsDevice, cContentManager, 1000, 50000, "Textures/Smoke");
            LoadParticleSystem();
            Emitter.ParticlesPerSecond = 200;
            Name = "Dot";
        }
Exemplo n.º 14
0
 public LD(GraphicsDevice gd)
 {
     effect = new BasicEffect(gd);
     effect.VertexColorEnabled = true;
     vertices = new VertexPositionColor[ushort.MaxValue];
     vertexCount = 0;
 }
Exemplo n.º 15
0
 public Fatter(Vector3 position,
     ComponentManager componentManager,
     ContentManager content,
     GraphicsDevice graphics)
     : base("Fatter", position, componentManager, content, graphics, "fatwalk")
 {
 }
Exemplo n.º 16
0
        /// <summary>
        /// Constructs a new cylinder primitive,
        /// with the specified size and tessellation level.
        /// </summary>
        public CylinderPrimitive(GraphicsDevice graphicsDevice,
            float height, float radius, int tessellation)
        {
            if (tessellation < 3)
                throw new ArgumentOutOfRangeException("tessellation");

            height /= 2;

            // Create a ring of triangles around the outside of the cylinder.
            for (int i = 0; i < tessellation; i++)
            {
                Vector3 normal = GetCircleVector(i, tessellation);

                AddVertex(normal * radius + Vector3.Up * height, normal);
                AddVertex(normal * radius + Vector3.Down * height, normal);

                AddIndex(i * 2);
                AddIndex(i * 2 + 1);
                AddIndex((i * 2 + 2) % (tessellation * 2));

                AddIndex(i * 2 + 1);
                AddIndex((i * 2 + 3) % (tessellation * 2));
                AddIndex((i * 2 + 2) % (tessellation * 2));
            }

            // Create flat triangle fan caps to seal the top and bottom.
            CreateCap(tessellation, height, radius, Vector3.Up);
            CreateCap(tessellation, height, radius, Vector3.Down);

            InitializePrimitive(graphicsDevice);
        }
Exemplo n.º 17
0
Arquivo: Hud.cs Projeto: GarethIW/LD26
        public void Draw(GraphicsDevice gd, SpriteBatch sb)
        {
            Rectangle bounds = gd.Viewport.Bounds;

            Vector2 meterPosition = new Vector2(bounds.Right - 100, ((bounds.Height/2) - (texHud.Height/2)) +10);
            Vector2 soulsPosition1 = new Vector2(bounds.Left + 100, bounds.Height - 110);
            Vector2 soulsPosition2 = new Vector2(bounds.Left + 100, bounds.Height - 85);

            soulsPosition1 = Vector2.Lerp(new Vector2(bounds.Left + 100, bounds.Height - 110), new Vector2(bounds.Center.X - (smallFont.MeasureString("Souls Perished").X / 2), (bounds.Center.Y / 2) - 100f), soulsToCenterAmount);
            soulsPosition2 = Vector2.Lerp(new Vector2(bounds.Left + 100, bounds.Height - 85), new Vector2(bounds.Center.X - (largeFont.MeasureString(SoulsPerished.ToString("N0")).X / 2), (bounds.Center.Y / 2) - 75f), soulsToCenterAmount);

            // Water level
            if (waterAlpha > 0f)
            {
                sb.Draw(texHud, meterPosition, new Rectangle(75, 0, 75, texHud.Height), Color.White * waterAlpha, 0f, new Vector2(75 / 2, 0), new Vector2(1f,1.08f), SpriteEffects.None, 1);
                sb.Draw(texHud, meterPosition + new Vector2(0, texHud.Height) + new Vector2(2, 2), new Rectangle(150, 0, 75, texHud.Height), Color.Black * waterAlpha, 0f, new Vector2(75 / 2, texHud.Height), new Vector2(1f, waterLevelHeight), SpriteEffects.None, 1);
                sb.Draw(texHud, meterPosition + new Vector2(0, (texHud.Height - (texHud.Height * waterLevelHeight)) + 5f) + new Vector2(2, 2), new Rectangle(0, 78 + (75 * waterAnimFrame), 75, 72), Color.Black * waterAlpha, 0f, new Vector2(75 / 2, 75), 1f, SpriteEffects.None, 1);
                sb.Draw(texHud, meterPosition + new Vector2(0, texHud.Height), new Rectangle(150, 0, 75, texHud.Height), Color.White * waterAlpha, 0f, new Vector2(75 / 2, texHud.Height), new Vector2(1f, waterLevelHeight), SpriteEffects.None, 1);
                sb.Draw(texHud, meterPosition + new Vector2(0, (texHud.Height - (texHud.Height * waterLevelHeight)) + 5f), new Rectangle(0, 78 + (75*waterAnimFrame), 75, 72), Color.White * waterAlpha, 0f, new Vector2(75 / 2, 75), 1f, SpriteEffects.None, 1);
                //sb.Draw(texHud, meterPosition + new Vector2(0, -20) + new Vector2(2, 2), new Rectangle(0, 0, 75, 75), Color.Black * waterAlpha, 0f, new Vector2(75 / 2, 0), 1f, SpriteEffects.None, 1);
                sb.Draw(texHud, meterPosition + new Vector2(0, -25), new Rectangle(0, 0, 75, 75), Color.White * waterAlpha, 0f, new Vector2(75 / 2, 0), 1f, SpriteEffects.None, 1);
                if (waterLevelHeight > 0.9f)
                {
                    sb.Draw(texHud, meterPosition + new Vector2(0, -25), new Rectangle(0, 227, 75, 75), Color.White * (1f - (1f / 0.1f) * (1f - waterLevelHeight)), 0f, new Vector2(75 / 2, 0), 1f, SpriteEffects.None, 1);
                }
            }

            if (soulsAlpha > 0f)
            {
                Helper.ShadowText(sb, smallFont, "Souls Perished", soulsPosition1, Color.White * soulsAlpha, Vector2.Zero, 1f);
                Helper.ShadowText(sb, largeFont, SoulsPerished.ToString("N0"), soulsPosition2, Color.White * soulsAlpha, Vector2.Zero, 1f);
            }
        }
Exemplo n.º 18
0
 public cButton(Texture2D newTexture, GraphicsDevice graphics)
 {
     texture = newTexture;
     //ScreenW = 800, ScreenH = 600
     //ImgW = 100, ImgH = 20
     size = new Vector2(/*graphics.Viewport.Width*/ 600, 100);
 }
Exemplo n.º 19
0
        /// <summary>
        /// Loads the quad.
        /// </summary>
        /// <param name="device">The device.</param>
        public QuadRender(GraphicsDevice device) 
        {
            
            myDevice = device;         
            
            verts = new VertexPositionTexture[]
                        {
                            new VertexPositionTexture(
                                new Vector3(0,0,0),
                                new Vector2(1,1)),
                            new VertexPositionTexture(
                                new Vector3(0,0,0),
                                new Vector2(0,1)),
                            new VertexPositionTexture(
                                new Vector3(0,0,0),
                                new Vector2(0,0)),
                            new VertexPositionTexture(
                                new Vector3(0,0,0),
                                new Vector2(1,0))
                        };

             ib = new short[] { 0, 1, 2, 2, 3, 0 };


        }             
Exemplo n.º 20
0
        public void LoadContent(Texture2D sheet, GraphicsDevice gd, LightingEngine le)
        {
            spriteSheet = sheet;
            Initialize(gd, le);

            engineSound = AudioController.effects["boat"].CreateInstance();
        }
Exemplo n.º 21
0
        public void initialize(Vector3 position, Vector3 headingDirection, float speed, float strength, float strengthUp, GameMode gameMode)
        {
            base.initialize(position, headingDirection, speed);
            healthAmount = (int)(GameConstants.HealingAmount * strength * strengthUp);

            this.gameMode = gameMode;
            if (gameMode == GameMode.MainGame)
            {
                this.graphicDevice = PlayGameScene.GraphicDevice;
                this.gameCamera = PlayGameScene.gameCamera;
                this.spriteBatch = PoseidonGame.spriteBatch;
            }
            else if (gameMode == GameMode.ShipWreck)
            {
                this.graphicDevice = ShipWreckScene.GraphicDevice;
                this.gameCamera = ShipWreckScene.gameCamera;
                this.spriteBatch = PoseidonGame.spriteBatch;
            }
            else if (gameMode == GameMode.SurvivalMode)
            {
                this.graphicDevice = SurvivalGameScene.GraphicDevice;
                this.gameCamera = SurvivalGameScene.gameCamera;
                this.spriteBatch = PoseidonGame.spriteBatch;
            }

            laserBeamTexture = IngamePresentation.healLaserBeamTexture;

            Vector3 direction2D = graphicDevice.Viewport.Project(position + headingDirection, gameCamera.ProjectionMatrix, gameCamera.ViewMatrix, Matrix.Identity)
                - graphicDevice.Viewport.Project(position, gameCamera.ProjectionMatrix, gameCamera.ViewMatrix, Matrix.Identity);
            direction2D.Normalize();
            this.forwardDir = (float)Math.Atan2(direction2D.X, direction2D.Y);
        }
Exemplo n.º 22
0
 public override void Begin(GraphicsDevice device, SpriteBlendMode blendMode, SpriteSortMode sortMode, SaveStateMode stateMode, Local.Matrix transformMatrix)
 {
     _childRenderer = GetCurrentRenderer();
     _childRenderer.Begin(device, blendMode, sortMode, stateMode, transformMatrix);
     currentSortMode = sortMode;
     base.Begin(device, blendMode, sortMode, stateMode, transformMatrix);
 }
Exemplo n.º 23
0
        public TextureCreator(SpriteManager sprManager, GraphicsDevice device)
        {
            this.sprManager = sprManager;
            this.device = device;

            effect = new BasicEffect(device);
        }
Exemplo n.º 24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LightmapDrawBuffer"/> class.
        /// </summary>
        /// <param name="device">The graphics device.</param>
        public LightmapDrawBuffer(GraphicsDevice device)
        {
            this.device = device;

            // this.indices = new List<int>();
            this.vertices = new List<HullVertex>();
        }
Exemplo n.º 25
0
 public virtual void ColorVertex(GraphicsDevice gd, int index, Vector2 texturePosition)
 {
     VertexPositionNormalTexture v = vertices[index];
     v.TextureCoordinate = texturePosition;
     vertices[index] = v;
     InitializeVertexBuffer(gd);
 }
Exemplo n.º 26
0
 public override void Draw(double elapsedSeconds, GraphicsDevice device)
 {
     sb.Begin();
     gui.Draw(device, sb, elapsedSeconds);
     sb.End();
     base.Draw(elapsedSeconds, device);
 }
Exemplo n.º 27
0
        public override void Draw(GraphicsDevice device, Camera camera)
        {
            game.GraphicsDevice.BlendState = BlendState.AlphaBlend;

            Matrix[] transforms = new Matrix[model.Bones.Count];
            model.CopyAbsoluteBoneTransformsTo(transforms);
            game.GraphicsDevice.DepthStencilState = DepthStencilState.DepthRead;

            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.World = mesh.ParentBone.Transform * GetWorld();
                    effect.View = camera.view;
                    effect.Projection = camera.projection;
                    effect.TextureEnabled = true;
                    effect.Texture = tex;
                    effect.Alpha = alpha;

                    //trying to get lighting to work, but so far the model just shows up as pure black - it was exported with a green blinn shader
                    //effect.EnableDefaultLighting(); //did not work
                    effect.LightingEnabled = true;

                }
                mesh.Draw();
            }
        }
Exemplo n.º 28
0
 //Source http://gamedev.stackexchange.com/questions/44015/how-can-i-draw-a-simple-2d-line-in-xna-without-using-3d-primitives-and-shders
 private void LoadContent(GraphicsDevice gd)
 {
     // create 1x1 texture for line drawing
     t = new Texture2D(gd, 1, 1);
     t.SetData<Color>(
         new Color[] { Color.White });// fill the texture with white
 }
Exemplo n.º 29
0
        public Event(SpriteBatch _s, GraphicsDevice _g,SpriteFont _font)
        {
            s = _s;
            g = _g;
            font = _font;

            posBGI.X = 0;
            posBGI.Y = 0;
            posLeft0.X = 0;
            posLeft0.Y = 10;
            posLeft1.X = 60;
            posLeft1.Y = 10;
            posRight0.X = 480;
            posRight0.Y = 10;
            posRight1.X = 520;
            posRight1.Y = 10;
            posFrame.X = 10;
            posFrame.Y = 340;
            posName.X = 100;
            posName.Y = 355;
            posTalk.X = 50;
            posTalk.Y = 400;

            serif = new List<string>();
            Stream stream;
             stream = File.OpenRead("images/hb1.png");
            imgBGI = Texture2D.FromStream(g, stream);

             stream = File.OpenRead("images/sowaku.png");
             imgFrame = Texture2D.FromStream(g, stream);
        }
Exemplo n.º 30
0
        public void Draw(GraphicsDevice gd)
        {
            drawEffect.World = Matrix.CreateTranslation(Position);

            drawEffect.DiffuseColor = new Vector3(1f, 1f - hitAlpha, 1f - hitAlpha);
            foreach (EffectPass pass in drawEffect.CurrentTechnique.Passes)
            {
                pass.Apply();

                AnimChunk c = shipSprite.AnimChunks[0];
                if (c == null) continue;

                if (c == null || c.VertexArray == null || c.VertexArray.Length == 0) continue;
                gd.DrawUserIndexedPrimitives<VertexPositionNormalColor>(PrimitiveType.TriangleList, c.VertexArray, 0, c.VertexArray.Length, c.IndexArray, 0, c.VertexArray.Length / 2);

            }

            drawEffect.World = Matrix.CreateScale(0.75f) * (Matrix.CreateRotationX(orbRotation.X) * Matrix.CreateRotationY(orbRotation.Y) * Matrix.CreateRotationZ(orbRotation.Z)) * Matrix.CreateTranslation(orbPosition);

            drawEffect.DiffuseColor = Color.White.ToVector3();

            foreach (EffectPass pass in drawEffect.CurrentTechnique.Passes)
            {
                pass.Apply();

                AnimChunk c = shipSprite.AnimChunks[1];
                if (c == null) continue;

                if (c == null || c.VertexArray == null || c.VertexArray.Length == 0) continue;
                gd.DrawUserIndexedPrimitives<VertexPositionNormalColor>(PrimitiveType.TriangleList, c.VertexArray, 0, c.VertexArray.Length, c.IndexArray, 0, c.VertexArray.Length / 2);
            }
        }
Exemplo n.º 31
0
 public GameObject(GraphicsDevice graphicsDevice, int width, int height, Color color, float speed) : base(graphicsDevice, width, height, color)
 {
 }
Exemplo n.º 32
0
        public MainForm(ScreenManager screenManager)
        {
            _adaptToSizeEnabled = false;
            _screenManager      = screenManager;

            ServiceRegistration.Get <ILogger>().Debug("SkinEngine MainForm: Registering DirectX MainForm as IScreenControl service");
            ServiceRegistration.Set <IScreenControl>(this);

            InitializeComponent();

            // Use the native method because the Icon.ExtractAssociatedIcon throws an exception when running from UNC paths
            ushort uicon;
            IntPtr handle = NativeMethods.ExtractAssociatedIcon(Handle, ServiceRegistration.Get <IPathManager>().GetPath("<APPLICATION_PATH>"), out uicon);

            Icon = Icon.FromHandle(handle);

            CheckForIllegalCrossThreadCalls = false;

            StartupSettings startupSettings = ServiceRegistration.Get <ISettingsManager>().Load <StartupSettings>();
            AppSettings     appSettings     = ServiceRegistration.Get <ISettingsManager>().Load <AppSettings>();

            _previousMousePosition = new Point(-1, -1);

            // Default screen for splashscreen is the one from where MP2 was started.
            System.Windows.Forms.Screen preferredScreen = System.Windows.Forms.Screen.FromControl(this);
            int numberOfScreens = System.Windows.Forms.Screen.AllScreens.Length;
            int validScreenNum  = GetScreenNum();

            // Force the splashscreen to be displayed on a specific screen.
            if (startupSettings.StartupScreenNum >= 0 && startupSettings.StartupScreenNum < numberOfScreens)
            {
                validScreenNum  = startupSettings.StartupScreenNum;
                preferredScreen = System.Windows.Forms.Screen.AllScreens[validScreenNum];
                StartPosition   = FormStartPosition.Manual;
            }

            // Store original desktop size
            _screenSize = preferredScreen.Bounds.Size;
            _screenBpp  = preferredScreen.BitsPerPixel;

            Size desiredWindowedSize;

            if (appSettings.WindowPosition.HasValue && appSettings.WindowSize.HasValue)
            {
                desiredWindowedSize = appSettings.WindowSize.Value;
                Location            = ValidatePosition(appSettings.WindowPosition.Value, preferredScreen.WorkingArea.Size, ref desiredWindowedSize);
            }
            else
            {
                Location            = new Point(preferredScreen.WorkingArea.X, preferredScreen.WorkingArea.Y);
                desiredWindowedSize = new Size(SkinContext.SkinResources.SkinWidth, SkinContext.SkinResources.SkinHeight);
            }

            _previousWindowLocation   = Location;
            _previousWindowClientSize = desiredWindowedSize;
            _previousWindowState      = FormWindowState.Normal;
            _previousMode             = ScreenMode.NormalWindowed;

            if (appSettings.ScreenMode == ScreenMode.FullScreen)
            {
                SwitchToFullscreen(validScreenNum);
            }
            else
            {
                SwitchToWindowedSize(appSettings.ScreenMode, Location, desiredWindowedSize, false);
            }

            SkinContext.WindowSize = ClientSize;

            // GraphicsDevice has to be initialized after the form was sized correctly
            ServiceRegistration.Get <ILogger>().Debug("SkinEngine MainForm: Initialize DirectX");
            GraphicsDevice.Initialize_MainThread(this);

            // Read and apply ScreenSaver settings
            _screenSaverTimeOut   = TimeSpan.FromMinutes(appSettings.ScreenSaverTimeoutMin);
            _isScreenSaverEnabled = appSettings.ScreenSaverEnabled;

            _applicationSuspendLevel = appSettings.SuspendLevel;
            UpdateSystemSuspendLevel_MainThread(); // Don't use UpdateSystemSuspendLevel() here because the window handle was not created yet

            Application.Idle   += OnApplicationIdle;
            _adaptToSizeEnabled = true;

            VideoPlayerSynchronizationStrategy = new SynchronizeToPrimaryPlayer();

            // Register touch events
            TouchDown += MainForm_OnTouchDown;
            TouchMove += MainForm_OnTouchMove;
            TouchUp   += MainForm_OnTouchUp;
        }
Exemplo n.º 33
0
 public override void Enable(GraphicsDevice device, GraphicsDeviceManager graphicsDeviceManager, bool requireMirror, int mirrorWidth, int mirrorHeight)
 {
     ActualRenderFrameSize = optimalRenderFrameSize = new Size2(mirrorWidth, mirrorHeight);
     MirrorTexture         = Texture.New2D(device, ActualRenderFrameSize.Width, ActualRenderFrameSize.Height, PixelFormat.R8G8B8A8_UNorm_SRgb, TextureFlags.RenderTarget | TextureFlags.ShaderResource);
 }
Exemplo n.º 34
0
        public void GenerateGrid(GraphicsDevice Graphics)
        {
            List <Vector3> Positions   = new List <Vector3>();
            List <Color>   ColorValues = new List <Color>();

            //draw axis lines

            Vector2 Red   = new Vector2(0.1875f, 0.1875f);
            Vector2 Green = new Vector2(0.1875f, 0.375f);
            Vector2 Blue  = new Vector2(0.375f, 0.1875f);
            Vector2 Gray  = new Vector2(0.375f, 0.375f);

            List <GridVertex> GridVertices = new List <GridVertex>();

            //front,back,left,right,top,bottom
            int[] Indices = new int[] { 2, 0, 1, 1, 3, 2, 7, 5, 4, 4, 6, 7, 6, 4, 0, 0, 2, 6, 3, 1, 5, 5, 7, 3, 6, 2, 3, 3, 7, 6, 0, 4, 5, 5, 1, 0 };

            Vector3[] LineLookup = new Vector3[24]
            {
                //X Axis
                new Vector3(0, 0, 0),
                new Vector3(SX, 0, 0),
                new Vector3(0, 0, Thickness),
                new Vector3(SX, 0, Thickness),

                new Vector3(0, Thickness, 0),
                new Vector3(SX, Thickness, 0),
                new Vector3(0, Thickness, Thickness),
                new Vector3(SX, Thickness, Thickness),
                //Y Axis
                new Vector3(0, 0, 0),
                new Vector3(Thickness, 0, 0),
                new Vector3(0, 0, Thickness),
                new Vector3(Thickness, 0, Thickness),

                new Vector3(0, SY, 0),
                new Vector3(Thickness, SY, 0),
                new Vector3(0, SY, Thickness),
                new Vector3(Thickness, SY, Thickness),
                //Z Axis
                new Vector3(0, 0, 0),
                new Vector3(Thickness, 0, 0),
                new Vector3(0, 0, SZ),
                new Vector3(Thickness, 0, SZ),

                new Vector3(0, Thickness, 0),
                new Vector3(Thickness, Thickness, 0),
                new Vector3(0, Thickness, SZ),
                new Vector3(Thickness, Thickness, SZ)
            };

            //X Axis
            for (int i = 0; i < Indices.Length; i++)
            {
                GridVertices.Add(new GridVertex(LineLookup[Indices[i]] + Position, Red));
            }
            //Y Axis
            for (int i = 0; i < Indices.Length; i++)
            {
                GridVertices.Add(new GridVertex(LineLookup[Indices[i] + 8] + Position, Green));
            }
            //Z Axis
            for (int i = 0; i < Indices.Length; i++)
            {
                GridVertices.Add(new GridVertex(LineLookup[Indices[i] + 16] + Position, Blue));
            }

            for (float i = Scale; i < SY; i += Scale)
            {
                Vector3 Offset = new Vector3(0 + Thickness, i, 0);
                for (int index = 0; index < Indices.Length; index++)
                {
                    GridVertices.Add(new GridVertex(LineLookup[Indices[index]] + Offset + Position, Gray));
                }
            }

            for (float i = Scale; i < SX; i += Scale)
            {
                Vector3 Offset = new Vector3(i, 0 + Thickness, 0);
                for (int index = 0; index < Indices.Length; index++)
                {
                    GridVertices.Add(new GridVertex(LineLookup[Indices[index] + 8] + Offset + Position, Gray));
                }
            }
            GridVertices.Reverse();

            VertexBuffer Buffer = new VertexBuffer(Graphics, GridVertex.VertexDeclaration, GridVertices.Count, BufferUsage.WriteOnly);

            Buffer.SetData(GridVertices.ToArray());
            Geom.SetVertexBuffer(Buffer);
        }
Exemplo n.º 35
0
        public SpherePrimitive(GraphicsDevice graphicsDevice,
                               float diameter, int tessellation)
        {
            if (tessellation < 3)
            {
                throw new ArgumentOutOfRangeException("tessellation");
            }

            int verticalSegments   = tessellation;
            int horizontalSegments = tessellation * 2;

            float radius = diameter / 2;

            AddVertex(Vector3.Down * radius, Vector3.Down);

            for (int i = 0; i < verticalSegments - 1; i++)
            {
                float latitude = ((i + 1) * MathHelper.Pi /
                                  verticalSegments) - MathHelper.PiOver2;

                float dy  = (float)Math.Sin(latitude);
                float dxz = (float)Math.Cos(latitude);

                for (int j = 0; j < horizontalSegments; j++)
                {
                    float longitude = j * MathHelper.TwoPi / horizontalSegments;

                    float dx = (float)Math.Cos(longitude) * dxz;
                    float dz = (float)Math.Sin(longitude) * dxz;

                    Vector3 normal = new Vector3(dx, dy, dz);

                    AddVertex(normal * radius, normal);
                }
            }

            AddVertex(Vector3.Up * radius, Vector3.Up);

            for (int i = 0; i < horizontalSegments; i++)
            {
                AddIndex(0);
                AddIndex(1 + (i + 1) % horizontalSegments);
                AddIndex(1 + i);
            }
            for (int i = 0; i < verticalSegments - 2; i++)
            {
                for (int j = 0; j < horizontalSegments; j++)
                {
                    int nextI = i + 1;
                    int nextJ = (j + 1) % horizontalSegments;

                    AddIndex(1 + i * horizontalSegments + j);
                    AddIndex(1 + i * horizontalSegments + nextJ);
                    AddIndex(1 + nextI * horizontalSegments + j);

                    AddIndex(1 + i * horizontalSegments + nextJ);
                    AddIndex(1 + nextI * horizontalSegments + nextJ);
                    AddIndex(1 + nextI * horizontalSegments + j);
                }
            }

            for (int i = 0; i < horizontalSegments; i++)
            {
                AddIndex(CurrentVertex - 1);
                AddIndex(CurrentVertex - 2 - (i + 1) % horizontalSegments);
                AddIndex(CurrentVertex - 2 - i);
            }

            InitializePrimitive(graphicsDevice);
        }
Exemplo n.º 36
0
 public SpherePrimitive(GraphicsDevice graphicsDevice)
     : this(graphicsDevice, 1, 16)
 {
 }
        /// <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)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            // get camera viewport
            var viewport = GraphicsDevice.Viewport.Bounds;

            viewport.Location += cameraPos.ToPoint();

            // count draw calls
            int drawCalls = 0;

            // draw using static grid grid
            if (mode == DemoRenderMode.Use_Static_Batch)
            {
                staticGrid.Draw(spriteBatch, viewport, offset: (-cameraPos).ToPoint());
                drawCalls = staticGrid.LastDrawCallsCount;
            }
            // draw entities manually
            else
            {
                // should we cull invisible sprites?
                bool needCulling = mode == DemoRenderMode.No_Batch_Only_Visible;

                // begin batch
                spriteBatch.Begin(SpriteSortMode.FrontToBack,
                                  BlendState.AlphaBlend,
                                  SamplerState.PointClamp,
                                  transformMatrix: Matrix.CreateTranslation(new Vector3(-cameraPos.X, -cameraPos.Y, 0)));

                // iterate and draw all sprites
                foreach (var sprite in _sprites)
                {
                    // if need to cull, do it
                    if (needCulling && !viewport.Intersects(sprite.BoundingRect))
                    {
                        continue;
                    }

                    // draw the sprite itself
                    drawCalls++;
                    spriteBatch.Draw(sprite.Texture,
                                     sprite.DestRect,
                                     sprite.SourceRect,
                                     sprite.Color,
                                     sprite.Rotation,
                                     sprite.Origin,
                                     sprite.SpriteEffect,
                                     sprite.ZIndex);
                }
                spriteBatch.End();
            }

            // draw metadata
            spriteBatch.Begin();
            spriteBatch.Draw(filledRect, new Rectangle(0, 0, 240, 110), Color.Black);
            int textPosY   = 4;
            int lineHeight = 20;

            spriteBatch.DrawString(font, "Sprites Count: " + spritesCountStr, new Vector2(4, textPosY), Color.White); textPosY   += lineHeight;
            spriteBatch.DrawString(font, "Draw Calls: " + drawCalls.ToString(), new Vector2(4, textPosY), Color.White); textPosY += lineHeight;
            spriteBatch.DrawString(font, "Mode: " + mode.ToString(), new Vector2(4, textPosY), Color.White); textPosY            += lineHeight;
            spriteBatch.DrawString(font, "- Press arrows to move camera.", new Vector2(4, textPosY), Color.White); textPosY      += lineHeight;
            spriteBatch.DrawString(font, "- Press space to change mode.", new Vector2(4, textPosY), Color.White); textPosY       += lineHeight;

            // draw fps counter
            spriteBatch.Draw(filledRect, new Rectangle(GraphicsDevice.Viewport.Bounds.Right - 95, 0, 95, lineHeight + 4), Color.Black);
            if (_timeToMeasureFps <= 0f)
            {
                framerateStr      = ((int)(1 / gameTime.ElapsedGameTime.TotalSeconds)).ToString();
                _timeToMeasureFps = 1f;
            }
            else
            {
                _timeToMeasureFps -= (float)gameTime.ElapsedGameTime.TotalSeconds;
            }
            spriteBatch.DrawString(font, "FPS: " + framerateStr, new Vector2(GraphicsDevice.Viewport.Bounds.Right - 91, 4), Color.White);
            spriteBatch.End();

            base.Draw(gameTime);
        }
Exemplo n.º 38
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Plane"/> class.
 /// </summary>
 public Plane(GraphicsDevice graphicsDevice) : base(graphicsDevice)
 {
 }
Exemplo n.º 39
0
        //------------------------------------------------------------------
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.HotPink);

            base.Draw(gameTime);
        }
Exemplo n.º 40
0
 public override void Draw(SpriteBatch batch, GraphicsDevice device)
 {
     Stuff.DrawPlayerIndicator(editor.MousePos, Game1.BlueColor, index);
 }
Exemplo n.º 41
0
 public void SetIndexBuffer(GraphicsDevice device, uint[] indices)
 {
     IndexBuffer = new IndexBuffer(device, typeof(uint), indices.Length, BufferUsage.None);
     IndexBuffer.SetData(indices);
 }
Exemplo n.º 42
0
 public MeshFactory(MonoGameGraphics graphics)
 {
     this.demo   = graphics.Demo;
     this.device = graphics.Device;
 }
Exemplo n.º 43
0
 public Deer(string sprites, Vector3 position, ComponentManager manager, ChunkManager chunks, GraphicsDevice graphics, ContentManager content, string name) :
     base
     (
         new CreatureStats
 {
     Dexterity    = 12,
     Constitution = 6,
     Strength     = 3,
     Wisdom       = 2,
     Charisma     = 1,
     Intelligence = 3,
     Size         = 3
 },
         "Herbivore",
         manager.World.PlanService,
         manager.Factions.Factions["Herbivore"],
         new Physics
         (
             "A Deer",
             manager.RootComponent,
             Matrix.CreateTranslation(position),
             new Vector3(0.3f, 0.3f, 0.3f),
             new Vector3(0, 0, 0),
             1.0f, 1.0f, 0.999f, 0.999f,
             new Vector3(0, -10, 0)
         ),
         chunks, graphics, content, name
     )
 {
     Initialize(new SpriteSheet(sprites));
 }
Exemplo n.º 44
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)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            if (gameWon)
            {
                GraphicsDevice.SetRenderTarget(renderTarget1);
                GraphicsDevice.Clear(Color.TransparentBlack);
                spriteBatch.Begin();
                gameBoard.Draw(spriteBatch, gameWon);
                spriteBatch.End();
                flickering.Draw(renderTarget1, renderTarget2);
                GraphicsDevice.SetRenderTarget(null);
            }
            else
            {
                GraphicsDevice.SetRenderTarget(renderTarget1);
                GraphicsDevice.Clear(Color.TransparentBlack);
                flickering.Draw(renderTarget1, renderTarget2);
                GraphicsDevice.SetRenderTarget(null);
            }

            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);

            if (showBackground)
            {
                spriteBatch.Draw(background_Sprite, GraphicsDevice.Viewport.Bounds, Color.White);
            }
            else
            {
                spriteBatch.Draw(background_Sprite, GraphicsDevice.Viewport.Bounds, Color.White * 0.95f);
                showBackground = true;
            }

            if (!gameWon)
            {
                gameBoard.Draw(spriteBatch, gameWon);
            }

            if (gameStarted)
            {
                fallingShapes.Draw(spriteBatch);
                if (draggedShape != null)
                {
                    draggedShape.Draw(spriteBatch);
                }
            }
            else
            {
                startButton.Draw(spriteBatch);
            }

            Vector2 stringPos = timer < 10 ? new Vector2(WINDOW_WIDTH - 180, 35) : new Vector2(WINDOW_WIDTH - 200, 35);

            spriteBatch.DrawString(spriteFont, Math.Ceiling(timer).ToString(), stringPos, Color.White, 0f, Vector2.Zero, 2.5f, SpriteEffects.None, 0);

            spriteBatch.End();

            spriteBatch.Begin(0, BlendState.AlphaBlend);
            spriteBatch.Draw(renderTarget2, new Rectangle(0, 0, pp.BackBufferWidth, pp.BackBufferHeight), Color.White);
            spriteBatch.End();
            base.Draw(gameTime);
        }
Exemplo n.º 45
0
 public void StartUI()
 {
     ServiceRegistration.Get <ILogger>().Debug("SkinEngine MainForm: Starting UI");
     GraphicsDevice.Reset();
     StartRenderThread_Async();
 }
Exemplo n.º 46
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
            spriteBatch.Begin();
            //spriteBatch.DrawString(debugFont, debugstring1, new Vector2(10, 10), Color.Black);
            //spriteBatch.DrawString(debugFont, debugstring2, new Vector2(10, 40), Color.Black);
            //spriteBatch.DrawString(debugFont, debugstring3, new Vector2(10, 70), Color.Black);
            switch (CurrentGameState)
            {
            case GameState.MainMenu:
                //spriteBatch.DrawString(debugFont, gameTimeSinceStart.ToString(), new Vector2(10, 10), Color.Black);
                //spriteBatch.DrawString(debugFont, gameTimeSincePlaying.ToString(), new Vector2(10, 40), Color.Black);
                playBeatmapsButton.Draw(spriteBatch);
                createBeatmapsButton.Draw(spriteBatch);
                gameTimeSinceStart = (int)gameTime.TotalGameTime.TotalMilliseconds;
                break;

            case GameState.Playing:
                //gameTimeSincePlaying = (int)gameTime.TotalGameTime.TotalMilliseconds - gameTimeSinceStart;

                spriteBatch.DrawString(debugFont, PointGenerator.TotalPoints.ToString(), new Vector2(10, 10), Color.Black);
                spriteBatch.DrawString(debugFont, PointGenerator.Multiplicator, new Vector2(10, 30), Color.Black);
                //this.countShakersAndBeats();
                //spriteBatch.DrawString(debugFont, debugstring1, new Vector2(10, 50), Color.Black);
                //spriteBatch.DrawString(debugFont, debugstring2, new Vector2(10, 70), Color.Black);
                //spriteBatch.DrawString(debugFont, endTime.ToString(), new Vector2(10, 90), Color.Black);


                PointGenerator.Draw(spriteBatch, (int)MediaPlayer.PlayPosition.TotalMilliseconds);

                foreach (var kv in BeatDictionary.ToDictionary(kv => kv.Key, kv => kv.Value))
                {
                    if (kv.Key <= MediaPlayer.PlayPosition.TotalMilliseconds)
                    {
                        if (kv.Value.Identifier() == PlayObjectIdentifier.Shaker)
                        {
                            Shaker tempShaker = kv.Value as Shaker;
                            if ((tempShaker.Length + kv.Key) <= (int)MediaPlayer.PlayPosition.TotalMilliseconds)
                            {
                                BeatDictionary.Remove(kv.Key);
                                if (tempShaker.isComplete())
                                {
                                    PointGenerator.generatePointEffect(new Vector2(400f, 240f), PointEffectState.FullPoints, (int)MediaPlayer.PlayPosition.TotalMilliseconds);
                                }
                                else
                                {
                                    PointGenerator.generatePointEffect(new Vector2(400f, 240f), PointEffectState.ReducedPoints, (int)MediaPlayer.PlayPosition.TotalMilliseconds);
                                }
                                checkForEndOfSong();
                            }
                        }
                        else
                        {
                            ClickablePlayObject tempBeat = kv.Value as ClickablePlayObject;
                            if (!tempBeat.thisDraw)
                            {
                                BeatDictionary.Remove(kv.Key);
                                PointGenerator.generatePointEffect(tempBeat.Center, 2f, (int)MediaPlayer.PlayPosition.TotalMilliseconds);
                            }
                        }
                        kv.Value.Draw(spriteBatch);
                    }
                    else
                    {
                        break;
                    }
                }
                spriteBatch.DrawString(debugFont, MediaPlayer.PlayPosition.TotalMilliseconds.ToString(), new Vector2(10, 430), Color.Yellow);

                break;

            case GameState.BeatmapCreator:
                gameTimeSinceCreating = (int)gameTime.TotalGameTime.TotalMilliseconds - gameTimeSinceStart;
                returnToMainMenuButton.Draw(spriteBatch);
                //spriteBatch.DrawString(debugFont, MediaPlayer.PlayPosition.TotalMilliseconds.ToString(), new Vector2(10, 10), Color.Black);
                //spriteBatch.DrawString(debugFont, debugstring1, new Vector2(10, 30), Color.Black);
                //spriteBatch.DrawString(debugFont, debugstring2, new Vector2(10, 50), Color.Black);
                //spriteBatch.DrawString(debugFont, debugstring3, new Vector2(10, 70), Color.Black);
                break;


            case GameState.SaveMenu:

                break;

            case GameState.XMLLoadMenu:
                loadMenu.Draw(spriteBatch);
                break;

            case GameState.SongLoadMenu:
                loadMenu.Draw(spriteBatch);
                break;

            case GameState.ScoreMenu:
                returnToMainMenuButton.Draw(spriteBatch);
                spriteBatch.DrawString(scoreFont, "Final Score:", new Vector2(150, 200), Color.Red);
                spriteBatch.DrawString(scoreFont, PointGenerator.TotalPoints.ToString(), new Vector2(150, 300), Color.Red);
                break;
            }


            spriteBatch.End();
            base.Draw(gameTime);
        }
Exemplo n.º 47
0
 public virtual void DeviceReset(GraphicsDevice device)
 {
 }
Exemplo n.º 48
0
 public void DisposeDirectX()
 {
     ServiceRegistration.Get <ILogger>().Debug("SkinEngine MainForm: Dispose DirectX");
     GraphicsDevice.Dispose();
 }
Exemplo n.º 49
0
        internal AssetStore(
            FileSystem fileSystem,
            string language,
            GraphicsDevice graphicsDevice,
            StandardGraphicsResources standardGraphicsResources,
            ShaderResourceManager shaderResources,
            OnDemandAssetLoadStrategy loadStrategy)
        {
            LoadContext = new AssetLoadContext(
                fileSystem,
                language,
                graphicsDevice,
                standardGraphicsResources,
                shaderResources,
                this);

            _scopedSingleAssetStorage   = new List <IScopedSingleAssetStorage>();
            _singleAssetStorageByTypeId = new Dictionary <uint, IScopedSingleAssetStorage>();

            void AddSingleAssetStorage <TAsset>(ScopedSingleAsset <TAsset> assetStorage)
                where TAsset : BaseSingletonAsset, new()
            {
                _scopedSingleAssetStorage.Add(assetStorage);

                var typeId = AssetHash.GetHash(typeof(TAsset).Name);

                _singleAssetStorageByTypeId.Add(typeId, assetStorage);
            }

            AddSingleAssetStorage(AIData = new ScopedSingleAsset <AIData>());
            AddSingleAssetStorage(AnimationSoundClientBehaviorGlobalSetting = new ScopedSingleAsset <AnimationSoundClientBehaviorGlobalSetting>());
            AddSingleAssetStorage(AptButtonTooltipMap    = new ScopedSingleAsset <AptButtonTooltipMap>());
            AddSingleAssetStorage(ArmySummaryDescription = new ScopedSingleAsset <ArmySummaryDescription>());
            AddSingleAssetStorage(AudioSettings          = new ScopedSingleAsset <AudioSettings>());
            AddSingleAssetStorage(AwardSystem            = new ScopedSingleAsset <AwardSystem>());
            AddSingleAssetStorage(BannerUI          = new ScopedSingleAsset <BannerUI>());
            AddSingleAssetStorage(ChallengeGenerals = new ScopedSingleAsset <ChallengeGenerals>());
            AddSingleAssetStorage(CreateAHeroSystem = new ScopedSingleAsset <CreateAHeroSystem>());
            AddSingleAssetStorage(Credits           = new ScopedSingleAsset <Credits>());
            AddSingleAssetStorage(DrawGroupInfo     = new ScopedSingleAsset <DrawGroupInfo>());
            AddSingleAssetStorage(Environment       = new ScopedSingleAsset <Environment>());
            AddSingleAssetStorage(Fire                                            = new ScopedSingleAsset <Fire>());
            AddSingleAssetStorage(FireLogicSystem                                 = new ScopedSingleAsset <FireLogicSystem>());
            AddSingleAssetStorage(FormationAssistant                              = new ScopedSingleAsset <FormationAssistant>());
            AddSingleAssetStorage(GameData                                        = new ScopedSingleAsset <GameData>());
            AddSingleAssetStorage(InGameNotificationBox                           = new ScopedSingleAsset <InGameNotificationBox>());
            AddSingleAssetStorage(InGameUI                                        = new ScopedSingleAsset <InGameUI>());
            AddSingleAssetStorage(Language                                        = new ScopedSingleAsset <Language>());
            AddSingleAssetStorage(LinearCampaign                                  = new ScopedSingleAsset <LinearCampaign>());
            AddSingleAssetStorage(LargeGroupAudioUnusedKnownKeys                  = new ScopedSingleAsset <LargeGroupAudioUnusedKnownKeys>());
            AddSingleAssetStorage(LivingWorldMapInfo                              = new ScopedSingleAsset <LivingWorldMapInfo>());
            AddSingleAssetStorage(LivingWorldAutoResolveResourceBonus             = new ScopedSingleAsset <LivingWorldAutoResolveResourceBonus>());
            AddSingleAssetStorage(LivingWorldAutoResolveSciencePurchasePointBonus = new ScopedSingleAsset <LivingWorldAutoResolveSciencePurchasePointBonus>());
            AddSingleAssetStorage(MiscAudio                                       = new ScopedSingleAsset <MiscAudio>());
            AddSingleAssetStorage(MiscEvaData                                     = new ScopedSingleAsset <MiscEvaData>());
            AddSingleAssetStorage(MissionObjectiveList                            = new ScopedSingleAsset <MissionObjectiveList>());
            AddSingleAssetStorage(MouseData                                       = new ScopedSingleAsset <MouseData>());
            AddSingleAssetStorage(MultiplayerSettings                             = new ScopedSingleAsset <MultiplayerSettings>());
            AddSingleAssetStorage(OnlineChatColors                                = new ScopedSingleAsset <OnlineChatColors>());
            AddSingleAssetStorage(Pathfinder                                      = new ScopedSingleAsset <Pathfinder>());
            AddSingleAssetStorage(StrategicHud                                    = new ScopedSingleAsset <StrategicHud>());
            AddSingleAssetStorage(WaterTransparency                               = new ScopedSingleAsset <WaterTransparency>());
            AddSingleAssetStorage(Weather                                         = new ScopedSingleAsset <Weather>());

            _scopedAssetCollections = new List <IScopedAssetCollection>();
            _byTypeId = new Dictionary <uint, IScopedAssetCollection>();

            void AddAssetCollection <TAsset>(ScopedAssetCollection <TAsset> assetCollection)
                where TAsset : BaseAsset
            {
                _scopedAssetCollections.Add(assetCollection);

                var typeId = AssetHash.GetHash(typeof(TAsset).Name);

                _byTypeId.Add(typeId, assetCollection);
            }

            AddAssetCollection(AIBases                           = new ScopedAssetCollection <AIBase>(this));
            AddAssetCollection(AIDozerAssignments                = new ScopedAssetCollection <AIDozerAssignment>(this));
            AddAssetCollection(AmbientStreams                    = new ScopedAssetCollection <AmbientStream>(this));
            AddAssetCollection(Animations                        = new ScopedAssetCollection <Animation>(this));
            AddAssetCollection(ArmorTemplates                    = new ScopedAssetCollection <ArmorTemplate>(this));
            AddAssetCollection(ArmyDefinitions                   = new ScopedAssetCollection <ArmyDefinition>(this));
            AddAssetCollection(AudioEvents                       = new ScopedAssetCollection <AudioEvent>(this));
            AddAssetCollection(AudioFiles                        = new ScopedAssetCollection <AudioFile>(this, loadStrategy.CreateAudioFileLoader()));
            AddAssetCollection(AudioLods                         = new ScopedAssetCollection <AudioLod>(this));
            AddAssetCollection(AutoResolveArmors                 = new ScopedAssetCollection <AutoResolveArmor>(this));
            AddAssetCollection(AutoResolveBodies                 = new ScopedAssetCollection <AutoResolveBody>(this));
            AddAssetCollection(AutoResolveCombatChains           = new ScopedAssetCollection <AutoResolveCombatChain>(this));
            AddAssetCollection(AutoResolveHandicapLevels         = new ScopedAssetCollection <AutoResolveHandicapLevel>(this));
            AddAssetCollection(AutoResolveLeaderships            = new ScopedAssetCollection <AutoResolveLeadership>(this));
            AddAssetCollection(AutoResolveReinforcementSchedules = new ScopedAssetCollection <AutoResolveReinforcementSchedule>(this));
            AddAssetCollection(AutoResolveWeapons                = new ScopedAssetCollection <AutoResolveWeapon>(this));
            AddAssetCollection(BannerTypes                       = new ScopedAssetCollection <BannerType>(this));
            AddAssetCollection(BenchProfiles                     = new ScopedAssetCollection <BenchProfile>(this));
            AddAssetCollection(BridgeTemplates                   = new ScopedAssetCollection <BridgeTemplate>(this));
            AddAssetCollection(CampaignTemplates                 = new ScopedAssetCollection <CampaignTemplate>(this));
            AddAssetCollection(CommandButtons                    = new ScopedAssetCollection <CommandButton>(this));
            AddAssetCollection(CommandMaps                       = new ScopedAssetCollection <CommandMap>(this));
            AddAssetCollection(CommandSets                       = new ScopedAssetCollection <CommandSet>(this));
            AddAssetCollection(ControlBarResizers                = new ScopedAssetCollection <ControlBarResizer>(this));
            AddAssetCollection(ControlBarSchemes                 = new ScopedAssetCollection <ControlBarScheme>(this));
            AddAssetCollection(CrateDatas                        = new ScopedAssetCollection <CrateData>(this));
            AddAssetCollection(CrowdResponses                    = new ScopedAssetCollection <CrowdResponse>(this));
            AddAssetCollection(DamageFXs                         = new ScopedAssetCollection <DamageFX>(this));
            AddAssetCollection(DialogEvents                      = new ScopedAssetCollection <DialogEvent>(this));
            AddAssetCollection(DynamicGameLods                   = new ScopedAssetCollection <DynamicGameLod>(this));
            AddAssetCollection(EmotionNuggets                    = new ScopedAssetCollection <EmotionNugget>(this));
            AddAssetCollection(EvaEvents                         = new ScopedAssetCollection <EvaEvent>(this));
            AddAssetCollection(ExperienceLevels                  = new ScopedAssetCollection <ExperienceLevel>(this));
            AddAssetCollection(ExperienceScalarTables            = new ScopedAssetCollection <ExperienceScalarTable>(this));
            AddAssetCollection(FactionVictoryDatas               = new ScopedAssetCollection <FactionVictoryData>(this));
            AddAssetCollection(FontDefaultSettings               = new ScopedAssetCollection <FontDefaultSetting>(this));
            AddAssetCollection(FontSubstitutions                 = new ScopedAssetCollection <FontSubstitution>(this));
            AddAssetCollection(FXLists                           = new ScopedAssetCollection <FXList>(this));
            AddAssetCollection(FXParticleSystemTemplates         = new ScopedAssetCollection <FXParticleSystemTemplate>(this));
            AddAssetCollection(GuiTextures                       = new ScopedAssetCollection <GuiTextureAsset>(this, loadStrategy.CreateGuiTextureLoader()));
            AddAssetCollection(HeaderTemplates                   = new ScopedAssetCollection <HeaderTemplate>(this));
            AddAssetCollection(HouseColors                       = new ScopedAssetCollection <HouseColor>(this));
            AddAssetCollection(LargeGroupAudioMaps               = new ScopedAssetCollection <LargeGroupAudioMap>(this));
            AddAssetCollection(LivingWorldAITemplates            = new ScopedAssetCollection <LivingWorldAITemplate>(this));
            AddAssetCollection(LivingWorldAnimObjects            = new ScopedAssetCollection <LivingWorldAnimObject>(this));
            AddAssetCollection(LivingWorldArmyIcons              = new ScopedAssetCollection <LivingWorldArmyIcon>(this));
            AddAssetCollection(LivingWorldBuildings              = new ScopedAssetCollection <LivingWorldBuilding>(this));
            AddAssetCollection(LivingWorldBuildingIcons          = new ScopedAssetCollection <LivingWorldBuildingIcon>(this));
            AddAssetCollection(LivingWorldBuildPlotIcons         = new ScopedAssetCollection <LivingWorldBuildPlotIcon>(this));
            AddAssetCollection(LivingWorldCampaigns              = new ScopedAssetCollection <LivingWorldCampaign>(this));
            AddAssetCollection(LivingWorldObjects                = new ScopedAssetCollection <LivingWorldObject>(this));
            AddAssetCollection(LivingWorldPlayerArmies           = new ScopedAssetCollection <LivingWorldPlayerArmy>(this));
            AddAssetCollection(LivingWorldPlayerTemplates        = new ScopedAssetCollection <LivingWorldPlayerTemplate>(this));
            AddAssetCollection(LivingWorldRegionCampaigns        = new ScopedAssetCollection <LivingWorldRegionCampaign>(this));
            AddAssetCollection(LivingWorldRegionEffects          = new ScopedAssetCollection <LivingWorldRegionEffects>(this));
            AddAssetCollection(LivingWorldSounds                 = new ScopedAssetCollection <LivingWorldSound>(this));
            AddAssetCollection(LocomotorTemplates                = new ScopedAssetCollection <LocomotorTemplate>(this));
            AddAssetCollection(LodPresets                        = new ScopedAssetCollection <LodPreset>(this));
            AddAssetCollection(MapCaches                         = new ScopedAssetCollection <MapCache>(this));
            AddAssetCollection(MappedImages                      = new ScopedAssetCollection <MappedImage>(this));
            AddAssetCollection(MeshNameMatches                   = new ScopedAssetCollection <MeshNameMatches>(this));
            AddAssetCollection(Models                          = new ScopedAssetCollection <Model>(this, loadStrategy.CreateModelLoader()));
            AddAssetCollection(ModelAnimations                 = new ScopedAssetCollection <Graphics.Animation.W3DAnimation>(this, loadStrategy.CreateAnimationLoader()));
            AddAssetCollection(ModelBoneHierarchies            = new ScopedAssetCollection <ModelBoneHierarchy>(this, loadStrategy.CreateModelBoneHierarchyLoader()));
            AddAssetCollection(ModelMeshes                     = new ScopedAssetCollection <ModelMesh>(this)); // TODO: ModelMesh loader?
            AddAssetCollection(ModifierLists                   = new ScopedAssetCollection <ModifierList>(this));
            AddAssetCollection(MouseCursors                    = new ScopedAssetCollection <MouseCursor>(this));
            AddAssetCollection(MultiplayerColors               = new ScopedAssetCollection <MultiplayerColor>(this));
            AddAssetCollection(MultiplayerStartingMoneyChoices = new ScopedAssetCollection <MultiplayerStartingMoneyChoice>(this));
            AddAssetCollection(Multisounds                     = new ScopedAssetCollection <Multisound>(this));
            AddAssetCollection(MusicTracks                     = new ScopedAssetCollection <MusicTrack>(this));
            AddAssetCollection(ObjectCreationLists             = new ScopedAssetCollection <ObjectCreationList>(this));
            AddAssetCollection(ObjectDefinitions               = new ScopedAssetCollection <ObjectDefinition>(this));
            AddAssetCollection(PlayerAITypes                   = new ScopedAssetCollection <PlayerAIType>(this));
            AddAssetCollection(PlayerTemplates                 = new ScopedAssetCollection <PlayerTemplate>(this));
            AddAssetCollection(Ranks                   = new ScopedAssetCollection <Rank>(this));
            AddAssetCollection(RegionCampaigns         = new ScopedAssetCollection <RegionCampaign>(this));
            AddAssetCollection(RoadTemplates           = new ScopedAssetCollection <RoadTemplate>(this));
            AddAssetCollection(Sciences                = new ScopedAssetCollection <Science>(this));
            AddAssetCollection(ScoredKillEvaAnnouncers = new ScopedAssetCollection <ScoredKillEvaAnnouncer>(this));
            AddAssetCollection(ShellMenuSchemes        = new ScopedAssetCollection <ShellMenuScheme>(this));
            AddAssetCollection(SkirmishAIDatas         = new ScopedAssetCollection <SkirmishAIData>(this));
            AddAssetCollection(SkyboxTextureSets       = new ScopedAssetCollection <SkyboxTextureSet>(this));
            AddAssetCollection(SpecialPowers           = new ScopedAssetCollection <SpecialPower>(this));
            AddAssetCollection(StanceTemplates         = new ScopedAssetCollection <StanceTemplate>(this));
            AddAssetCollection(StaticGameLods          = new ScopedAssetCollection <StaticGameLod>(this));
            AddAssetCollection(StreamedSounds          = new ScopedAssetCollection <StreamedSound>(this));
            AddAssetCollection(Subsystems              = new ScopedAssetCollection <LoadSubsystem>(this));
            AddAssetCollection(TerrainTextures         = new ScopedAssetCollection <TerrainTexture>(this));
            AddAssetCollection(Textures                = new ScopedAssetCollection <TextureAsset>(this, loadStrategy.CreateTextureLoader()));
            AddAssetCollection(Upgrades                = new ScopedAssetCollection <UpgradeTemplate>(this));
            AddAssetCollection(VictorySystemDatas      = new ScopedAssetCollection <VictorySystemData>(this));
            AddAssetCollection(Videos                  = new ScopedAssetCollection <Video>(this));
            AddAssetCollection(WaterSets               = new ScopedAssetCollection <WaterSet>(this));
            AddAssetCollection(WaterTextureLists       = new ScopedAssetCollection <WaterTextureList>(this));
            AddAssetCollection(WeaponTemplates         = new ScopedAssetCollection <WeaponTemplate>(this));
            AddAssetCollection(WeatherDatas            = new ScopedAssetCollection <WeatherData>(this));
            AddAssetCollection(WindowTransitions       = new ScopedAssetCollection <WindowTransition>(this));
        }
Exemplo n.º 50
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)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);


            spriteBatch.Begin();

            switch (state)
            {
                #region menu
            case GameState.gameMenu:
                spriteBatch.Draw(Game1.graphicsLib.backgroundMenu, new Vector2(0, 0), Color.White);
                menuControl.Draw(gameTime);

                break;

                #endregion
                #region playing
            case GameState.gamePlaying:
                spriteBatch.Draw(Game1.graphicsLib.background, new Vector2(0, 0), Color.White);



                player.Draw(spriteBatch);

                foreach (Item i in items)
                {
                    i.Draw(spriteBatch);
                }


                foreach (Bullet b in bullets)
                {
                    b.Draw(spriteBatch);
                }

                foreach (Zombie z in zombies)
                {
                    z.Draw(spriteBatch);
                }



                spriteBatch.Draw(Game1.graphicsLib.health, new Rectangle(10, 10, player.Health * 2, 30), new Rectangle(10, 10, player.Health * 3, 30), Color.Red);
                spriteBatch.DrawString(Game1.graphicsLib.text, "Health " + player.Health, new Vector2(10, 15), Color.White);
                spriteBatch.DrawString(Game1.graphicsLib.text, "Kills: " + kills, new Vector2(550, 10), Color.White);
                spriteBatch.DrawString(Game1.graphicsLib.text, "Weapon: " + player.CurrenWeapon, new Vector2(250, 10), Color.White);
                if (!player.DefaultWeapon())
                {
                    spriteBatch.DrawString(Game1.graphicsLib.text, "Ammo: " + player.Ammo, new Vector2(250, 30), Color.White);
                }
                else
                {
                    spriteBatch.DrawString(Game1.graphicsLib.text, "Ammo: " + "infinite", new Vector2(250, 30), Color.White);
                }

                break;

                #endregion
                #region highscores
            case GameState.gameHighScores:
                spriteBatch.Draw(Game1.graphicsLib.backgroundMenu, new Vector2(0, 0), Color.White);
                spriteBatch.DrawString(Game1.graphicsLib.text, "High scores", new Vector2(350, 10), Color.Red);
                spriteBatch.DrawString(Game1.graphicsLib.text, "Player        Kills  ", new Vector2(350, 60), Color.Red);

                if (!highScoreEntered)
                {
                    if (highScores.IsHighScore(kills))
                    {
                        AddHighScore(gameTime, highScores);
                    }
                }

                if (highScoreEntered)
                {
                    if (!scoresSaved)
                    {
                        highScores.Save("Content/hiscores.xml");
                        scoresSaved = true;
                    }
                }

                if ((scoresSaved || highScores.IsHighScore(kills)))
                {
                    DrawHighScores(spriteBatch);
                }
                DrawHighScores(spriteBatch);
                spriteBatch.DrawString(Game1.graphicsLib.text, "Press Escape to exit", new Vector2(320, 500), Color.Red);


                break;

                #endregion
                #region help
            case GameState.gameHelp:
                spriteBatch.Draw(Game1.graphicsLib.backgroundMenu, new Vector2(0, 0), Color.White);
                spriteBatch.DrawString(Game1.graphicsLib.text, "Help", new Vector2(350, 10), Color.Red);
                spriteBatch.DrawString(Game1.graphicsLib.text, "Controls\n" +
                                       "--------------\n" +
                                       "move: arrow keys\n" +
                                       "shoot: space bar\n" +
                                       "\n" +
                                       "How to play?\n" +
                                       "--------------\n" +
                                       "Select 'Play' from the menu and\n" +
                                       "press enter.\n" +
                                       "\n" +
                                       "Idea is to survive as long as you\n" +
                                       "can and kill as meany zombies you\n" +
                                       "can.\n" +
                                       "\n" +
                                       "There are three different weapons in\n" +
                                       "this game:\n" +
                                       "\n" +
                                       "- Assault rifle: basic weapon with infinite ammunition\n" +
                                       "- Machinegun: firerate is high\n" +
                                       "- Rifle: firerate is low, but creates a great amount of\n" +
                                       "damage.\n", new Vector2(100, 50), Color.Red);
                spriteBatch.DrawString(Game1.graphicsLib.text, "Press Escape to exit", new Vector2(320, 550), Color.Red);
                break;
                #endregion

                #region popup

            case GameState.gamePopup:

                spriteBatch.Draw(Game1.graphicsLib.backgroundMenu, new Vector2(0, 0), Color.White);
                popup.Draw();

                if (popup.IsDone())
                {
                    gameOver();
                }

                break;

                #endregion
            }
            spriteBatch.End();


            base.Draw(gameTime);
        }
Exemplo n.º 51
0
        /// <summary>
        /// Prep work before screen is painted
        /// </summary>
        /// <param name="gd"></param>
        /// <param name="state"></param>
        public virtual void PreDraw(GraphicsDevice gd, WorldState state)
        {
            if (Blueprint == null)
            {
                return;
            }
            var pxOffset = -state.WorldSpace.GetScreenOffset();
            var damage   = Blueprint.Damage;
            var _2d      = state._2D;
            var oldLevel = state.Level;
            var oldBuild = state.BuildMode;

            state.SilentLevel     = State.Level;
            state.SilentBuildMode = 0;

            /**
             * This is a little bit different from a normal 2d world. All objects are part of the static
             * buffer, and they are redrawn into the parent world's scroll buffers.
             */

            var recacheWalls   = false;
            var recacheObjects = false;

            if (TicksSinceLight++ > 60 * 4)
            {
                damage.Add(new BlueprintDamage(BlueprintDamageType.OUTDOORS_LIGHTING_CHANGED));
            }

            foreach (var item in damage)
            {
                switch (item.Type)
                {
                case BlueprintDamageType.ROTATE:
                case BlueprintDamageType.ZOOM:
                case BlueprintDamageType.LEVEL_CHANGED:
                    recacheObjects = true;
                    recacheWalls   = true;
                    break;

                case BlueprintDamageType.SCROLL:
                    break;

                case BlueprintDamageType.LIGHTING_CHANGED:
                    Blueprint.OutsideColor = state.OutsideColor;
                    Blueprint.GenerateRoomLights();
                    State.OutsideColor = Blueprint.RoomColors[1];
                    State.OutsidePx.SetData(new Color[] { state.OutsideColor });
                    State.AmbientLight.SetData(Blueprint.RoomColors);
                    TicksSinceLight = 0;
                    break;

                case BlueprintDamageType.OBJECT_MOVE:
                case BlueprintDamageType.OBJECT_GRAPHIC_CHANGE:
                case BlueprintDamageType.OBJECT_RETURN_TO_STATIC:
                    recacheObjects = true;
                    break;

                case BlueprintDamageType.WALL_CUT_CHANGED:
                case BlueprintDamageType.FLOOR_CHANGED:
                case BlueprintDamageType.WALL_CHANGED:
                    recacheWalls = true;
                    break;
                }
            }
            damage.Clear();

            var is2d = state.Camera is WorldCamera;

            if (is2d)
            {
                state._2D.End();
                state._2D.Begin(state.Camera);
            }
            if (recacheWalls)
            {
                //clear the sprite buffer before we begin drawing what we're going to cache
                Blueprint.Terrain.RegenTerrain(gd, state, Blueprint);
                Blueprint.FloorGeom.FullReset(gd, false);
                if (is2d)
                {
                    Blueprint.WallComp.Draw(gd, state);
                }
                StaticArchCache.Clear();
                state._2D.End(StaticArchCache, true);
            }

            if (recacheObjects && is2d)
            {
                state._2D.Pause();
                state._2D.Resume();

                foreach (var obj in Blueprint.Objects)
                {
                    if (obj.Level > state.Level)
                    {
                        continue;
                    }
                    var tilePosition = obj.Position;
                    state._2D.OffsetPixel(state.WorldSpace.GetScreenFromTile(tilePosition));
                    state._2D.OffsetTile(tilePosition);
                    state._2D.SetObjID(obj.ObjectID);
                    obj.Draw(gd, state);
                }
                StaticObjectsCache.Clear();
                state._2D.End(StaticObjectsCache, true);
            }

            state.SilentBuildMode = oldBuild;
            state.SilentLevel     = oldLevel;
        }
Exemplo n.º 52
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);
            spriteBatch.Begin();

            if (GameState == STATE_MENU || GameState == STATE_PAUSED)
            {
                spriteBatch.Draw(logo, new Rectangle(160 * 3 / 2, 32 * 3 / 2, 1080, 384), Color.White);
            }
            buttonStart.Draw(spriteBatch);
            buttonExit.Draw(spriteBatch);
            buttonResume.Draw(spriteBatch);
            buttonOutline.Draw(spriteBatch);
            buttonRestart.Draw(spriteBatch);

            if (GameState == STATE_PLAYING)
            {
                spriteBatch.Draw(grid, new Rectangle(0, 0, 1120 * 3 / 2, 640 * 3 / 2), Color.White);
                spriteBatch.Draw(background, new Rectangle(320 * 3 / 2, 0, 480 * 3 / 2, 640 * 3 / 2), Color.White);
                spriteBatch.Draw(goal, new Rectangle((1120 - 320) * 3 / 2, endHeight, 160 * 3 / 2, 160 * 3 / 2), Color.White);
                spriteBatch.Draw(control, new Rectangle(960 * 3 / 2, 0, 160 * 3 / 2, 640 * 3 / 2), Color.White);
                // spriteBatch.Draw(ground, new Vector2(250, 940), Color.White);
                // spriteBatch.Draw(ground, new Vector2(0, 940), Color.White);
                // spriteBatch.Draw(ground1, new Vector2(570, 808), Color.White);
                spriteBatch.Draw(startPlace, new Rectangle(160 * 3 / 2, (640 - 160) * 3 / 2, 160 * 3 / 2, 160 * 3 / 2), Color.White);
                spriteBatch.Draw(nextPiece, new Rectangle(32 * 3 / 2, 32 * 3 / 2, 256 * 3 / 2, 256 * 3 / 2), Color.White);
                spriteBatch.Draw(skipBoard, new Rectangle(32 * 3 / 2, 320 * 3 / 2, 256 * 3 / 2, 128 * 3 / 2), Color.White);
                if (skip == 0)
                {
                    spriteBatch.Draw(skip1, new Rectangle(32 * 3 / 2, 320 * 3 / 2, 256 * 3 / 2, 128 * 3 / 2), Color.White);
                }
                if (skip <= 1)
                {
                    spriteBatch.Draw(skip2, new Rectangle(32 * 3 / 2, 320 * 3 / 2, 256 * 3 / 2, 128 * 3 / 2), Color.White);
                }
                if (skip <= 2)
                {
                    spriteBatch.Draw(skip3, new Rectangle(32 * 3 / 2, 320 * 3 / 2, 256 * 3 / 2, 128 * 3 / 2), Color.White);
                }

                // Draw the board
                gameBoard.Draw(spriteBatch, BoardLocation, texture1px);
                for (int k = 0; k < nextBlockBoards.Length; k++)
                {
                    nextBlockBoards[k].Draw(spriteBatch, nextBlockBoardsLocation[k], texture1px);
                }

                // Draw the player
                // player.Draw(spriteBatch);
                player.Draw(gameTime, spriteBatch);
            }

            if (GameState == STATE_GAMEOVER)
            {
                // Draw game over screen
                spriteBatch.DrawString(GameFont, "You Lose!", new Vector2(450 * 3 / 2, 30 * 3 / 2), Color.Red);
                if (totalTime % 60 < 10)
                {
                    spriteBatch.DrawString(GameFont, "Time: " + Math.Truncate(totalTime / 60) + " : 0" + Math.Round(totalTime % 60, 2, MidpointRounding.ToEven), new Vector2(450 * 3 / 2, 110 * 3 / 2), Color.White);
                }
                else if (totalTime % 60 >= 10)
                {
                    spriteBatch.DrawString(GameFont, "Time: " + Math.Truncate(totalTime / 60) + " : " + Math.Round(totalTime % 60, 2, MidpointRounding.ToEven), new Vector2(450 * 3 / 2, 110 * 3 / 2), Color.White);
                }
                spriteBatch.DrawString(GameFont, "Lines: " + Lines, new Vector2(450 * 3 / 2, 190 * 3 / 2), Color.White);
                spriteBatch.Draw(lose, new Rectangle(480 * 3 / 2, 260 * 3 / 2, 160 * 3 / 2, 160 * 3 / 2), Color.White);
            }

            // Display the debug Window
            // DrawDebugWindow(spriteBatch);

            if (GameState == STATE_GAMEWON)
            {
                // Draw game over screen
                spriteBatch.DrawString(GameFont, "You Win!", new Vector2(450 * 3 / 2, 30 * 3 / 2), Color.Yellow);
                if (totalTime % 60 < 10)
                {
                    spriteBatch.DrawString(GameFont, "Time: " + Math.Truncate(totalTime / 60) + " : 0" + Math.Round(totalTime % 60, 2, MidpointRounding.ToEven), new Vector2(450 * 3 / 2, 110 * 3 / 2), Color.White);
                }
                else if (totalTime % 60 >= 10)
                {
                    spriteBatch.DrawString(GameFont, "Time: " + Math.Truncate(totalTime / 60) + " : " + Math.Round(totalTime % 60, 2, MidpointRounding.ToEven), new Vector2(450 * 3 / 2, 110 * 3 / 2), Color.White);
                }
                spriteBatch.DrawString(GameFont, "Lines: " + Lines, new Vector2(450 * 3 / 2, 190 * 3 / 2), Color.White);
                spriteBatch.Draw(win, new Rectangle(480 * 3 / 2, 260 * 3 / 2, 160 * 3 / 2, 160 * 3 / 2), Color.White);
            }

            spriteBatch.End();
            base.Draw(gameTime);
        }
Exemplo n.º 53
0
 public ConeInvert(GraphicsDevice graphics) : base(graphics)
 {
     InvertWindingOrder = true;
 }
Exemplo n.º 54
0
 /// <summary>
 /// Constructs a new particle engine
 /// </summary>
 /// <param name="graphicsDevice">The graphics device</param>
 /// <param name="size">The maximum number of particles in the system</param>
 /// <param name="texture">The texture of the particles</param>
 public ParticleSystem(GraphicsDevice graphicsDevice, int size, Texture2D texture, SpriteBatch spriteBatch)
 {
     this.particles   = new Particle[size];
     this.spriteBatch = spriteBatch;
     this.texture     = texture;
 }
Exemplo n.º 55
0
 /// <summary>
 /// Creates a new World instance.
 /// </summary>
 /// <param name="Device">A GraphicsDevice instance.</param>
 public SubWorldComponent(GraphicsDevice Device)
     : base(Device)
 {
 }
Exemplo n.º 56
0
 /// <summary>
 /// Constructs a new cylinder primitive, using default settings.
 /// </summary>
 public Cone(GraphicsDevice graphicsDevice) : base(graphicsDevice)
 {
 }
Exemplo n.º 57
0
        public void Render(DwarfTime gameTime,
                           ChunkManager chunks,
                           Camera camera,
                           SpriteBatch spriteBatch,
                           GraphicsDevice graphicsDevice,
                           Effect effect,
                           WaterRenderType waterRenderMode, float waterLevel)
        {
            bool renderForWater = (waterRenderMode != WaterRenderType.None);

            if (!renderForWater)
            {
                visibleComponents.Clear();
                componentsToDraw.Clear();


                List <Body> list = FrustrumCullLocatableComponents(camera);
                foreach (Body component in list)
                {
                    visibleComponents.Add(component);
                }


                Camera = camera;
                foreach (GameComponent component in Components.Values)
                {
                    bool isLocatable = component is Body;

                    if (isLocatable)
                    {
                        Body loc = (Body)component;


                        if (((loc.GlobalTransform.Translation - camera.Position).LengthSquared() < chunks.DrawDistanceSquared &&
                             visibleComponents.Contains(loc) || !(loc.FrustrumCull) || !(loc.WasAddedToOctree) && !loc.IsAboveCullPlane)
                            )
                        {
                            componentsToDraw.Add(component);
                        }
                    }
                    else
                    {
                        componentsToDraw.Add(component);
                    }
                }
            }


            effect.Parameters["xEnableLighting"].SetValue(GameSettings.Default.CursorLightEnabled ? 1 : 0);
            graphicsDevice.RasterizerState = RasterizerState.CullNone;

            foreach (GameComponent component in componentsToDraw)
            {
                if (waterRenderMode == WaterRenderType.Reflective && !RenderReflective(component, waterLevel))
                {
                    continue;
                }
                component.Render(gameTime, chunks, camera, spriteBatch, graphicsDevice, effect, renderForWater);
            }

            effect.Parameters["xEnableLighting"].SetValue(0);
        }
Exemplo n.º 58
0
        // Load all tiles for level
        public static void LoadContent(ContentManager Content, GraphicsDevice GraphicsDevice)
        {
            tileManager = new TileManager();

            // Load textures for level
            Texture2D block = Content.Load <Texture2D>(@"Sprites/Block");

            tileManager.AddTile(block, new Vector2(0, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(25, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(50, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(75, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(100, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(125, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(150, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(175, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(200, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(225, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(250, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(275, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(300, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(325, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(350, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(375, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(400, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(425, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(450, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(475, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(500, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(525, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(550, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(575, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(600, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(625, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(650, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(675, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(700, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(725, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(750, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(775, 391), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(692, 366), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(717, 366), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(742, 366), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(767, 366), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(792, 366), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(727, 341), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(752, 341), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(777, 341), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(50, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(75, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(100, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(125, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(150, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(175, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(200, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(225, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(250, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(275, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(300, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(325, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(350, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(375, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(400, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(425, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(450, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(475, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(500, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(525, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(550, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(575, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(600, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(625, 286), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(775, 216), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(750, 216), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(725, 216), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(700, 216), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(675, 216), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(650, 216), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(625, 216), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(600, 216), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(575, 216), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(550, 216), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(525, 216), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(500, 216), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(500, 191), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(500, 166), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(475, 216), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(475, 191), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(450, 216), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(425, 216), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(400, 216), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(150, 261), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(150, 236), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(150, 211), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(150, 186), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(400, 141), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(400, 116), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(400, 91), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(400, 66), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(400, 41), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(400, 16), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(375, 92), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(350, 92), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(325, 92), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(375, 67), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(350, 67), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(325, 67), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(300, 67), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(275, 67), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(250, 67), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(225, 67), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(375, 42), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(350, 42), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(325, 42), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(300, 42), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(275, 42), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(250, 42), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(225, 42), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(200, 42), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(175, 42), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(150, 42), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(125, 42), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(100, 42), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(75, 42), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(50, 42), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(25, 42), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(0, 42), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(50, 67), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(50, 92), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(50, 117), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(50, 142), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(50, 167), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(50, 192), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(75, 192), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(25, 192), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(0, 192), new Rectangle(0, 0, 25, 25));

            tileManager.AddTile(block, new Vector2(775, 153), new Rectangle(0, 0, 25, 25));

            tileManager.AddTile(block, new Vector2(109, 366), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(300, 366), new Rectangle(0, 0, 25, 25));
            tileManager.AddTile(block, new Vector2(512, 366), new Rectangle(0, 0, 25, 25));
        }
Exemplo n.º 59
0
 public virtual void InitDeviceResources(GraphicsDevice device)
 {
 }
Exemplo n.º 60
0
        public Room7_Level3(GameWorld gameWorld, GraphicsDevice graphicsDevice, ContentManager content) : base(gameWorld, graphicsDevice, content)
        {
            var buttonTexture = _content.Load <Texture2D>("Button");
            var buttonFont    = _content.Load <SpriteFont>("Font");

            Font = content.Load <SpriteFont>("Font");
            Texture2D piller = content.Load <Texture2D>("Pillar1");

            #region Texture loaded
            //Left Wall
            Texture2D wallTopCorLeft  = content.Load <Texture2D>("64x64/Wall_Corner_Top_Left");
            Texture2D wallTopCorLeft2 = content.Load <Texture2D>("64x64/Wall_Corner_Top_Left_2");
            Texture2D wallTopLeft     = content.Load <Texture2D>("64x64/Wall_Left_Up_1");
            Texture2D wallTopLeft2    = content.Load <Texture2D>("64x64/Wall_Left_Up_2");
            Texture2D wallMidLeftTop  = content.Load <Texture2D>("64x64/Wall_Mid_Left_Top");
            Texture2D wallMidLeftLow  = content.Load <Texture2D>("64x64/Wall_Mid_Left_Low");
            Texture2D wallBotLeft2    = content.Load <Texture2D>("64x64/Wall_Left_Bottom_2");
            Texture2D wallBotLeft1    = content.Load <Texture2D>("64x64/Wall_Left_Bottom_1");
            Texture2D wallBotCorLeft1 = content.Load <Texture2D>("64x64/Wall_Corner_Bot_Left_1");
            Texture2D wallBotCorLeft2 = content.Load <Texture2D>("64x64/Wall_Corner_Bot_Left_2");
            Texture2D wallBotLow      = content.Load <Texture2D>("64x64/Wall_Left_Left_Low_2");
            Texture2D wallTopLow      = content.Load <Texture2D>("64x64/Wall_Right_Left_Low_1");
            //Bottom Wall
            Texture2D wallBottomLeft1        = content.Load <Texture2D>("64x64/Wall_Left_Bottom_Up_1");
            Texture2D wallBottomLeft2        = content.Load <Texture2D>("64x64/Wall_Left_Bot_2");
            Texture2D wallBottomMiddle1      = content.Load <Texture2D>("64x64/Wall_Mid_Bottom_Up");
            Texture2D wallBottomMiddle2      = content.Load <Texture2D>("64x64/Wall_Mid_Bottom_Low");
            Texture2D wallBottomRight2       = content.Load <Texture2D>("64x64/Wall_Right_Bottom_2");
            Texture2D wallBottomRight1       = content.Load <Texture2D>("64x64/Wall_Right_Bottom_1");
            Texture2D wallCornerBottomRight1 = content.Load <Texture2D>("64x64/Wall_Corner_Bot_Right_1");
            Texture2D wallCornerBottomRight2 = content.Load <Texture2D>("64x64/Wall_Corner_Bot_Right_2");
            Texture2D wallLeftBotLow         = content.Load <Texture2D>("64x64/Wall_Left_Bottom_Low_2");
            Texture2D wallRightBotLow        = content.Load <Texture2D>("64x64/Wall_Right_Bottom_Low_1");
            //Right Wall
            Texture2D wallRightLeft1      = content.Load <Texture2D>("64x64/Wall_Right_Bottom_Up_1");
            Texture2D wallRightLeft2      = content.Load <Texture2D>("64x64/Wall_Right_Bottom_Up_2");
            Texture2D wallRightMiddle1    = content.Load <Texture2D>("64x64/Wall_Mid_Right_Up");
            Texture2D wallRightMiddle2    = content.Load <Texture2D>("64x64/Wall_Mid_Right_Low");
            Texture2D wallRightTop2       = content.Load <Texture2D>("64x64/Wall_Right_Top_2");
            Texture2D wallRightTop1       = content.Load <Texture2D>("64x64/Wall_Right_Top_1");
            Texture2D wallCornerTopRight1 = content.Load <Texture2D>("64x64/Wall_Corner_Top_Right_1");
            Texture2D wallCornerTopRight2 = content.Load <Texture2D>("64x64/Wall_Corner_Top_Right_2");
            Texture2D wallLeftRightLow    = content.Load <Texture2D>("64x64/Wall_Right_Right_Low_1");
            Texture2D wallRightRightLow   = content.Load <Texture2D>("64x64/Wall_Left_Right_Low_2");
            //Top Wall
            Texture2D wallTopRight1   = content.Load <Texture2D>("64x64/Wall_Top_Right_1");
            Texture2D wallTopRight2   = content.Load <Texture2D>("64x64/Wall_Top_Right_2");
            Texture2D wallTopMiddle1  = content.Load <Texture2D>("64x64/Wall_Mid_Top_Up");
            Texture2D wallTopMiddle2  = content.Load <Texture2D>("64x64/Wall_Mid_Top_Low");
            Texture2D wallTopLeft_2   = content.Load <Texture2D>("64x64/Wall_Top_Left_1");
            Texture2D wallTopLeft_1   = content.Load <Texture2D>("64x64/Wall_Top_Left_2");
            Texture2D wallLeftTopLow  = content.Load <Texture2D>("64x64/Wall_Right_Top_Low_2");
            Texture2D wallRightTopLow = content.Load <Texture2D>("64x64/Wall_Right_Top_Low_1");
            //Floor
            Texture2D floorPattern1  = content.Load <Texture2D>("64x64/Floor_1");
            Texture2D floorPattern2  = content.Load <Texture2D>("64x64/Floor_2");
            Texture2D floorPlain     = content.Load <Texture2D>("64x64/Plain_Floor");
            Texture2D floorBrick     = content.Load <Texture2D>("64x64/Brick_Floor");
            Texture2D floorPlainGray = content.Load <Texture2D>("64x64/Plain_Floor_Gray");
            Texture2D floorRockyGray = content.Load <Texture2D>("64x64/Rocky_Floor_Gray");
            //Door
            //Top Door
            Texture2D Door_Left_Top_Top  = content.Load <Texture2D>("64x64/Door_Left_Top_Top");
            Texture2D Door_Mid_Top_Top   = content.Load <Texture2D>("64x64/Door_Mid_Top_Top");
            Texture2D Door_Right_Top_Top = content.Load <Texture2D>("64x64/Door_Right_Top_Top");
            Texture2D Door_Left_Bot_Top  = content.Load <Texture2D>("64x64/Door_Left_Bot_Top");
            Texture2D Door_Mid_Bot_Top   = content.Load <Texture2D>("64x64/Door_Mid_Bot_Top");
            Texture2D Door_Right_Bot_Top = content.Load <Texture2D>("64x64/Door_Right_Bot_Top");
            //Right Door
            Texture2D Door_Left_Top_Right  = content.Load <Texture2D>("64x64/Door_Left_Top_Right");
            Texture2D Door_Mid_Top_Right   = content.Load <Texture2D>("64x64/Door_Mid_Top_Right");
            Texture2D Door_Right_Top_Right = content.Load <Texture2D>("64x64/Door_Right_Top_Right");
            Texture2D Door_Left_Bot_Right  = content.Load <Texture2D>("64x64/Door_Left_Bot_Right");
            Texture2D Door_Mid_Bot_Right   = content.Load <Texture2D>("64x64/Door_Mid_Bot_Right");
            Texture2D Door_Right_Bot_Right = content.Load <Texture2D>("64x64/Door_Right_Bot_Right");
            //Bottom Door
            Texture2D Door_Left_Top_Bottom  = content.Load <Texture2D>("64x64/Door_Left_Top_Bottom");
            Texture2D Door_Mid_Top_Bottom   = content.Load <Texture2D>("64x64/Door_Mid_Top_Bottom");
            Texture2D Door_Right_Top_Bottom = content.Load <Texture2D>("64x64/Door_Right_Top_Bottom");
            Texture2D Door_Left_Bot_Bottom  = content.Load <Texture2D>("64x64/Door_Left_Bot_Bottom");
            Texture2D Door_Mid_Bot_Bottom   = content.Load <Texture2D>("64x64/Door_Mid_Bot_Bottom");
            Texture2D Door_Right_Bot_Bottom = content.Load <Texture2D>("64x64/Door_Right_Bot_Bottom");
            //Left Door
            Texture2D Door_Left_Top_Left  = content.Load <Texture2D>("64x64/Door_Left_Top_Left");
            Texture2D Door_Mid_Top_Left   = content.Load <Texture2D>("64x64/Door_Mid_Top_Left");
            Texture2D Door_Right_Top_Left = content.Load <Texture2D>("64x64/Door_Right_Top_Left");
            Texture2D Door_Left_Bot_Left  = content.Load <Texture2D>("64x64/Door_Left_Bot_Left");
            Texture2D Door_Mid_Bot_Left   = content.Load <Texture2D>("64x64/Door_Mid_Bot_Left");
            Texture2D Door_Right_Bot_Left = content.Load <Texture2D>("64x64/Door_Right_Bot_Left");

            //Carpet
            Texture2D Carpet_Top_Left  = content.Load <Texture2D>("64x64/Carpet_Left_Top_Corner");
            Texture2D Carpet_Top_Mid   = content.Load <Texture2D>("64x64/Carpet_Top_Mid");
            Texture2D Carpet_Top_Right = content.Load <Texture2D>("64x64/Carpet_Top_Right_Corner");
            Texture2D Carpet_Left_Mid  = content.Load <Texture2D>("64x64/Carpet_Left_Mid");
            Texture2D Carpet_Left_Bot  = content.Load <Texture2D>("64x64/Carpet_Left_Bot_Corner");
            Texture2D Carpet_Bot_Mid   = content.Load <Texture2D>("64x64/Carpet_Bot_Mid");
            Texture2D Carpet_Bot_Right = content.Load <Texture2D>("64x64/Carpet_Bot_Right_Corner");
            Texture2D Carpet_Right_Mid = content.Load <Texture2D>("64x64/Carpet_Right_Mid");
            Texture2D Carpet_Mid       = content.Load <Texture2D>("64x64/Carpet_Mid");


            //Misc.
            Texture2D Brazier             = content.Load <Texture2D>("64x64/Brazier");
            Texture2D Rocks               = content.Load <Texture2D>("64x64/Rocks");
            Texture2D ShieldTop           = content.Load <Texture2D>("64x64/Wall_Right_Top_Low_Shield");
            Texture2D ShieldRight         = content.Load <Texture2D>("64x64/Wall_Right_Right_Low_Shield");
            Texture2D ShieldBot           = content.Load <Texture2D>("64x64/Wall_Right_Bot_Low_Shield");
            Texture2D ShieldLeft          = content.Load <Texture2D>("64x64/Wall_Right_Left_Low_Shield");
            Texture2D ShieldAndSwordTop   = content.Load <Texture2D>("64x64/Wall_Right_Top_Low_SwordShield");
            Texture2D ShieldAndSwordRight = content.Load <Texture2D>("64x64/Wall_Right_Right_Low_SwordShield");
            Texture2D ShieldAndSwordBot   = content.Load <Texture2D>("64x64/Wall_Right_Bot_Low_SwordShield");
            Texture2D ShieldAndSwordLeft  = content.Load <Texture2D>("64x64/Wall_Right_Left_Low_SwordShield");
            Texture2D wall      = content.Load <Texture2D>("Wall");
            Texture2D ground    = content.Load <Texture2D>("Ground");
            Texture2D DoorFront = content.Load <Texture2D>("DoorFront1");
            Texture2D Shop      = content.Load <Texture2D>("Shop");
            #endregion

            #region Added textures to list
            AddTexture(wall);
            AddTexture(piller);
            AddTexture(ground);
            AddTexture(DoorFront);
            AddTexture(wallTopCorLeft);
            AddTexture(wallTopCorLeft2);
            AddTexture(wallTopLeft);
            AddTexture(wallTopLeft2);
            AddTexture(wallMidLeftTop);
            AddTexture(wallMidLeftLow);
            AddTexture(wallBotLeft2);
            AddTexture(wallBotLeft1);
            AddTexture(wallBotCorLeft1);
            AddTexture(wallBotCorLeft2);
            AddTexture(floorPattern1);
            AddTexture(wallBotLow);
            AddTexture(wallTopLow);
            AddTexture(wallBottomLeft1);
            AddTexture(wallBottomLeft2);
            AddTexture(wallBottomMiddle1);
            AddTexture(wallBottomMiddle2);
            AddTexture(wallBottomRight2);
            AddTexture(wallBottomRight1);
            AddTexture(wallCornerBottomRight1);
            AddTexture(wallCornerBottomRight2);
            AddTexture(wallLeftBotLow);
            AddTexture(wallRightBotLow);
            AddTexture(wallRightLeft1);
            AddTexture(wallRightLeft2);
            AddTexture(wallRightMiddle1);
            AddTexture(wallRightMiddle2);
            AddTexture(wallRightTop2);
            AddTexture(wallRightTop1);
            AddTexture(wallCornerTopRight1);
            AddTexture(wallCornerTopRight2);
            AddTexture(wallLeftRightLow);
            AddTexture(wallRightRightLow);
            AddTexture(wallTopRight1);
            AddTexture(wallTopRight2);
            AddTexture(wallTopMiddle1);
            AddTexture(wallTopMiddle2);
            AddTexture(wallTopLeft_1);
            AddTexture(wallTopLeft_2);
            AddTexture(wallLeftTopLow);
            AddTexture(wallRightTopLow);
            AddTexture(floorPattern2);
            AddTexture(Door_Left_Top_Top);
            AddTexture(Door_Mid_Top_Top);
            AddTexture(Door_Right_Top_Top);
            AddTexture(Door_Left_Bot_Top);
            AddTexture(Door_Mid_Bot_Top);
            AddTexture(Door_Right_Bot_Top);
            AddTexture(Door_Left_Top_Right);
            AddTexture(Door_Mid_Top_Right);
            AddTexture(Door_Right_Top_Right);
            AddTexture(Door_Left_Bot_Right);
            AddTexture(Door_Mid_Bot_Right);
            AddTexture(Door_Right_Bot_Right);
            AddTexture(Door_Left_Top_Bottom);
            AddTexture(Door_Mid_Top_Bottom);
            AddTexture(Door_Right_Top_Bottom);
            AddTexture(Door_Left_Bot_Bottom);
            AddTexture(Door_Mid_Bot_Bottom);
            AddTexture(Door_Right_Bot_Bottom);
            AddTexture(Door_Left_Top_Left);
            AddTexture(Door_Mid_Top_Left);
            AddTexture(Door_Right_Top_Left);
            AddTexture(Door_Left_Bot_Left);
            AddTexture(Door_Mid_Bot_Left);
            AddTexture(Door_Right_Bot_Left);
            AddTexture(Brazier);
            AddTexture(Rocks);
            AddTexture(ShieldTop);
            AddTexture(ShieldRight);
            AddTexture(ShieldBot);
            AddTexture(ShieldLeft);
            AddTexture(ShieldAndSwordTop);
            AddTexture(ShieldAndSwordRight);
            AddTexture(ShieldAndSwordBot);
            AddTexture(ShieldAndSwordLeft);
            AddTexture(Carpet_Top_Left);
            AddTexture(Carpet_Top_Mid);
            AddTexture(Carpet_Top_Right);
            AddTexture(Carpet_Left_Mid);
            AddTexture(Carpet_Left_Bot);
            AddTexture(Carpet_Bot_Mid);
            AddTexture(Carpet_Bot_Right);
            AddTexture(Carpet_Right_Mid);
            AddTexture(Carpet_Mid);
            #endregion
        }