#include "../graphics/Canvas.h"
#include "../graphics/Color.h"
+#include "../world/Character.h"
#include "../world/Entity.h"
#include "../world/Tileset.h"
#include "../world/World.h"
? ctrl.Controlled().vbox.Center()
: target.Pos();
cam.Update(delta);
+
+ // testing arm rotation
+ //dynamic_cast<Character *>(*world.Entities().begin())->armAngle -= 3 * delta;
}
for (const Entity *e : world.Entities()) {
canvas.SetColor(boundsColor);
canvas.OutlineRect(
- cam.ToScreen(Vector<float>(e->bounds.Left(), e->bounds.Top())),
- cam.ToScale(Vector<float>(e->bounds.Size()))
+ cam.ToScreen(e->bounds.Position()),
+ cam.ToScale(e->bounds.Size())
);
+ if (const Character *c = dynamic_cast<const Character *>(e)) {
+ canvas.OutlineRectRot(
+ Rect<float>(
+ cam.ToScreen(c->bounds.Position() + c->arm.Position()),
+ cam.ToScale(c->arm.Size())
+ ),
+ cam.ToScreen(c->bounds.Position() + c->armOrigin),
+ c->armAngle
+ );
+ }
canvas.SetColor(vboxColor);
- canvas.Line(
- cam.ToScreen(Vector<float>(e->vbox.Left(), e->vbox.Top())),
- cam.ToScreen(Vector<float>(e->vbox.Right(), e->vbox.Top())) - Vector<int>(1, 0)
- );
- canvas.Line(
- cam.ToScreen(Vector<float>(e->vbox.Left(), e->vbox.Bottom())) - Vector<int>(0, 1),
- cam.ToScreen(Vector<float>(e->vbox.Right(), e->vbox.Bottom())) - Vector<int>(1, 1)
+ canvas.OutlineRect(
+ cam.ToScreen(e->vbox.Position()),
+ cam.ToScale(e->vbox.Size())
);
canvas.SetColor(hboxColor);
- canvas.Line(
- cam.ToScreen(Vector<float>(e->hbox.Left(), e->hbox.Top())),
- cam.ToScreen(Vector<float>(e->hbox.Left(), e->hbox.Bottom())) - Vector<int>(0, 1)
- );
- canvas.Line(
- cam.ToScreen(Vector<float>(e->hbox.Right(), e->hbox.Top())) - Vector<int>(1, 0),
- cam.ToScreen(Vector<float>(e->hbox.Right(), e->hbox.Bottom())) - Vector<int>(1, 1)
+ canvas.OutlineRect(
+ cam.ToScreen(e->hbox.Position()),
+ cam.ToScale(e->hbox.Size())
);
}
}