C++ Pixels In Console Window

前端 未结 6 1099
谎友^
谎友^ 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:20

    Console is a text device, so in general you don't write to individual pixels. You can create a special font and select it as a font for console, but it will be monochromatic. There are libraries which simplify writing console UI (e.g. Curses), but I believe that you also have more gamelike functionality in mind besides just showing a sprite.

    if you want to write a game, I suggest taking a look at some of the graphics/game frameworks/libs, e.g. SDL

提交回复
热议问题