public Chart2DSpriteContainer(SpriteSet<UVColorVertexData> sprites, FontGeometry fontGeo,
            VertexSurface<FastChart2DBarVertex> fastBarSurface = null)
        {
            this.line = (Sprite2DGeometry)sprites["line"].Geometry;
            this.point = (Sprite2DGeometry)sprites["point"].Geometry;

            this.surface = sprites.Surface;

            this.quadUV = sprites["quad"].Geometry.UV;

            this.font = fontGeo;

            this.ThinLineWidth = 0.015f;
            this.ThickLineWidth = 0.03f;
            this.SmallPointSize = 0.03f;
            this.LargePointSize = 0.1f;
            this.Color = Color.DeepPink;

            if (fastBarSurface != null)
            {
                this.fastBarSurface = fastBarSurface;
                this.fastBarSurface.AddSettings(sprites.Surface.Settings);
                this.fastBarSurface.AddSettings(
                    new Vector2Uniform("uv01", this.quadUV.TopLeft),
                    new Vector2Uniform("uv11", this.quadUV.TopRight),
                    new Vector2Uniform("uv00", this.quadUV.BottomLeft),
                    new Vector2Uniform("uv10", this.quadUV.BottomRight)
                    );
            }
        }
示例#2
0
        private void drawBarH(Vector3 position, float width, float height,
                              Sprite2DGeometry start, Sprite2DGeometry middle, Sprite2DGeometry end)
        {
            if (width < 0)
            {
                position.X += width;
                width      *= -1;
            }

            float endWidth = height * 0.25f;

            if (width < height * 0.5f)
            {
                endWidth    = width * 0.5f;
                position.X += height * 0.025f;
            }
            else
            {
                middle.Color = this.Color;
                middle.DrawRectangle(position.X + endWidth, position.Y, position.Z, width - endWidth * 2, height);
            }

            start.Color = this.Color;
            start.DrawRectangle(position.X, position.Y, position.Z, endWidth, height);

            end.Color = this.Color;
            end.DrawRectangle(position.X + width - endWidth, position.Y, position.Z, endWidth, height);
        }
        public Chart2DSpriteContainer(SpriteSet <UVColorVertexData> sprites, FontGeometry fontGeo,
                                      VertexSurface <FastChart2DBarVertex> fastBarSurface = null)
        {
            this.line  = (Sprite2DGeometry)sprites["line"].Geometry;
            this.point = (Sprite2DGeometry)sprites["point"].Geometry;

            this.surface = sprites.Surface;

            this.quadUV = sprites["quad"].Geometry.UV;

            this.font = fontGeo;

            this.ThinLineWidth  = 0.015f;
            this.ThickLineWidth = 0.03f;
            this.SmallPointSize = 0.03f;
            this.LargePointSize = 0.1f;
            this.Color          = Color.DeepPink;

            if (fastBarSurface != null)
            {
                this.fastBarSurface = fastBarSurface;
                this.fastBarSurface.AddSettings(sprites.Surface.Settings);
                this.fastBarSurface.AddSettings(
                    new Vector2Uniform("uv01", this.quadUV.TopLeft),
                    new Vector2Uniform("uv11", this.quadUV.TopRight),
                    new Vector2Uniform("uv00", this.quadUV.BottomLeft),
                    new Vector2Uniform("uv10", this.quadUV.BottomRight)
                    );
            }
        }
示例#4
0
文件: Civilian.cs 项目: amulware/ld33
        public Civilian(GameState game)
            : base(game)
        {
            this.sprite = (Sprite2DGeometry)GeometryManager.Instance.GetSprite("bloob").Geometry;

            this.controller = new CivilianController(game, this);
            this.eventListenerTileManager = new GameEventListenerTileManager(game, this);

            this.initialised = true;
        }
示例#5
0
        private Sprite2DGeometry createSpriteGeometry(IndexedSurface <UVColorVertexData> surface,
                                                      float w, float h)
        {
            var geo = new Sprite2DGeometry(surface)
            {
                Size = new Vector2(w, h)
            };

            return(geo);
        }
