|
|
|
|
@ -127,17 +127,18 @@ namespace lunarium
|
|
|
|
|
mpGroundBox->ComputeAABB(&groundbox, mpGroundBody->GetTransform(), 0);
|
|
|
|
|
|
|
|
|
|
Rectangle groundRect(groundbox);
|
|
|
|
|
g->DrawFilledBox(groundRect.LeftTop() * scaleFactor,
|
|
|
|
|
groundRect.RightBottom() * scaleFactor,
|
|
|
|
|
Color(0.0f, 1.0f, 0.0f, 1.0f));
|
|
|
|
|
groundRect.Scale(scaleFactor, scaleFactor);
|
|
|
|
|
groundRect.X *= scaleFactor;
|
|
|
|
|
groundRect.Y *= scaleFactor;
|
|
|
|
|
g->DrawFilledBox(groundRect, Color(0.0f, 1.0f, 0.0f, 1.0f));
|
|
|
|
|
|
|
|
|
|
b2AABB groundbox2;
|
|
|
|
|
mpGroundBox2->ComputeAABB(&groundbox2, mpGroundBody2->GetTransform(), 0);
|
|
|
|
|
|
|
|
|
|
mpGroundBox2->ComputeAABB(&groundbox2, mpGroundBody2->GetTransform(), 0);
|
|
|
|
|
Rectangle groundRect2(groundbox2);
|
|
|
|
|
g->DrawFilledBox(groundRect2.LeftTop() * scaleFactor,
|
|
|
|
|
groundRect2.RightBottom() * scaleFactor,
|
|
|
|
|
Color(0.0f, 1.0f, 0.0f, 1.0f));
|
|
|
|
|
groundRect2.Scale(scaleFactor, scaleFactor);
|
|
|
|
|
groundRect2.X *= scaleFactor;
|
|
|
|
|
groundRect2.Y *= scaleFactor;
|
|
|
|
|
g->DrawFilledBox(groundRect2, Color(0.0f, 1.0f, 0.0f, 1.0f));
|
|
|
|
|
|
|
|
|
|
b2AABB dynbox;
|
|
|
|
|
b2Transform transform;
|
|
|
|
|
@ -146,39 +147,38 @@ namespace lunarium
|
|
|
|
|
mpDynamicBox->ComputeAABB(&dynbox, transform, 0);
|
|
|
|
|
Rectangle dynRect(dynbox);
|
|
|
|
|
float angle = mpDynamicBody->GetAngle();
|
|
|
|
|
g->DrawFilledBox(dynRect.LeftTop() * scaleFactor,
|
|
|
|
|
dynRect.RightBottom() * scaleFactor,
|
|
|
|
|
Color(0.0f, 0.0f, 1.0f, 1.0f), angle);
|
|
|
|
|
dynRect.Scale(scaleFactor, scaleFactor);
|
|
|
|
|
dynRect.X *= scaleFactor;
|
|
|
|
|
dynRect.Y *= scaleFactor;
|
|
|
|
|
g->DrawFilledBox(dynRect, Color(0.0f, 0.0f, 1.0f, 1.0f), angle);
|
|
|
|
|
|
|
|
|
|
// Debug info
|
|
|
|
|
char str[256] = { 0 };
|
|
|
|
|
sprintf(str, "GroundBox: (%f, %f) (%f, %f)",
|
|
|
|
|
groundRect.LeftTop().x * scaleFactor, groundRect.LeftTop().y * scaleFactor,
|
|
|
|
|
groundRect.RightBottom().x * scaleFactor, groundRect.RightBottom().y * scaleFactor);
|
|
|
|
|
g->DrawString(str, Rectangle(10.0f, 10.0f, 800.0f, 30.0f), Color(0.75f, 0.85f, 0.5f, 1.0f), 0.4f);
|
|
|
|
|
sprintf(str, "GroundBox: pos: (%f, %f) size: (%f, %f)", groundRect.X, groundRect.Y, groundRect.HalfWidth, groundRect.HalfHeight);
|
|
|
|
|
g->DrawString(str, Rectangle::MakeFromTopLeft(10.0f, 10.0f, 800.0f, 30.0f), Color(0.75f, 0.85f, 0.5f, 1.0f), 0.4f);
|
|
|
|
|
|
|
|
|
|
sprintf(str, "GroundBox Half Size: (%f, %f)", groundRect.Width, groundRect.Height);
|
|
|
|
|
g->DrawString(str, Rectangle(10.0f, 35.0f, 800.0f, 30.0f), Color(0.75f, 0.85f, 0.5f, 1.0f), 0.4f);
|
|
|
|
|
// sprintf(str, "GroundBox Half Size: (%f, %f)", groundRect.Width, groundRect.Height);
|
|
|
|
|
// g->DrawString(str, Rectangle(10.0f, 35.0f, 800.0f, 30.0f), Color(0.75f, 0.85f, 0.5f, 1.0f), 0.4f);
|
|
|
|
|
|
|
|
|
|
sprintf(str, "DynBox: (%f, %f) (%f, %f), Angle: %f",
|
|
|
|
|
dynRect.LeftTop().x * scaleFactor, dynRect.LeftTop().y * scaleFactor,
|
|
|
|
|
dynRect.RightBottom().x * scaleFactor, dynRect.RightBottom().y * scaleFactor, angle);
|
|
|
|
|
g->DrawString(str, Rectangle(10.0f, 60.0f, 1000.0f, 100.0f), Color(0.75f, 0.85f, 0.5f, 1.0f), 0.4);
|
|
|
|
|
// sprintf(str, "DynBox: (%f, %f) (%f, %f), Angle: %f",
|
|
|
|
|
// dynRect.LeftTop().x * scaleFactor, dynRect.LeftTop().y * scaleFactor,
|
|
|
|
|
// dynRect.RightBottom().x * scaleFactor, dynRect.RightBottom().y * scaleFactor, angle);
|
|
|
|
|
// g->DrawString(str, Rectangle(10.0f, 60.0f, 1000.0f, 100.0f), Color(0.75f, 0.85f, 0.5f, 1.0f), 0.4);
|
|
|
|
|
|
|
|
|
|
int ww, wh;
|
|
|
|
|
Core::MainWindow().GetFramebufferSize(&ww, &wh);
|
|
|
|
|
for (int i = 0; i < wh; i += 10)
|
|
|
|
|
{
|
|
|
|
|
sprintf(str, "%d", i);
|
|
|
|
|
g->DrawString(str, Rectangle(ww - 35.0f, i, 4.0f, 5.0f), Color(1.0f, 0.0f, 0.0f, 1.0f), 0.25f);
|
|
|
|
|
g->DrawBox(Rectangle(ww - 10.0f, i, 10.0f, 2.0f), Color(1.0f, 0.0f, 0.0f, 1.0f), 1.0f);
|
|
|
|
|
g->DrawString(str, Rectangle::MakeFromTopLeft(ww - 35.0f, i, 4.0f, 5.0f), Color(1.0f, 0.0f, 0.0f, 1.0f), 0.25f);
|
|
|
|
|
g->DrawBox(Rectangle::MakeFromTopLeft(ww - 10.0f, i, 10.0f, 2.0f), Color(1.0f, 0.0f, 0.0f, 1.0f), 1.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < ww; i += 25)
|
|
|
|
|
{
|
|
|
|
|
sprintf(str, "%d", i);
|
|
|
|
|
g->DrawString(str, Rectangle(i, wh - 20.0f, 4.0f, 5.0f), Color(1.0f, 0.0f, 0.0f, 1.0f), 0.25f);
|
|
|
|
|
g->DrawBox(Rectangle(i, wh - 5.0f, 2.0f, 5.0f), Color(1.0f, 0.0f, 0.0f, 1.0f), 1.0f);
|
|
|
|
|
g->DrawString(str, Rectangle::MakeFromTopLeft(i, wh - 20.0f, 4.0f, 5.0f), Color(1.0f, 0.0f, 0.0f, 1.0f), 0.25f);
|
|
|
|
|
g->DrawBox(Rectangle::MakeFromTopLeft(i, wh - 5.0f, 2.0f, 5.0f), Color(1.0f, 0.0f, 0.0f, 1.0f), 1.0f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|