Exemplo n.º 1
0
Arquivo: Game.cs Projeto: Keilerr/csat
        public override void Update(float time)
        {
            visibleTime += time;

            if (player.PlayerState == OggPlayerStatus.Stopped)
            {
                player.Play();
            }

            if (tex == -1 || visibleTime > 1)
            {
                if (visibleTime < 100)
                {
                    misses++;
                }

                visibleTime = 0;
                x           = Rnd.Next(Settings.Width - 100);
                y           = Rnd.Next(Settings.Height - 100);
                tex         = Rnd.Next(2);
            }

            // end game. back to menu
            if (Keyboard[Key.Escape])
            {
                GameClass game = new GameMenu();  // menu
                BaseGame.SetGame(game);
                return;
            }

            base.Update(time);
        }
Exemplo n.º 2
0
        public override void Update(float time)
        {
            if (Mouse[MouseButton.Left])
            {
                float x = Mouse.X;
                float y = Mouse.Y;
                // orig size is 1024x768 (where coordinates below are taken)
                // so calculate x & y incase resolution is different than orig
                x = x / (float)Settings.Width * 1024f;
                y = y / (float)Settings.Height * 768f;

                if (y > 400 && y < 500)
                {
                    // start
                    if (x > 80 && x < 260)
                    {
                        GameClass game = new Game();  // start game
                        BaseGame.SetGame(game);
                        return;
                    }

                    // exit
                    if (x > 780 && x < 940)
                    {
                        Dispose();
                        BaseGame.Running = false; // end game
                        return;
                    }
                }
            }

            base.Update(time);
        }
Exemplo n.º 3
0
Arquivo: Main.cs Projeto: Keilerr/csat
        static void Main()
        {
            Log.Create("log.txt");
            Settings.ReadXML("settings.xml");

            Settings.ModelDir    = "../../data/model/";
            Settings.TextureDir  = "../../data/texture/";
            Settings.ShaderDir   = "../../data/shader/";
            Settings.ParticleDir = "../../data/particles/";

            int version;
            GraphicsContextFlags flags;

            if (Settings.UseGL3 == false)
            {
                flags   = GraphicsContextFlags.Default;
                version = 2;
            }
            else
            {
                flags   = GraphicsContextFlags.ForwardCompatible;
                version = 3;
            }
#if DEBUG
            flags |= GraphicsContextFlags.Debug;
#endif

            using (BaseGame bgame = new BaseGame("Project XYZ", version, 0, flags))
            {
#if !DEBUG
                try
#endif
                {
                    GameClass game = new Tests();
                    BaseGame.SetGame(game);
                    bgame.Run(120.0);
                }
#if !DEBUG
                catch (Exception e)
                {
                    Log.WriteLine("Main(): " + e.ToString());
                }
#endif
            }

            Log.WriteLine("Exiting..");
#if DEBUG
            //Console.ReadKey();
#endif
        }
Exemplo n.º 4
0
        static void Main()
        {
            Log.Create("log.txt");
            Settings.ReadXML("settings.xml");

            int version;
            GraphicsContextFlags flags;

            if (Settings.UseGL3 == false)
            {
                flags   = GraphicsContextFlags.Default;
                version = 2;
            }
            else
            {
                flags   = GraphicsContextFlags.ForwardCompatible;
                version = 3;
            }
#if DEBUG
            flags |= GraphicsContextFlags.Debug;
#endif

            using (BaseGame bgame = new BaseGame("Project XYZ", version, 0, flags))
            {
                BaseGame.Instance.WindowBorder = OpenTK.WindowBorder.Fixed;

#if !DEBUG
                try
#endif
                {
                    GameClass game = new Game();
                    BaseGame.SetGame(game);
                    bgame.Run(120.0);
                }
#if !DEBUG
                catch (Exception e)
                {
                    Log.WriteLine("Main(): " + e.ToString());
                }
#endif
            }

            Log.WriteLine("Exiting..");
#if DEBUG
            //Console.ReadKey();
#endif
        }
Exemplo n.º 5
0
Arquivo: Menu.cs Projeto: Keilerr/csat
        // starttaa esimerkki
        private void button1_Click(Object sender, EventArgs e)
        {
            Hide();

            DisplayDevice dev = DisplayDevice.Default;
            int           ind = comboBox1.SelectedIndex;

            string[] strs = ((string)(comboBox1.Items[ind])).Split('x');
            Settings.Width  = int.Parse(strs[0]);
            Settings.Height = int.Parse(strs[1]);
            Settings.Bpp    = int.Parse(strs[2]);

            // fullscreen?
            if (checkBox1.Checked)
            {
                Settings.FullScreen = true;
            }
            else
            {
                Settings.FullScreen = false;
            }

            int version;
            GraphicsContextFlags flags;

            if (Settings.UseGL3 == false)
            {
                flags   = GraphicsContextFlags.Default;
                version = 2;
            }
            else
            {
                flags   = GraphicsContextFlags.ForwardCompatible;
                version = 3;
            }
#if DEBUG
            flags |= GraphicsContextFlags.Debug;
#endif

            using (BaseGame bgame = new BaseGame("Project XYZ", version, 0, flags))
            {
#if !DEBUG
                try
#endif
                {
                    GameClass game = new Game();
                    BaseGame.SetGame(game);
                    bgame.Run(120.0);
                }
#if !DEBUG
                catch (Exception ex)
                {
                    Log.WriteLine(ex.ToString());
                }
#endif
            }

            GC.Collect();
            GC.WaitForPendingFinalizers();
            Show();
        }