コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScreenManager"/> class.
 /// </summary>
 /// <param name="graphicsManager">The graphics manager.</param>
 /// <param name="contentManager">The content manager.</param>
 /// <param name="gameObjectManager">The game object manager.</param>
 /// <param name="settings">The settings.</param>
 /// <param name="gameSettings">The game settings.</param>
 /// <param name="shaderManager">The shader manager.</param>
 /// <param name="audioManager">The audio manager.</param>
 /// <param name="playerSettings">The player settings.</param>
 public ScreenManager(
 IBallerburgGraphicsManager graphicsManager,
 IContentManager contentManager,
 IGameObjectManager gameObjectManager,
 ApplicationSettings settings,
 IGameSettingsManager gameSettings,
 IShaderManager shaderManager,
 AudioManager audioManager,
 PlayerSettings[] playerSettings)
 {
     // Load content belonging to the screen manager.
       this.graphicsManager = graphicsManager;
       this.contentManager = contentManager;
       this.gameObjectManager = gameObjectManager;
       this.GameSettings = gameSettings;
       this.shaderManager = shaderManager;
       this.audioManager = audioManager;
       this.playerSettings = playerSettings;
       applicationSettings = settings;
       isInitialized = true;
 }
コード例 #2
0
ファイル: EngineModule.cs プロジェクト: nogu3ira/essence-udk
        protected override void Initialize()
        {
#if DEBUG
            new DebugTraceListener {
                TraceLevel = TraceLevels.Verbose
            };
#endif

            //Register engine managers
            Container.Register <IConfiguration, ConfigurationManager>().AsSingleton();
            Container.Register <IDeviceContextService, DeviceContextManager>().AsSingleton();
            Container.Register <IInput, InputManager>().AsSingleton();
            Container.Register <INetwork, NetworkManager>().AsSingleton();
            Container.Register <IShaderManager, ShaderManager>().AsSingleton();

            //Register Render Chains
            Container.Register <IWorldRenderChain, WorldRenderChain>().AsSingleton();
            Container.Register <IUIRenderChain, UIRenderChain>().AsSingleton();

            //Register Update Chain
            Container.Register <IChain <UpdateState>, UpdateChain>().AsSingleton();

            //Kernel.Bind<IStorageAdapterParameterBuilder>().To<DirectX9UnicodeFontAdapterParameterBuilder>()
            //    .When(request =>
            //        request.ParentRequest.Service == typeof(IUnicodeFontFactory<Texture2D>));

            //Register UO file factories
            //Kernel.Bind<IAnimationDataFactory<AnimationData>>().To<AnimationDataFactory<AnimationData>>().InSingletonScope();
            //Kernel.Bind<IAnimationFactory<Texture2D>>().To<AnimationFactory<Texture2D>>().InSingletonScope();
            //Kernel.Bind<IArtworkFactory<Texture2D>>().To<ArtworkFactory<Texture2D>>().InSingletonScope();
            //Kernel.Bind<IASCIIFontFactory<Texture2D>>().To<ASCIIFontFactory<Texture2D>>().InSingletonScope();
            //Kernel.Bind<IGumpFactory<Texture2D>>().To<GumpFactory<Texture2D>>().InSingletonScope();
            //Kernel.Bind<ISkillsFactory<Skill>>().To<SkillsFactory<Skill>>().InSingletonScope();
            //Kernel.Bind<ISoundFactory<Sound>>().To<SoundFactory<Sound>>().InSingletonScope();
            //Kernel.Bind<ITexmapFactory<Texture2D>>().To<TexmapFactory<Texture2D>>().InSingletonScope();
            //Kernel.Bind<IUnicodeFontFactory<Texture2D>>().To<UnicodeFontFactory<Texture2D>>().InSingletonScope();

            //Register client components
            Container.Register <IConsole>().AsSingleton();

            IConfiguration config = Container.Resolve <IConfiguration>();
            config.RestoreDefaultsInvoked += OnConfigRestoreDefaultsInvoked;

            if (config.GetValue <bool>(ConfigSections.Diagnostics, ConfigKeys.ShowConsole))
            {
                NativeMethods.AllocConsole();

                if (config.GetValue <bool>(ConfigSections.Diagnostics, ConfigKeys.ConsoleTraceListener, false))
                {
                    new ConsoleTraceListener();
                }
            }

            if (config.GetValue <bool>(ConfigSections.Diagnostics, ConfigKeys.FileTraceListener, false))
            {
                new DebugLogTraceListener("debug.log");
            }

            IDeviceContextService deviceContextService = Container.Resolve <IDeviceContextService>();

            IShaderManager shaderManager = Container.Resolve <IShaderManager>();
            shaderManager.Register <SimpleTextureEffect>(new SimpleTextureEffect(deviceContextService.Context));
            shaderManager.Register <CombineShader>(new CombineShader(deviceContextService.Context));

            new GameConsoleTracer(Container);

            new TestRendering(Container);
        }
コード例 #3
0
        /// <summary>
        /// Draws the castle texture.
        /// </summary>
        /// <param name="shaderManager">The shader manager.</param>
        private void DrawCastleTexture(IShaderManager shaderManager)
        {
            var effect = shaderManager.TheEffect;
              effect.CurrentTechnique = effect.Techniques["Simplest"];
              effect.Parameters["xAmbientIntensity"].SetValue(1.0f);
              effect.Parameters["xAmbientColor"].SetValue(new Vector3(1.0f, 1.0f, 1.0f));

              GraphicsManager.GraphicsDevice.SetRenderTarget(renderTarget);

              GraphicsManager.GraphicsDevice.Clear(Color.Transparent);

              var view = Matrix.CreateLookAt(new Vector3(0f, 8f, 20f), new Vector3(0f, 0f, 0f), new Vector3(0f, 1f, 0f));
              var projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver2, 1f, 5f, 100f);

              // Draw the castle to the rendertarget
              ScreenManager.GameObjectManager.Castles[castleType].DrawDefault(
              Matrix.Identity,
              Matrix.CreateRotationY(castleYaw) * view,
              projection,
              Matrix.Identity,
              effect,
              ScreenManager.ContentManager,
              GraphicsManager.GraphicsDevice);

              GraphicsManager.GraphicsDevice.SetRenderTarget(null);

              castleTexture = renderTarget;
        }