Example #1
0
        public Bullet(MainAsteroidsScene scene, int collideLayer) : base(scene)
        {
            polygonCollider            = new PolygonCollider(this, Core.Resources.Resources.Polygones.Bullet, scene.collidersWorld, collideLayer);
            polygonCollider.Tag        = "Bullet";
            polygonCollider.OnCollide += PolygonCollider_OnCollide;

            physic = new PhysicCore(this);

            polygonRender = new PolygonRender(this, Core.Resources.Resources.Polygones.Bullet);
            spriteRender  = new SpriteRender(this, Core.Resources.Resources.Sprites.Bullet);
            spriteRender.SetActive(false);
        }
Example #2
0
        public Asteroid(MainAsteroidsScene scene, SpriteInfo spriteInfo, Polygon polygon) : base(scene)
        {
            this.scene   = scene;
            SpriteRender = new SpriteRender(this, spriteInfo);
            SpriteRender.SetActive(false);

            PolygonRender = new PolygonRender(this, polygon);

            collider2D            = new PolygonCollider(this, polygon, scene.collidersWorld, 1);
            collider2D.OnCollide += Collider2D_OnCollide;
            collider2D.Tag        = "Asteroid";
            Physic = new PhysicCore(this);
        }
Example #3
0
        //private double m_scale;

        public LittleSharpRenderEngine(IEnvelope bbox, ICoordinateSystem coordinateSystem, Size size, Color background)
        {
            m_boundingBox    = bbox;
            m_targetCoordsys = coordinateSystem;
            m_canvas         = new Bitmap(size.Width, size.Height);
            m_graphics       = Graphics.FromImage(m_canvas);
            m_graphics.Clear(background);
            m_graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

            //m_graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;

            //m_graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
            //m_graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
            //m_graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

            PointRender      = new PointRender(new Render.Point().Render);
            LineStringRender = new LineStringRender(new Render.Line().Render);
            PolygonRender    = new PolygonRender(new Render.Area().Render);
        }
        //private double m_scale;

        public LittleSharpRenderEngine(IEnvelope bbox, ICoordinateSystem coordinateSystem, Size size, Color background)
        {
            m_boundingBox = bbox;
            m_targetCoordsys = coordinateSystem;
            m_canvas = new Bitmap(size.Width, size.Height);
            m_graphics = Graphics.FromImage(m_canvas);
            m_graphics.Clear(background);
            m_graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            
            //m_graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
            
            //m_graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
            //m_graphics.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
            //m_graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

            PointRender = new PointRender(new Render.Point().Render);
            LineStringRender = new LineStringRender(new Render.Line().Render);
            PolygonRender = new PolygonRender(new Render.Area().Render);
        }
Example #5
0
        public LaserRay(MainAsteroidsScene scene, SpaceShip space) : base(scene)
        {
            this.spaceShip = space;
            var   polygon = new Polygon(Resources.Polygones.Bullet);
            float maxDim  = Math.Max(scene.Dimensions.X, scene.Dimensions.Y);

            polygon.Scale(new Vector2(4, maxDim));
            polygon.Center      = new Vector2(0, maxDim);
            polygonCollider     = new PolygonCollider(this, polygon, scene.collidersWorld, 0);
            polygonCollider.Tag = "Bullet";
            PolygonRender       = new PolygonRender(this, polygon);

            var li        = Resources.Sprites.Laser;
            var origin    = new Vector2(li.Rect.Width / 2, li.Rect.Height);
            var spritInfo = new SpriteInfo(li.Texture, li.Rect, origin.ToVector2f());

            SpriteRender       = new SpriteRender(this, spritInfo);
            SpriteRender.Scale = new Vector2(1, maxDim / spritInfo.Rect.Height);
            SpriteRender.SetActive(false);
        }
Example #6
0
        public UFO(MainAsteroidsScene scene, SpaceShip spaceShip) : base(scene)
        {
            this.scene     = scene;
            this.spaceShip = spaceShip;
            Name           = "UFO";
            physic         = new PhysicCore(this);
            gun            = new Gun(scene, this, 0, physic, 1);

            gun.BulletSpeed    = 450;
            gun.BulletLifeTime = 1.5f;
            gun.FireRate       = 1.5f;

            var plgn = Core.Resources.Resources.Polygones.UFO;

            polygonCollider            = new PolygonCollider(this, plgn, scene.collidersWorld, 1);
            polygonCollider.OnCollide += PolygonCollider_OnCollide;
            polygonCollider.Tag        = Name;
            PolygonRender              = new PolygonRender(this, plgn);
            SpriteRender = new SpriteRender(this, Core.Resources.Resources.Sprites.UFO);
            SpriteRender.SetActive(false);
        }