public static void RunTest() { gxtLog log = new gxtLog(); log.Initialize(true, gxtVerbosityLevel.INFORMATIONAL); gxtConsoleLogListener console = new gxtConsoleLogListener(); console.Initialize(); log.AddListener(console); gxtLog.WriteLineV(gxtVerbosityLevel.INFORMATIONAL, "Starting hashed string test...\n"); string a = "ccl"; string b = "gxt"; string c = "rit"; string d = "hashedString"; string e = "123abc"; string f = "zebra"; string g = "gazongas"; string h = "PLAYER_TYPE"; string i = "ENEMY_TYPE"; string j = "0"; gxtHashedString ha = new gxtHashedString(a); gxtHashedString hb = new gxtHashedString(b); gxtHashedString hc = new gxtHashedString(c); gxtHashedString hd = new gxtHashedString(d); gxtHashedString he = new gxtHashedString(e); gxtHashedString hf = new gxtHashedString(f); gxtHashedString hg = new gxtHashedString(g); gxtHashedString hh = new gxtHashedString(h); gxtHashedString hi = new gxtHashedString(i); gxtHashedString hj = new gxtHashedString(j); Print(ha); Print(hb); Print(hc); Print(hd); Print(he); Print(hf); Print(hg); Print(hh); Print(hi); Print(hj); bool lessThan = (ha < hb); gxtLog.WriteLineV(gxtVerbosityLevel.INFORMATIONAL, lessThan); bool eq = he.Id == gxtHashedString.Hash("123abc"); gxtLog.WriteLineV(gxtVerbosityLevel.INFORMATIONAL, eq); gxtLog.WriteLineV(gxtVerbosityLevel.INFORMATIONAL, "\nFinished hashed string test..."); }
public void Initialize(Vector2 initPos, float speed = 3.0f, float maxSpeed = 500.0f) { hashedString = new gxtHashedString("player_actor"); this.position = initPos; this.rotation = 0.0f; // if we were to take a rotation be sure to use gxtMath.WrapAngle(initRot) MoveSpeed = speed; MaxSpeed = maxSpeed; this.clipMode = asgClipMode.NORMAL; // in physics world units // setup body playerBody = new gxtRigidBody(); playerBody.Mass = 2.0f; playerBody.CanSleep = false; // should NEVER go to sleep playerBody.Awake = true; playerBody.FixedRotation = true; playerBody.IgnoreGravity = false; playerBody.Position = position; playerBody.Rotation = rotation; world.AddRigidBody(playerBody); // setup geom //playerPolygon = gxtGeometry.CreateRectanglePolygon(2, 3.5f); playerPolygon = gxtGeometry.CreateRoundedRectanglePolygon(2.0f, 3.5f, 0.45f, 0.05f); //playerPolygon = gxtGeometry.CreateEllipsePolygon(1.0f, 1.75f, 20); //playerPolygon = gxtGeometry.CreateCapsulePolygon(3.0f, 1.0f, 8); //playerPolygon = gxtGeometry.CreateCirclePolygon(3.0f, 3); playerGeom = new gxtGeom(playerPolygon, position, rotation); playerGeom.Tag = this; playerGeom.CollidesWithGroups = world.PhysicsWorld.GetCollisionGroup("traversable_world_geometry"); playerGeom.CollisionGroups = world.PhysicsWorld.GetCollisionGroup("player"); playerGeom.RigidBody = playerBody; playerGeom.OnCollision += OnCollision; playerGeom.OnSeperation += OnSeperation; world.PhysicsWorld.AddGeom(playerGeom); // setup scene node // for now we'll just use a line loop but programming it // this way makes it easy to swap out for something like a skeleton // or a texture later down the road scenePoly = gxtPolygon.Copy(playerPolygon); scenePoly.Scale(gxtPhysicsWorld.PHYSICS_SCALE); //playerEntity = new gxtLineLoop(scenePoly.v); // setup drawable //playerDrawable = new gxtDrawable(playerEntity, Color.Yellow, true, 0.1f); playerSceneNode = new gxtSceneNode(); playerSceneNode.Position = playerBody.Position; //playerSceneNode.AttachDrawable(playerDrawable); //world.AddSceneNode(playerSceneNode); // setup raycatsing logic rayCastTimer = new gxtStopWatch(true); world.AddProcess(rayCastTimer); raycasts = new List<gxtRayHit>(); clipMode = asgClipMode.NORMAL; this.halfHeight = playerGeom.LocalAABB.Height * 0.5f; }
public void Initialize(Vector2 initPos, float initRot = 0.0f) { hashedString = new gxtHashedString("player_actor"); this.position = initPos; this.rotation = gxtMath.WrapAngle(initRot); // in physics world units playerPolygon = gxtGeometry.CreateRectanglePolygon(2, 5.5f); }
public static void Print(gxtHashedString hstr) { gxtLog.WriteLineV(gxtVerbosityLevel.INFORMATIONAL, "String: {0} Value: {1}", hstr.String, hstr.Id); }