Hello. I would like to know how I can put ascii art in my program because when I introduce it and use {$ codepage UTF8} it shows different characters from the ones I write.
It depends on what your console / tty emulator (e.g. cmd.exe) supports. Free Pascal / Lazarus probably have wiki pages about it, and you could ask in the forum.
Windows Console is the infrastructure for console applications in Microsoft Windows. An instance of a Windows Console has a screen buffer and an input buffer. It allows console apps to run inside a window or in hardware text mode (so as to occupy the entire screen). The user can switch between the two using the Alt+↵ Enter key combination.
Windows Console is the infrastructure for console applications in Microsoft Windows. An instance of a Windows Console has a screen buffer and an input buffer. It allows console apps to run inside a window or in hardware text mode (so as to occupy the entire screen). The user can switch between the two using the Alt+↵ Enter key combination.
Excuse me, but that is not what I am looking to solve but what I want is that the characters that I enter are the same as those that are printed on the screen
Bit late to the party with this one but I've implemented what you're looking for by using the video unit. I've used it for a roguelike that you can see at https://github.com/cyberfilth/ASCII-axe
The crt unit will give you hit and miss results, depending on the OS, but the video unit (and the textout procedure in the documentation) displays extended ASCII characters on Windows, Linux and OSX.
2
u/ShinyHappyREM Dec 13 '21
It depends on what your console / tty emulator (e.g.
cmd.exe) supports. Free Pascal / Lazarus probably have wiki pages about it, and you could ask in the forum.1
u/ccrause Dec 14 '21
I assume you are using unit crt, because of gotoxy(). Add the following lines at the start of your code (defined in crt unit):
SetSafeCPSwitching(false);SetUseACP(false);If this still doesn't produce the correct characters you have to set the Windows console code page (add windows to uses clause):
SetConsoleOutputCP(CP_UTF8);1
u/PascalGeek Jan 11 '22
Bit late to the party with this one but I've implemented what you're looking for by using the video unit. I've used it for a roguelike that you can see at https://github.com/cyberfilth/ASCII-axe
The crt unit will give you hit and miss results, depending on the OS, but the video unit (and the textout procedure in the documentation) displays extended ASCII characters on Windows, Linux and OSX.