Fix sprites

This commit is contained in:
Miloslav Číž 2018-09-04 13:37:49 +02:00
parent 6ad2165a40
commit d24bf31d6e

View file

@ -421,9 +421,9 @@ public:
Character()
{
mCamera.position.x = UNITS_PER_SQUARE * 1;
mCamera.position.y = UNITS_PER_SQUARE * 5;
mCamera.direction = 200;
mCamera.position.x = 2468;//UNITS_PER_SQUARE * 1;
mCamera.position.y = 6736;//UNITS_PER_SQUARE * 5;
mCamera.direction = -100;//200;
mCamera.fovAngle = UNITS_PER_SQUARE / 4;
mCamera.height = UNITS_PER_SQUARE / 2;
mCamera.resolution.x = 110 / SUBSAMPLE;
@ -489,13 +489,21 @@ void draw()
render(player.mCamera,heightFunc,pixelFunc,c);
Vector2D v;
v.x = 5 * UNITS_PER_SQUARE;
v.y = 7 * UNITS_PER_SQUARE;
PixelInfo pos = mapToScreen(v,UNITS_PER_SQUARE / 4,player.mCamera);
Vector2D v;
v.x = 5 * UNITS_PER_SQUARE;
v.y = 7 * UNITS_PER_SQUARE;
PixelInfo pos = mapToScreen(v,UNITS_PER_SQUARE / 4,player.mCamera);
if (pos.depth > 0)
drawSprite(sprite,pos.position.x,pos.position.y,perspectiveScale(32,pos.depth));
if (pos.depth > 0)
drawSprite(sprite,pos.position.x * SUBSAMPLE,pos.position.y,perspectiveScale(32,pos.depth));
p.display.setColor(rgbToIndex(7,7,3));
p.display.setCursor(1,1);
p.display.print(player.mCamera.position.x);
p.display.print(" ");
p.display.print(player.mCamera.position.y);
p.display.print(" ");
p.display.print(player.mCamera.direction);
}
int main()