Esempio n. 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);
                }
            }

            if (SystemConfiguration.SoundOn)
            {
                // 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);
                }
            }

            // Create and initialize the FPS object.
            FPS = new FPS();
            FPS.Initialize();

            // Create and initialize the CPU.
            CPU = new CPU();
            CPU.Initialize();

            // Create and initialize Timer.
            Timer = new Timer();
            if (!Timer.Initialize())
            {
                MessageBox.Show("Could not initialize Timer object", "Error", MessageBoxButtons.OK);
                return(false);
            }

            // Create the position object.
            Position = new Position();

            return(true);
        }
Esempio n. 2
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;
            }

            if (SystemConfiguration.SoundOn)
            {
                // 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;
                }
            }

            // Create and initialize the FPS object.
            FPS = new FPS();
            FPS.Initialize();

            // Create and initialize the CPU.
            CPU = new CPU();
            CPU.Initialize();

            // Create and initialize Timer.
            Timer = new Timer();
            if (!Timer.Initialize())
            {
                MessageBox.Show("Could not initialize Timer object", "Error", MessageBoxButtons.OK);
                return false;
            }

            // Create the position object.
            Position = new Position();

            return true;
        }