added toml
This commit is contained in:
parent
038e15a19c
commit
eeff5a45dc
|
@ -53,7 +53,7 @@ int Config::readInteger(std::string line) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
Color Config::readColor(std::string line) {
|
vkvm::Color Config::readColor(std::string line) {
|
||||||
int red, green, blue;
|
int red, green, blue;
|
||||||
std::istringstream iss(line);
|
std::istringstream iss(line);
|
||||||
|
|
||||||
|
@ -61,6 +61,6 @@ Color Config::readColor(std::string line) {
|
||||||
std::cout << "failed when read color from config" << std::endl;
|
std::cout << "failed when read color from config" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Color color(red, green, blue);
|
vkvm::Color color(red, green, blue);
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ void DritteFont::readFont() {
|
||||||
for(i = 0; i < characterHeight; i++) {
|
for(i = 0; i < characterHeight; i++) {
|
||||||
for(j = 0; j < characterWidth; j++) {
|
for(j = 0; j < characterWidth; j++) {
|
||||||
characters[row * config.column + column][i][j] =
|
characters[row * config.column + column][i][j] =
|
||||||
data[offset + (i * width + j) * PIXEL_SIZE] != (char)config.background_color.red;
|
data[offset + (i * width + j) * PIXEL_SIZE] != (char)config.background_color.getRed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
offset = findNextStartOffset(data, offset, config);
|
offset = findNextStartOffset(data, offset, config);
|
||||||
|
@ -59,7 +59,7 @@ void DritteFont::readFont() {
|
||||||
for(i = 0; i < characterHeight; i++) {
|
for(i = 0; i < characterHeight; i++) {
|
||||||
for(j = 0; j < characterWidth; j++) {
|
for(j = 0; j < characterWidth; j++) {
|
||||||
characters[config.row * config.column + column][i][j] =
|
characters[config.row * config.column + column][i][j] =
|
||||||
data[offset + (i * width + j) * PIXEL_SIZE] != (char)config.background_color.red;
|
data[offset + (i * width + j) * PIXEL_SIZE] != (char)config.background_color.getRed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
offset = findNextStartOffset(data, offset, config);
|
offset = findNextStartOffset(data, offset, config);
|
||||||
|
@ -113,17 +113,17 @@ int DritteFont::getCharacterSize(std::vector<char> data, Config config, int widt
|
||||||
// the method must be modified
|
// the method must be modified
|
||||||
for(; offset < data.size(); offset++) {
|
for(; offset < data.size(); offset++) {
|
||||||
|
|
||||||
if(((unsigned int)data[offset] & 0xff) == config.border_color.red) // only use red value because the red, green and blue values are equal.
|
if(((unsigned int)data[offset] & 0xff) == config.border_color.getRed()) // only use red value because the red, green and blue values are equal.
|
||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
if(((unsigned int)data[offset] & 0xff) != config.border_color.red) {
|
if(((unsigned int)data[offset] & 0xff) != config.border_color.getRed()) {
|
||||||
if(counter > 0 && counter < config.border_width * 3 + DEVIATION_NUMBER) { // mal 3 because color has 3 values, red, green and blue values.
|
if(counter > 0 && counter < config.border_width * 3 + DEVIATION_NUMBER) { // mal 3 because color has 3 values, red, green and blue values.
|
||||||
tempOffset = offset;
|
tempOffset = offset;
|
||||||
while (((unsigned int)data[tempOffset++] & 0xff) != config.border_color.red) {
|
while (((unsigned int)data[tempOffset++] & 0xff) != config.border_color.getRed()) {
|
||||||
characterWidth++;
|
characterWidth++;
|
||||||
}
|
}
|
||||||
tempOffset = offset;
|
tempOffset = offset;
|
||||||
while (((unsigned int)data[tempOffset] & 0xff) != config.border_color.red) {
|
while (((unsigned int)data[tempOffset] & 0xff) != config.border_color.getRed()) {
|
||||||
characterHeight++;
|
characterHeight++;
|
||||||
tempOffset += width * PIXEL_SIZE;
|
tempOffset += width * PIXEL_SIZE;
|
||||||
}
|
}
|
||||||
|
@ -146,10 +146,10 @@ int DritteFont::findNextStartOffset(std::vector<char> data, int offset, Config c
|
||||||
|
|
||||||
for(; offset < data.size(); offset += PIXEL_SIZE) {
|
for(; offset < data.size(); offset += PIXEL_SIZE) {
|
||||||
|
|
||||||
if(((unsigned int)data[offset] & 0xff) == config.border_color.red) // only use red value because the red, green and blue values are equal.
|
if(((unsigned int)data[offset] & 0xff) == config.border_color.getRed()) // only use red value because the red, green and blue values are equal.
|
||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
if(((unsigned int)data[offset] & 0xff) != config.border_color.red) {
|
if(((unsigned int)data[offset] & 0xff) != config.border_color.getRed()) {
|
||||||
if(counter > 0 && counter < config.border_width + DEVIATION_NUMBER) { // mal 3 because color has 3 values, red, green and blue values.
|
if(counter > 0 && counter < config.border_width + DEVIATION_NUMBER) { // mal 3 because color has 3 values, red, green and blue values.
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue