示例#1
0
        public CAsteroid(IGameObjectManager pObjMan, IEngineCore pEngineCore, TPoint2 stPos, float fSize)
            : base(pObjMan, pEngineCore)
        {
            ObjType = EGameObjectType.GotAsteroid;

            _uiCounter  = (uint)Rand.Next(500);
            RenderLayer = 2;
            _fSize      = fSize;
            _fColScale  = 0.8f;
            _stPos      = stPos;
            _fAngle     = Rand.Next(360);

            IResourceManager pResMan;
            IEngineSubSystem pSubSys;

            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys);
            pResMan = (IResourceManager)pSubSys;

            IEngineBaseObject pBaseObj;

            pResMan.GetResourceByName(Res.MeshAsteroid, out pBaseObj);
            _pMesh = (IMesh)pBaseObj;
            pResMan.GetResourceByName(Res.TexAsteroid, out pBaseObj);
            _pTex = (ITexture)pBaseObj;
        }
示例#2
0
文件: CShot.cs 项目: whztt07/DGLE
        public CShot(IGameObjectManager pObjMan, IEngineCore pEngineCore, TPoint2 stPos, float fAngle)
            : base(pObjMan, pEngineCore)
        {
            ObjType = EGameObjectType.GotShot;

            RenderLayer = 3;
            _fSize = 64f;
            _fColScale = 0.5f;
            this._stPos = stPos;
            this._fAngle = fAngle;

            IResourceManager pResMan;
            IEngineSubSystem pSubSys;
            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys);
            pResMan = (IResourceManager)pSubSys;

            IEngineBaseObject pBaseObj;
            pResMan.GetResourceByName(Res.TexSpark, out pBaseObj);
            pTexSpark = (ITexture)pBaseObj;

            ISoundSample p_snd;
            pResMan.GetResourceByName(Res.SndFire, out pBaseObj);
            p_snd = (ISoundSample)pBaseObj;
            p_snd.Play();
        }
示例#3
0
文件: CPlayer.cs 项目: whztt07/DGLE
        public CPlayer(IGameObjectManager pObjMan, IEngineCore pEngineCore)
            : base(pObjMan, pEngineCore)
        {
            _fVelocity = 0f;
            uiShotPause = 15;

            ObjType = EGameObjectType.GotPlayer;

            _stPos = new TPoint2(Res.GameVpWidth / 2f, Res.GameVpHeight / 2f);
            _fSize = 150f;
            _fColScale = 0.6f;

            dimPl = new TPoint3(_fSize, _fSize, _fSize);

            IResourceManager pResMan;
            IEngineSubSystem pSubSys;

            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_INPUT, out pSubSys);
            pInput = (IInput)pSubSys;

            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys);
            pResMan = (IResourceManager)pSubSys;

            IEngineBaseObject pBaseObj;
            pResMan.GetResourceByName(Res.MeshShip, out pBaseObj);
            pMesh = (IMesh)pBaseObj;
            pResMan.GetResourceByName(Res.TexShip, out pBaseObj);
            pTex = (ITexture)pBaseObj;
            pResMan.GetResourceByName(Res.TexSpark, out pBaseObj);
            pTexSpark = (ITexture)pBaseObj;
        }
示例#4
0
文件: CExplo.cs 项目: yunatoomi/DGLE
        public CExplo(IGameObjectManager pObjMan, IEngineCore pEngineCore, TPoint2 stPos, float fSize) :
            base(pObjMan, pEngineCore)
        {
            RenderLayer = 4;
            this._fSize = fSize;
            this._stPos = stPos;
            _fAngle     = Rand.Next(360);

            IResourceManager pResMan;
            IEngineSubSystem pSubSys;

            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys);
            pResMan = (IResourceManager)pSubSys;

            IEngineBaseObject pBaseObj;

            pResMan.GetResourceByName(Res.TexExplo, out pBaseObj);
            pTexExplo = (ITexture)pBaseObj;

            ISoundSample p_snd;

            pResMan.GetResourceByName(Res.SndExplo, out pBaseObj);
            p_snd = (ISoundSample)pBaseObj;
            p_snd.Play();
        }
