Added class TileGenerator.

This commit is contained in:
Miroslav Bendík 2012-08-23 12:46:22 +02:00
parent 6a4083d28c
commit 3d54e5edaa
4 changed files with 127 additions and 16 deletions

@ -28,10 +28,12 @@ include_directories(
)
set(mapper_HDRS
TileGenerator.h
)
set(mapper_SRCS
mapper.cpp
TileGenerator.cpp
)
add_executable(minetest_mapper

72
TileGenerator.cpp Normal file

@ -0,0 +1,72 @@
/*
* =====================================================================
* Version: 1.0
* Created: 23.08.2012 12:35:53
* Author: Miroslav Bendík
* Company: LinuxOS.sk
* =====================================================================
*/
#include "TileGenerator.h"
TileGenerator::TileGenerator():
m_bgColor("#ffffff"),
m_scaleColor("#000000"),
m_originColor("#ff0000"),
m_playerColor("#ff0000"),
m_drawOrigin(false),
m_drawPlayers(false),
m_drawScale(false),
m_drawUnderground(false)
{
}
TileGenerator::~TileGenerator()
{
}
void TileGenerator::setBgColor(const std::string &bgColor)
{
m_bgColor = bgColor;
}
void TileGenerator::setScaleColor(const std::string &scaleColor)
{
m_scaleColor = scaleColor;
}
void TileGenerator::setOriginColor(const std::string &originColor)
{
m_originColor = originColor;
}
void TileGenerator::setPlayerColor(const std::string &playerColor)
{
m_playerColor = playerColor;
}
void TileGenerator::setDrawOrigin(bool drawOrigin)
{
m_drawOrigin = drawOrigin;
}
void TileGenerator::setDrawPlayers(bool drawPlayers)
{
m_drawPlayers = drawPlayers;
}
void TileGenerator::setDrawScale(bool drawScale)
{
m_drawScale = drawScale;
}
void TileGenerator::setDrawUnderground(bool drawUnderground)
{
m_drawUnderground = drawUnderground;
}
void TileGenerator::generate(const std::string &/*input*/, const std::string &/*output*/)
{
}

42
TileGenerator.h Normal file

@ -0,0 +1,42 @@
/*
* =====================================================================
* Version: 1.0
* Created: 23.08.2012 12:35:59
* Author: Miroslav Bendík
* Company: LinuxOS.sk
* =====================================================================
*/
#ifndef TILEGENERATOR_H_JJNUCARH
#define TILEGENERATOR_H_JJNUCARH
#include <string>
class TileGenerator
{
public:
TileGenerator();
~TileGenerator();
void setBgColor(const std::string &bgColor);
void setScaleColor(const std::string &scaleColor);
void setOriginColor(const std::string &originColor);
void setPlayerColor(const std::string &playerColor);
void setDrawOrigin(bool drawOrigin);
void setDrawPlayers(bool drawPlayers);
void setDrawScale(bool drawScale);
void setDrawUnderground(bool drawUnderground);
void generate(const std::string &input, const std::string &output);
private:
std::string m_bgColor;
std::string m_scaleColor;
std::string m_originColor;
std::string m_playerColor;
bool m_drawOrigin;
bool m_drawPlayers;
bool m_drawScale;
bool m_drawUnderground;
}; /* ----- end of class TileGenerator ----- */
#endif /* end of include guard: TILEGENERATOR_H_JJNUCARH */

@ -14,6 +14,7 @@
#include <map>
#include <stdint.h>
#include <string>
#include "TileGenerator.h"
using namespace std;
@ -95,17 +96,11 @@ int main(int argc, char *argv[])
{"drawscale", no_argument, 0, 'S'},
{"drawunderground", no_argument, 0, 'U'}
};
string input;
string output;
string bgcolor = "#ffffff";
string scalecolor = "#000000";
string origincolor = "#ff0000";
string playercolor = "#ff0000";
bool draworigin = false;
bool drawplayers = false;
bool drawscale = false;
bool drawunderground = false;
TileGenerator generator;
int option_index = 0;
int c = 0;
while (1) {
@ -129,28 +124,28 @@ int main(int argc, char *argv[])
output = optarg;
break;
case 'b':
bgcolor = optarg;
generator.setBgColor(optarg);
break;
case 's':
scalecolor = optarg;
generator.setScaleColor(optarg);
break;
case 'r':
origincolor = optarg;
generator.setOriginColor(optarg);
break;
case 'p':
playercolor = optarg;
generator.setPlayerColor(optarg);
break;
case 'R':
draworigin = true;
generator.setDrawOrigin(true);
break;
case 'P':
drawplayers = true;
generator.setDrawPlayers(true);
break;
case 'S':
drawscale = true;
generator.setDrawScale(true);
break;
case 'U':
drawunderground = true;
generator.setDrawScale(true);
break;
default:
abort();