public virtual void Initialize(bool setupDebugDrawing = true) { base.Initialize(); world = new gxtWorld(); world.Initialize(); if (setupDebugDrawing) { if (gxtDebugDrawer.SingletonIsInitialized) { debugDrawId = gxtDebugDrawer.Singleton.GetNewId(); gxtDebugDrawer.Singleton.AddSceneGraph(debugDrawId, world.SceneGraph); } else { gxtLog.WriteLineV(gxtVerbosityLevel.WARNING, "Cannot Set Up Debug Drawing For The Gameplay Screen Because the Debug Drawer Has Not Been Initialized"); } } // setup in game console }
public override void Initialize(bool setupDebugDrawing = true) { base.Initialize(); world = new gxtWorld(); world.Initialize(true, "ASG Prototype"); gxtDisplayManager.Singleton.WindowTitle = "ASG Prototype"; if (setupDebugDrawing) { if (gxtDebugDrawer.SingletonIsInitialized) { debugDrawId = gxtDebugDrawer.Singleton.GetNewId(); gxtDebugDrawer.Singleton.AddSceneGraph(debugDrawId, world.SceneGraph); gxtDebugDrawer.Singleton.DebugFont = gxtResourceManager.Singleton.Load<Microsoft.Xna.Framework.Graphics.SpriteFont>("Fonts\\debug_font"); } else { gxtLog.WriteLineV(gxtVerbosityLevel.WARNING, "Cannot Set Up Debug Drawing For The Gameplay Screen Because the Debug Drawer Has Not Been Initialized"); } } gxtLog.WriteLineV(gxtVerbosityLevel.SUCCESS, "Initialized GXT World \"{0}\"", world.Name); gxtLog.WriteLineV(gxtVerbosityLevel.INFORMATIONAL, "Populating world..."); world.PhysicsWorld.AddCollisionGroupName("player", gxtCollisionGroup.GROUP1); world.PhysicsWorld.AddCollisionGroupName("traversable_world_geometry", gxtCollisionGroup.GROUP2); // setup player asgPlayerActor player = new asgPlayerActor(world); player.Initialize(Vector2.Zero, 6.5f); world.AddActor(player); // player controller asgPlayerController playerController = new asgPlayerController(); playerController.Initialize(player); world.AddController(playerController); // camera controller asgCameraController cameraController = new asgCameraController(world.Camera); cameraController.Initialize(asgCameraMode.AUTONOMOUS, player, 1.0f, new Vector2(0.0f, -3.5f)); world.AddController(cameraController); // geoms (platforms and walls) gxtPolygon platformPolygon = gxtGeometry.CreateRectanglePolygon(15.0f, 2.0f); CreatePlatformGeom(platformPolygon, new Vector2(0.0f, 8.5f)); // dynamic box gxtRigidBody boxBody = new gxtRigidBody(); boxBody.Mass = 1.0f; boxBody.CanSleep = false; boxBody.Awake = true; gxtPolygon box = gxtGeometry.CreateRectanglePolygon(1.5f, 1.5f); gxtGeom boxGeom = new gxtGeom(box, true); boxGeom.RigidBody = boxBody; boxBody.Inertia = gxtRigidBody.GetInertiaForRectangle(1.5f, 1.5f, boxBody.Mass); boxBody.Position = new Vector2(-3.5f, -3.5f); world.AddGeom(boxGeom); world.AddRigidBody(boxBody); gxtLog.WriteLineV(gxtVerbosityLevel.INFORMATIONAL, "Done populating world..."); }
/// <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. //root.Initialize(this); //spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here base.LoadContent(); world = new gxtWorld(); }
public asgPlayerActor(gxtWorld world) { this.world = world; this.enabled = true; }