/// <summary> /// Initializes a new instance of the <see cref="XenkoRenderer"/> class. /// </summary> /// <param name="graphicsDeviceManager">The graphics device manager.</param> public XenkoRenderer(GraphicsDeviceManager graphicsDeviceManager, EffectSystem effectSystem) : base() { manager = graphicsDeviceManager; this.effectSystem = effectSystem; spriteBatch = new SpriteBatch(manager.GraphicsDevice); clipRectanges = new Stack<Rectangle>(); activeEffects = new Stack<EffectInstance>(); scissorRasterizerStateDescription = RasterizerStates.CullNone; scissorRasterizerStateDescription.ScissorTestEnable = true; // enables the scissor test geometryRasterizerStateDescription = RasterizerStates.CullNone; //geometryRasterizerStateDescription.FillMode = FillMode.Wireframe; geometryPipelineState = new MutablePipelineState(manager.GraphicsDevice); geometryPipelineState.State.DepthStencilState = DepthStencilStates.None; }
/// <summary> /// Initializes a new instance of the <see cref="Game"/> class. /// </summary> public Game() { // Register the logger backend before anything else logListener = GetLogListener(); if (logListener != null) GlobalLogger.GlobalMessageLogged += logListener; // Create all core services, except Input which is created during `Initialize'. // Registration takes place in `Initialize'. Script = new ScriptSystem(Services); SceneSystem = new SceneSystem(Services); Audio = new AudioSystem(Services); gameFontSystem = new GameFontSystem(Services); SpriteAnimation = new SpriteAnimationSystem(Services); ProfilerSystem = new GameProfilingSystem(Services); Content.Serializer.LowLevelSerializerSelector = ParameterContainerExtensions.DefaultSceneSerializerSelector; // Creates the graphics device manager GraphicsDeviceManager = new GraphicsDeviceManager(this); AutoLoadDefaultSettings = true; }
/// <summary> /// Initializes a new instance of the <see cref="Game"/> class. /// </summary> public Game() { // Register the logger backend before anything else logListener = GetLogListener(); if (logListener != null) GlobalLogger.GlobalMessageLogged += logListener; // Create and register all core services Input = new InputManager(Services); Script = new ScriptSystem(Services); SceneSystem = new SceneSystem(Services); Audio = new AudioSystem(Services); UI = new UISystem(Services); gameFontSystem = new GameFontSystem(Services); SpriteAnimation = new SpriteAnimationSystem(Services); ProfilerSystem = new GameProfilingSystem(Services); // --------------------------------------------------------- // Add common GameSystems - Adding order is important // (Unless overriden by gameSystem.UpdateOrder) // --------------------------------------------------------- // Add the input manager GameSystems.Add(Input); // Add the scheduler system // - Must be after Input, so that scripts are able to get latest input // - Must be before Entities/Camera/Audio/UI, so that scripts can apply // changes in the same frame they will be applied GameSystems.Add(Script); // Add the UI System GameSystems.Add(UI); // Add the Audio System GameSystems.Add(Audio); // Add the Font system GameSystems.Add(gameFontSystem); //Add the sprite animation System GameSystems.Add(SpriteAnimation); Asset.Serializer.LowLevelSerializerSelector = ParameterContainerExtensions.DefaultSceneSerializerSelector; // Creates the graphics device manager GraphicsDeviceManager = new GraphicsDeviceManager(this); GameSystems.Add(ProfilerSystem); AutoLoadDefaultSettings = true; }
/// <summary> /// Initializes a new instance of the <see cref="XenkoEngine"/> class. /// </summary> /// <param name="graphicsDevice">The graphics device.</param> /// <param name="nativeScreenWidth">Width of the native screen.</param> /// <param name="nativeScreenHeight">Height of the native screen.</param> public XenkoEngine(GraphicsDeviceManager manager, EffectSystem effectSystem) : base() { renderer = new XenkoRenderer(manager, effectSystem); }