示例#5
0
        public CShot(IGameObjectManager pObjMan, IEngineCore pEngineCore, TPoint2 stPos, float fAngle)
            : base(pObjMan, pEngineCore)
        {
            ObjType = EGameObjectType.GotShot;

            RenderLayer  = 3;
            _fSize       = 64f;
            _fColScale   = 0.5f;
            this._stPos  = stPos;
            this._fAngle = fAngle;

            IResourceManager pResMan;
            IEngineSubSystem pSubSys;

            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys);
            pResMan = (IResourceManager)pSubSys;

            IEngineBaseObject pBaseObj;

            pResMan.GetResourceByName(Res.TexSpark, out pBaseObj);
            pTexSpark = (ITexture)pBaseObj;

            ISoundSample p_snd;

            pResMan.GetResourceByName(Res.SndFire, out pBaseObj);
            p_snd = (ISoundSample)pBaseObj;
            p_snd.Play();
        }
示例#6
0
文件: CPlayer.cs 项目: yunatoomi/DGLE
        public CPlayer(IGameObjectManager pObjMan, IEngineCore pEngineCore)
            : base(pObjMan, pEngineCore)
        {
            _fVelocity  = 0f;
            uiShotPause = 15;

            ObjType = EGameObjectType.GotPlayer;

            _stPos     = new TPoint2(Res.GameVpWidth / 2f, Res.GameVpHeight / 2f);
            _fSize     = 150f;
            _fColScale = 0.6f;

            dimPl = new TPoint3(_fSize, _fSize, _fSize);

            IResourceManager pResMan;
            IEngineSubSystem pSubSys;

            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_INPUT, out pSubSys);
            pInput = (IInput)pSubSys;

            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys);
            pResMan = (IResourceManager)pSubSys;

            IEngineBaseObject pBaseObj;

            pResMan.GetResourceByName(Res.MeshShip, out pBaseObj);
            pMesh = (IMesh)pBaseObj;
            pResMan.GetResourceByName(Res.TexShip, out pBaseObj);
            pTex = (ITexture)pBaseObj;
            pResMan.GetResourceByName(Res.TexSpark, out pBaseObj);
            pTexSpark = (ITexture)pBaseObj;
        }
示例#7
0
        public RazorLightEngine(IEngineCore core, IPageLookup pagelookup)
        {
            if (core == null)
            {
                throw new ArgumentNullException(nameof(core));
            }

            if (pagelookup == null)
            {
                throw new ArgumentNullException();
            }

            this.core          = core;
            this.pageLookup    = pagelookup;
            this.Configuration = core.Configuration;
        }
示例#8
0
        public CScorePopup(IGameObjectManager pObjMan, IEngineCore pEngineCore, TPoint2 stPos, float fSize, uint uiScore)
            : base(pObjMan, pEngineCore)
        {
            _uiScore = uiScore;
            pObjMan.IncreaseGameScore(uiScore);

            RenderLayer = 5;
            _fSize = Res.Clamp(fSize / 100f, 0.25f, 5f);
            _stPos = stPos;

            IResourceManager pResMan;
            IEngineSubSystem pSubSys;
            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys);
            pResMan = (IResourceManager)pSubSys;

            IEngineBaseObject pBaseObj;
            pResMan.GetResourceByName(Res.FntMain, out pBaseObj);
            _pFnt = (IBitmapFont)pBaseObj;
        }
示例#9
0
        public CGameObject(IGameObjectManager pObjMan, IEngineCore pEngineCore)
        {
            _pObjMan = pObjMan;
            _pEngineCore = pEngineCore;
            ObjType = EGameObjectType.GotUnknown;

            _fSize = 10f;
            _fColScale = 1f;
            _fAngle = 0f;
            _uiCounter = 0;
            RenderLayer = 0;

            IRender pRender;

            IEngineSubSystem pSubSys;
            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RENDER, out pSubSys);
            pRender = (IRender)pSubSys;
            pRender.GetRender2D(out _pRender2D);
        }
示例#10
0
文件: CSpark.cs 项目: whztt07/DGLE
        public CSpark(IGameObjectManager pObjMan, IEngineCore pEngineCore, TPoint2 stPos)
            : base(pObjMan, pEngineCore)
        {
            RenderLayer = 1;
            _fSize = 96f;
            this._stPos = stPos;
            _fAngle = Rand.Next(360);

            pos = new TPoint2(stPos.x - _fSize / 2f, stPos.y - _fSize / 2f);
            dim = new TPoint2(_fSize, _fSize);

            IResourceManager pResMan;
            IEngineSubSystem pSubSys;
            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys);
            pResMan = (IResourceManager)pSubSys;

            IEngineBaseObject pBaseObj;
            pResMan.GetResourceByName(Res.TexSpark, out pBaseObj);
            pTexSpark = (ITexture)pBaseObj;
        }
示例#11
0
        public CBackGround(IGameObjectManager pObjMan, IEngineCore pEngineCore)
            : base(pObjMan, pEngineCore)
        {
            RenderLayer = -1;

            IResourceManager pResMan;
            IEngineSubSystem pSubSys;
            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys);
            pResMan = (IResourceManager)pSubSys;

            IEngineBaseObject pBaseObj;
            pResMan.GetResourceByName(Res.MeshPlanet, out pBaseObj);
            _pMeshPlanet = (IMesh)pBaseObj;
            pResMan.GetResourceByName(Res.TexStars, out pBaseObj);
            _pTexSpace = (ITexture)pBaseObj;
            pResMan.GetResourceByName(Res.TexPlanet, out pBaseObj);
            _pTexEarth = (ITexture)pBaseObj;
            pResMan.GetResourceByName(Res.TexClouds, out pBaseObj);
            _pTexClouds = (ITexture)pBaseObj;
        }
示例#12
0
        public CGameObject(IGameObjectManager pObjMan, IEngineCore pEngineCore)
        {
            _pObjMan     = pObjMan;
            _pEngineCore = pEngineCore;
            ObjType      = EGameObjectType.GotUnknown;

            _fSize      = 10f;
            _fColScale  = 1f;
            _fAngle     = 0f;
            _uiCounter  = 0;
            RenderLayer = 0;

            IRender pRender;

            IEngineSubSystem pSubSys;

            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RENDER, out pSubSys);
            pRender = (IRender)pSubSys;
            pRender.GetRender2D(out _pRender2D);
        }
示例#13
0
        public CScorePopup(IGameObjectManager pObjMan, IEngineCore pEngineCore, TPoint2 stPos, float fSize, uint uiScore) :
            base(pObjMan, pEngineCore)
        {
            _uiScore = uiScore;
            pObjMan.IncreaseGameScore(uiScore);

            RenderLayer = 5;
            _fSize      = Res.Clamp(fSize / 100f, 0.25f, 5f);
            _stPos      = stPos;

            IResourceManager pResMan;
            IEngineSubSystem pSubSys;

            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys);
            pResMan = (IResourceManager)pSubSys;

            IEngineBaseObject pBaseObj;

            pResMan.GetResourceByName(Res.FntMain, out pBaseObj);
            _pFnt = (IBitmapFont)pBaseObj;
        }
示例#14
0
        public CBackGround(IGameObjectManager pObjMan, IEngineCore pEngineCore)
            : base(pObjMan, pEngineCore)
        {
            RenderLayer = -1;

            IResourceManager pResMan;
            IEngineSubSystem pSubSys;

            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys);
            pResMan = (IResourceManager)pSubSys;

            IEngineBaseObject pBaseObj;

            pResMan.GetResourceByName(Res.MeshPlanet, out pBaseObj);
            _pMeshPlanet = (IMesh)pBaseObj;
            pResMan.GetResourceByName(Res.TexStars, out pBaseObj);
            _pTexSpace = (ITexture)pBaseObj;
            pResMan.GetResourceByName(Res.TexPlanet, out pBaseObj);
            _pTexEarth = (ITexture)pBaseObj;
            pResMan.GetResourceByName(Res.TexClouds, out pBaseObj);
            _pTexClouds = (ITexture)pBaseObj;
        }
示例#15
0
文件: CSpark.cs 项目: yunatoomi/DGLE
        public CSpark(IGameObjectManager pObjMan, IEngineCore pEngineCore, TPoint2 stPos)
            : base(pObjMan, pEngineCore)
        {
            RenderLayer = 1;
            _fSize      = 96f;
            this._stPos = stPos;
            _fAngle     = Rand.Next(360);

            pos = new TPoint2(stPos.x - _fSize / 2f, stPos.y - _fSize / 2f);
            dim = new TPoint2(_fSize, _fSize);

            IResourceManager pResMan;
            IEngineSubSystem pSubSys;

            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys);
            pResMan = (IResourceManager)pSubSys;

            IEngineBaseObject pBaseObj;

            pResMan.GetResourceByName(Res.TexSpark, out pBaseObj);
            pTexSpark = (ITexture)pBaseObj;
        }
示例#16
0
文件: CExplo.cs 项目: whztt07/DGLE
        public CExplo(IGameObjectManager pObjMan, IEngineCore pEngineCore, TPoint2 stPos, float fSize)
            : base(pObjMan, pEngineCore)
        {
            RenderLayer = 4;
            this._fSize = fSize;
            this._stPos = stPos;
            _fAngle = Rand.Next(360);

            IResourceManager pResMan;
            IEngineSubSystem pSubSys;
            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys);
            pResMan = (IResourceManager)pSubSys;

            IEngineBaseObject pBaseObj;
            pResMan.GetResourceByName(Res.TexExplo, out pBaseObj);
            pTexExplo = (ITexture)pBaseObj;

            ISoundSample p_snd;
            pResMan.GetResourceByName(Res.SndExplo, out pBaseObj);
            p_snd = (ISoundSample)pBaseObj;
            p_snd.Play();
        }
示例#17
0
文件: CAsteroid.cs 项目: whztt07/DGLE
        public CAsteroid(IGameObjectManager pObjMan, IEngineCore pEngineCore, TPoint2 stPos, float fSize)
            : base(pObjMan, pEngineCore)
        {
            ObjType = EGameObjectType.GotAsteroid;

            _uiCounter = (uint)Rand.Next(500);
            RenderLayer = 2;
            _fSize = fSize;
            _fColScale = 0.8f;
            _stPos = stPos;
            _fAngle = Rand.Next(360);

            IResourceManager pResMan;
            IEngineSubSystem pSubSys;
            pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys);
            pResMan = (IResourceManager)pSubSys;

            IEngineBaseObject pBaseObj;
            pResMan.GetResourceByName(Res.MeshAsteroid, out pBaseObj);
            _pMesh = (IMesh)pBaseObj;
            pResMan.GetResourceByName(Res.TexAsteroid, out pBaseObj);
            _pTex = (ITexture)pBaseObj;
        }
示例#18
0
文件: DGLE.cs 项目: whztt07/DGLE
 public static bool CreateEngine(out IEngineCore pEngineCore, E_GET_ENGINE_FLAGS eFlags)
 {
     if (pGetEngine == null)
     {
         pEngineCore = null;
         return false;
     }
     pGetEngine(out pEngineCore, eFlags, _DGLE_SDK_VER_);
     return true;
 }
示例#19
0
文件: DGLE.cs 项目: whztt07/DGLE
        public static bool GetEngine([MarshalAs(UnmanagedType.LPStr)] string pcDllFileName, out IEngineCore pEngineCore, E_GET_ENGINE_FLAGS eFlags)
        {
            pEngineCore = null;

            if (hServer == IntPtr.Zero)
            {
                if (hServer == IntPtr.Zero)
                {
                    hServer = Imports.LoadLibrary(pcDllFileName);
                    if (hServer == IntPtr.Zero) return false;
                }
                if (pGetEngine == null && pFreeEngine == null)
                {
                    IntPtr pGetEnginePointer = Imports.GetProcAddress(hServer, "CreateEngine");
                    pGetEngine = Marshal.GetDelegateForFunctionPointer(pGetEnginePointer, typeof(GetEngineDelegate)) as GetEngineDelegate;
                    IntPtr pFreeEnginePointer = Imports.GetProcAddress(hServer, "FreeEngine");
                    pFreeEngine = Marshal.GetDelegateForFunctionPointer(pFreeEnginePointer, typeof(FreeEngineDelegate)) as FreeEngineDelegate;
                    if (pGetEngine == null || pFreeEngine == null)
                    {
                        Imports.FreeLibrary(hServer);
                        hServer = IntPtr.Zero;
                        return false;
                    }
                }

                CreateEngine(out pEngineCore, eFlags);
                return (pEngineCore != null);
            }
            else
                return false;
        }
示例#20
0
文件: DGLE.cs 项目: whztt07/DGLE
 public static bool FreeEngine(IEngineCore pEngineCore, bool bFreeDLL)
 {
     if (pEngineCore != null)
         pFreeEngine(pEngineCore);
     if (bFreeDLL && hServer != IntPtr.Zero)
     {
         Imports.FreeLibrary(hServer);
         hServer = IntPtr.Zero;
         pGetEngine = null;
         pFreeEngine = null;
     }
     return true;
 }
示例#21
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);
        }
示例#22
0
文件: DGLE.cs 项目: whztt07/DGLE
 public static bool GetEngine([MarshalAs(UnmanagedType.LPStr)] string pcDllFileName, out IEngineCore pEngineCore) { return GetEngine(pcDllFileName, out pEngineCore, E_GET_ENGINE_FLAGS.GEF_DEFAULT); }
示例#23
0
文件: Main.cs 项目: 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;
        }