/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { input = (InputHandler)Game.Services.GetService(typeof(IInputHandler)); console = (DeveloperConsole)Game.Services.GetService(typeof(IDeveloperConsole)); console.MessageHandler += new DeveloperConsole.DeveloperConsoleMessageHandler(ConsoleMessageHandler); camera = (Camera)Game.Services.GetService(typeof(ICamera)); guimanager = (GUIManager)Game.Services.GetService(typeof(IGUIManager)); // Define the World Simulator = new PhysicsSimulator(new Vector2(0, 8)); debugView = new PhysicsSimulatorView(Simulator); base.Initialize(); controlPanel = new GUIPhysicsControls(Game); controlPanel.Initialize(); guimanager.AddComponent(controlPanel); GUIButton btn = (GUIButton)controlPanel.getComponent("pause"); btn.OnMouseClick += new GUIButton.MouseClickHandler(PauseButtonMouseClick); btn = (GUIButton)controlPanel.getComponent("play"); btn.OnMouseClick += new GUIButton.MouseClickHandler(PlayButtonMouseClick); statusLabel = (GUILabel)controlPanel.getComponent("status"); //start off paused. Paused = true; GUICheckbox cb = (GUICheckbox)controlPanel.getComponent("debugdraw"); cb.CheckStateChange += new GUICheckbox.CheckChangeEventHandler(DebugDrawCheckStateChanged); cb.Checked = debugDraw; }
public override void Initialize() { PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 0)); PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator); base.Initialize(); }
public override void Initialize() { PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 100)); PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator); PhysicsSimulatorView.EnableGridView = false; base.Initialize(); }
public override void Initialize() { PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 0)); PhysicsSimulator.MaxContactsToDetect = 2; //for stacked objects, simultaneous collision are the bottlenecks so limit them to 2 per geometric pair. PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator); base.Initialize(); }
protected GameScreen() { ScreenState = ScreenState.TransitionOn; TransitionPosition = 1; TransitionOffTime = TimeSpan.Zero; TransitionOnTime = TimeSpan.Zero; PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 0)); PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator); }
public override void Initialize() { PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 150)); PhysicsSimulator.MaxContactsToDetect = 5; PhysicsSimulator.MaxContactsToResolve = 2; PhysicsSimulator.Iterations = 10; PhysicsSimulator.BiasFactor = .4f; PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator); base.Initialize(); }
public EditorScreen(Game game) : base(game) { physicsSim = new PhysicsSimulator(new Vector2(0f, 1.0f)); entityManager = new EntityManager(); guiManager = new GUIManager(); simView = new PhysicsSimulatorView(physicsSim); simView.LoadContent(Game.GraphicsDevice, Game.Content); //Build UI GUITextButton exitBtn = new GUITextButton(game, "BTN_EXIT", "POP", "Exit", 10, 10); guiManager.addObject(exitBtn); }
public override void Initialize() { PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 200)); PhysicsSimulator.MaxContactsToDetect = 2; //for stacked objects, simultaneous collision are the bottlenecks so limit them to 2 per geometric pair. PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator); PhysicsSimulatorView.EnableGridView = false; PhysicsSimulatorView.EnableEdgeView = false; PhysicsSimulatorView.EnableVerticeView = false; PhysicsSimulatorView.EnableAABBView = true; PhysicsSimulatorView.EnableCoordinateAxisView = true; 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); // TODO: use this.Content to load your game content here knight.LoadContent(physicsSimulator, Content); level.Build("level.xml", physicsSimulator, Content); bodyCamera = BodyFactory.Instance.CreateBody(physicsSimulator, 1f, 1f); bodyCamera.IgnoreGravity = true; camera = new Camera2D(new Vector2(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height)); camera.TrackingBody = bodyCamera; camera.Zoom = .25f; psView = new PhysicsSimulatorView(physicsSimulator); psView.LoadContent(GraphicsDevice, Content); }
public override void Initialize() { PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 50)); //PhysicsSimulator.NarrowPhaseCollider = new SAT(PhysicsSimulator); PhysicsSimulator.BiasFactor = .2f; //for stacked objects, simultaneous collision are the bottlenecks so limit them to 2 per geometric pair. PhysicsSimulator.MaxContactsToDetect = 2; PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator); PhysicsSimulatorView.EnableEdgeView = false; base.Initialize(); }
protected GameScreen() { _physicsSimulator = new PhysicsSimulator(new Vector2(0, 0)); _physicsSimulatorView = new PhysicsSimulatorView(_physicsSimulator); }
public override void Initialize() { PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 100)); PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator); PhysicsSimulator.MaxContactsToDetect = 6; PhysicsSimulator.MaxContactsToResolve = 3; PhysicsSimulator.BroadPhaseCollider = new BruteForceCollider(PhysicsSimulator); PhysicsSimulator.Iterations = 20; PhysicsSimulatorView.EnableContactView = false; PhysicsSimulatorView.EnableEdgeView = true; PhysicsSimulatorView.EnableAABBView = false; PhysicsSimulatorView.EnableVerticeView = false; base.Initialize(); }
public override void Initialize() { PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 100)); PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator); PhysicsSimulatorView.EnableEdgeView = true; PhysicsSimulatorView.EnableCoordinateAxisView = true; PhysicsSimulatorView.EnableAABBView = false; base.Initialize(); }