Esempio n. 1
0
        static void Main()
        {
            if (Engine.GetEngine("..\\DGLE.dll", out engCore))
            {
                TEngineWindow engWin = new TEngineWindow(SCREEN_WIDTH, SCREEN_HEIGHT, false);
                engCore.InitializeEngine(IntPtr.Zero, Application.ProductName, ref engWin, 33, E_ENGINE_INIT_FLAGS.EIF_DEFAULT);

                engCore.ConsoleVisible(true);

                delInit = Init;
                delFree = Free;
                delUpdate = Update;
                delRender = Render;

                engCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_INIT, delInit, IntPtr.Zero);
                engCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_FREE, delFree, IntPtr.Zero);
                engCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_UPDATE, delUpdate, IntPtr.Zero);
                engCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_RENDER, delRender, IntPtr.Zero);

                engCore.StartEngine();

                Engine.FreeEngine();
            }
            else
                MessageBox.Show("Couldn't load \"DGLE.dll\"!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
Esempio n. 2
0
        void Run()
        {
            if (Engine.GetEngine(DLL_PATH, out pEngineCore))
            {
                TEngineWindow win = new TEngineWindow(GAME_VP_WIDTH, GAME_VP_HEIGHT, false, true, E_MULTISAMPLING_MODE.MM_4X, E_ENG_WINDOW_FLAGS.EWF_ALLOW_SIZEING);
                pEngineCore.InitializeEngine(IntPtr.Zero, APP_CAPTION, ref win, 33, E_ENGINE_INIT_FLAGS.EIF_DEFAULT);
                // You can do some initialization here

                pEngineCore.ConsoleVisible(true);

                DInit    = new DSubscriber(Init);
                DFree    = new DSubscriber(Free);
                DUpdate  = new DSubscriber(Update);
                DRender  = new DSubscriber(Render);
                DFullScr = new DListenerProc(OnFullScreenEvent);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_INIT, DInit, IntPtr.Zero);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_FREE, DFree, IntPtr.Zero);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_UPDATE, DUpdate, IntPtr.Zero);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_RENDER, DRender, IntPtr.Zero);

                pEngineCore.AddEventListener(E_EVENT_TYPE.ET_ON_FULLSCREEN, DFullScr, IntPtr.Zero);

                pEngineCore.StartEngine(); //Entering engine loop
            }
            else
            {
                MessageBox.Show("Couldn't load \"DGLE.dll\"!", APP_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            Engine.FreeEngine();
        }
Esempio n. 3
0
        public void Run()
        {
            if (Engine.GetEngine(DLL_PATH, out pEngineCore))
            {
                TEngineWindow win = TEngineWindow.Default;
                pEngineCore.InitializeEngine(IntPtr.Zero, APP_CAPTION, ref win, 33u, E_ENGINE_INIT_FLAGS.EIF_DEFAULT);
                // You can do some initialization here

                pEngineCore.ConsoleVisible(true);

                DInit    = Init;
                DProcess = Process;
                DRender  = Render;

                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_INIT, DInit, IntPtr.Zero);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_UPDATE, DProcess, IntPtr.Zero);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_RENDER, DRender, IntPtr.Zero);

                //
                pEngineCore.StartEngine(); //Entering engine loop
            }
            else
            {
                MessageBox.Show("Couldn't find " + Path.GetFullPath(DLL_PATH) + "!");
            }
            Engine.FreeEngine();
        }
