Open guylangston opened 5 years ago
For this problem: Currently, direct-buffer technique only supports 8bit char + 8 bit char (ASCII)
My method is very primitive: Returns the width of the character according to the Unicode table. Typesetting according to font width.
'a' for 1 CHAR_INFO 'の' for 2 CHAR_INFOs
example code:
//some function like this. int get_char_width(wchar_t character) { // ASCII char if(character < 127){ return 1; // simple handling }else return 2; }
Of course actual situation is much more complicated than this, you also need to consider the rendering of the same character by different fonts in Windows Console.
Here is the specific implementation : https://github.com/zmcj1/BoxheadConsoleGameEngine/blob/main/src/MinConsoleNative/Console.cpp
I have read your WIN32 code, why not try to use the WIN32 API to get keyboard and mouse input?
some APIs like: GetCursorPos GetAsyncKeyState
Implement samples to demonstrate / setup different scenarios
Currently, direct-buffer technique only supports 8bit char + 8 bit char (ASCII):