Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/cpp-tests/Classes/Box2DTestBed/Tests/ApplyForce.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,21 @@ class ApplyForce : public Test
{
switch (key)
{
case 'w':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_W:
{
b2Vec2 f = m_body->GetWorldVector(b2Vec2(0.0f, -200.0f));
b2Vec2 p = m_body->GetWorldPoint(b2Vec2(0.0f, 2.0f));
m_body->ApplyForce(f, p, true);
}
break;

case 'a':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_A:
{
m_body->ApplyTorque(50.0f, true);
}
break;

case 'd':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_D:
{
m_body->ApplyTorque(-50.0f, true);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/cpp-tests/Classes/Box2DTestBed/Tests/BodyTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ class BodyTypes : public Test
{
switch (key)
{
case 'd':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_D:
m_platform->SetType(b2_dynamicBody);
break;

case 's':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_S:
m_platform->SetType(b2_staticBody);
break;

case 'k':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_K:
m_platform->SetType(b2_kinematicBody);
m_platform->SetLinearVelocity(b2Vec2(-m_speed, 0.0f));
m_platform->SetAngularVelocity(0.0f);
Expand Down
10 changes: 5 additions & 5 deletions tests/cpp-tests/Classes/Box2DTestBed/Tests/Car.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,25 +230,25 @@ class Car : public Test
{
switch (key)
{
case 'a':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_A:
m_spring1->SetMotorSpeed(m_speed);
break;

case 's':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_S:
m_spring1->SetMotorSpeed(0.0f);
break;

case 'd':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_D:
m_spring1->SetMotorSpeed(-m_speed);
break;

case 'q':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_Q:
m_hz = b2Max(0.0f, m_hz - 1.0f);
m_spring1->SetSpringFrequencyHz(m_hz);
m_spring2->SetSpringFrequencyHz(m_hz);
break;

case 'e':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_E:
m_hz += 1.0f;
m_spring1->SetSpringFrequencyHz(m_hz);
m_spring2->SetSpringFrequencyHz(m_hz);
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp-tests/Classes/Box2DTestBed/Tests/Confined.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class Confined : public Test
{
switch (key)
{
case 'c':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_C:
CreateCircle();
break;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/cpp-tests/Classes/Box2DTestBed/Tests/ConvexHull.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ class ConvexHull : public Test
{
switch (key)
{
case 'a':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_A:
m_auto = !m_auto;
break;

case 'g':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_G:
Generate();
break;
}
Expand Down
12 changes: 6 additions & 6 deletions tests/cpp-tests/Classes/Box2DTestBed/Tests/DistanceTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,27 +95,27 @@ class DistanceTest : public Test
{
switch (key)
{
case 'a':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_A:
m_positionB.x -= 0.1f;
break;

case 'd':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_D:
m_positionB.x += 0.1f;
break;

case 's':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_S:
m_positionB.y -= 0.1f;
break;

case 'w':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_W:
m_positionB.y += 0.1f;
break;

case 'q':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_Q:
m_angleB += 0.1f * b2_pi;
break;

case 'e':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_E:
m_angleB -= 0.1f * b2_pi;
break;
}
Expand Down
8 changes: 4 additions & 4 deletions tests/cpp-tests/Classes/Box2DTestBed/Tests/DynamicTreeTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,19 @@ class DynamicTreeTest : public Test
{
switch (key)
{
case 'a':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_A:
m_automated = !m_automated;
break;

case 'c':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_C:
CreateProxy();
break;

case 'd':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_D:
DestroyProxy();
break;

case 'm':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_M:
MoveProxy();
break;
}
Expand Down
14 changes: 7 additions & 7 deletions tests/cpp-tests/Classes/Box2DTestBed/Tests/EdgeShapes.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,15 @@ class EdgeShapes : public Test
{
switch (key)
{
case '1':
case '2':
case '3':
case '4':
case '5':
Create(key - '1');
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_1:
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_2:
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_3:
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_4:
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_5:
Create((int32)key - (int32)cocos2d::EventKeyboard::KeyCode::KEY_1);
break;

case 'd':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_D:
DestroyBody();
break;
}
Expand Down
3 changes: 2 additions & 1 deletion tests/cpp-tests/Classes/Box2DTestBed/Tests/Gears.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ class Gears : public Test
{
switch (key)
{
case 0:
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_0:
// case 0:
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp-tests/Classes/Box2DTestBed/Tests/MotorJoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class MotorJoint : public Test
{
switch (key)
{
case 's':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_S:
m_go = !m_go;
break;
}
Expand Down
6 changes: 2 additions & 4 deletions tests/cpp-tests/Classes/Box2DTestBed/Tests/Pinball.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ class Pinball : public Test
{
switch (key)
{
case 'a':
case 'A':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_A:
m_button = true;
break;
}
Expand All @@ -148,8 +147,7 @@ class Pinball : public Test
{
switch (key)
{
case 'a':
case 'A':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_A:
m_button = false;
break;
}
Expand Down
12 changes: 6 additions & 6 deletions tests/cpp-tests/Classes/Box2DTestBed/Tests/PolyCollision.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,27 +81,27 @@ class PolyCollision : public Test
{
switch (key)
{
case 'a':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_A:
m_positionB.x -= 0.1f;
break;

case 'd':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_D:
m_positionB.x += 0.1f;
break;

case 's':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_S:
m_positionB.y -= 0.1f;
break;

case 'w':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_W:
m_positionB.y += 0.1f;
break;

case 'q':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_Q:
m_angleB += 0.1f * b2_pi;
break;

case 'e':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_E:
m_angleB -= 0.1f * b2_pi;
break;
}
Expand Down
17 changes: 8 additions & 9 deletions tests/cpp-tests/Classes/Box2DTestBed/Tests/PolyShapes.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,15 @@ class PolyShapes : public Test
{
switch (key)
{
case '1':
case '2':
case '3':
case '4':
case '5':
Create(key - '1');
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_1:
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_2:
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_3:
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_4:
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_5:
Create((int32)key - (int32)cocos2d::EventKeyboard::KeyCode::KEY_1);
break;

case 'a':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_A:
for (int32 i = 0; i < e_maxBodies; i += 2)
{
if (m_bodies[i])
Expand All @@ -252,8 +252,7 @@ class PolyShapes : public Test
}
}
break;

case 'd':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_D:
DestroyBody();
break;
}
Expand Down
6 changes: 3 additions & 3 deletions tests/cpp-tests/Classes/Box2DTestBed/Tests/Prismatic.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ class Prismatic : public Test
{
switch (key)
{
case 'l':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_L:
m_joint->EnableLimit(!m_joint->IsLimitEnabled());
break;

case 'm':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_M:
m_joint->EnableMotor(!m_joint->IsMotorEnabled());
break;

case 's':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_S:
m_joint->SetMotorSpeed(-m_joint->GetMotorSpeed());
break;
}
Expand Down
19 changes: 9 additions & 10 deletions tests/cpp-tests/Classes/Box2DTestBed/Tests/RayCast.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,20 +306,19 @@ class RayCast : public Test
{
switch (key)
{
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
Create(key - '1');
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_1:
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_2:
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_3:
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_4:
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_5:
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_6:
Create((int32)key - (int32)cocos2d::EventKeyboard::KeyCode::KEY_1);
break;

case 'd':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_D:
DestroyBody();
break;

case 'm':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_M:
if (m_mode == e_closest)
{
m_mode = e_any;
Expand Down
4 changes: 2 additions & 2 deletions tests/cpp-tests/Classes/Box2DTestBed/Tests/Revolute.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ class Revolute : public Test
{
switch (key)
{
case 'l':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_L:
m_joint->EnableLimit(!m_joint->IsLimitEnabled());
break;

case 'm':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_M:
m_joint->EnableMotor(!m_joint->IsMotorEnabled());
break;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/cpp-tests/Classes/Box2DTestBed/Tests/Rope.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ class Rope : public Test
{
switch (key)
{
case 'q':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_Q:
m_angle = b2Max(-b2_pi, m_angle - 0.05f * b2_pi);
m_rope.SetAngle(m_angle);
break;

case 'e':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_E:
m_angle = b2Min(b2_pi, m_angle + 0.05f * b2_pi);
m_rope.SetAngle(m_angle);
break;
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp-tests/Classes/Box2DTestBed/Tests/RopeJoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class RopeJoint : public Test
{
switch (key)
{
case 'j':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_J:
if (m_rope)
{
m_world->DestroyJoint(m_rope);
Expand Down
6 changes: 3 additions & 3 deletions tests/cpp-tests/Classes/Box2DTestBed/Tests/ShapeEditing.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ShapeEditing : public Test
{
switch (key)
{
case 'c':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_C:
if (m_fixture2 == NULL)
{
b2CircleShape shape;
Expand All @@ -63,7 +63,7 @@ class ShapeEditing : public Test
}
break;

case 'd':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_D:
if (m_fixture2 != NULL)
{
m_body->DestroyFixture(m_fixture2);
Expand All @@ -72,7 +72,7 @@ class ShapeEditing : public Test
}
break;

case 's':
case (unsigned char)cocos2d::EventKeyboard::KeyCode::KEY_S:
if (m_fixture2 != NULL)
{
m_sensor = !m_sensor;
Expand Down
Loading