Пример #1
0
        static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException += (args, e) => Log.Debug(e.ExceptionObject.ToString());

            Settings.KeyBindings.Initialize();

            var window  = new EditorWindow();
            var context = new GxContext(window.DrawTarget);

            context.InitContext();

            InterfaceManager.Instance.Initialize(window.DrawTarget, context);
            WorldFrame.Instance.Initialize(window.DrawTarget, context);
            WorldFrame.Instance.OnResize((int)window.RenderSize.Width, (int)window.RenderSize.Height);

            InterfaceManager.Instance.RenderWindow.OnLoadFinished();

            var app   = new Application();
            var timer = new DispatcherTimer(TimeSpan.FromMilliseconds(10), DispatcherPriority.ApplicationIdle,
                                            (sender, args) =>
            {
                context.BeginFrame();
                WorldFrame.Instance.OnFrame();
                InterfaceManager.Instance.OnFrame();
                context.EndFrame();
            }, app.Dispatcher);

            app.Run(window);

            WorldFrame.Instance.Shutdown();
        }
Пример #2
0
        static void Main()
        {
            System.Windows.Forms.Application.EnableVisualStyles();
            AppDomain.CurrentDomain.UnhandledException += (args, e) => Log.Debug(e.ExceptionObject.ToString());

            var baseDir     = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) ?? Directory.GetCurrentDirectory();
            var profilesDir = Path.Combine(baseDir, "JitProfiles");

            if (!Directory.Exists(profilesDir))
            {
                Directory.CreateDirectory(profilesDir);
            }

            var dbcdir = Path.Combine(baseDir, "DBC");

            if (!Directory.Exists(dbcdir))
            {
                Directory.CreateDirectory(dbcdir);
            }

            ProfileOptimization.SetProfileRoot(profilesDir);
            ProfileOptimization.StartProfile("JitProfile.jpf");

            FontCollection.Initialize();
            Settings.KeyBindings.Initialize();
            XmlService.Initialize();

            var window  = new EditorWindow();
            var context = new GxContext(window.DrawTarget);

            context.InitContext();

            // TODO: move all shader initializations somehwere?
            context.InitShaders();

            WorldFrame.Instance.Initialize(window.DrawTarget, context);
            WorldFrame.Instance.OnResize((int)window.RenderSize.Width, (int)window.RenderSize.Height);

            var wnd = new MainWindow {
                elementHost1 = { Child = window }
            };

            wnd.Show();
            var isClosed = false;

            wnd.FormClosing += (sender, args) => isClosed = true;

            while (isClosed == false)
            {
                context.BeginFrame();
                WorldFrame.Instance.OnFrame();
                context.EndFrame();
                System.Windows.Forms.Application.DoEvents();
            }

            WorldFrame.Instance.Shutdown();
        }