guylangston / ConsoleZ

Enhanced Console featuring color encoding, fast rendering, markdown, html mapper
MIT License
13 stars 2 forks source link

DirectConsole - Fast 'direct' to buffer Console for games and non-scrolling GUI #4

Open guylangston opened 5 years ago

guylangston commented 5 years ago

Implement samples to demonstrate / setup different scenarios

Currently, direct-buffer technique only supports 8bit char + 8 bit char (ASCII):

image

zmcj1 commented 4 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:

define HALF_WIDTH_CHAR 1

define FULL_WIDTH_CHAR 2

//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

zmcj1 commented 4 years ago

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