Ejemplo n.º 1
0
 public override void Render(Renderer renderer)
 {
     sprite.SetWidth(width + percent * (width_max - width));
     sprite.SetHeight(height + percent * (height_max - height));
     sprite.SetColor(new Color(1, 1, 1, 1 - percent));
     sprite.SetPosition(Pos_BindObject.X, Pos_BindObject.Y);
     renderer.DrawSprite(sprite);
 }
Ejemplo n.º 2
0
 public override void Render(Renderer renderer, float x, float y)
 {
     sprite.SetWidth(width + (1 - percent) * (1 - percent) * (width_max - width));
     sprite.SetHeight(height + (1 - percent)*(1 - percent) *(height_max - height));
     sprite.SetColor(new Color(1, 1, 1, 1));
     sprite.SetPosition(x, y);
     renderer.DrawSprite(sprite);
 }
Ejemplo n.º 3
0
 public virtual void Render(Renderer renderer, Vector2D Pos)
 {
     sprite.SetPosition(Pos.X, Pos.Y);
     renderer.DrawSprite(sprite);
     foreach (CollisionComponent c in AttackComponents)
     {
         c.Render(renderer);
     }
 }
Ejemplo n.º 4
0
 public virtual void Render(Renderer renderer)
 {
     renderer.DrawSprite(sprite);
     foreach (CollisionComponent c in AttackComponents)
     {
         c.Render(renderer);
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 提供一个分数参数,将其画下来
 /// </summary>
 /// <param name="isc">Score参数</param>
 /// <param name="distance">数字间的距离</param>
 public void DrawNumber(Renderer _renderer, IScore isc , float distance)
 {
     float alpha = isc.alpha;
     Vector2D vct = new Vector2D(isc.Position.X, isc.Position.Y);
     string num = isc.Score.ToString();
     char[] arr = num.ToArray<char>();
     int length = arr.Length;
     int len2 = length / 2;
     for (int i = 0; i < length; i++)
     {
         Sprite sp = score_number.GetNumber(arr[i].ToString());
         sp.SetPosition(vct.X + (i-len2) * distance, vct.Y);              //数字居中显示
         sp.SetColor(new Color(1, 1, 1, alpha*0.5f));
         _renderer.DrawSprite(sp);
     }
 }
Ejemplo n.º 6
0
 public override void Render(Renderer renderer)
 {
     if (Position.Y < 450)
     {
         sprite.SetPosition(Position.X, Position.Y);
         renderer.DrawSprite(sprite);
     }
     else
     {
         littleState.SetPosition(Position.X, 450);
         renderer.DrawSprite(littleState);
     }
 }
Ejemplo n.º 7
0
 public override void Render(Renderer renderer)
 {
     sprite.SetColor(new Color(1, 1, 1, alpha));
     sprite.SetPosition(Position.X, Position.Y);
     renderer.DrawSprite(sprite);
 }
Ejemplo n.º 8
0
 public virtual void Render(Renderer renderer)
 {
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 绘制文本
 /// </summary>
 /// <param name="renderer">着色器</param>
 /// <param name="str">提供字符串</param>
 /// <param name="x">书写坐标</param>
 /// <param name="y">书写坐标</param>
 /// <param name="percent">字体显示大小所占百分比</param>
 /// <param name="Col_diatanceMax">列的最大范围</param>
 /// <param name="color">想要展示的颜色</param>
 /// <param name="CharacterPercent">展示字体的百分比</param>
 public virtual void DrawString(Renderer renderer, string str, double x, double y, float percent,
    double Col_diatanceMax, Color color ,float CharacterPercent)
 {
     if (!Binded)
         throw new Exception("当前工具没有绑定字体");
     Sprite sprite;
     Extra.VariableSprite Chac = new Extra.VariableSprite();          //可变倍率纹理精灵
     massege.SetString(str);                          //绑定字符串
     int CurrentCharIndex = 0;                        //当前字符所在索引项
     Char[] Arr = str.ToCharArray();
     int count = Arr.Length;
     double offsetx = 0;
     int offsety = 0;
     float h_distance = percent * 24;
     for (int i = 0; i < count; i++)
     {
         string s = Arr[i].ToString();
         if (s == "\n")
         {
             offsetx = 0;
             offsety++;
             continue;
         }
         else if (s == " ") { offsetx += 24 * percent; CurrentCharIndex += 1; }
         else
         {
             double showP = massege.GetAttribute(CharacterPercent, CurrentCharIndex);
             sprite = SelectFont.GetAci(s);
             Chac.BindSprite(sprite);
             Chac.SetAttribute(x + offsetx, y - offsety * h_distance, showP,
                 (float)sprite.GetWidth() * percent, (float)sprite.GetHeight() * percent);
             showP = showP * showP * showP;
             Chac.SetColorVol(new Color(color.Red, color.Green, color.Blue, color.Alpha),
                 new Color(color.Red, color.Green, color.Blue, color.Alpha * (float)showP));
             sprite = Chac.GetSprite();
             double width = sprite.GetWidth();
             if (width < 16 * percent)
                 offsetx += 16 * percent + 1;
             else
                 offsetx += width + 1;       //至少保留1象素
             renderer.DrawSprite(sprite);
             CurrentCharIndex += 1;
         }
         if (offsetx >= Col_diatanceMax)
         {
             offsetx = 0;
             offsety++;
         }
     }
 }
Ejemplo n.º 10
0
 public virtual void DrawString(Renderer renderer, string str, double x, double y, float percent,
     double Col_diatanceMax, Color color)
 {
     if (!Binded)
         throw new Exception("当前工具没有绑定字体");
     Sprite sprite;
     Char[] Arr = str.ToCharArray();
     int count = Arr.Length;
     double offsetx = 0;
     int offsety = 0;
     float h_distance = percent * 24;
     for (int i = 0; i < count; i++)
     {
         string s = Arr[i].ToString();
         if (s == "\n")
         {
             offsetx = 0;
             offsety++;
             continue;
         }
         else if (s == " ") { offsetx += 24*percent; }
         else
         {
             sprite = SelectFont.GetAci(s);
             sprite.SetWidth((float)sprite.GetWidth() * percent);
             sprite.SetHeight((float)sprite.GetHeight() * percent);
             sprite.SetPosition(x + offsetx, y - offsety * h_distance);
             sprite.SetColor(color);
             double width = sprite.GetWidth();
             if (width < 16 * percent)
                 offsetx += 16 * percent+1;
             else
                 offsetx += width+1;       //至少保留1象素
             renderer.DrawSprite(sprite);
         }
         if (offsetx >= Col_diatanceMax)
         {
             offsetx = 0;
             offsety++;
         }
     }
 }
Ejemplo n.º 11
0
        /// <summary>
        /// 绘制字符串
        /// </summary>
        /// <param name="str">将要绘画的字符串</param>
        /// <param name="x">首字的对应显示坐标x</param>
        /// <param name="y">首字的对应显示坐标y</param>
        /// <param name="percent">字体显示的百分比(高度参照24,宽度自适应)</param>
        /// <param name="distance">字间的间距</param>
        /// <param name="ColMax">每行最多能显示的字的数量</param>
        public virtual void DrawString(Renderer renderer, string str, double x, double y,float percent,
            float distance , int ColMax )
        {
            if (!Binded)
                throw new Exception("当前工具没有绑定字体");
            Sprite sprite;
            Char[] Arr = str.ToCharArray();
            int count = Arr.Length;
            int offsetx = 0;
            int offsety = 0;
            float h_distance = percent * 24;
            for (int i = 0; i < count; i++)
            {
                string s = Arr[i].ToString();
                if (s == "\n")
                {
                    offsetx = 0;
                    offsety++;
                    continue;
                }
                else if (s == " ")
                {

                }
                else
                {
                    sprite = SelectFont.GetAci(s);
                    sprite.SetWidth((float)sprite.GetWidth() * percent);
                    sprite.SetHeight((float)sprite.GetHeight() * percent);
                    sprite.SetPosition(x + offsetx * distance, y - offsety * h_distance);
                    renderer.DrawSprite(sprite);
                }
                offsetx++;
                if (offsetx >= ColMax)
                {
                    offsetx = 0;
                    offsety++;
                }
            }
        }
Ejemplo n.º 12
0
 public override void Render(Renderer renderer, float x, float y)
 {
     sprite.SetPosition(x, y);
     renderer.DrawSprite(sprite, x, y, (float)R_angle);
 }
Ejemplo n.º 13
0
 public override void Render(Renderer renderer)
 {
     sprite.SetPosition(Position.X, Position.Y);
     renderer.DrawSprite(sprite, Position.X, Position.Y, (float)R_angle);
 }
Ejemplo n.º 14
0
 public virtual void Render(Renderer renderer, float x, float y)
 {
 }
Ejemplo n.º 15
0
 public override void Render(Renderer renderer)
 {
     //x,y是头的坐标位置,(以下是画出身体)
     float ag = 0;
     for (int i = bodycount-1; i > 0; i--)
     {
         sprites[i].SetPosition(positions[i].X, positions[i].Y);
         //方向定义为指向前一个块
         Vector2D vct = new Vector2D(positions[i].X - positions[i - 1].X,
             positions[i].Y - positions[i - 1].Y);
         //如果点没有发生变化,则跳过本次循环
         if (vct.X == 0 && vct.Y == 0)
             continue;
         vct.Normalize();
         ag = vct.getcurve();
         renderer.DrawSprite(sprites[i], positions[i].X, positions[i].Y, ag + 90);
     }
 }
Ejemplo n.º 16
0
 public virtual void Render(Renderer renderer)
 {
     if (effect != null)
     effect.Render(renderer);
 }