public Layer(Graphic graphic, uint height, uint width, EnumLayer id) { Graphic = graphic; Height = height; Width = width; Sprites = new ConcurrentBag <Tuple <Sprite, RenderStates> >(); SpritesAnimated = new ConcurrentBag <Tuple <SpriteAnimated, RenderStates> >(); Texts = new ConcurrentBag <Tuple <Text, RenderStates> >(); SpriteObjects = new ConcurrentBag <SpriteObject>(); }
//public void AddSprite(EnumLayer layer, Sprite sprite, RenderStates state) //{ // Layers[layer].AddSprite(sprite, state); //} //public RectangleShape AddRectangle(EnumLayer layer, int x, int y, int width, int height, Color color) //{ // var r = new Sprite(new Vector2f(width, height)); // r.Color = color; // RenderStates state = new RenderStates() // { // BlendMode = BlendMode.Alpha, // Transform = Transform.Identity // }; // state.Transform.Translate(x, y); // Layers[layer].AddDrawable(r, state); // return r; //} public Sprite AddSprite(EnumLayer layer, int x, int y, Color color, string textureName, int width = 0, int height = 0, bool repeated = false) { var r = SpriteFactory.Instance.GetSprite(textureName, width, height, repeated); r.Color = color; RenderStates state = new RenderStates() { BlendMode = new BlendMode(BlendMode.Factor.SrcAlpha, BlendMode.Factor.DstAlpha, BlendMode.Equation.Add), Transform = Transform.Identity }; state.Transform.Translate(x, y); Layers[layer].AddSprite(r, state); return(r); }
public Text AddText(EnumLayer layer, int x, int y, uint fontSize, Color color) { var t = new Text("", FontFactory.Instance.DefaultFont()); t.Color = color; t.CharacterSize = fontSize; RenderStates state = new RenderStates() { BlendMode = BlendMode.Alpha, Transform = Transform.Identity }; state.Transform.Translate(x, y); Layers[layer].AddText(t, state); return(t); }
public SpriteAnimated AddSpriteAnimated(EnumLayer layer, string textureName, int frameWidth, int frameHeight, int framesPerSecond, int x, int y, Color color, int firstFrame = 0, int lastFrame = 0, bool isAnimated = false, bool isLooped = true, int width = 0, int height = 0) { var r = SpriteFactory.Instance.GetSpriteAnimated(textureName, frameWidth, frameHeight, framesPerSecond, firstFrame, lastFrame, isAnimated, isLooped, width, height); r.Color = color; RenderStates state = new RenderStates() { BlendMode = BlendMode.Alpha, Transform = Transform.Identity }; state.Transform.Translate(x, y); Layers[layer].AddSpriteAnimated(r, state); return(r); }
public List <SpriteObject> RayCast(EnumLayer layer, int x, int y) { return(Layers[layer].RayCast(x, y)); }
public void ClearLayer(EnumLayer layer) { Layers[layer].Clear(); }
public SpriteObject AddSpriteObject(EnumLayer layer, SpriteObject sprite) { Layers[layer].AddSpriteObject(sprite); return(sprite); }