简体   繁体   English

在打印数组中使用扩展的ASCII字符

[英]using extended ASCII characters in printed array

How do I go about using extended ASCII characters in lieu of regular characters? 如何使用扩展ASCII字符代替常规字符?

I'm making a pong game and currently have | 我正在做乒乓球游戏,目前有| characters making up the paddle, however I want ASCII 219 (a solid rectangle) to make it up. 组成桨的字符,但是我想用ASCII 219(一个实心矩形)组成。 here's my code so far 到目前为止,这是我的代码

    char right_paddle_chars[] = {   '|',
                                    '|', 
                                    '|', 
                                    '|',
                                    '|', 
                                    '|',
                                    '|',    };

    paddle_id = create_big_sprite(75, 10, 1, 7, right_paddle_chars);

"Extended ASCII" is a meaningless term which is used frequently. “扩展ASCII”是一个无意义的术语 ,经常使用。 Perhaps you are referring to the graphics in one of the IBM codepages, eg, 850 (see MSDN , which shows "Code Page 850 MS-DOS Latin 1"). 也许您是在IBM代码页之一(例如850)中引用图形的(请参阅MSDN ,其中显示“代码页850 MS-DOS拉丁语1”)。

However, if you are using ncurses, you are likely using it on some non-DOS system (such as Unix, Linux or BSD), and most recent systems use UTF-8 encoding. 但是,如果您使用的是ncurses,则可能会在某些非DOS系统(例如Unix,Linux或BSD)上使用它,并且最新的系统使用UTF-8编码。 Again, Microsoft documents the equivalents for Unicode (see MSDN ). 再次,Microsoft记录了Unicode的等效项(请参见MSDN )。 Codepage 850's 0xdb maps to Unicode 0x2588 . 代码页850的0xdb映射到Unicode 0x2588

Using ncursesw (the wide-character flavor), you could have an array of wchar_t (wide-characters) holding the Unicode values of your choice, and print that as a string using addwstr . 使用ncursesw (宽字符样式 ),您可以拥有一个wchar_t (宽字符)数组,其中包含您选择的Unicode值,然后使用addwstr打印为字符串。

Given that information, you can see that this question has been asked in a different fashion here: Output “█” with ncursesw in C . 有了这些信息,您可以在此处以不同的方式询问此问题: 在C中用ncursesw输出“█”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM