Esempio n. 1
0
        void InternalDraw(SizeF offset, float screenWidth, float screenHeight)
        {
            if (!Enabled)
            {
                return;
            }

            int frameCount = Function.Call <int>(Hash.GET_FRAME_COUNT);

            if (_lastDraw[_id] != frameCount)
            {
                _indexes[_id]  = 0;
                _lastDraw[_id] = frameCount;
            }
            if (_globalLastDrawFrame != frameCount)
            {
                _globalLevel         = 0;
                _globalLastDrawFrame = frameCount;
            }

            float scaleX      = Size.Width / screenWidth;
            float scaleY      = Size.Height / screenHeight;
            float positionX   = (Position.X + offset.Width) / screenWidth;
            float positionY   = (Position.Y + offset.Height) / screenHeight;
            float aspectRatio = Screen.AspectRatio;

            if (!Centered)
            {
                positionX += scaleX * 0.5f;
                positionY += scaleY * 0.5f;
            }

            MemoryAccess.DrawTexture(_id, _indexes[_id]++, _globalLevel++, 100, scaleX, scaleY / aspectRatio, 0.5f, 0.5f, positionX, positionY, Rotation * 0.00277777778f, aspectRatio, Color);
        }
        private void InternalDraw(SizeF offset, float screenWidth, float screenHeight)
        {
            if (!this.Enabled)
            {
                return;
            }
            int num1 = Function.Call <int>(Hash.GET_FRAME_COUNT, (InputArgument[])Array.Empty <InputArgument>());

            if (CustomSprite._lastDraw[this._id] != num1)
            {
                CustomSprite._indexes[this._id]  = 0;
                CustomSprite._lastDraw[this._id] = num1;
            }
            if (CustomSprite._globalLastDrawFrame != num1)
            {
                CustomSprite._globalLevel         = 0;
                CustomSprite._globalLastDrawFrame = num1;
            }
            SizeF size  = this.Size;
            float sizeX = size.Width / screenWidth;

            size = this.Size;
            float num2        = size.Height / screenHeight;
            float posX        = (this.Position.X + offset.Width) / screenWidth;
            float posY        = (this.Position.Y + offset.Height) / screenHeight;
            float aspectRatio = Screen.AspectRatio;

            if (!this.Centered)
            {
                posX += sizeX * 0.5f;
                posY += num2 * 0.5f;
            }
            MemoryAccess.DrawTexture(this._id, CustomSprite._indexes[this._id]++, CustomSprite._globalLevel++, 100, sizeX, num2 / aspectRatio, 0.5f, 0.5f, posX, posY, this.Rotation * (1f / 360f), aspectRatio, this.Color);
        }
Esempio n. 3
0
 private void InternalDraw(SizeF offset, float screenWidth, float screenHeight)
 {
     if (this.Enabled)
     {
         int num = Function.Call <int>(Hash.GET_FRAME_COUNT, Array.Empty <InputArgument>());
         if (_lastDraw[this._id] != num)
         {
             _indexes[this._id]  = 0;
             _lastDraw[this._id] = num;
         }
         if (_globalLastDrawFrame != num)
         {
             _globalLevel         = 0;
             _globalLastDrawFrame = num;
         }
         float sizeX       = this.Size.Width / screenWidth;
         float num7        = this.Size.Height / screenHeight;
         float posX        = (this.Position.X + offset.Width) / screenWidth;
         float posY        = (this.Position.Y + offset.Height) / screenHeight;
         float aspectRatio = Screen.AspectRatio;
         if (!this.Centered)
         {
             posX += sizeX * 0.5f;
             posY += num7 * 0.5f;
         }
         int num5  = this._id;
         int index = _indexes[num5];
         _indexes[num5] = index + 1;
         _globalLevel++;
         MemoryAccess.DrawTexture(this._id, index, _globalLevel, 100, sizeX, num7 / aspectRatio, 0.5f, 0.5f, posX, posY, this.Rotation * 0.002777778f, aspectRatio, this.Color);
     }
 }
