public PixelEngine( ) { Debug.Print("Initializing Engine..."); m_Graphics = new GraphicsDeviceManager(this); Window.Title = "Pixel Engine 0.4a"; Content.RootDirectory = "Content"; //Game = this; SpriteSheets = new SortedList <int, Texture2D>( ); //Initialize Physics Debug.Print("Initializing Physics Engine"); //Open new thread to physics pipeline PHYSICS_WORLD = new World(new Vector2(0f, 0f)); Debug.Print("Initializing World"); while (WorldManager.Initialize( ) != 0) { } //Initialize UI Engine.UI.UI.Initialize( ); }
protected override void Draw(GameTime gameTime) { //Clear the back-buffer GraphicsDevice.Clear(Color.Black); //Begin batch var viewMatrix = GAME_CAMERA.GetViewTransformMatrix( ); m_SpriteBatch.Begin(SpriteSortMode.BackToFront, transformMatrix: viewMatrix); //Draw loaded scene WorldManager.Draw ( m_SpriteBatch, gameTime ); //End batch m_SpriteBatch.End( ); //Parent callback base.Draw(gameTime); }
protected override void Update(GameTime gameTime) { var deltaTime = ( float )gameTime.ElapsedGameTime.TotalSeconds; if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState( ).IsKeyDown(Keys.Escape)) { Exit( ); } //Do Physics step PHYSICS_WORLD.Step(Math.Min(( float )gameTime.ElapsedGameTime.TotalSeconds, (1f / 30f))); //Dispatch Physics Events if (OnPhysicsUpdate != null) { OnPhysicsUpdate(PHYSICS_WORLD); } //Update loaded scene WorldManager.Update(gameTime); base.Update(gameTime); }