Beispiel #1
0
        public static void startGame(bool firstTimeLoad)
        {
            if (!firstTimeLoad)
            {
                return;
            }

            try
            {
                textBox1          = new TextBox();
                textBox1.Location = new System.Drawing.Point(0, 0);
                textBox1.Name     = "textBox1";
                textBox1.ReadOnly = true;
                textBox1.Size     = new System.Drawing.Size(100, 20);
                textBox1.TabIndex = 0;

                SapiSpeech.initialize();
                DSound.initialize(textBox1.Handle);
                dxInput.DInputInit(textBox1);

                DSound.initializeOgg();
                Options.readFromFile();
                KeyMap.initialize();
                //this.Deactivate += new EventHandler(GUI_Deactivate);
                //this.Activated += new EventHandler(GUI_Activated);

                if (!Common.isRegistered())
                {
                    MessageBox.Show("This game is not registered. Please contact"
                                    + " BPCPrograms SD to obtain a license.",
                                    "Registration");
                }
                register();
                OggBuffer introSound = DSound.playOgg(DSound.SoundPath + "\\i.ogg");
                while ((introSound.isPlaying() && !dxInput.isKeyHeldDown()))
                {
                    Thread.Sleep(5);
                }
                introSound.stopOgg();
                introSound = null;
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message + " " + err.StackTrace, "Error",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                Environment.Exit(0);
            }
        }