Beispiel #1
0
        Program(int _windowWidth, int _windowHeight, string _windowName) : base(_windowWidth, _windowHeight, GraphicsMode.Default, _windowName)
        {
            // LOAD ASSETS

            /* FIX */
            string assetOriginDir = Path.GetFullPath(Path.Combine(System.IO.Directory.GetCurrentDirectory(), @"..\..\assets\"));
            string directory      = Directory.GetCurrentDirectory() + @"\assets\";

            Directory.CreateDirectory(directory);
            FileInfo[] Files = new DirectoryInfo(assetOriginDir).GetFiles();
            foreach (FileInfo file in Files)
            {
                string dest = directory + file.Name;
                if (!File.Exists(dest))
                {
                    File.Copy(assetOriginDir + file.Name, dest);
                }
            }


            Icon        = new Icon(directory + "icon.ico");
            whitePawn   = new TysonBitmap(directory + "whitePawn.png");
            whiteRook   = new TysonBitmap(directory + "whiteRook.png");
            whiteBishop = new TysonBitmap(directory + "whiteBishop.png");
            whiteKnight = new TysonBitmap(directory + "whiteKnight.png");
            whiteKing   = new TysonBitmap(directory + "whiteKing.png");
            whiteQueen  = new TysonBitmap(directory + "whiteQueen.png");
            blackPawn   = new TysonBitmap(directory + "blackPawn.png");
            blackRook   = new TysonBitmap(directory + "blackRook.png");
            blackBishop = new TysonBitmap(directory + "blackBishop.png");
            blackKnight = new TysonBitmap(directory + "blackKnight.png");
            blackKing   = new TysonBitmap(directory + "blackKing.png");
            blackQueen  = new TysonBitmap(directory + "blackQueen.png");

            // SETUP
            GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            GL.Viewport(ClientRectangle);
            GL.LoadIdentity();
            GL.Ortho(0, Width, Height, 0, -1, 0);
            for (int i = 0; i < SQRNUM; i++)
            {
                chessBoardPositions[i] = new Vector2d(HALFSQRSIZE + ((i % RN) * SQRSIZE), HALFSQRSIZE + ((i / RN) * SQRSIZE));
            }
            swapTurn();
        }
Beispiel #2
0
 public static void rIMAGE(TysonBitmap image, double x, double y, double w, double h)
 {
     image.Render(x, y, w, h, Color.White);
 }
Beispiel #3
0
 void renderImage(Vector2d _pos, TysonBitmap _pic)
 {
     Toolbox.rIMAGE(_pic, _pos.X, _pos.Y, 25, 52);
 }