Esempio n. 4
0
        public static void RawDraw(string filename, int time, PointF Position, SizeF Size, PointF center,
                                   float rotation, System.Drawing.Color color)
        {
            if (!File.Exists(filename))
            {
                throw new FileNotFoundException(filename);
            }

            int _id;

            if (_textures.ContainsKey(filename))
            {
                _id = _textures[filename];
            }
            else
            {
                _id = MemoryAccess.CreateTexture(filename);
                _textures.Add(filename, _id);
            }

            if (!_indexes.ContainsKey(_id))
            {
                _indexes.Add(_id, 0);
            }
            if (!_lastDraw.ContainsKey(_id))
            {
                _lastDraw.Add(_id, 0);
            }

            int frameCount = Function.Call <int>(Hash.GET_FRAME_COUNT);

            if (_lastDraw[_id] != frameCount)
            {
                _indexes[_id]  = 0;
                _lastDraw[_id] = frameCount;
            }
            if (_globalLastDrawFrame != frameCount)
            {
                _globalLevel         = 0;
                _globalLastDrawFrame = frameCount;
            }

            float aspectRatio = Screen.AspectRatio;

            MemoryAccess.DrawTexture(_id, _indexes[_id]++, _globalLevel++, 100, Size.Width, Size.Height, center.X, center.Y, Position.X, Position.Y, rotation * 0.00277777778f, aspectRatio, color);
        }
Esempio n. 5
0
        public static void RawDraw(string filename, int time, PointF Position, SizeF Size, PointF center, float rotation, System.Drawing.Color color)
        {
            int num;

            if (_textures.ContainsKey(filename))
            {
                num = _textures[filename];
            }
            else
            {
                if (!File.Exists(filename))
                {
                    throw new FileNotFoundException(filename);
                }
                num = MemoryAccess.CreateTexture(filename);
                _textures.Add(filename, num);
            }
            if (!_indexes.ContainsKey(num))
            {
                _indexes.Add(num, 0);
            }
            if (!_lastDraw.ContainsKey(num))
            {
                _lastDraw.Add(num, 0);
            }
            int num2 = Function.Call <int>(Hash.GET_FRAME_COUNT, Array.Empty <InputArgument>());

            if (_lastDraw[num] != num2)
            {
                _indexes[num]  = 0;
                _lastDraw[num] = num2;
            }
            if (_globalLastDrawFrame != num2)
            {
                _globalLevel         = 0;
                _globalLastDrawFrame = num2;
            }
            float aspectRatio = Screen.AspectRatio;
            int   num4        = num;
            int   index       = _indexes[num4];

            _indexes[num4] = index + 1;
            _globalLevel++;
            MemoryAccess.DrawTexture(num, index, _globalLevel, 100, Size.Width, Size.Height, center.X, center.Y, Position.X, Position.Y, rotation * 0.002777778f, aspectRatio, color);
        }
        public static void RawDraw(
            string filename,
            int time,
            PointF Position,
            SizeF Size,
            PointF center,
            float rotation,
            Color color)
        {
            int num1;

            if (CustomSprite._textures.ContainsKey(filename))
            {
                num1 = CustomSprite._textures[filename];
            }
            else
            {
                num1 = File.Exists(filename) ? MemoryAccess.CreateTexture(filename) : throw new FileNotFoundException(filename);
                CustomSprite._textures.Add(filename, num1);
            }
            if (!CustomSprite._indexes.ContainsKey(num1))
            {
                CustomSprite._indexes.Add(num1, 0);
            }
            if (!CustomSprite._lastDraw.ContainsKey(num1))
            {
                CustomSprite._lastDraw.Add(num1, 0);
            }
            int num2 = Function.Call <int>(Hash.GET_FRAME_COUNT, (InputArgument[])Array.Empty <InputArgument>());

            if (CustomSprite._lastDraw[num1] != num2)
            {
                CustomSprite._indexes[num1]  = 0;
                CustomSprite._lastDraw[num1] = num2;
            }
            if (CustomSprite._globalLastDrawFrame != num2)
            {
                CustomSprite._globalLevel         = 0;
                CustomSprite._globalLastDrawFrame = num2;
            }
            float aspectRatio = Screen.AspectRatio;

            MemoryAccess.DrawTexture(num1, CustomSprite._indexes[num1]++, CustomSprite._globalLevel++, 100, Size.Width, Size.Height, center.X, center.Y, Position.X, Position.Y, rotation * (1f / 360f), aspectRatio, color);
        }