Пример #1
0
        public bool Initialize()
        {
            // Initialize the system configuration.
            if (Configuration == null)
            {
                Configuration = new SystemConfiguration();
            }

            // Initialize windows api.
            InitializeWindows();

            if (Input == null)
            {
                Input = new InputClass();
                if (!Input.Initialize(Configuration, MainForm.Handle))
                {
                    return(false);
                }
            }

            if (Graphics == null)
            {
                Graphics = new GraphicsClass();
                if (!Graphics.Initialize(Configuration, MainForm.Handle))
                {
                    return(false);
                }
            }

            // Create the sound object
            Sound = new WaveSound("sound01.wav");

            // Initialize the sound object.
            if (!Sound.Initialize(MainForm.Handle))
            {
                MessageBox.Show("Could not initialize Direct Sound", "Error", MessageBoxButtons.OK);
                return(false);
            }

            return(true);
        }
Пример #2
0
        public void Shutdown()
        {
            // Release the sound object
            if (Sound != null)
            {
                Sound.Shutdown();
                Sound = null;
            }

            if (Graphics != null)
            {
                Graphics.Shutdown();
                Graphics = null;
            }

            if (Input != null)
            {
                Input.Shutdown();
                Input = null;
            }

            ShutdownWindows();
        }