Ejemplo n.º 1
0
    public Board()
    {
        GDevice     = LightFireCS.Graphics.GDevice.Get();
        Cam         = new LightFireCS.Graphics.Camera();
        TexMan      = LightFireCS.Graphics.TextureManager.Get();
        ModelLoader = LightFireCS.Graphics.ModelLoader.Get();
        InputDevice = LightFireCS.Input.IDevice.Get();
        TexMan.LoadTextureFromFile(@"g:\Programmieren\Chess\Models\WHITE.TGA");
        TexMan.LoadTextureFromFile(@"g:\Programmieren\Chess\Models\BLACK.TGA");
        TexMan.LoadTextureFromFile(@"g:\Programmieren\Chess\Models\BOARD.TGA");
        Cam.SetPosition(0, 20, 30);
        Cam.SetRotation(0, 0, 45);

        Cam.SetPosition(0, 30, 30);
        Cam.SetRotation(0, 0, 120);

        HomePosition();

        arrow = new Arrow(1, 1, true);

        /*ParseFen("rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1");
         * Render();
         * ParseFen("rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq c6 0 2");
         * Render();
         * ParseFen("rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2");
         * Render();*/
        //MoveFigure(1, 7, 2, 5);

        /*MoveFigure(2, 6, 2, 4);
         * MoveFigure(1, 1, 1, 3);
         * MoveFigure(1, 3, 2, 4);
         * RenderAscii();*/
    }
Ejemplo n.º 2
0
        public int[] PickPoint()
        {
            int mx, my;

            LightFireCS.Input.IDevice.Get().GetMousePos(out mx, out my);

            Vector3 pos, dir;

            GDevice.Get().RayFromPoint(mx, my, out pos, out dir);

            for (int x = 0; x < size - 1; x++)
            {
                for (int z = 0; z < size - 1; z++)
                {
                    Vector3 v1 = new Vector3(x * scaleXZ, terrain[x, z] * scaleY, z * scaleXZ);
                    Vector3 v2 = new Vector3(x * scaleXZ, terrain[x, z + 1] * scaleY, (z + 1) * scaleXZ);
                    Vector3 v3 = new Vector3((x + 1) * scaleXZ, terrain[x + 1, z + 1] * scaleY, (z + 1) * scaleXZ);

                    if (Intersection.RayTriangle(pos, dir, v1, v2, v3))
                    {
                        return(new int[] { x, z });
                    }

                    Vector3 v4 = new Vector3((x + 1) * scaleXZ, terrain[x + 1, z] * scaleY, z * scaleXZ);
                    if (Intersection.RayTriangle(pos, dir, v2, v3, v4))
                    {
                        return(new int[] { x, z });
                    }
                }
            }

            return(new int[] { -1, -1 });
        }
Ejemplo n.º 3
0
        public static GDevice Get()
        {
            if (null == instance)
            {
                instance = new GDevice();
            }

            return(instance);
        }