Inheritance: Jurassic.Library.ObjectInstance
Beispiel #1
0
        public Person(string name, SpritesetInstance spriteset, bool destroy)
        {
#if(DEBUG)
            if (_debug1 == null)
                _debug1 = new ColorInstance(Program._engine, Color.Magenta);
            if (_debug2 == null)
                _debug2 = new ColorInstance(Program._engine, Color.Red);
#endif

            Name = name;
            DestroyOnMap = destroy;
            Speed = new Vector2f(1, 1);
            _innerSS = spriteset;

            Data = Program.CreateObject();
            _base = _innerSS.GetBase();

            _sprite = new Sprite(_innerSS.TextureAtlas.Texture);
            Mask = new Color(255, 255, 255);

            Scripts = new FunctionScript[5];

            string d = GetDirectionAt(0);
            if (!String.IsNullOrEmpty(d))
                Direction = d;
        }
Beispiel #2
0
 public static void GradientRectangle(double x, double y, double width, double height, ColorInstance c1, ColorInstance c2, ColorInstance c3, ColorInstance c4)
 {
     _verts[0] = new Vertex(new Vector2f((float)x, (float)y), c1.Color);
     _verts[1] = new Vertex(new Vector2f((float)(x + width), (float)y), c2.Color);
     _verts[2] = new Vertex(new Vector2f((float)(x + width), (float)(y + height)), c3.Color);
     _verts[3] = new Vertex(new Vector2f((float)x, (float)(y + height)), c4.Color);
     Program.Batch.AddVerts(_verts, 4);
 }
Beispiel #3
0
 public static ColorInstance BlendColorsWeighted(ColorInstance c1, ColorInstance c2, double w)
 {
     int R = (int)((int)c1["red"] * w + (int)c2["red"] * (1 - w));
     int G = (int)((int)c1["green"] * w + (int)c2["green"] * (1 - w));
     int B = (int)((int)c1["blue"] * w + (int)c2["blue"] * (1 - w));
     int A = (int)((int)c1["alpha"] * w + (int)c2["alpha"] * (1 - w));
     return new ColorInstance(_engine, R, G, B, A);
 }
Beispiel #4
0
        /// <summary>
        /// Draws this obstruction segement to the System.Drawings.Graphics.
        /// </summary>
        /// <param name="g">The System.Drawing.Graphics to use.</param>
        /// <param name="offset">The x/y offset to use.</param>
        /// <param name="zoom">The zoom factor to use.</param>
        public void Draw(ref Vector2f offset, ColorInstance color)
        {
            int x = _x1 + (int)offset.X;
            int y = _y1 + (int)offset.Y;
            int xx = _x2 + (int)offset.X;
            int yy = _y2 + (int)offset.Y;

            GlobalPrimitives.Line(x, y, xx, yy, color);
        }
Beispiel #5
0
 public static void GradientCircle(double x, double y, double radius, ColorInstance inner, ColorInstance outer, [DefaultParameterValue(false)] bool antialias = false)
 {
     Program.Batch.Flush();
     _circle.Radius = (float)radius;
     _circle.FillColor = inner.Color;
     _circle.Position = new Vector2f((float)x, (float)y);
     _circle.Origin = new Vector2f((float)radius, (float)radius);
     Target.Draw(_circle);
 }
Beispiel #6
0
 public static void FilledCircle(double x, double y, double radius, ColorInstance color)
 {
     Program.Batch.Flush();
     _circle.Radius = (float)radius;
     _circle.FillColor = color.Color;
     _circle.Position = new Vector2f((float)x, (float)y);
     _circle.Origin = new Vector2f((float)radius, (float)radius);
     Target.Draw(_circle);
 }
Beispiel #7
0
        public EmitterInstance(ScriptEngine engine, ImageInstance image, ColorInstance color, double life, double speed)
            : base(engine)
        {
            Image = image;
            ImgWidth = (int)image.Texture.Size.X;
            ImgHeight = (int)image.Texture.Size.Y;
            StartX = 0;
            StartY = 0;
            Life = life;
            Speed = speed;
            Color = color;

            PopulateFunctions();
        }
 public WindowStyleInstance Clone()
 {
     WindowStyleInstance wind = new WindowStyleInstance(Engine);
     wind["color"] = new ColorInstance(Engine, (ColorInstance)this["color"]);
     wind._backgroundMode = _backgroundMode;
     _edgeColors.CopyTo(wind._edgeColors, 0);
     _edgeOffsets.CopyTo(wind._edgeOffsets, 0);
     wind._edgeWidth = _edgeWidth;
     for (var i = 0; i < _textures.Length; ++i)
     {
         wind._textures[i] = new Texture(_textures[i]);
         wind._sprites[i] = new Sprite(wind._textures[i]);
     }
     wind._version = _version;
     return wind;
 }
 public void OutlinedRectangle(int x, int y, int w, int h, ColorInstance color)
 {
     _changed = true;
 }
 public void LineSeries(ArrayInstance points, ColorInstance color)
 {
     _changed = true;
 }
 public void OutlinedCircle(int ox, int oy, int r, ColorInstance color, [DefaultParameterValue(false)] bool antialias = false)
 {
     _changed = true;
 }
 public void GradientRectangle(int x, int y, int w, int h, ColorInstance c1, ColorInstance c2, ColorInstance c3, ColorInstance c4)
 {
     FillVert(0, x, y, c1.Color);
     FillVert(1, x + w, y, c2.Color);
     FillVert(2, x + w, y + h, c3.Color);
     FillVert(3, x, y + h, c4.Color);
     _batch.AddVerts(_verts, 4);
     _changed = true;
 }
 public void Line(int x1, int y1, int x2, int y2, ColorInstance color)
 {
     Color col = color.GetColor();
     Vertex[] _verts = new Vertex[2];
     _verts[0] = new Vertex(new Vector2f(x1, y1), col);
     _verts[1] = new Vertex(new Vector2f(x2, y2), col);
     _batch.AddVerts(_verts, 2, PrimitiveType.Lines);
     _changed = true;
 }
Beispiel #14
0
 static HWSurfaceInstance CreateSurface(int w, int h, ColorInstance color)
 {
     return new HWSurfaceInstance(_engine, w, h, color.Color);
 }
 public void GradientLine(int x1, int y1, int x2, int y2, ColorInstance col1, ColorInstance col2)
 {
     Vertex[] _verts = new Vertex[2];
     _verts[0] = new Vertex(new Vector2f(x1, y1), col1.GetColor());
     _verts[1] = new Vertex(new Vector2f(x2, y2), col2.GetColor());
     _batch.AddVerts(_verts, 2, PrimitiveType.Lines);
     _changed = true;
 }
Beispiel #16
0
        public void WrapBlitMask(int x1, int y1, int x2, int y2, ColorInstance col, [DefaultParameterValue(-1)] int width = -1, [DefaultParameterValue(-1)] int height = -1)
        {
            Color c = col.Color;
            float w = width < 0 ? (float)_image.Size.X : width;
            float h = height < 0 ? (float)_image.Size.Y : height;

            Vertex[] array = new Vertex[4];
            _image.Repeated = true;

            array[0] = new Vertex(new Vector2f(x1, y1), c, new Vector2f(x2, y2));
            array[1] = new Vertex(new Vector2f(x1 + w, y1), c, new Vector2f(x2 + w, y2));
            array[2] = new Vertex(new Vector2f(x1 + w, y1 + h), c, new Vector2f(x2 + w, y2 + h));
            array[3] = new Vertex(new Vector2f(x1, y1 + h), c, new Vector2f(x2, y2 + h));

            Program.Batch.Add(_image, array);
        }
Beispiel #17
0
 public void SetColorMask(ColorInstance color)
 {
     _color = color.Color;
 }
 public void ReplaceColor(ColorInstance colorA, ColorInstance colorB)
 {
     _changed = true;
 }
        public void BlitMaskSurface(HWSurfaceInstance surf, int x, int y, ColorInstance mask)
        {
            if (surf == null) return;
            if (surf._changed) { surf.Update(); }

            FloatRect dest = new FloatRect(x, y, _source.Width, _source.Height);
            _batch.Add(_atlastex, surf._source, dest, mask.Color);

            _changed = true;
        }
Beispiel #20
0
 public static EmitterInstance CreateEmitter(ImageInstance image, ColorInstance color, double life, double speed)
 {
     return new EmitterInstance(Program._engine, image, color, life, speed);
 }
Beispiel #21
0
        public void ZoomBlitMask(double x, double y, double z, ColorInstance color)
        {
            if (!Visible(x, y)) return;

            float wz = (float)(_source.Width * z);
            float hz = (float)(_source.Height * z);

            Program.Batch.Add(_image, _source, new FloatRect((float)x, (float)y, wz, hz), color.GetColor());
        }
Beispiel #22
0
 public void RotateBlitMask(double x, double y, double r, ColorInstance color)
 {
     if (!Visible(x, y)) return;
     Program.Batch.Add(_image, (float)x, (float)y, color.Color, r);
 }
 public void PointSeries(ArrayInstance array, ColorInstance color)
 {
     Color c = color.GetColor();
     Vertex[] verts = new Vertex[array.Length];
     for (var i = 0; i < array.Length; ++i)
     {
         Vector2f vect = GlobalPrimitives.GetVector(array[i] as ObjectInstance);
         verts[i] = new Vertex(vect, c);
     }
     _batch.AddVerts(verts, verts.Length, PrimitiveType.Points);
     _changed = true;
 }
Beispiel #24
0
 public void BlitMaskSurface(HWSurfaceInstance surf, int x, int y, ColorInstance mask)
 {
     if (surf._changed) { surf.Update(); }
     _myBatch.Add(surf._cache, (float)x, (float)y);
     _changed = true;
 }
 public void Rectangle(int x, int y, int w, int h, ColorInstance color)
 {
     Color col = color.Color;
     FillVert(0, x, y, ref col);
     FillVert(1, x + w, y, ref col);
     FillVert(2, x + w, y + h, ref col);
     FillVert(3, x, y + h, ref col);
     _batch.AddVerts(_verts, 4);
     _changed = true;
 }
Beispiel #26
0
 static ColorInstance BlendColors(ColorInstance c1, ColorInstance c2)
 {
     return BlendColorsWeighted(c1, c2, 0.5);
 }
 public void SetPixel(int x, int y, ColorInstance color)
 {
     Vertex[] verts = new Vertex[1] { new Vertex(new Vector2f(x, y), color.GetColor()) };
     _batch.AddVerts(verts, 1, PrimitiveType.Points);
     _changed = true;
 }
Beispiel #28
0
 public void Draw(ColorInstance color)
 {
     GlobalPrimitives.Line(Start.X, Start.Y, End.X, End.Y, color);
 }
Beispiel #29
0
 public ColorInstance(ScriptEngine parent, ColorInstance color)
     : this(parent, color._color)
 {
 }
Beispiel #30
0
 public static void SetPersonMask(string name, ColorInstance color)
 {
     Person value;
     if (PeopleTable.TryGetValue(name, out value))
     {
         value.Mask = color.GetColor();
     }
 }