Esempio n. 4
0
        void Run()
        {
            if (Engine.GetEngine(DllPath, out pEngineCore))
            {
                var win = new TEngineWindow(ScreenWidth, ScreenHeight, false);
                pEngineCore.InitializeEngine(IntPtr.Zero, AppCaption, ref win);

                pEngineCore.ConsoleVisible(false);

                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_INIT, new DSubscriber(Init), IntPtr.Zero);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_FREE, new DSubscriber(Free), IntPtr.Zero);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_UPDATE, new DSubscriber(Update), IntPtr.Zero);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_RENDER, new DSubscriber(Render), IntPtr.Zero);

                pEngineCore.ConsoleRegisterVariable("game_debug", "Display game debug information.",
                                                    ref _debug, 0, 1, null, IntPtr.Zero);

                pEngineCore.StartEngine();
            }
            else
            {
                MessageBox.Show("Couldn't load \"DGLE.dll\"!", AppCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            Engine.FreeEngine();
        }
Esempio n. 5
0
        static void Main()
        {
            if (Engine.GetEngine("..\\DGLE.dll", out engCore))
            {
                TEngineWindow engWin = new TEngineWindow(SCREEN_WIDTH, SCREEN_HEIGHT, false);
                engCore.InitializeEngine(IntPtr.Zero, Application.ProductName, ref engWin, 33, E_ENGINE_INIT_FLAGS.EIF_DEFAULT);

                engCore.ConsoleVisible(true);

                delInit   = Init;
                delFree   = Free;
                delUpdate = Update;
                delRender = Render;

                engCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_INIT, delInit, IntPtr.Zero);
                engCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_FREE, delFree, IntPtr.Zero);
                engCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_UPDATE, delUpdate, IntPtr.Zero);
                engCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_RENDER, delRender, IntPtr.Zero);

                engCore.StartEngine();

                Engine.FreeEngine();
            }
            else
            {
                MessageBox.Show("Couldn't load \"DGLE.dll\"!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 6
0
        void Run()
        {
            if(Engine.GetEngine(DllPath, out pEngineCore))
            {
                var win = new TEngineWindow(ScreenWidth, ScreenHeight, false);
                pEngineCore.InitializeEngine(IntPtr.Zero, AppCaption, ref win);

                pEngineCore.ConsoleVisible(true);

                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_INIT, new DSubscriber(Init), IntPtr.Zero);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_FREE, new DSubscriber(Free), IntPtr.Zero);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_UPDATE, new DSubscriber(Update), IntPtr.Zero);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_RENDER, new DSubscriber(Render), IntPtr.Zero);

                pEngineCore.StartEngine();
            }
            else
                MessageBox.Show("Couldn't load \"DGLE.dll\"!", AppCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            Engine.FreeEngine();
        }
Esempio n. 7
0
        void Run()
        {
            if (Engine.GetEngine(DllPath, out pEngineCore))
            {
                var win = new TEngineWindow(ScreenWidth, ScreenHeight, false, false, E_MULTISAMPLING_MODE.MM_4X /* multisampling will smooth lines and primitive edges */);
                pEngineCore.InitializeEngine(IntPtr.Zero, AppCaption, ref win);

                pEngineCore.ConsoleVisible(false);

                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_INIT, new DSubscriber(Init), IntPtr.Zero);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_FREE, new DSubscriber(Free), IntPtr.Zero);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_UPDATE, new DSubscriber(Update), IntPtr.Zero);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_RENDER, new DSubscriber(Render), IntPtr.Zero);

                pEngineCore.StartEngine();
            }
            else
            {
                MessageBox.Show("Couldn't load \"DGLE.dll\"!", AppCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            Engine.FreeEngine();
        }
Esempio n. 8
0
        void Run()
        {
            if (Engine.GetEngine(DLL_PATH, out pEngineCore))
            {
                TEngineWindow win = new TEngineWindow(SCREEN_WIDTH, SCREEN_HEIGHT, false, true, E_MULTISAMPLING_MODE.MM_4X, E_ENG_WINDOW_FLAGS.EWF_ALLOW_SIZEING);
                pEngineCore.InitializeEngine(IntPtr.Zero, APP_CAPTION, ref win, 33, E_ENGINE_INIT_FLAGS.EIF_DEFAULT);

                pEngineCore.ConsoleVisible(true);

                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_INIT, new DSubscriber(Init), IntPtr.Zero);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_FREE, new DSubscriber(Free), IntPtr.Zero);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_UPDATE, new DSubscriber(Update), IntPtr.Zero);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_RENDER, new DSubscriber(Render), IntPtr.Zero);

                pEngineCore.StartEngine();
            }
            else
            {
                MessageBox.Show("Couldn't load \"DGLE.dll\"!", APP_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            Engine.FreeEngine();
        }
Esempio n. 9
0
        void Run()
        {
            if (Engine.GetEngine(DLL_PATH, out pEngineCore))
            {
                TEngineWindow win = new TEngineWindow(SCREEN_WIDTH, SCREEN_HEIGHT, false, true, E_MULTISAMPLING_MODE.MM_4X, E_ENG_WINDOW_FLAGS.EWF_ALLOW_SIZEING);
                pEngineCore.InitializeEngine(IntPtr.Zero, APP_CAPTION, ref win, 33, E_ENGINE_INIT_FLAGS.EIF_DEFAULT);
                // You can do some initialization here

                pEngineCore.ConsoleVisible(true);

                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_INIT, new DSubscriber(Init), IntPtr.Zero);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_FREE, new DSubscriber(Free), IntPtr.Zero);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_UPDATE, new DSubscriber(Update), IntPtr.Zero);
                pEngineCore.AddProcedure(E_ENGINE_PROCEDURE_TYPE.EPT_RENDER, new DSubscriber(Render), IntPtr.Zero);

                pEngineCore.StartEngine(); //Entering engine loop
            }
            else
                MessageBox.Show("Couldn't load \"DGLE.dll\"!", APP_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
            Engine.FreeEngine();
        }
