Beispiel #1
0
        public Sprite(GameTexture defaultTexture, int width, int height)
        {
            this._defaultTexture = defaultTexture;

            this._width = width;
            this._height = height;
        }
Beispiel #2
0
        public Sprite(GameTexture defaultTexture)
        {
            this._defaultTexture = defaultTexture;

            this._width = defaultTexture.Texture2D.Width;
            this._height = defaultTexture.Texture2D.Height;
        }
        private static void LoadTextures()
        {
            Textures = new List<Objects.GameTexture>();

            _textureNames.ForEach(textureName =>
                {
                    string filePath = GraphicsManager.GraphicsFolder + @"\" + textureName + ".png";

                    using (FileStream fileStream = new FileStream(filePath, FileMode.Open))
                    {
                        var texture = Texture2D.FromStream(GraphicsManager.GraphicsDeviceManager.GraphicsDevice, fileStream);

                        GameTexture gameTexture = new GameTexture(texture, textureName);

                        Textures.Add(gameTexture);
                    }
                });
        }