fixed pixel value bug
This commit is contained in:
parent
4841423c79
commit
491acaada1
22
src/main.cpp
22
src/main.cpp
|
@ -14,15 +14,17 @@ int main() {
|
|||
Bitmap bitmap;
|
||||
bitmap.load("../res/font.bmp");
|
||||
|
||||
std::string str = "Hello, World!";
|
||||
std::string str;
|
||||
std::cout << "string to draw: ";
|
||||
std::cin >> str;
|
||||
|
||||
//values used to calculate the coordinates of the characters
|
||||
int xOffset = 1;
|
||||
int xOffset = 2;
|
||||
int yOffset = 2;
|
||||
int xSize = 6;
|
||||
int xSize = 5;
|
||||
int ySize = 7;
|
||||
int xCount = 18;
|
||||
int xStart = 0;
|
||||
int xStart = 1;
|
||||
int yStart = 2;
|
||||
|
||||
//print vertical
|
||||
|
@ -41,12 +43,18 @@ int main() {
|
|||
|
||||
//print current row of the current character
|
||||
for (int j = x; j < x + xSize; j++) {
|
||||
auto *pixel = (unsigned int *) bitmap.getPixel(j, i + y);
|
||||
if (*pixel == 0) {
|
||||
char *pixel_ptr = bitmap.getPixel(j, i + y);
|
||||
unsigned int pixel = 0;
|
||||
*((char*)&pixel+0) = pixel_ptr[0];
|
||||
*((char*)&pixel+1) = pixel_ptr[1];
|
||||
*((char*)&pixel+2) = pixel_ptr[2];
|
||||
|
||||
if (pixel == 0) {
|
||||
std::cout << " ";
|
||||
} else {
|
||||
std::cout << "1";
|
||||
std::cout << "1";
|
||||
}
|
||||
|
||||
}
|
||||
std::cout << " ";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue