示例#1
0
        public AppModel(MainWindow window)
        {
            Window = window;
            m_windowStack.Push(window);

            // Set the logger callback
            m_logCallbackPointer = new Core.LogCallback(Logger.log);

            // init gl host
            GlHost         = new OpenGLHost(window);
            GlHost.Error  += window.GlHostOnError;
            window.Loaded += OnWindowLoaded;
            //GlHost.InitializeOpenGl();

            // Now we may init the DLLs that we have an OpenGL context
            if (!Core.mufflon_initialize())
            {
                throw new Exception(Core.core_get_dll_error());
            }
            Core.profiling_enable();
            if (!Loader.loader_initialize())
            {
                throw new Exception(Loader.loader_get_dll_error());
            }
            Loader.loader_profiling_enable();
        }
示例#2
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Must provide 1 argument: map path");
                return;
            }

            var mapPath = args[0];

            if (File.Exists(mapPath) == false)
            {
                Console.WriteLine($"Error: Could not find {mapPath}");
                return;
            }

            var factory = new MapFactory(Path.GetDirectoryName(mapPath));
            var h2map   = factory.Load(Path.GetFileName(mapPath));

            if (h2map is not H2vMap scene)
            {
                throw new NotSupportedException("Only Vista maps are supported");
            }

            Bitmaps = scene.GetLocalTagsOfType <BitmapTag>().ToArray();

            var host = new OpenGLHost();

            host.CreateWindow(new Vector2(1600, 900));
            window = host.GetWindow();
            Setup();

            host.RegisterCallbacks(Update, Render);
            host.Start(30, 30);
        }
示例#3
0
        public Engine()
        {
            var host = new OpenGLHost();

            gameWindowGetter = host.GetWindow;

            graphicsHost = host;
            gameLoop     = host;

            audioHost = OpenALHost.Open(EngineGlobals.Forward, EngineGlobals.Up);
        }