improve avatar wrapping

This commit is contained in:
2022-11-18 20:56:09 +11:00
parent 065fa979f3
commit 505e7b78d1

View File

@ -233,15 +233,17 @@ int main(int argc, char** argv)
// test player thingo // test player thingo
if (showavatar) if (showavatar)
{ {
const int plrSz = 32;
const int hplrSz = plrSz / 2;
plrpos = VecAdd(plrpos, VecScale(stickl.compos, framedelta * 0.5)); plrpos = VecAdd(plrpos, VecScale(stickl.compos, framedelta * 0.5));
plrpos.x = pfmod(plrpos.x, rendSize.w); plrpos.x = pfmod(plrpos.x + hplrSz, rendSize.w + plrSz) - hplrSz;
plrpos.y = pfmod(plrpos.y, rendSize.h); plrpos.y = pfmod(plrpos.y + hplrSz, rendSize.h + plrSz) - hplrSz;
SetDrawColour(AVATAR); SetDrawColour(AVATAR);
const int plrSz = 32;
DrawRect( DrawRect(
(int)plrpos.x - plrSz / 2, (int)plrpos.x - hplrSz,
(int)plrpos.y - plrSz / 2, (int)plrpos.y - hplrSz,
plrSz, plrSz); plrSz, plrSz);
} }