From d24bf31d6e35b5f078c421342f6eeae9e3d0a8f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Tue, 4 Sep 2018 13:37:49 +0200 Subject: [PATCH] Fix sprites --- game.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/game.cpp b/game.cpp index 5a3d7b5..658aaa5 100644 --- a/game.cpp +++ b/game.cpp @@ -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()