小编Joe*_*Joe的帖子

每像素碰撞 - 代码说明

我目前正在尝试理解每像素碰撞检测.

这是我不明白的代码:

static bool IntersectPixels(Rectangle rectangleA, Color[] dataA,
                            Rectangle rectangleB, Color[] dataB)
{
    // Find the bounds of the rectangle intersection
    int top = Math.Max(rectangleA.Top, rectangleB.Top);
    int bottom = Math.Min(rectangleA.Bottom, rectangleB.Bottom);
    int left = Math.Max(rectangleA.Left, rectangleB.Left);
    int right = Math.Min(rectangleA.Right, rectangleB.Right);

    // Check every point within the intersection bounds
    for (int y = top; y < bottom; y++)
    {
        for (int x = left; x < right; x++)
        {
            // Get the color of both pixels at this point
            Color …
Run Code Online (Sandbox Code Playgroud)

c# xna

2
推荐指数
2
解决办法
5973
查看次数

标签 统计

c# ×1

xna ×1