Esempio n. 1
0
 public Light(Color color, FETexture lightTextureMask, int width, int height)
 {
     this.Color            = color;
     this.LightMaskTexture = lightTextureMask;
     this.Width            = width;
     this.Height           = height;
 }
Esempio n. 2
0
 public static void Initialize()
 {
     PixelTexture = new Texture2D(Engine.Graphics.GraphicsDevice, 1, 1);
     PixelTexture.SetData <Color>(new Color[] { Color.White });
     FEPixelTexture = new FETexture(PixelTexture);
     Font           = Engine.Instance.DefaultResourceContent.Load <SpriteFont>("defaultFont");
 }
Esempio n. 3
0
        public void AddObject(string layerName, FETexture texture, Point position, Point offset, Color color, float yPos)
        {
            var renderObject = NewRenderObject();

            renderObject.Texture     = texture;
            renderObject.Destination = new Rectangle(position.X + offset.X, position.Y + offset.Y, texture.Width, texture.Height);
            renderObject.Color       = color;
            renderObject.Y           = yPos;
            renderLayers.AddObjectToLayer(layerName, renderObject);
        }
Esempio n. 4
0
        public void AddObject(string layerName, FETexture texture, Rectangle destinationRect, Color color, float yPos)
        {
            var renderObject = NewRenderObject();

            renderObject.Texture     = texture;
            renderObject.Destination = destinationRect;
            renderObject.Color       = color;
            renderObject.Y           = yPos;
            renderLayers.AddObjectToLayer(layerName, renderObject);
        }
Esempio n. 5
0
 public Light(Color color, Vector2 position, int width, int height)
 {
     this.Color            = color;
     this.Position         = position;
     this.Width            = width;
     this.Height           = height;
     this.LightMaskTexture = Content.DefaultResource.LoadFETexture("LightMaskDefault");
     this.Width            = LightMaskTexture.Width;
     this.Height           = LightMaskTexture.Height;
 }
Esempio n. 6
0
 public SpriteComponent(FETexture texture, string layerName, int offsetX = 0, int offsetY = 0)
 {
     this.texture = texture;
     Width        = texture.Width;
     Height       = texture.Height;
     Color        = Color.White;
     LayerName    = layerName;
     OffsetX      = offsetX;
     OffsetY      = offsetY;
 }
Esempio n. 7
0
        public void AddTexture(string layerName, FETexture texture, Rectangle destination, Vector2 origin, float rotation, Color color)
        {
            if (renderLayers.TryGetValue(layerName, out var layer))
            {
                var pooledObject = renderObjectPool.Get();
                pooledObject.Texture     = texture;
                pooledObject.Destination = destination;
                pooledObject.Origin      = origin;
                pooledObject.Rotation    = rotation;
                pooledObject.Color       = color;

                layer.Add(pooledObject);
            }
            else
            {
                throw new ArgumentException($"No layer exists with name '{layerName}'.");
            }
        }
Esempio n. 8
0
        public Tileset(Texture2D tileSheet, int tileWidth, int tileHeight, int tileBuffer)
        {
            TileBuffer = tileBuffer;
            TileSheet  = tileSheet;
            TileWidth  = tileWidth;
            TileHeight = tileHeight;

            var tilesInRow    = tileSheet.Width / (tileWidth + tileBuffer + tileBuffer);
            var tilesInColumn = tileSheet.Height / (tileHeight + tileBuffer + tileBuffer);

            tiles = new FETexture[tileSheet.Width / tileWidth, tileSheet.Height / tileHeight];
            for (int x = 0; x < tilesInRow; x++)
            {
                for (int y = 0; y < tilesInColumn; y++)
                {
                    tiles[x, y] = new FETexture(TileSheet, new Rectangle(x * (tileWidth + tileBuffer * 2) + tileBuffer, y * (tileHeight + tileBuffer * 2) + tileBuffer, tileWidth, tileHeight));
                }
            }
        }