/// <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); SpriteBatchHelpers.Initialize(this.GraphicsDevice); Billboard.Initialize(this.GraphicsDevice, Content.Load <Effect>("Shaders/Billboarding")); }
/// <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); this.Services.AddService(typeof(SpriteBatch), spriteBatch); DiagnosticsManager.Initialize(this); SpriteBatchHelpers.Initialize(GraphicsDevice); Primitives.Initialize(GraphicsDevice); Billboard.Initialize(GraphicsDevice, Content.Load <Effect>("Shaders/Billboarding")); // TODO: use this.Content to load your game content here CreateSpheres(); ship = new Ship(this); followCam = new FollowCamera(camera, ship); lightningTexture = new LightningTexture(GraphicsDevice, 50, 100); #region Particles pSet = new ParticleSettings() { BlendState = BlendState.Additive, MaxParticles = 10, Duration = TimeSpan.FromSeconds(0.5), DurationRandomness = 0.1f, EmitterVelocitySensitivity = 0, MinVelocity = 1f, MaxVelocity = 2f, Gravity = Vector3.Zero, EndVelocity = 0, MinColor = Color.White, MaxColor = Color.White, MinRotateSpeed = -0.1f, MaxRotateSpeed = 0.1f, MinStartSize = 0.25f, MaxStartSize = 0.35f, MinEndSize = 0.5f, MaxEndSize = 0.6f }; var pTex = new Texture2D(GraphicsDevice, 5, 5); pTex.SetData(Enumerable.Repeat(Color.FromNonPremultiplied(0, 0, 255, 125), 25).ToArray()); var pEff = Content.Load <Effect>("Shaders/Particles"); pSys = new ParticleSystem(this, pSet, pTex, pEff, camera); pEmi = new ParticleEmitter(pSys) { Position = Vector3.UnitX, ParticlesPerSecond = 10 }; pEmi2 = new ParticleEmitter(pSys) { Position = -Vector3.UnitX, ParticlesPerSecond = 10 }; //pEmi = new ParticleEmitter(pSys) { Position = Vector3.UnitY, ParticlesPerSecond = 10 }; //pEmi = new ParticleEmitter(pSys) { Position = new Vector3(Vector2.One, 0), ParticlesPerSecond = 10 }; #endregion base.LoadContent(); }
/// <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); SpriteBatchHelpers.Initialize(this.GraphicsDevice); Billboard.Initialize(this.GraphicsDevice, Content.Load <Effect>("Shaders/Billboarding")); #region Particles pSet = new ParticleSettings() { BlendState = BlendState.Additive , MaxParticles = 100 , Duration = TimeSpan.FromSeconds(1) , DurationRandomness = 1 , EmitterVelocitySensitivity = 1 , MinXVelocity = -0.2f , MaxXVelocity = 0.2f , MinYVelocity = -0.2f , MaxYVelocity = 0.2f , Gravity = Vector3.Zero , EndVelocity = 0 , MinColor = Color.White , MaxColor = Color.White , MinRotateSpeed = -0.1f , MaxRotateSpeed = 0.1f , MinStartSize = 0.2f , MaxStartSize = 0.3f , MinEndSize = 1 , MaxEndSize = 2 }; var pTex = new Texture2D(GraphicsDevice, 5, 5); pTex.SetData(Enumerable.Repeat(Color.FromNonPremultiplied(0, 0, 255, 125), 25).ToArray()); var pEff = Content.Load <Effect>("Shaders/Particles"); pSys = new ParticleSystem(this, pSet, pTex, pEff, camera); pEmi = new ParticleEmitter(pSys) { Position = Vector3.Zero, ParticlesPerSecond = 10 }; pEmi = new ParticleEmitter(pSys) { Position = Vector3.UnitX, ParticlesPerSecond = 10 }; pEmi = new ParticleEmitter(pSys) { Position = Vector3.UnitY, ParticlesPerSecond = 10 }; pEmi = new ParticleEmitter(pSys) { Position = new Vector3(Vector2.One, 0), ParticlesPerSecond = 10 }; #endregion }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { graphics.IsFullScreen = false; graphics.PreferredBackBufferWidth = 512; graphics.PreferredBackBufferHeight = 512; graphics.ApplyChanges(); SpriteBatchHelpers.Initialize(this.GraphicsDevice); inputSystem = new InputSystem(this); anim = new AnimatedLightning(Vector2.One * 12, Vector2.One * 500, 45, MathHelper.ToRadians(45), 0.7f, 5, 1, 10); //lightningPoints = LightningGenerator.Get(Vector2.One * 12, Vector2.One * 500, 140, 5, 1); //lightningSegments = LightningGenerator.GetForked(Vector2.One * 12, Vector2.One * 500, 45, MathHelper.ToRadians(45), 0.7f, 5, 1); inputSystem.RegisterKeyReleasedAction(Keys.Escape, () => Exit()); inputSystem.RegisterMouseMoveAction((x, y) => { anim.End += new Vector2(x, y); }); base.Initialize(); }
/// <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); this.Services.AddService(typeof(SpriteBatch), spriteBatch); DiagnosticsManager.Initialize(this); SpriteBatchHelpers.Initialize(GraphicsDevice); Primitives.Initialize(GraphicsDevice); Renderer = new Engine.Graphics.Renderer() { Camera = new PerspectiveCamera() { Position = Vector3.UnitX, Target = Vector3.Zero, Up = Vector3.Up, FieldOfView = MathHelper.PiOver4, AspectRatio = GraphicsDevice.Viewport.AspectRatio, NearPlane = 0.01f, FarPlane = 5000f } }; // TODO: use this.Content to load your game content here // TODO: load assets (player string font and player model) World = new World(this, Renderer); var player = World.SpawnPlayer("Player1"); var playerTrans = World.Transformations[player]; playerTrans.Scale = new Vector3(2); // TODO: load world state from data files base.LoadContent(); }
protected override void Initialize() { SpriteBatchHelpers.Initialize(this.GraphicsDevice); graphics.IsFullScreen = false; graphics.PreferredBackBufferWidth = 512; graphics.PreferredBackBufferHeight = 512; graphics.ApplyChanges(); inputSystem = new InputSystem(this); inputSystem.RegisterKeyReleasedAction(Keys.Escape, () => Exit()); inputSystem.RegisterKeyReleasedAction(Keys.Up, () => { level++; RefreshTurtle(); }); inputSystem.RegisterKeyReleasedAction(Keys.Down, () => { level--; RefreshTurtle(); }); inputSystem.RegisterKeyReleasedAction(Keys.Left, () => { dist /= 2; RefreshTurtle(); }); inputSystem.RegisterKeyReleasedAction(Keys.Right, () => { dist *= 2; RefreshTurtle(); }); inputSystem.RegisterKeyReleasedAction(Keys.W, () => { angle /= 2; RefreshTurtle(); }); inputSystem.RegisterKeyReleasedAction(Keys.S, () => { angle *= 2; RefreshTurtle(); }); inputSystem.RegisterKeyReleasedAction(Keys.D0, () => { system = new TreeSystem(); angle = 45; level = 8; RefreshTurtle(); }); inputSystem.RegisterKeyReleasedAction(Keys.D1, () => { system = new SierpinskiTriangle(); angle = 60; level = 8; RefreshTurtle(); }); inputSystem.RegisterKeyReleasedAction(Keys.D2, () => { system = new SierpinskiTriangleB(); angle = 120; level = 8; RefreshTurtle(); }); inputSystem.RegisterKeyReleasedAction(Keys.D3, () => { system = new DragonCurve(); angle = 90; dist = 6; level = 8; RefreshTurtle(); }); inputSystem.RegisterKeyReleasedAction(Keys.D4, () => { system = new KochCurve(); angle = 90; level = 8; RefreshTurtle(); }); inputSystem.RegisterKeyReleasedAction(Keys.D5, () => { system = new CantorDust(); level = 8; RefreshTurtle(); }); inputSystem.RegisterKeyReleasedAction(Keys.D6, () => { system = new FractalPlant(); angle = 35; level = 8; RefreshTurtle(); }); base.Initialize(); }