// Methods
        public virtual bool Initialize(string title, int width, int height, bool vSync, bool fullScreen, int testTimeSeconds)
        {
            bool result = false;

            if (Configuration == null)
            {
                Configuration = new DSystemConfiguration(title, width, height, fullScreen, vSync);
            }

            // Initialize Window.
            InitializeWindows(title);

            if (Input == null)
            {
                Input = new DInput();
                Input.Initialize();
            }
            if (Graphics == null)
            {
                Graphics = new DGraphics();
                result   = Graphics.Initialize(Configuration, RenderForm.Handle);
            }

            DPerfLogger.Initialize("RenderForm C# SharpDX: " + Configuration.Width + "x" + Configuration.Height + " VSync:" + DSystemConfiguration.VerticalSyncEnabled + " FullScreen:" + DSystemConfiguration.FullScreen + "   " + RenderForm.Text, testTimeSeconds, Configuration.Width, Configuration.Height);

            return(result);
        }
        public void ShutDown()
        {
            ShutdownWindows();
            DPerfLogger.ShutDown();

            Graphics?.ShutDown();
            Graphics      = null;
            Input         = null;
            Configuration = null;
        }
Exemplo n.º 3
0
        // Methods
        public virtual bool Initialize(string title, int width, int height, bool vSync, bool fullScreen, int testTimeSeconds)
        {
            bool result = false;

            if (Configuration == null)
            {
                Configuration = new DSystemConfiguration(title, width, height, fullScreen, vSync);
            }

            // Initialize Window.
            InitializeWindows(title);

            if (Input == null)
            {
                Input = new DInput();
                if (!Input.Initialize(Configuration, RenderForm.Handle))
                {
                    return(false);
                }
            }
            if (Graphics == null)
            {
                Graphics = new DGraphics();
                result   = Graphics.Initialize(Configuration, RenderForm.Handle);
            }

            DPerfLogger.Initialize("RenderForm C# SharpDX: " + Configuration.Width + "x" + Configuration.Height + " VSync:" + DSystemConfiguration.VerticalSyncEnabled + " FullScreen:" + DSystemConfiguration.FullScreen + "   " + RenderForm.Text, testTimeSeconds, Configuration.Width, Configuration.Height);;

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

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

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

            // This seperates out the creation of one DirectSound object and one PrimaryBuffer nad loads as many SecondaryBuffers as there are Sound.LoadAudio Calls. We pass in only the first instanceances DirectSound to play from both secondaryBuffers from the one primaryBuffer.
            Sound.LoadAudio(Sound._DirectSound);
            Sound.Play(0, new SharpDX.Vector3(-2.0f, 0, 0.0f)); // Front Center

            return(result);
        }
Exemplo n.º 4
0
        public virtual bool Initialize(string title, int width, int height, bool vSync, bool fullScreen, int testTimeSeconds)
        {
            bool result = false;

            Configuration = new DSystemConfiguration(title, width, height, fullScreen, vSync);
            InitializeWindows(title);
            RenderForm.BackColor = Color.Black;
            Input    = new DInput();
            result   = Input.Initialize();
            Graphics = new DGraphics();
            result   = Graphics.Initialize(Configuration);
            Timer    = new DTimer();
            result   = Timer.Initialize();

            return(result);
        }
        // Methods
        public virtual bool Initialize(string title, int width, int height, bool vSync, bool fullScreen, int testTimeSeconds)
        {
            bool result = false;

            if (Configuration == null)
            {
                Configuration = new DSystemConfiguration(title, width, height, fullScreen, vSync);
            }

            // Initialize Window.
            InitializeWindows(title);

            if (Input == null)
            {
                Input = new DInput();
                if (!Input.Initialize(Configuration, RenderForm.Handle))
                {
                    return(false);
                }
            }
            if (Graphics == null)
            {
                Graphics = new DGraphics();
                result   = Graphics.Initialize(Configuration, RenderForm.Handle);
            }

            DPerfLogger.Initialize("RenderForm C# SharpDX: " + Configuration.Width + "x" + Configuration.Height + " VSync:" + DSystemConfiguration.VerticalSyncEnabled + " FullScreen:" + DSystemConfiguration.FullScreen + "   " + RenderForm.Text, testTimeSeconds, Configuration.Width, Configuration.Height);;

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

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

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

            return(result);
        }
Exemplo n.º 6
0
        // Methods
        public virtual bool Initialize(string title, int width, int height, bool vSync, bool fullScreen, int testTimeSeconds)
        {
            bool result = false;

            if (Configuration == null)
            {
                Configuration = new DSystemConfiguration(title, width, height, fullScreen, vSync);
            }

            // Initialize Window.
            InitializeWindows(title);

            if (Input == null)
            {
                Input = new DInput();
                if (!Input.Initialize(Configuration, RenderForm.Handle))
                {
                    return(false);
                }
            }
            if (Graphics == null)
            {
                Graphics = new DGraphics();
                result   = Graphics.Initialize(Configuration, RenderForm.Handle);
            }

            DPerfLogger.Initialize("RenderForm C# SharpDX: " + Configuration.Width + "x" + Configuration.Height + " VSync:" + DSystemConfiguration.VerticalSyncEnabled + " FullScreen:" + DSystemConfiguration.FullScreen + "   " + RenderForm.Text, testTimeSeconds, Configuration.Width, Configuration.Height);;

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

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

            // Set the initial position of the viewer to the same as the initial camera position.
            SharpDX.Vector3 camPos = Graphics.Camera.GetPosition();
            Position.SetPosition(camPos.X, camPos.Y, camPos.Z);

            return(result);
        }
        // Methods
        public virtual bool Initialize(string title, int width, int height, bool vSync, bool fullScreen, int testTimeSeconds)
        {
            bool result = false;

            if (Configuration == null)
            {
                Configuration = new DSystemConfiguration(title, width, height, fullScreen, vSync);
            }

            // Initialize Window.
            InitializeWindows(title);

            // And for this tutorial only paint the Forms Background Black.
            RenderForm.BackColor = Color.Black;

            if (Input == null)
            {
                Input = new DInput();
                Input.Initialize();
            }
            if (Graphics == null)
            {
                Graphics = new DGraphics();
                result   = Graphics.Initialize(Configuration);
            }

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

            return(result);
        }