protected override void Initialize() { Camera = new Camera(this); Camera.Position = new Vector3(15, 15, 30); Camera.Target = Camera.Position + Vector3.Normalize(new Vector3(10, 5, 20)); debugDrawer = new DebugDrawer(this); debugDrawer.UpdateOrder = int.MaxValue / 2; display = new Display(this); display.DrawOrder = int.MaxValue; display.DisplayText[5] = "PRESS ENTER TO SHOW SCENE EDITOR"; quadDrawer = new QuadDrawer(this); this.Components.Add(quadDrawer); this.Components.Add(display); this.Components.Add(debugDrawer); this.Components.Add(Camera); base.Initialize(); }
/// <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() { Camera = new Camera(this); Camera.Position = new Vector2(0, 10); this.Components.Add(Camera); DebugDrawer = new DebugDrawer(this); this.Components.Add(DebugDrawer); Display = new Display(this); Display.DrawOrder = int.MaxValue; this.Components.Add(Display); this.PhysicScenes = new List<Scenes.Scene>(); foreach (Type type in Assembly.GetExecutingAssembly().GetTypes()) { if (type.Namespace == "JitterDemo.Scenes" && !type.IsAbstract) { if (type.Name == "Pyramid") currentScene = PhysicScenes.Count; Scenes.Scene scene = (Scenes.Scene)Activator.CreateInstance(type, this); this.PhysicScenes.Add(scene); } } if (PhysicScenes.Count > 0) this.PhysicScenes[currentScene].Build(); base.Initialize(); }
protected override void Initialize() { Camera = new Camera(this); Camera.Position = new Vector3(15, 15, 30); Camera.Target = Camera.Position + Vector3.Normalize(new Vector3(10, 5, 20)); this.Components.Add(Camera); DebugDrawer = new DebugDrawer(this); this.Components.Add(DebugDrawer); Display = new Display(this); Display.DrawOrder = int.MaxValue; this.Components.Add(Display); primitives[(int)Primitives.box] = new Primitives3D.BoxPrimitive(GraphicsDevice); primitives[(int)Primitives.capsule] = new Primitives3D.CapsulePrimitive(GraphicsDevice); primitives[(int)Primitives.cone] = new Primitives3D.ConePrimitive(GraphicsDevice); primitives[(int)Primitives.cylinder] = new Primitives3D.CylinderPrimitive(GraphicsDevice); primitives[(int)Primitives.sphere] = new Primitives3D.SpherePrimitive(GraphicsDevice); BasicEffect = new BasicEffect(GraphicsDevice); BasicEffect.EnableDefaultLighting(); BasicEffect.PreferPerPixelLighting = true; this.PhysicScenes = new List<Scenes.Scene>(); foreach (Type type in Assembly.GetExecutingAssembly().GetTypes()) { if (type.Namespace == "JitterDemo.Scenes" && !type.IsAbstract) { if (type.Name == "SoftBodyJenga") currentScene = PhysicScenes.Count; Scenes.Scene scene = (Scenes.Scene)Activator.CreateInstance(type, this); this.PhysicScenes.Add(scene); } } if (PhysicScenes.Count > 0) this.PhysicScenes[currentScene].Build(); base.Initialize(); }