I'm making a program in C (simple snake game).

I'm using window.h and came across an inconvenience.

I'm using COORD's and SetConsoleCursorPosition to move about the cursor. However, moving one y coordinate is almost the same as moving two x coordinates in terms of how many pixels each represents.

For example, this square window has a width of 80 and height of 40 in terms of the cursor position coordinates. Also, you can clearly see the contraction (and therefore reduction of apparent speed of the snake) when moving sidewards in the images below.

Is there any efficient solution to this so that the pixel size of one move in the x direction is the same as one move in the y direction.

Many thanks.

[Snake Moving Vertically [1]

Snake Moving Horizontally

1 Answers

1
mnistic On Best Solutions

The SetCurrentConsoleFontEx function lets you specify the console font size in the lpConsoleCurrentFontEx's dwFontSize member. There you can set the font width and height be the same.