⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cubeface.java

📁 一个java写的魔方游戏
💻 JAVA
字号:
// FrontEnd Plus GUI for JAD
// DeCompiled : CubeFace.class

import java.awt.Color;
import java.awt.Graphics;

class CubeFace extends Face
{

    int Height;
    int Width;
    Color ColorMap[][];
    int SquareX[];
    int SquareY[];
    int MapX[][];
    int MapY[][];

    CubeFace(int i, int j)
    {
        super(4);
        SquareX = new int[4];
        SquareY = new int[4];
        Height = i;
        Width = j;
        ColorMap = new Color[Height][Width];
        MapX = new int[Height + 1][Width + 1];
        MapY = new int[Height + 1][Width + 1];
    }

    void SetMap(Color acolor[][])
    {
        for(int i = 0; i < Height; i++)
        {
            for(int j = 0; j < Width; j++)
                ColorMap[i][j] = acolor[i][j];

        }

    }

    void SetMap(Color color, int i, int j)
    {
        ColorMap[i][j] = color;
    }

    public float Unproject(float f, float f1)
    {
        float f2 = ScreenVer[1].x;
        float f3 = ScreenVer[1].y;
        float f4 = ScreenVer[1].z;
        float f5 = ScreenVer[2].x;
        float f6 = ScreenVer[2].y;
        float f7 = ScreenVer[2].z;
        float f8 = ScreenVer[3].x;
        float f9 = ScreenVer[3].y;
        float f10 = ScreenVer[3].z;
        float f11 = f6 * f10 - f7 * f9;
        float f12 = f7 * f8 - f5 * f10;
        float f13 = f5 * f9 - f6 * f8;
        float f14 = f4 * f9 - f3 * f10;
        float f15 = f2 * f10 - f4 * f8;
        float f16 = f3 * f8 - f2 * f9;
        float f17 = f3 * f7 - f4 * f6;
        float f18 = f4 * f5 - f2 * f7;
        float f19 = f2 * f6 - f3 * f5;
        float f20 = f2 * f11 + f3 * f12 + f4 * f13;
        float f21 = f11 + f14 + f17;
        float f22 = f12 + f15 + f18;
        float f23 = f13 + f16 + f19;
        return (f20 - f21 * f - f22 * f1) / f23;
    }

    public void Paint(Graphics g, int i, int j)
    {
        for(int i2 = 0; i2 < VerNum; i2++)
        {
            ScreenX[i2] = (int)ScreenVer[i2].x + i / 2;
            ScreenY[i2] = j / 2 - (int)ScreenVer[i2].y;
        }

        float f = (float)(ScreenX[1] - ScreenX[0]) / (float)Width;
        float f1 = (float)(ScreenY[1] - ScreenY[0]) / (float)Width;
        float f2 = (float)(ScreenX[3] - ScreenX[0]) / (float)Height;
        float f3 = (float)(ScreenY[3] - ScreenY[0]) / (float)Height;
        for(int k = 0; k <= Height; k++)
        {
            for(int j1 = 0; j1 <= Width; j1++)
            {
                MapX[k][j1] = (int)((double)((float)ScreenX[0] + (float)j1 * f + (float)k * f2) + 0.5D);
                MapY[k][j1] = (int)((double)((float)ScreenY[0] + (float)j1 * f1 + (float)k * f3) + 0.5D);
            }

        }

        for(int l = 0; l < Height; l++)
        {
            for(int k1 = 0; k1 < Width; k1++)
            {
                SquareX[0] = MapX[l][k1];
                SquareX[1] = MapX[l][k1 + 1];
                SquareX[2] = MapX[l + 1][k1 + 1];
                SquareX[3] = MapX[l + 1][k1];
                SquareY[0] = MapY[l][k1];
                SquareY[1] = MapY[l][k1 + 1];
                SquareY[2] = MapY[l + 1][k1 + 1];
                SquareY[3] = MapY[l + 1][k1];
                g.setColor(ColorMap[l][k1]);
                g.fillPolygon(SquareX, SquareY, 4);
            }

        }

        g.setColor(Color.black);
        for(int i1 = 0; i1 <= Height; i1++)
            g.drawLine((int)((double)((float)ScreenX[0] + (float)i1 * f2) + 0.5D), (int)((double)((float)ScreenY[0] + (float)i1 * f3) + 0.5D), (int)((double)((float)ScreenX[1] + (float)i1 * f2) + 0.5D), (int)((double)((float)ScreenY[1] + (float)i1 * f3) + 0.5D));

        for(int l1 = 0; l1 <= Width; l1++)
            g.drawLine((int)((double)((float)ScreenX[0] + (float)l1 * f) + 0.5D), (int)((double)((float)ScreenY[0] + (float)l1 * f1) + 0.5D), (int)((double)((float)ScreenX[3] + (float)l1 * f) + 0.5D), (int)((double)((float)ScreenY[3] + (float)l1 * f1) + 0.5D));

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -