Beispiel #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;
        }
Beispiel #2
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();
        }
Beispiel #3
0
        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;
        }
Beispiel #4
0
        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();
        }
Beispiel #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();
        }
Beispiel #6
0
        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;
        }
Beispiel #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;
        }
Beispiel #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;
        }
Beispiel #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);
        }
Beispiel #10
0
        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;
        }
Beispiel #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;
        }
Beispiel #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);
        }
Beispiel #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;
        }
Beispiel #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;
        }
Beispiel #15
0
        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;
        }
Beispiel #16
0
        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();
        }
Beispiel #17
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;
        }
Beispiel #18
0
 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;
 }
Beispiel #19
0
        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;
        }
Beispiel #20
0
 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;
 }
Beispiel #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);
        }
Beispiel #22
0
 public static bool GetEngine([MarshalAs(UnmanagedType.LPStr)] string pcDllFileName, out IEngineCore pEngineCore) { return GetEngine(pcDllFileName, out pEngineCore, E_GET_ENGINE_FLAGS.GEF_DEFAULT); }
Beispiel #23
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;
        }