static void Main()
        {
            CreateCacheDirectory();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //Настан кој ќе се повика пред да терминира процесот
            AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit);

            SettingsForm settingsForm = new SettingsForm();
            DialogResult result = settingsForm.ShowDialog();
            if (result != DialogResult.OK)
            {
                settingsForm.Dispose();
                return;
            }

            bool fullScreen = settingsForm.Fullscreen;
            GraphicDetails graphicDetails = settingsForm.GraphicDetails;
            settingsForm.Dispose();

            GameWindow window = new GameWindow(fullScreen);
            Thread windowThread = new Thread(() => Program.StartGameWindow(window));
            windowThread.Start();

            Thread gameThread = new Thread(() => Program.StartNewGame(window, graphicDetails));
            gameThread.Start();
        }
        private static void StartNewGame(GameWindow window, GraphicDetails details)
        {
            int gameUpdatePeriod = 16; //~60 FPS
            //int gameUpdatePeriod = 9; //debugging;

            GameArkanoid.GetInstance().GraphicDetails = details;
            window.StartGameFramework(new GameFramework(GameArkanoid.GetInstance(), gameUpdatePeriod));
        }
 private static void StartGameWindow(GameWindow window)
 {
     Application.Run(window);
 }