Esempio n. 10
0
        public static bool Init(string[] args)
        {
            string appName = Assembly.GetExecutingAssembly().GetName().Name;

            // check gtk
            if (!ThemeHelper.CheckGtk())
            {
                return(false);
            }
            ThemeHelper.ApplyCustomTheme(args);

            // init gtk app
            Application.Init(appName, ref args);

            // check windows platform
            if (!Gui.PlatformUtils.IsWindows)
            {
                CustomMessageDialog dlg = new CustomMessageDialog(
                    null, MessageType.Error,
                    "Your OS is not supported on this version!");
                dlg.Ok += (sender, e) => Application.Quit();
                dlg.Show();
                Application.Run();
                return(false);
            }

            // load dgle
            IEngineCore pEngineCore = null;

            if (!Engine.GetEngine(DLL_PATH, out pEngineCore))
            {
                CustomMessageDialog dlg = new CustomMessageDialog(
                    null, MessageType.Error,
                    "Couldn't load \"{0}\"!", DLL_NAME);
                dlg.Ok += (sender, e) => Application.Quit();
                dlg.Show();
                Application.Run();
                return(false);
            }

            Core = pEngineCore;

            // init dgle with force no window
            TEngineWindow eng_win = new TEngineWindow();

            Core.InitializeEngine(
                IntPtr.Zero, appName, ref eng_win, 33,
                E_ENGINE_INIT_FLAGS.EIF_FORCE_NO_WINDOW | E_ENGINE_INIT_FLAGS.EIF_NO_SPLASH);
            //Core.ConsoleVisible(false);

            // init virtual file systems from dgle
            try
            {
                Packer.Init();
            }
            catch
            {
                CustomMessageDialog dlg = new CustomMessageDialog(
                    null, MessageType.Error, ButtonsType.Ok,
                    "Failed to load file systems from DGLE!");
                dlg.Ok += (sender, e) =>
                          Program.Stop();
                dlg.Show();

                return(false);
            }

            // init main win
            MainWindow win = new MainWindow();

            win.Show();
            win.DeleteEvent += (o, a) =>
            {
                Stop();
                a.RetVal = true;
            };

            return(true);
        }
Esempio n. 11
0
File: Main.cs Progetto: whztt07/DGLE
        public static bool Init(string[] args)
        {
            string appName = Assembly.GetExecutingAssembly().GetName().Name;

            // check gtk
            if (!ThemeHelper.CheckGtk())
                return false;
            ThemeHelper.ApplyCustomTheme(args);

            // init gtk app
            Application.Init(appName, ref args);

            // check windows platform
            if (!Gui.PlatformUtils.IsWindows)
            {
                CustomMessageDialog dlg = new CustomMessageDialog(
                    null, MessageType.Error,
                    "Your OS is not supported on this version!");
                dlg.Ok += (sender, e) => Application.Quit();
                dlg.Show();
                Application.Run();
                return false;
            }

            // load dgle
            IEngineCore pEngineCore = null;
            if (!Engine.GetEngine(DLL_PATH, out pEngineCore))
            {
                CustomMessageDialog dlg = new CustomMessageDialog(
                    null, MessageType.Error,
                    "Couldn't load \"{0}\"!", DLL_NAME);
                dlg.Ok += (sender, e) => Application.Quit();
                dlg.Show();
                Application.Run();
                return false;
            }

            Core = pEngineCore;

            // init dgle with force no window
            TEngineWindow eng_win = new TEngineWindow();
            Core.InitializeEngine(
                IntPtr.Zero, appName, ref eng_win, 33,
                E_ENGINE_INIT_FLAGS.EIF_FORCE_NO_WINDOW | E_ENGINE_INIT_FLAGS.EIF_NO_SPLASH);
            //Core.ConsoleVisible(false);

            // init virtual file systems from dgle
            try
            {
                Packer.Init();
            }
            catch
            {
                CustomMessageDialog dlg = new CustomMessageDialog(
                    null, MessageType.Error, ButtonsType.Ok,
                    "Failed to load file systems from DGLE!");
                dlg.Ok += (sender, e) =>
                    Program.Stop();
                dlg.Show();

                return false;
            }

            // init main win
            MainWindow win = new MainWindow();
            win.Show();
            win.DeleteEvent += (o, a) =>
            {
                Stop();
                a.RetVal = true;
            };

            return true;
        }