Ejemplo n.º 1
0
        public override void Draw(Equestribatch sb)
        {
            if (!entryComplete)
            {
                _displayColor = Color.Multiply(Color.White, timer / ENTRYTIME);
            }
            if (delayComplete && !exitComplete)
            {
                _displayColor = Color.Multiply(Color.White, 1 - (timer / EXITTIME));
            }
            sb.Begin();

            if (entryComplete && !displayComplete)
            {
                sb.DrawString(_fontDisplay, (goldRecieved >= 0 ? "+" : "") + goldRecieved,
                              Vector2.Lerp(_displayPos, _displayPos - new Vector2(0, 128), timer / DISPLAYTIME),
                              Color.Multiply(goldRecieved >= 0 ? Color.Yellow : Color.Red, 1 - (timer / DISPLAYTIME)));
            }

            //sb.DrawString(_fontDisplay, "" + goldDisplayed, _displayPos + Vector2.One, );
            sb.DrawString(_fontDisplay, "" + goldDisplayed, _displayPos, _displayColor);
            sb.Draw(_bits.Texture, _displayPos - new Vector2(38, -8), _displayColor);

            sb.End();

            base.Draw(sb);
        }
 public override void Draw(Equestribatch sb)
 {
     sb.Begin();
     sb.Draw(_windowTarget.Texture, new Rectangle((int)Position.X, (int)Position.Y, WIDGET_WIDTH, WIDGET_HEIGHT), Color.White);
     sb.End();
     base.Draw(sb);
 }
        public void RunTarget(
            System.Action <Equestribatch> _method,
            Color?clearColor     = null,
            EffectObject effect  = null,
            SamplerState sampler = null)
        {
            if (_inUse)
            {
                Systems.ConsoleWindow.WriteLine("Tried used Target Asset while it was already in use");
                return;
            }
            if (!_ready)
            {
                Systems.ConsoleWindow.WriteLine("Render Target is not ready for use");
                return;
            }
            BeginTarget();
            devRef.Clear((clearColor == null ? Color.Black : clearColor.Value));
            targetBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, sampler, null, null, effect);

            _method.Invoke(targetBatch);

            targetBatch.End();
            EndTarget();
        }
Ejemplo n.º 4
0
 public override void Draw(Equestribatch sb)
 {
     sb.Begin();
     sb.Draw(_windowTarget.Texture, new Rectangle((int)Position.X, (int)Position.Y, WIDGET_WIDTH, WIDGET_HEIGHT), Color.White);
     sb.End();
     base.Draw(sb);
 }
Ejemplo n.º 5
0
        public override void Draw(Equestribatch sb)
        {
            sb.Begin();

            sb.Draw(_popText.Texture, Position, _popText[STAR_NAME], Color.Yellow,
                    _starRotation, _popText[STAR_NAME].Center, 1, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0.0f);

            Color textColor;

            switch (_type)
            {
            case PopType.HealthPop:
                textColor = Color.Green;
                break;

            case PopType.PDamagePop:
                textColor = Color.Red;
                break;

            case PopType.EDamagePop:
                textColor = Color.White;
                break;

            default:
                textColor = Color.Violet;
                break;
            }

            sb.Draw(_number.Texture, Position, null, textColor,
                    0.0f, new Vector2(_number.Width / 2, _number.Height / 2), 1, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0.0f);

            sb.End();

            //base.Draw(sb);
        }
Ejemplo n.º 6
0
        public static void GenerateTextureObjectFromPopText(out TextureObject output, int num, Color?color = null)
        {
            TextureAtlas atlas = EngineGlobals.AssetManager.GetTexture("{pop_text}") as TextureAtlas;

            string temp = "" + num;
            int    width = 0, height = 0;

            for (int i = 0; i < temp.Length; i++)
            {
                var rect = atlas["num_" + temp[i]];
                width += rect.Width;
                if (rect.Height > height)
                {
                    height = rect.Height;
                }
            }

            RenderTarget2D _textTarget = new RenderTarget2D(Device_Ref, width, height);

            Device_Ref.SetRenderTarget(_textTarget);
            Device_Ref.Clear(color == null ? Color.Black : color.Value);

            Equestribatch batch        = new Equestribatch(Device_Ref);

            batch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
            int lastWidth = 0;

            for (int i = 0; i < temp.Length; i++)
            {
                batch.Draw(atlas.Texture, new Vector2(lastWidth, 0), atlas["num_" + temp[i]], Color.White);
                lastWidth += atlas["num_" + temp[i]].Width;
            }

            batch.End();

            Device_Ref.SetRenderTarget(null);

            output = EngineGlobals.AssetManager.CreateTextureObjectFromTarget("{" + temp + "}", _textTarget);

            _textTarget.Dispose();
        }
Ejemplo n.º 7
0
        public override void Draw(Equestribatch sb)
        {
            if (!entryComplete)
                _displayColor = Color.Multiply(Color.White, timer / ENTRYTIME);
            if (delayComplete && !exitComplete)
                _displayColor = Color.Multiply(Color.White, 1 - (timer / EXITTIME));
            sb.Begin();

            if(entryComplete && !displayComplete)
                sb.DrawString(_fontDisplay,(goldRecieved >= 0 ? "+" : "") + goldRecieved,
                    Vector2.Lerp(_displayPos,_displayPos - new Vector2(0,128),timer / DISPLAYTIME),
                    Color.Multiply(goldRecieved >= 0 ? Color.Yellow : Color.Red,1 - (timer/DISPLAYTIME)));

            //sb.DrawString(_fontDisplay, "" + goldDisplayed, _displayPos + Vector2.One, );
            sb.DrawString(_fontDisplay, "" + goldDisplayed, _displayPos, _displayColor);
            sb.Draw(_bits.Texture, _displayPos - new Vector2(38, -8), _displayColor);

            sb.End();

            base.Draw(sb);
        }
        public static void GenerateTextureObjectFromPopText(out TextureObject output,int num, Color? color = null)
        {
            TextureAtlas atlas = EquestriEngine.AssetManager.GetTexture("{pop_text}") as TextureAtlas;

            string temp = "" + num;
            int width = 0, height = 0;

            for (int i = 0; i < temp.Length; i++)
            {
                var rect = atlas["num_" + temp[i]];
                width += rect.Width;
                if (rect.Height > height)
                    height = rect.Height;
            }

            RenderTarget2D _textTarget = new RenderTarget2D(Device_Ref,width,height);
            Device_Ref.SetRenderTarget(_textTarget);
            Device_Ref.Clear(color == null ? Color.Black : color.Value);

            Equestribatch batch = new Equestribatch(Device_Ref);
            batch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
            int lastWidth = 0;
            for (int i = 0; i < temp.Length; i++)
            {
                batch.Draw(atlas.Texture, new Vector2(lastWidth, 0), atlas["num_" + temp[i]], Color.White);
                lastWidth += atlas["num_" + temp[i]].Width;
            }

            batch.End();

            Device_Ref.SetRenderTarget(null);

            output = EquestriEngine.AssetManager.CreateTextureObjectFromTarget("{"+temp+"}", _textTarget);

            _textTarget.Dispose();
        }
        public override void Draw(Equestribatch sb)
        {
            sb.Begin();

            sb.Draw(_popText.Texture, Position, _popText[STAR_NAME], Color.Yellow,
                _starRotation, _popText[STAR_NAME].Center, 1, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0.0f);

            Color textColor;

            switch (_type)
            {
                case PopType.HealthPop:
                    textColor = Color.Green;
                    break;
                case PopType.PDamagePop:
                    textColor = Color.Red;
                    break;
                case PopType.EDamagePop:
                    textColor = Color.White;
                    break;
                default:
                    textColor = Color.Violet;
                    break;
            }

            sb.Draw(_number.Texture, Position, null,textColor,
             0.0f, new Vector2(_number.Width / 2, _number.Height / 2), 1, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0.0f);

            sb.End();

            //base.Draw(sb);
        }
        public static void EndDrawSort()
        {
            _eqBatch.End();

            _eqBatch.GraphicsDevice.DepthStencilState = EquestriEngine.DepthState;
        }