private void Form1_Load(object sender, EventArgs e)
        {
            MinimumSize = new Size(Width, Height);
            MaximumSize = new Size(Width, Height);



            tableLayoutPanel1.BackColor = Color.Transparent;

            BackgroundImage       = Image.FromFile("../../Img/bg.png");
            BackgroundImageLayout = ImageLayout.Stretch;

            ca = new ControlArkanoid();

            ca.Dock = DockStyle.Fill;

            ca.Width  = Width;
            ca.Height = Height;

            ca.FinishGame = () =>
            {
                ca = null;
                ca = new ControlArkanoid();

                MessageBox.Show("Has perdido");

                ca.Hide();
                tableLayoutPanel1.Show();
            };
        }
        private void BttnStartGame_Click(object sender, EventArgs e)
        {
            GameData.InitializeGame();
            // Instanciacion y preparacion de UserControl
            ca = new ControlArkanoid
            {
                Dock = DockStyle.Fill,

                Width  = Width,
                Height = Height
            };

            // Seteo de Delegate que maneja el fin del juego
            ca.FinishGame = () =>
            {
                MessageBox.Show("Has perdido");

                ca.Hide();
                tableLayoutPanel1.Show();
            };

            // Seteo de Delegate que maneja cuando se gana el juego
            ca.WinningGame = () =>
            {
                PlayerController.CreateNewScore(currentPlayer.idPlayer, GameData.score);

                MessageBox.Show("Has ganado!");

                ca.Hide();
                tableLayoutPanel1.Show();
            };

            tableLayoutPanel1.Hide();

            FormRegister fr = new FormRegister();

            fr.gn = (string nick) =>
            {
                if (PlayerController.CreatePlayer(nick))
                {
                    MessageBox.Show($"Bienvenido nuevamenete {nick}");
                }
                else
                {
                    MessageBox.Show($"Gracias por registrarte {nick}");
                }

                currentPlayer = new Player(nick, 0);

                fr.Dispose();
            };

            fr.Show();

            Controls.Add(ca);
        }
        private void BttnStartGame_Click(object sender, EventArgs e)
        {
            tableLayoutPanel1.Hide();
            start = new LogIn {
                Dock = DockStyle.Fill
            };
            start.startGame = () =>
            {
                start.Dispose();
                Controls.Remove(start);
                Controls.Add(ca);
                bttnStartGame.Focus();

                ca.GamePage = (wo) =>
                {
                    gP = wo;
                };

                ca.TerminarJuego = () =>
                {
                    player.Score = DatosJuego.puntaje;
                    PlayerDAO.CreateNew(player);
                    DatosJuego.vidas           = 3;
                    DatosJuego.ticksRealizados = 0;
                    DatosJuego.puntaje         = 0;
                    Controls.Remove(ca);
                    ca = null;
                    ca = new ControlArkanoid
                    {
                        Dock = DockStyle.Fill,
                    };
                    ca.Width  = Width;
                    ca.Height = Height;

                    if (gP)
                    {
                        Controls.Add(w);
                    }
                    else
                    {
                        Controls.Add(gO);
                    }
                };
                bttnStartGame.Focus();
            };
            Controls.Add(start);
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            start = new LogIn {
                Dock = DockStyle.Fill
            };
            topScores = new HighScores {
                Dock = DockStyle.Fill
            };
            ca = new ControlArkanoid {
                Dock = DockStyle.Fill
            };
            ca.Width  = Width;
            ca.Height = Height;
            player    = new Player();

            gO = new GameOverUser
            {
                Dock = DockStyle.Fill
            };
            gO.backToMenu = () =>
            {
                Controls.Remove(gO);
                tableLayoutPanel1.Show();
            };

            w = new Winner
            {
                Dock = DockStyle.Fill
            };
            w.backToMenuW = () =>
            {
                Controls.Remove(w);
                tableLayoutPanel1.Show();
            };


            start.startGame = () =>
            {
                start.Dispose();
                Controls.Remove(start);
                Controls.Add(ca);
                bttnStartGame.Focus();

                ca.GamePage = (wo) =>
                {
                    gP = wo;
                };

                ca.TerminarJuego = () =>
                {
                    player.Score = DatosJuego.puntaje;
                    PlayerDAO.CreateNew(player);
                    DatosJuego.vidas           = 3;
                    DatosJuego.ticksRealizados = 0;
                    DatosJuego.puntaje         = 0;
                    Controls.Remove(ca);
                    ca = null;
                    ca = new ControlArkanoid
                    {
                        Dock = DockStyle.Fill,
                    };
                    ca.Width  = Width;
                    ca.Height = Height;

                    if (gP)
                    {
                        Controls.Add(w);
                    }
                    else
                    {
                        Controls.Add(gO);
                    }
                };
                bttnStartGame.Focus();
            };

            topScores.backMenu = () =>
            {
                Controls.Remove(topScores);
                tableLayoutPanel1.Show();
            };

            ca.GamePage = (wo) =>
            {
                gP = wo;
            };

            ca.TerminarJuego = () =>
            {
                player.Score = DatosJuego.puntaje;
                PlayerDAO.CreateNew(player);
                Controls.Remove(ca);
                DatosJuego.vidas           = 3;
                DatosJuego.puntaje         = 0;
                DatosJuego.ticksRealizados = 0;
                ca = null;
                ca = new ControlArkanoid
                {
                    Dock = DockStyle.Fill,
                };
                ca.Width  = Width;
                ca.Height = Height;

                if (gP)
                {
                    Controls.Add(w);
                }
                else
                {
                    Controls.Add(gO);
                }
            };
            bttnStartGame.Focus();
        }