protected override void Update() { audio.Update(); frameinfo.Update(); vsc.Update(timer.ElapsedSeconds); //vscp.Update(timer.ElapsedSeconds); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { Input.Update(); frameinfo.Update(); if (Input.IsKeyDown(Keys.Escape)) { this.Exit(); } if (Input.IsKeyDown(Keys.F2)) { ToggleFullScreen(); } if (Input.IsKeyDown(Keys.W)) { model.Para.BasePara.center += Vector3.Forward * 0.02f; model.WorldMatrix = Matrix.CreateTranslation(model.BasePara.center); audioemitter.Position = model.BasePara.center; } if (Input.IsKeyDown(Keys.S)) { model.Para.BasePara.center += Vector3.Backward * 0.02f; model.WorldMatrix = Matrix.CreateTranslation(model.BasePara.center); audioemitter.Position = model.BasePara.center; } if (Input.IsKeyDown(Keys.A)) { model.Para.BasePara.center += Vector3.Left * 0.02f; model.WorldMatrix = Matrix.CreateTranslation(model.BasePara.center); audioemitter.Position = model.BasePara.center; } if (Input.IsKeyDown(Keys.D)) { model.Para.BasePara.center += Vector3.Right * 0.02f; model.WorldMatrix = Matrix.CreateTranslation(model.BasePara.center); audioemitter.Position = model.BasePara.center; } model.Para.BasePara.orientation3D += model.BasePara.rotationspeed3D * (float)gameTime.ElapsedGameTime.TotalSeconds; model.Ori3DMatrix = VisionStimulus.GetOri3DMatrix(model.BasePara.orientation3D); if (audio.ActiveCue3Ds.Count > 0) { audio.ActiveCue3Ds[0].Emitter = audioemitter; } else { audio.Play("BgMusic", audioemitter); } audio.Update(); base.Update(gameTime); }
protected override void Initialize() { logger = new SLLogger(); frameinfo = new FrameInfo(); audio = new SLAudio(SLConfig["content"] + "StiLib", SLConfig["content"] + "SLMWB", SLConfig["content"] + "SLSWB", SLConfig["content"] + "SLSB"); audio.Update(); audio.StartBgMusic("BgMusic"); BarPara bpara = BarPara.Default; bpara.width = 4.0f; bpara.height = 1.0f; bpara.BasePara.direction = 0.0f; bpara.BasePara.speed = 10.0f; bpara.BasePara.space = 10.0f; bpara.BasePara.center = new Vector3(-2.0f, -2.0f, 0.0f); bpara.BasePara.color = Color.SeaGreen; bar = new Bar(GraphicsDevice, SLConfig, bpara); GratingPara gpara = GratingPara.Default; gpara.shape = Shape.Circle; gpara.gratingtype = GratingType.Sinusoidal; gpara.BasePara.center = new Vector3(2.0f, 2.0f, 0.0f); gpara.lhcolor = Color.OrangeRed; gpara.rlcolor = new Color(0f, 1f, 0f, 1f); gpara.BasePara.diameter = 7.0f; gpara.sf = 0.5f; gpara.contrast = 0.8f; gpara.luminance = 0.3f; gpara.maskpara.BasePara.diameter = 1.2f; grating = new Grating(GraphicsDevice, Services, "Content", gpara); text = new Text(GraphicsDevice, Services, "Content", "Arial"); model = new SLModel(GraphicsDevice, Services, "Content", "earth"); cross = new Primitive(GraphicsDevice, PrimitivePara.Cross(3f, Color.Green, 4 * Vector3.UnitX)); arrow = new Primitive(GraphicsDevice, PrimitivePara.Arrow(4f, Color.Red, -4 * Vector3.UnitX, 60f, 1f)); model.Para.BasePara.rotationspeed3D = Vector3.UnitY; model.ProjectionType = ProjectionType.Perspective; model.globalCamera.NearPlane = 0.1f; timer = new SLTimer(); timer.Start(); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { Input.Update(); frameinfo.Update(); audio.Update(); vsc.Update(gameTime.TotalGameTime.TotalSeconds); if (Input.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape)) { this.Exit(); } if (Input.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.F2)) { ToggleFullScreen(); } if (Input.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.G)) { SetGamma(new Vector3(2.1f, 2.1f, 2.1f)); } base.Update(gameTime); }
/// <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() { base.Initialize(); audio = new SLAudio(SLConfig["content"] + "StiLib", SLConfig["content"] + "SLMWB", SLConfig["content"] + "SLSWB", SLConfig["content"] + "SLSB"); audio.Update(); audio.StartBgMusic("BgMusic"); frameinfo = new FrameInfo(); text = new Text(GraphicsDevice, Services, "Content", "Arial"); model = new SLModel(GraphicsDevice, Services, "Content", "earth"); model.Para.BasePara.space = 10; model.Para.BasePara.rotationspeed3D = Vector3.UnitY; model.ProjectionType = ProjectionType.Perspective; model.globalCamera.Position = Vector3.UnitZ * 20; CollectionPara cpara = CollectionPara.Default; cpara.BasePara.center = Vector3.Zero; cpara.CollectionCenter = new Vector3(2f, 3f, 0.0f); cpara.CollectionSpeed = new Vector3(0.02f, 0.03f, 0.0f); vsc = new VSCollection <SLModel>(10, GraphicsDevice, model, cpara); }
protected override void Initialize() { logger = new SLLogger(); frameinfo = new FrameInfo(); audio = new SLAudio(SLConfig["content"] + "StiLib", SLConfig["content"] + "SLMWB", SLConfig["content"] + "SLSWB", SLConfig["content"] + "SLSB"); audio.Update(); audio.StartBgMusic("BgMusic"); BarPara bpara = BarPara.Default; bpara.width = 4.0f; bpara.height = 1.0f; bpara.BasePara.direction = 0.0f; bpara.BasePara.speed = 10.0f; bpara.BasePara.space = 10.0f; bpara.BasePara.center = new Vector3(-2.0f, -2.0f, 0.0f); bpara.BasePara.color = Color.SeaGreen; bar = new Bar(GraphicsDevice, SLConfig, bpara); GratingPara gpara = GratingPara.Default; gpara.shape = Shape.Circle; gpara.gratingtype = GratingType.Sinusoidal; gpara.BasePara.center = new Vector3(2.0f, 2.0f, 0.0f); gpara.lhcolor = Color.OrangeRed; gpara.rlcolor = new Color(0f, 1f, 0f, 1f); gpara.BasePara.diameter = 7.0f; gpara.sf = 0.5f; gpara.contrast = 0.8f; gpara.luminance = 0.3f; gpara.maskpara.BasePara.diameter = 1.2f; grating = new Grating(GraphicsDevice, Services, "Content", gpara); text = new Text(GraphicsDevice, Services, "Content", "Arial"); image = new Image(GraphicsDevice, Services, "Content", "Turtle"); quad = new SLQuad(GraphicsDevice, Services, "Content", "StiLib_Logo"); model = new SLModel(GraphicsDevice, Services, "Content", "earth"); video = new SLVideo(GraphicsDevice, Services, "Content", "Butterfly"); point = new Primitive(GraphicsDevice, PrimitivePara.Default); circle = new Primitive(GraphicsDevice, PrimitivePara.Circle(5f, Color.Azure, false)); disk = new Primitive(GraphicsDevice, PrimitivePara.Circle(0.3f, Color.DarkBlue, 4 * Vector3.UnitY,Color.DarkBlue, 100, true)); cross = new Primitive(GraphicsDevice, PrimitivePara.Cross(3f, Color.Green, 4 * Vector3.UnitX)); arrow = new Primitive(GraphicsDevice, PrimitivePara.Arrow(4f, Color.Red, -4 * Vector3.UnitX, 60f, 1f)); radialcircle = new Primitive(GraphicsDevice, PrimitivePara.Circle(5f, new Color(0f, 0f, 0f, 0.5f),Vector3.Zero, new Color(0f, 0f, 0f, 0.0f),100,true)); gaussian = new Primitive(GraphicsDevice, PrimitivePara.Gaussian(10, 1.5f, Color.Gray, Vector3.Zero)); disk.Para.BasePara.space = 10; model.Para.BasePara.rotationspeed3D = Vector3.UnitY; model.ProjectionType = ProjectionType.Perspective; //model.globalCamera.NearPlane = 0.1f; CollectionPara cpara = CollectionPara.Default; cpara.BasePara.center = Vector3.UnitX * 5; cpara.CollectionCenter = new Vector3(2f, 3f, 0.0f); cpara.CollectionSpeed = new Vector3(0.02f, 0.03f, 0.0f); vsc = new VSCollection<Primitive>(50, GraphicsDevice, cross, cpara); //vscp = new vscPrimitive(100, GraphicsDevice, disk, Services, "Content",cpara); timer = new SLTimer(); timer.Start(); }
/// <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() { base.Initialize(); audio = new SLAudio(SLConfig["content"] + "StiLib", SLConfig["content"] + "SLMWB", SLConfig["content"] + "SLSWB", SLConfig["content"] + "SLSB"); audio.Update(); audio.StartBgMusic("BgMusic"); frameinfo = new FrameInfo(); text = new Text(GraphicsDevice, Services, "Content", "Arial"); model = new SLModel(GraphicsDevice, Services, "Content", "earth"); model.Para.BasePara.space = 10; model.Para.BasePara.rotationspeed3D = Vector3.UnitY; model.ProjectionType = ProjectionType.Perspective; model.globalCamera.Position = Vector3.UnitZ * 20; CollectionPara cpara = CollectionPara.Default; cpara.BasePara.center = Vector3.Zero; cpara.CollectionCenter = new Vector3(2f, 3f, 0.0f); cpara.CollectionSpeed = new Vector3(0.02f, 0.03f, 0.0f); vsc = new VSCollection<SLModel>(10, GraphicsDevice, model, cpara); }
protected override void Initialize() { logger = new SLLogger(); frameinfo = new FrameInfo(); audio = new SLAudio(SLConfig["content"] + "StiLib", SLConfig["content"] + "SLMWB", SLConfig["content"] + "SLSWB", SLConfig["content"] + "SLSB"); audio.Update(); audio.StartBgMusic("BgMusic"); BarPara bpara = BarPara.Default; bpara.width = 4.0f; bpara.height = 1.0f; bpara.BasePara.direction = 0.0f; bpara.BasePara.speed = 10.0f; bpara.BasePara.space = 10.0f; bpara.BasePara.center = new Vector3(-2.0f, -2.0f, 0.0f); bpara.BasePara.color = Color.SeaGreen; bar = new Bar(GraphicsDevice, SLConfig, bpara); GratingPara gpara = GratingPara.Default; gpara.shape = Shape.Circle; gpara.gratingtype = GratingType.Sinusoidal; gpara.BasePara.center = new Vector3(2.0f, 2.0f, 0.0f); gpara.lhcolor = Color.OrangeRed; gpara.rlcolor = new Color(0f, 1f, 0f, 1f); gpara.BasePara.diameter = 7.0f; gpara.sf = 0.5f; gpara.contrast = 0.8f; gpara.luminance = 0.3f; gpara.maskpara.BasePara.diameter = 1.2f; grating = new Grating(GraphicsDevice, Services, "Content", gpara); text = new Text(GraphicsDevice, Services, "Content", "Arial"); model = new SLModel(GraphicsDevice, Services, "Content", "earth"); cross = new Primitive(GraphicsDevice, PrimitivePara.Cross(3f, Color.Green, 4 * Vector3.UnitX)); arrow = new Primitive(GraphicsDevice, PrimitivePara.Arrow(4f, Color.Red, -4 * Vector3.UnitX, 60f, 1f)); model.Para.BasePara.rotationspeed3D = Vector3.UnitY; model.ProjectionType = ProjectionType.Perspective; model.globalCamera.NearPlane = 0.1f; timer = new SLTimer(); timer.Start(); }
protected override void Initialize() { logger = new SLLogger(); frameinfo = new FrameInfo(); audio = new SLAudio(SLConfig["content"] + "StiLib", SLConfig["content"] + "SLMWB", SLConfig["content"] + "SLSWB", SLConfig["content"] + "SLSB"); audio.Update(); audio.StartBgMusic("BgMusic"); BarPara bpara = BarPara.Default; bpara.width = 4.0f; bpara.height = 1.0f; bpara.BasePara.direction = 0.0f; bpara.BasePara.speed = 10.0f; bpara.BasePara.space = 10.0f; bpara.BasePara.center = new Vector3(-2.0f, -2.0f, 0.0f); bpara.BasePara.color = Color.SeaGreen; bar = new Bar(GraphicsDevice, SLConfig, bpara); GratingPara gpara = GratingPara.Default; gpara.shape = Shape.Circle; gpara.gratingtype = GratingType.Sinusoidal; gpara.BasePara.center = new Vector3(2.0f, 2.0f, 0.0f); gpara.lhcolor = Color.OrangeRed; gpara.rlcolor = new Color(0f, 1f, 0f, 1f); gpara.BasePara.diameter = 7.0f; gpara.sf = 0.5f; gpara.contrast = 0.8f; gpara.luminance = 0.3f; gpara.maskpara.BasePara.diameter = 1.2f; grating = new Grating(GraphicsDevice, Services, "Content", gpara); text = new Text(GraphicsDevice, Services, "Content", "Arial"); image = new Image(GraphicsDevice, Services, "Content", "Turtle"); quad = new SLQuad(GraphicsDevice, Services, "Content", "StiLib_Logo"); model = new SLModel(GraphicsDevice, Services, "Content", "earth"); video = new SLVideo(GraphicsDevice, Services, "Content", "Butterfly"); point = new Primitive(GraphicsDevice, PrimitivePara.Default); circle = new Primitive(GraphicsDevice, PrimitivePara.Circle(5f, Color.Azure, false)); disk = new Primitive(GraphicsDevice, PrimitivePara.Circle(0.3f, Color.DarkBlue, 4 * Vector3.UnitY, Color.DarkBlue, 100, true)); cross = new Primitive(GraphicsDevice, PrimitivePara.Cross(3f, Color.Green, 4 * Vector3.UnitX)); arrow = new Primitive(GraphicsDevice, PrimitivePara.Arrow(4f, Color.Red, -4 * Vector3.UnitX, 60f, 1f)); radialcircle = new Primitive(GraphicsDevice, PrimitivePara.Circle(5f, new Color(0f, 0f, 0f, 0.5f), Vector3.Zero, new Color(0f, 0f, 0f, 0.0f), 100, true)); gaussian = new Primitive(GraphicsDevice, PrimitivePara.Gaussian(10, 1.5f, Color.Gray, Vector3.Zero)); disk.Para.BasePara.space = 10; model.Para.BasePara.rotationspeed3D = Vector3.UnitY; model.ProjectionType = ProjectionType.Perspective; //model.globalCamera.NearPlane = 0.1f; CollectionPara cpara = CollectionPara.Default; cpara.BasePara.center = Vector3.UnitX * 5; cpara.CollectionCenter = new Vector3(2f, 3f, 0.0f); cpara.CollectionSpeed = new Vector3(0.02f, 0.03f, 0.0f); vsc = new VSCollection <Primitive>(50, GraphicsDevice, cross, cpara); //vscp = new vscPrimitive(100, GraphicsDevice, disk, Services, "Content",cpara); timer = new SLTimer(); timer.Start(); }
protected override void Update() { audio.Update(); frameinfo.Update(); }