summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2005-08-09 03:08:03 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2005-08-09 03:08:03 +0000
commit4d338e801f8b1175585de6b5e7b8b2ca331b682f (patch)
treef4c7909c90edc043fbb5b0fe179685825176556d
parent9d544432e02295a078129e2314ee940cca023ae8 (diff)
downloadmana-client-4d338e801f8b1175585de6b5e7b8b2ca331b682f.tar.gz
mana-client-4d338e801f8b1175585de6b5e7b8b2ca331b682f.tar.bz2
mana-client-4d338e801f8b1175585de6b5e7b8b2ca331b682f.tar.xz
mana-client-4d338e801f8b1175585de6b5e7b8b2ca331b682f.zip
Adjust drawing offset to have the player centered in higher resolutions as well.
-rw-r--r--ChangeLog5
-rw-r--r--src/engine.cpp15
2 files changed, 14 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index ff58f119..995169ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-09 Björn Steinbrink <B.Steinbrink@gmx.de>
+
+ * src/engine.cpp: Adjust drawing offset to have the player centered in
+ higher resolutions as well.
+
2005-08-04 Björn Steinbrink <B.Steinbrink@gmx.de>
* src/main.cpp: Use "true" instead of "1" as bool argument.
diff --git a/src/engine.cpp b/src/engine.cpp
index 7901acac..7fe4d4df 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -329,8 +329,11 @@ void Engine::draw()
int mouseX, mouseY;
SDL_GetMouseState(&mouseX, &mouseY);
- int map_x = (player_node->x - 13) * 32 + get_x_offset(player_node);
- int map_y = (player_node->y - 9) * 32 + get_y_offset(player_node);
+ int midTileX = guiGraphics->getWidth() / 32 / 2;
+ int midTileY = guiGraphics->getHeight() / 32 / 2;
+
+ int map_x = (player_node->x - midTileX) * 32 + get_x_offset(player_node);
+ int map_y = (player_node->y - midTileY) * 32 + get_y_offset(player_node);
if (map_x < 0) {
map_x = 0;
@@ -340,11 +343,11 @@ void Engine::draw()
}
if (mCurrentMap) {
- if (map_x > (mCurrentMap->getWidth() - 13) * 32) {
- map_x = (mCurrentMap->getWidth() - 13) * 32;
+ if (map_x > (mCurrentMap->getWidth() - midTileX) * 32) {
+ map_x = (mCurrentMap->getWidth() - midTileX) * 32;
}
- if (map_y > (mCurrentMap->getHeight() - 9) * 32) {
- map_y = (mCurrentMap->getHeight() - 9) * 32;
+ if (map_y > (mCurrentMap->getHeight() - midTileY) * 32) {
+ map_y = (mCurrentMap->getHeight() - midTileY) * 32;
}
}