/// <summary> /// A ZeplinGame encapsulates the XNA Framework. /// </summary> /// <remarks>When a ZeplinGame is created, it will initialize the engine. Therefore, only one ZeplinGame should be created.</remarks> public ZeplinGame() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; ResourceContent = new ResourceContentManager(this.Services, EngineResources.ResourceManager); //this.IsFixedTimeStep = false; }
public InstancedModelDrawer(Game game) : base(game) { var resourceContentManager = new ResourceContentManager(game.Services, DrawerResource.ResourceManager); #if WINDOWS instancingEffect = resourceContentManager.Load<Effect>("InstancedEffect"); #else instancingEffect = resourceContentManager.Load<Effect>("InstancedEffectXbox"); #endif //instancingEffect = game.Content.Load<Effect>("InstancedEffect"); worldTransformsParameter = instancingEffect.Parameters["WorldTransforms"]; textureIndicesParameter = instancingEffect.Parameters["TextureIndices"]; viewParameter = instancingEffect.Parameters["View"]; projectionParameter = instancingEffect.Parameters["Projection"]; instancingEffect.Parameters["LightDirection1"].SetValue(Vector3.Normalize(new Vector3(.8f, -1.5f, -1.2f))); instancingEffect.Parameters["DiffuseColor1"].SetValue(new Vector3(.66f, .66f, .66f)); instancingEffect.Parameters["LightDirection2"].SetValue(Vector3.Normalize(new Vector3(-.8f, 1.5f, 1.2f))); instancingEffect.Parameters["DiffuseColor2"].SetValue(new Vector3(.3f, .3f, .5f)); instancingEffect.Parameters["AmbientAmount"].SetValue(.5f); instancingEffect.Parameters["Colors"].SetValue(colors); }
public InstancedModelDrawer(Game game) : base(game) { #if WINDOWS var resourceContentManager = new ResourceContentManager(game.Services, Indiefreaks.Xna.BEPU.Resources.WindowsPhysicsResources.ResourceManager); #elif XBOX360 var resourceContentManager = new ResourceContentManager(game.Services, Indiefreaks.Xna.BEPU.Resources.Xbox360PhysicsResources.ResourceManager); #else ResourceContentManager resourceContentManager = null; #endif instancingEffect = resourceContentManager.Load<Effect>("InstancedEffect"); worldTransformsParameter = instancingEffect.Parameters["WorldTransforms"]; textureIndicesParameter = instancingEffect.Parameters["TextureIndices"]; viewParameter = instancingEffect.Parameters["View"]; projectionParameter = instancingEffect.Parameters["Projection"]; instancingEffect.Parameters["LightDirection1"].SetValue(Vector3.Normalize(new Vector3(.8f, -1.5f, -1.2f))); instancingEffect.Parameters["DiffuseColor1"].SetValue(new Vector3(.66f, .66f, .66f)); instancingEffect.Parameters["LightDirection2"].SetValue(Vector3.Normalize(new Vector3(-.8f, 1.5f, 1.2f))); instancingEffect.Parameters["DiffuseColor2"].SetValue(new Vector3(.3f, .3f, .5f)); instancingEffect.Parameters["AmbientAmount"].SetValue(.5f); instancingEffect.Parameters["Texture0"].SetValue(textures[0]); instancingEffect.Parameters["Texture1"].SetValue(textures[1]); instancingEffect.Parameters["Texture2"].SetValue(textures[2]); instancingEffect.Parameters["Texture3"].SetValue(textures[3]); instancingEffect.Parameters["Texture4"].SetValue(textures[4]); instancingEffect.Parameters["Texture5"].SetValue(textures[5]); instancingEffect.Parameters["Texture6"].SetValue(textures[6]); instancingEffect.Parameters["Texture7"].SetValue(textures[7]); //This vertex declaration could be compressed or made more efficient, but such optimizations weren't critical. instancingVertexDeclaration = new VertexDeclaration(new[] {new VertexElement(0, VertexElementFormat.Single, VertexElementUsage.TextureCoordinate, 1)}); }
public override void ChangePrimitive(Primitive primitive) { // Load sphere and apply effect to sphere. ResourceContentManager resourceContentManager = new ResourceContentManager(_serviceProvider, Resources.ResourceManager); Model model = resourceContentManager.Load<Model>(primitive.ToString()); foreach (ModelMesh mesh in model.Meshes) foreach (ModelMeshPart meshPart in mesh.MeshParts) meshPart.Effect = _effect; Model = model; }
public GammaCorrectionPostProcessor() { _brightness = 0.2f; #if WINDOWS var shaderResources = new ResourceContentManager(SunBurnCoreSystem.Instance.Services, WindowsPostProcessResources.ResourceManager); #else var shaderResources = new ResourceContentManager(SunBurnCoreSystem.Instance.Services, Xbox360PostProcessResources.ResourceManager); #endif _gammaCorrectEffect = shaderResources.Load<Effect>("GammaCorrect"); }
public DeltaGame(Rectangle screenArea) : base() { #if DEBUG IsMouseVisible = true; Window.AllowUserResizing = true; #endif _embedded = new ResourceContentManager(Services, EmbeddedContent.ResourceManager); base.Content.RootDirectory = "Content"; G.Setup(this, screenArea); }
public ColorCorrectionProcessor() { _viewport = SunBurnCoreSystem.Instance.GraphicsDeviceManager.GraphicsDevice.Viewport; #if WINDOWS var shaderResources = new ResourceContentManager(SunBurnCoreSystem.Instance.Services, WindowsPostProcessResources.ResourceManager); #else var shaderResources = new ResourceContentManager(SunBurnCoreSystem.Instance.Services, Xbox360PostProcessResources.ResourceManager); #endif _colorCorrectEffect = shaderResources.Load<Effect>("PostColorCorrect"); }
public override void Initialize(IServiceProvider serviceProvider, GraphicsDevice graphicsDevice) { ResourceContentManager contentManager = new ResourceContentManager(serviceProvider, Resources.ResourceManager); BasicEffect basicEffect = new BasicEffect(graphicsDevice); basicEffect.VertexColorEnabled = false; basicEffect.LightingEnabled = false; basicEffect.TextureEnabled = true; basicEffect.Texture = contentManager.Load<Texture2D>("CubeTexture"); basicEffect.Projection = Matrix.CreatePerspectiveFieldOfView(1, 1, 1, 10); basicEffect.View = Matrix.CreateLookAt(Vector3.Backward * 2, Vector3.Zero, Vector3.Up); _effect = basicEffect; CreateCube(graphicsDevice, 1); }
public LightRenderer( ) { _game = ObjectFactory.GetInstance<IGame>( ) ; var content = new ResourceContentManager( ( (Game) _game ).Services, Resource1.ResourceManager ) ; var effect = content.Load<Effect>( @"KryptonEffect" ) ; _krypton=new KryptonEngine( (Game) _game, effect ); _krypton.Initialize( ); IoC.Model.ItemsAddedOrRemoved += ( s, e ) => rebuild( ) ; IoC.Model.ItemChanged += ( s, e ) => rebuild( ) ; IoC.Model.NewModelLoaded += ( s, e ) => rebuild( ) ; }
public GameConsole(Game game, SpriteBatch spriteBatch, IEnumerable<IConsoleCommand> commands, GameConsoleOptions options) { var content = new ResourceContentManager(game.Services, Resource1.ResourceManager); if (options.Font == null) { options.Font = content.Load<SpriteFont>("ConsoleFont"); } options.RoundedCorner = content.Load<Texture2D>("roundedCorner"); GameConsoleOptions.Options = options; GameConsoleOptions.Commands = commands.ToList(); Enabled = true; console = new GameConsoleComponent(this, game, spriteBatch); game.Services.AddService(typeof(GameConsole), this); game.Components.Add(console); }
// Dof Focus /// <summary> /// Creates a BaseRenderTargetPostProcessor instance. /// </summary> public DepthOfFieldPostProcessor() { FarClip = 140f; FocalWidth = 50f; FocalDistance = 60f; Attenuation = 0.5f; BlurRadius = 2; BlurAmount = 0.5f; _viewport = SunBurnCoreSystem.Instance.GraphicsDeviceManager.GraphicsDevice.Viewport; #if WINDOWS var shaderResources = new ResourceContentManager(SunBurnCoreSystem.Instance.Services, WindowsPostProcessResources.ResourceManager); #else var shaderResources = new ResourceContentManager(SunBurnCoreSystem.Instance.Services, Xbox360PostProcessResources.ResourceManager); #endif _blurEffect = shaderResources.Load<Effect>("GaussianBlur"); _dofEffect = shaderResources.Load<Effect>("DepthOfField"); ComputeKernel(_blurRadius, _blurAmount); ComputeOffsets(_viewport.Width, _viewport.Height); }
public BloomPostProcessor() { BlurRadius = 7; BlurAmount = 1f; BloomThreshold = 0.5f; BloomIntensity = 1.5f; BaseIntensity = 1; BloomSaturation = 2.5f; BaseSaturation = 1; _viewport = SunBurnCoreSystem.Instance.GraphicsDeviceManager.GraphicsDevice.Viewport; #if WINDOWS var shaderResources = new ResourceContentManager(SunBurnCoreSystem.Instance.Services, WindowsPostProcessResources.ResourceManager); #else var shaderResources = new ResourceContentManager(SunBurnCoreSystem.Instance.Services, Xbox360PostProcessResources.ResourceManager); #endif _gaussianBlurEffect = shaderResources.Load<Effect>("GaussianBlur"); _bloomExtractEffect = shaderResources.Load<Effect>("BloomExtract"); _bloomCombineEffect = shaderResources.Load<Effect>("BloomCombine"); ComputeKernel(_blurRadius, _blurAmount); ComputeOffsets(_viewport.Width, _viewport.Height); }
/// <summary> /// Set Common Rescource Content Manager /// </summary> /// <param name="resourceManager"></param> public void SetCommonContentManager(ResourceManager resourceManager) { Content = new ResourceContentManager(this.Services, SystemResources.ResourceManager); }
public G(int screenWidth, int screenHeight, bool vSync, string contentDirectory) : base() { _instance = this; Content = base.Content; Content.RootDirectory = contentDirectory; IsFixedTimeStep = true; _graphicsDeviceManager = new GraphicsDeviceManager(this); _graphicsDeviceManager.PreferredBackBufferWidth = screenWidth; _graphicsDeviceManager.PreferredBackBufferHeight = screenHeight; _graphicsDeviceManager.DeviceReset += OnDeviceReset; _graphicsDeviceManager.PreparingDeviceSettings += OnPreparingDeviceSettings; _graphicsDeviceManager.SynchronizeWithVerticalRetrace = vSync; _embedded = new ResourceContentManager(Services, EmbeddedContent.ResourceManager); #if DEBUG base.IsMouseVisible = true; Window.AllowUserResizing = true; #endif World = new World(); UI = new UIManager(); Random = new Random(); Input = new InputManager(); Audio = new AudioManager(@"Content\Audio\audio.xgs", @"Content\Audio\Sound Bank.xsb", @"Content\Audio\Wave Bank.xwb", @"Content\Audio\StreamingBank.xwb"); Collision = new CollisionWorld(new SeperatingAxisNarrowphase(), new UniformGridBroadphase()); ScreenArea = new Rectangle(0, 0, screenWidth, screenHeight); ScreenCenter = ScreenArea.Center.ToVector2(); #if WINDOWS Process = Process.GetCurrentProcess(); GameForm = (Form)Control.FromHandle(Window.Handle); EditorForm = new EditorForm(); EditorForm.Icon = GameForm.Icon; #endif }
public PrimitiveBatch(GraphicsDevice graphicsDevice, IServiceProvider services, Viewport viewport, int bufferSize) { if (graphicsDevice == null) throw new ArgumentNullException("graphicsDevice"); _graphicsDevice = graphicsDevice; ResourceContentManager content = new ResourceContentManager(services, Resources.ResourceManager); LoadEffect(content.Load<Effect>("PrimitiveEffect")); CreateRasterizerState(); }
internal void CreateWater() { _resources = REngine.Instance._resourceContent; water = new Water(); this.Position = Vector3.Zero; }
protected override void LoadContent() { base.LoadContent(); // Texture pack stuff if (settings.UseTexturePacks) { if (File.Exists(settings.LastTexturePack)) { // ZIP file LoadTexturePack(settings.LastTexturePack, true); } else if (Directory.Exists(settings.LastTexturePack)) { // Loose files LoadTexturePack(settings.LastTexturePack, false); } } if (settings.UseInternalFonts) { RomTerraria.Properties.Resources.ResourceManager.IgnoreCase = true; var embeddedContent = new ResourceContentManager(this.Services, RomTerraria.Properties.Resources.ResourceManager); fontDeathText = embeddedContent.Load<SpriteFont>("Death_Text"); fontItemStack = embeddedContent.Load<SpriteFont>("Item_Stack"); fontMouseText = embeddedContent.Load<SpriteFont>("Mouse_Text"); fontCombatText[0] = embeddedContent.Load<SpriteFont>("Combat_Text"); fontCombatText[1] = embeddedContent.Load<SpriteFont>("Combat_Crit"); } if (settings.ResizeBackgrounds) { for (int i = 0; i <= Terraria.Main.backgroundTexture.GetUpperBound(0); i++) { //Terraria.Main.backgroundTexture[i] = ReduceResolution(Terraria.Main.backgroundTexture[i]); //Terraria.Main.backgroundWidth[i] = Terraria.Main.backgroundTexture[i].Width * 2; //Terraria.Main.backgroundHeight[i] = Terraria.Main.backgroundTexture[i].Height * 2; } } spriteBatch = new SpriteBatch(this.GraphicsDevice); }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); Content = new ResourceContentManager(this.Services, Resource1.ResourceManager); spriteFont = Content.Load<SpriteFont>("SpriteFont1"); sphere = new SpherePrimitive(GraphicsDevice, 0.5f, 8); grid = new SampleGrid(); grid.GridSize = 16; grid.GridScale = 1.0f; grid.LoadGraphicsContent(GraphicsDevice); grid2 = new SampleGrid(); grid2.GridSize = 16; grid2.GridScale = 1.0f; grid2.GridColor = Color.BlueViolet; grid2.LoadGraphicsContent(GraphicsDevice); LabelledVector.Load(GraphicsDevice); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); ResourceContentManager Content = new ResourceContentManager(this.Services, Resource1.ResourceManager); //Font1 = content1.Load<SpriteFont>("Arial"); Font1 = Content.Load<SpriteFont>("Arial"); // TODO: use this.Content to load your game content here FontPos = new Vector2(graphics.GraphicsDevice.Viewport.Width / 2, graphics.GraphicsDevice.Viewport.Height / 2); }
protected override void Initialize() { debugObjects = new Dictionary<string, object>(); debugValues = new Dictionary<string, float>(); debugStrings = new List<string>(); ContentManager content = new ResourceContentManager(services, Resource.ResourceManager); DebugFont = content.Load<SpriteFont>("DebugFont"); DebugPos = new Vector2(15, 15); DebugColor = Color.Yellow; FPSCounter = new FPSCounter(DebugPos, DebugFont, DebugColor); }