コード例 #1
0
        public static int Run(Type appDelegateType, string[] args)
        {
            // Create the Application

            AppBase app = null;

#if ATOMIC_DESKTOP
            app = NETIPCPlayerApp.Create(args);
#endif

#if ATOMIC_ANDROID
            app = NETAtomicPlayer.Create(args);

            var renderer = AtomicNET.GetSubsystem <Renderer>();
            renderer.ReuseShadowMaps = false;
            renderer.ShadowQuality   = ShadowQuality.SHADOWQUALITY_SIMPLE_16BIT;
#endif

            appDelegate = (AppDelegate)Activator.CreateInstance(appDelegateType);

            appDelegate.Start();

            // Managed code in charge of main loop
            while (app.RunFrame())
            {
                appDelegate.PostFrame();
            }

            appDelegate.Shutdown();

            // Shut 'er down
            app.Shutdown();

            return(0);
        }
コード例 #2
0
        public static int Run(Type appDelegateType, string[] args)
        {
            // Create the Application

            AppBase app = null;

#if ATOMIC_DESKTOP
            app = NETIPCPlayerApp.Create(args);
#endif

#if ATOMIC_IOS
            // On iOS, we need to set main ready as main() isn't being called
            SDLEvents.SetMainReady();
#endif


#if ATOMIC_MOBILE
            app = NETAtomicPlayer.Create(args);

            var renderer = AtomicNET.GetSubsystem <Renderer>();
            renderer.ReuseShadowMaps = false;
            renderer.ShadowQuality   = ShadowQuality.SHADOWQUALITY_SIMPLE_16BIT;
#endif

            appDelegate = (AppDelegate)Activator.CreateInstance(appDelegateType);

            try
            {
                appDelegate.Start();

                // Managed code in charge of main loop
                while (app.RunFrame())
                {
                    appDelegate.PostFrame();
                }

                appDelegate.Shutdown();

                // Shut 'er down
                app.Shutdown();
            }
            catch (Exception e)
            {
                if (e.InnerException != null)
                {
                    Log.Error(e.InnerException.StackTrace);
                    // rethrow inner exception
                    throw e.InnerException;
                }
                else
                {
                    Log.Error(e.StackTrace);
                    // rethrow
                    throw e;
                }
            }

            return(0);
        }
コード例 #3
0
        public static void Initialize()
        {
            // Atomic Modules
            CoreModule.Initialize();
            MathModule.Initialize();
            EngineModule.Initialize();
            InputModule.Initialize();
            IOModule.Initialize();
            ResourceModule.Initialize();
            AudioModule.Initialize();
            GraphicsModule.Initialize();
            SceneModule.Initialize();
            Atomic2DModule.Initialize();
            NavigationModule.Initialize();
            NetworkModule.Initialize();
            PhysicsModule.Initialize();
            EnvironmentModule.Initialize();
            UIModule.Initialize();

#if ATOMIC_DESKTOP
            IPCModule.Initialize();
#endif

            AtomicAppModule.Initialize();
            ScriptModule.Initialize();

            AtomicNETScriptModule.Initialize();
            AtomicNETNativeModule.Initialize();

            PlayerModule.Initialize();

            coreDelegates = new CoreDelegates();
            coreDelegates.eventDispatch  = NativeCore.EventDispatch;
            coreDelegates.updateDispatch = NativeCore.UpdateDispatch;

            IntPtr coreptr = csi_Atomic_NETCore_Initialize(ref coreDelegates);

            NETCore core = (coreptr == IntPtr.Zero ? null : NativeCore.WrapNative <NETCore>(coreptr));

            if (core != null)
            {
                AtomicNET.RegisterSubsystem("NETCore", core);
            }

            context = core.Context;

            NativeCore.Initialize();
            CSComponentCore.Initialize();

#if ATOMIC_DESKTOP
            string[] arguments = Environment.GetCommandLineArgs();
            foreach (string arg in arguments)
            {
                AppBase.AddArgument(arg);
            }
#endif
        }
コード例 #4
0
        public static int RunServer(Type appDelegateType, string[] args)
        {
            // Create the Application
            AppBase = NETIPCServerApp.Create(args);

            appDelegate = (AppDelegate)Activator.CreateInstance(appDelegateType);

            try
            {
                appDelegate.Start();

                // Managed code in charge of main loop
                while (AppBase.RunFrame())
                {
                    appDelegate.PostFrame();
                }

                appDelegate.Shutdown();

                // Shut 'er down
                AppBase.Shutdown();
            }
            catch (Exception e)
            {
                if (e.InnerException != null)
                {
                    Log.Error(e.InnerException.StackTrace);
                    // rethrow inner exception
                    throw e.InnerException;
                }
                else
                {
                    Log.Error(e.StackTrace);
                    // rethrow
                    throw e;
                }
            }
            finally
            {
                AppBase = null;
            }


            return(0);
        }