From 3349bee3a48f7df558827514c42b9853b1126215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bend=C3=ADk?= Date: Sat, 25 Aug 2012 15:21:51 +0200 Subject: [PATCH] Added draworigin. --- TileGenerator.cpp | 15 ++++++++++----- TileGenerator.h | 3 +-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/TileGenerator.cpp b/TileGenerator.cpp index ba53f2b..cf90a85 100644 --- a/TileGenerator.cpp +++ b/TileGenerator.cpp @@ -196,11 +196,6 @@ void TileGenerator::setDrawScale(bool drawScale) } } -void TileGenerator::setDrawUnderground(bool drawUnderground) -{ - m_drawUnderground = drawUnderground; -} - void TileGenerator::parseColorsFile(const std::string &fileName) { ifstream in; @@ -243,6 +238,9 @@ void TileGenerator::generate(const std::string &input, const std::string &output if (m_drawScale) { renderScale(); } + if (m_drawOrigin) { + renderOrigin(); + } writeImage(output); } @@ -535,6 +533,13 @@ void TileGenerator::renderScale() } } +void TileGenerator::renderOrigin() +{ + int imageX = -m_xMin * 16 + m_border; + int imageY = m_mapHeight - m_zMin * -16 + m_border; + gdImageArc(m_image, imageX, imageY, 12, 12, 0, 360, rgb2int(m_originColor.r, m_originColor.g, m_originColor.b)); +} + inline std::list TileGenerator::getZValueList() const { std::list zlist; diff --git a/TileGenerator.h b/TileGenerator.h index f84fa9c..c5163ff 100644 --- a/TileGenerator.h +++ b/TileGenerator.h @@ -84,7 +84,6 @@ public: void setDrawOrigin(bool drawOrigin); void setDrawPlayers(bool drawPlayers); void setDrawScale(bool drawScale); - void setDrawUnderground(bool drawUnderground); void parseColorsFile(const std::string &fileName); void generate(const std::string &input, const std::string &output); @@ -99,6 +98,7 @@ private: void renderMapBlock(const std::string &mapBlock, const BlockPos &pos, int version); void renderShading(int zPos); void renderScale(); + void renderOrigin(); void writeImage(const std::string &output); int getImageX(int val) const; int getImageY(int val) const; @@ -111,7 +111,6 @@ private: bool m_drawOrigin; bool m_drawPlayers; bool m_drawScale; - bool m_drawUnderground; int m_border; sqlite3 *m_db;