예제 #1
0
        public static void Run <T>() where T : IDemoConfiguration, new()
        {
            Application.EnableVisualStyles();

            TryLoadBulletSharp();

            T    configuration = new T();
            Demo demo          = new Demo(configuration);

            GraphicsLibraryManager.Run(demo);
        }
예제 #2
0
        public void Run()
        {
            using (Graphics = GraphicsLibraryManager.GetGraphics(this))
            {
                Input    = new Input(Graphics.Form);
                Freelook = new FreeLook(Input);

                Graphics.Initialize();
                Graphics.CullingEnabled = isCullingEnabled;
                OnInitialize();

                if (World == null)
                {
                    OnInitializePhysics();
                    BulletExampleRunner.Get().PostOnInitializePhysics();
                }

                if (_isDebugDrawEnabled)
                {
                    if (_debugDrawer == null)
                    {
                        _debugDrawer           = Graphics.GetPhysicsDebugDrawer();
                        _debugDrawer.DebugMode = DebugDrawMode;
                    }
                    if (World != null)
                    {
                        World.DebugDrawer = _debugDrawer;
                    }
                }

                Graphics.UpdateView();

                clock.Start();

                Graphics.Run();

                /*
                 * if (_debugDrawer != null)
                 * {
                 * if (World != null)
                 * {
                 * World.DebugDrawer = null;
                 * }
                 * if (_debugDrawer is IDisposable)
                 * {
                 * (_debugDrawer as IDisposable).Dispose();
                 * }
                 * _debugDrawer = null;
                 * }
                 */
            }
            //Graphics = null;
        }
예제 #3
0
        public void Run()
        {
            using (Graphics = GraphicsLibraryManager.GetGraphics(this))
            {
                Input    = new Input(Graphics.Form);
                Freelook = new FreeLook(Input);

                _bodyPicker = new BodyPicker(this);

                Graphics.Initialize();
                Graphics.CullingEnabled = isCullingEnabled;
                OnInitialize();
                if (World == null)
                {
                    OnInitializePhysics();
                }
                if (_isDebugDrawEnabled)
                {
                    if (_debugDrawer == null)
                    {
                        _debugDrawer           = Graphics.GetPhysicsDebugDrawer();
                        _debugDrawer.DebugMode = DebugDrawMode;
                    }
                    if (World != null)
                    {
                        World.DebugDrawer = _debugDrawer;
                    }
                }
                Graphics.UpdateView();
                SetInfoText();

                Graphics.Run();

                if (_debugDrawer != null)
                {
                    if (World != null)
                    {
                        World.DebugDrawer = null;
                    }
                    if (_debugDrawer is IDisposable)
                    {
                        (_debugDrawer as IDisposable).Dispose();
                    }
                    _debugDrawer = null;
                }
            }
            Graphics = null;
        }
예제 #4
0
        public LibrarySelection()
        {
            InitializeComponent();

            AcceptButton = runButton;
            CancelButton = cancelButton;

            string[] supportedLibraries = GraphicsLibraryManager.GetSupportedLibraries();
            int      selectLibrary      = 0;

            foreach (string library in supportedLibraries)
            {
                if (GraphicsLibraryManager.IsLibraryAvailable(library))
                {
                    int index = libraryList.Items.Add(library);
                    logText.Text += library + " OK\r\n";
                    if (library.Equals(GraphicsLibraryManager.GraphicsLibraryName))
                    {
                        selectLibrary = index;
                    }
                }
                else
                {
                    logText.Text += library + " not loaded\r\n";
                }
            }

            if (libraryList.Items.Count != 0)
            {
                runButton.Enabled         = true;
                libraryList.SelectedIndex = selectLibrary;
            }
            GraphicsLibraryManager.GraphicsLibraryName = null;

            libraryList.DoubleClick += new EventHandler(libraryList_DoubleClick);
        }