Beispiel #1
0
    protected override void InternalDraw(GRAPHICS spriteBatch, Entry e)
    {
        base.InternalDraw(spriteBatch, e);

        spriteBatch.Draw(TEXTURE.Pixel, new RECT(0, offset.M32, 800, 1), COLOR.Lime, 0, 0, 0.5f, EFlip.None);
        spriteBatch.Draw(TEXTURE.Pixel, new RECT(offset.M31, 0, 1, 800), COLOR.Lime, 0, 0.5f, 0, EFlip.None);

        spriteBatch.Begin(offset);

        if (animation != null)
        {
            VECTOR2 pivotPoint = UIElement.CalcPivotPoint(VECTOR2.One, pivots[pivot]);
            spriteBatch.Draw(animation, VECTOR2.Zero, 0, pivotPoint.X, pivotPoint.Y);
        }

        for (int i = 0; i < rects.Count; i++)
        {
            spriteBatch.Draw(area, rects[i]);
        }
        if (Creating)
        {
            spriteBatch.Draw(area, RECT.CreateRectangle(start, GetCurrentPosition()));
        }

        spriteBatch.End();

        {
            VECTOR2 pivotPoint = UIElement.CalcPivotPoint(new VECTOR2(200, 200), pivots[pivot]);
            spriteBatch.Draw(TEXTURE.Pixel, new VECTOR2(offset.M31 + pivotPoint.X - 100, offset.M32 + pivotPoint.Y - 100), COLOR.Red, 0, 0.5f, 0.5f, 5, 5);
        }
    }
Beispiel #2
0
    protected override void InternalDraw(GRAPHICS spriteBatch, Entry e)
    {
        base.InternalDraw(spriteBatch, e);

        spriteBatch.Begin(offset);

        for (int i = 0; i < tile.Length; i++)
        {
            spriteBatch.Draw(tileTexture, tile[i]);
        }

        spriteBatch.Draw(anime, chara.Location, 0, 0, 0, 1, 1, flip);
        spriteBatch.Draw(charaTexture, chara);

        spriteBatch.End();
    }
Beispiel #3
0
    void DrawThumbnail(UIElement sender, GRAPHICS sb, Entry e)
    {
        var box = map.BoundingBox;

        VECTOR2 offset;
        float   scale;

        __GRAPHICS.ViewAdapt(box.Size, TBThumnail.Size, out scale, out offset);

        sb.Begin(MATRIX2x3.CreateTransform(0, box.X, box.Y, scale, scale, TBThumnail.X + offset.X, TBThumnail.Y + offset.Y));

        foreach (var item in map.Terrains)
        {
            item.Draw();
        }

        //VECTOR2 p1 = VECTOR2.Transform(VECTOR2.Zero, offsetInvert);
        //VECTOR2 p2 = VECTOR2.Transform(TBMap.Size, offsetInvert);
        //RECT rect = RECT.CreateRectangle(p1, p2);
        //__GRAPHICS.Draw(patchViewport, rect);

        sb.End();
    }
Beispiel #4
0
    protected override void InternalDraw(GRAPHICS spriteBatch, Entry e)
    {
        base.InternalDraw(spriteBatch, e);

        #region 绘制网格
        if (display)
        {
            int size = (int)(MAP.GRID * offset.M11);

            int  col = (int)TBMap.Width / size / 2 + 1;
            int  row = (int)TBMap.Height / size / 2 + 1;
            RECT rect;
            rect.X      = 0;
            rect.Width  = TBMap.Width;
            rect.Height = 1;
            for (int i = -row; i <= row; i++)
            {
                rect.Y = TBMap.Height * 0.5f + offset.M32 % size - TBMap.Height * 0.5f % size + i * size;
                spriteBatch.Draw(TEXTURE.Pixel, rect, COLOR.Lime, 0, 0, 0.5f, EFlip.None);
            }
            rect.Y      = 0;
            rect.Width  = 1;
            rect.Height = TBMap.Height;
            for (int i = -col; i <= col; i++)
            {
                rect.X = TBMap.Width * 0.5f + offset.M31 % size - TBMap.Width * 0.5f % size + i * size;
                spriteBatch.Draw(TEXTURE.Pixel, rect, COLOR.Lime, 0, 0.5f, 0, EFlip.None);
            }
        }
        #endregion

        spriteBatch.Begin(offset);

        #region 绘制地图
        foreach (var item in map.Terrains)
        {
            item.Draw();
        }
        foreach (var item in map.Terrains)
        {
            if (item.Texture == null)
            {
                item.DrawHitArea();
            }
        }
        if (display)
        {
            foreach (var item in map.Terrains)
            {
                if (item.Texture != null)
                {
                    item.Draw();
                }
            }
            // 绘制地形的格子
            foreach (var item in map.Terrains)
            {
                spriteBatch.Draw(TEXTURE.Pixel, new RECT(item.X, item.Y, MAP.GRID, MAP.GRID), new COLOR(255, 255, 0, 32), 0, 0, 1, EFlip.None);
            }
            // 绘制地形碰撞信息

            // 绘制地形锁定信息
            foreach (var item in map.Terrains)
            {
                if (item.Lock == ELockMode.LockBack)
                {
                    font.Text = "←";
                    font.Draw(spriteBatch, new RECT(item.X, item.Y - MAP.GRID, MAP.GRID, MAP.GRID));
                }
                else if (item.Lock == ELockMode.LockForward)
                {
                    font.Text = "→";
                    font.Draw(spriteBatch, new RECT(item.X, item.Y - MAP.GRID, MAP.GRID, MAP.GRID));
                }
            }
        }
        #endregion

        spriteBatch.Draw(TEXTURE.Pixel, VECTOR2.Zero, COLOR.Yellow, 0, 0.5f, 0.5f, 5, 5);

        VECTOR2 position = GetCurrentPosition();
        #region 绘制当前绘制项

        // 绘制当前选中的格子
        spriteBatch.Draw(patchSelectedGrid, new RECT(position.X, position.Y, MAP.GRID, MAP.GRID), 0, 0, 1);

        if (painting.ID != 0)
        {
            if (painting.Texture == null)
            {
                painting.Data.DrawHitArea(position.X, position.Y - painting.Data.BoundingBox.Height, 1);
            }
            else
            {
                spriteBatch.Draw(painting.Texture, new VECTOR2(painting.X, painting.Y), new COLOR(255, 255, 255, 160), 0, 0, 1, 1, 1, painting.Data.Flip);
            }
        }

        #endregion

        spriteBatch.End();
    }