示例#6
0
        public Civilian(GameState game)
            : base(game)
        {
            this.sprite = (Sprite2DGeometry)GeometryManager.Instance.GetSprite("bloob").Geometry;

            this.controller = new CivilianController(game, this);
            this.eventListenerTileManager = new GameEventListenerTileManager(game, this);

            this.initialised = true;
        }
        public GeometryManager(SurfaceManager surfaces)
        {
            this.Primitives = new PrimitiveGeometry(surfaces.Primitives);

            var font = Font.FromJsonFile("data/fonts/inconsolata.json");

            this.Text = new FontGeometry(surfaces.Text, font)
            {
                SizeCoefficient = new Vector2(1, -1)
            };

            this.Agents = new HeatmapGeometry(surfaces.Agents);

            this.Blueprint      = new Sprite2DGeometry(surfaces.Blueprint);
            this.Blueprint.Size = new Vector2(1.2f, -0.7f);
        }
示例#8
0
        public HudGeometry(SpriteSet <UVColorVertexData> sprites)
        {
            this.barStart  = sprites["barStart"].Geometry as Sprite2DGeometry;
            this.barEnd    = sprites["barEnd"].Geometry as Sprite2DGeometry;
            this.barMiddle = sprites["barMiddle"].Geometry as Sprite2DGeometry;

            this.barThinStart  = sprites["barThinStart"].Geometry as Sprite2DGeometry;
            this.barThinEnd    = sprites["barThinEnd"].Geometry as Sprite2DGeometry;
            this.barThinMiddle = sprites["barThinMiddle"].Geometry as Sprite2DGeometry;

            this.barFilledStart  = sprites["barFilledStart"].Geometry as Sprite2DGeometry;
            this.barFilledEnd    = sprites["barFilledEnd"].Geometry as Sprite2DGeometry;
            this.barFilledMiddle = sprites["barFilledMiddle"].Geometry as Sprite2DGeometry;

            this.square       = sprites["square"].Geometry as Sprite2DGeometry;
            this.squareFilled = sprites["squarefilled"].Geometry as Sprite2DGeometry;

            this.surface = sprites.Surface;
        }
        public Layer(ISurfaceShader shader, ISurfaceShader wispShader, CrepuscularRayGeometry rayGeo, string filename, float brightness, int wisps)
        {
            this.rayGeo = rayGeo;
            var texture = new Texture("gfx/" + filename + ".png", true);

            this.surface = new PostProcessSurface();
            this.surface.AddSettings(
                new TextureUniform("diffuseTexture", texture),
                new ColorUniform("color", Color.GrayScale((byte)(255 * brightness)))
                );
            shader.UseOnSurface(this.surface);

            this.wispSurface = new IndexedSurface<UVColorVertexData>();
            wispShader.UseOnSurface(this.wispSurface);

            this.wispGeo = new Sprite2DGeometry(this.wispSurface)
            {
                Color = Color.White.WithAlpha()
            };

            this.wisps = Enumerable.Range(0, wisps)
                .Select(i => new Wisp()).ToList();
        }
示例#10
0
        public override void Initialize(Vector3 position, Vector3 velocity, Vector3 acceleration, float lifeTime, PercentageArray <Color> colorPs, PercentageArray <float> scalePs, PercentageArray <float> alphaPs, Sprite2DGeometry geo)
        {
            base.Initialize(position, velocity, acceleration, lifeTime, colorPs, scalePs, alphaPs, geo);

            this.position.Z     = 0;
            this.velocity.Z     = 0;
            this.acceleration.Z = 0;
        }
 public InfiniteParticleEmitter2D(Vector2 position, Sprite2DGeometry geo)
     : base(position, 1, geo)
 {
 }
            public void Draw(Sprite2DGeometry geo, CrepuscularRayGeometry rayGeo)
            {
                var p = this.center + new Vector2(GameMath.Cos(this.angle), GameMath.Sin(this.angle)) * this.radius;

                geo.Color = this.color;
                geo.DrawSprite(p, 0, this.size);
                geo.Color = Color.White;
                geo.DrawSprite(p, 0, this.size * 0.7f);

                rayGeo.Draw(p.WithZ(), this.size * 1.5f, 3);
            }