C++ Pixels In Console Window

前端 未结 6 1067
谎友^
谎友^ 2020-12-04 22:27

In C++ using Code::Blocks v10.05, how do I draw a single pixel on the console screen? Is this easy at all, or would it be easier to just draw a rectangle? How do I color it?

6条回答
  •  遥遥无期
    2020-12-04 23:05

    If you're willing to have the image look blocky, you could take advantage of the block characters from the console code page.

    • = '\xDB' = U+2588 FULL BLOCK
    • = '\xDC' = U+2584 LOWER HALF BLOCK
    • = '\xDF' = U+2580 UPPER HALF BLOCK
    • and space

    By using the half-blocks in combination with colored text, you can turn an 80×25 console window into an 80×50 16-color display. (This was the approach used by the QBasic version of Nibbles.)

    Then, you just need to convert your image to the 16-color palette and a reasonably small size.

    Mario in 8 lines and 10 columns of

提交回复
热议问题