青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

我住包子山

this->blog.MoveTo("blog.baozishan.in")

Win32 Console Applications - Part 3 of 6 form adrianxw.dk

Win32 Console Applications - Part 3.

I recommend you compile and run this program. It will display the printable characters available to your console. If your console is a different size from mine, you may need to adjust the values for x and y, but this should be trivial. The rest of the tutorial assumes your character map is the same as mine - it should be, but it is possible if you have a different language set loaded into your system the positions of some of these characters may be different, run this, check them and modify the values used later accordingly, (frankly, I've worked with several language settings and never seen the character map to be different, but I'm told it is possible!).

#include <windows.h>
#include <iostream>
using namespace std;

int main()
{
    HANDLE hOut;
    int i;
    int x = 0;
    int y = 0;
    COORD Position;

    hOut = GetStdHandle(STD_OUTPUT_HANDLE);

    for (i=32; i<=255; i++)
    {
        Position.X = x;
        Position.Y = y;
        SetConsoleCursorPosition(hOut,
                                 Position);

        cout.width(3);
        cout << i << " " << (unsigned char)i << flush;

        ++y;
        if(y > 20)
        {
            y = 0;
            x += 6;
        }
    }

    Position.X = 0;
    Position.Y = 22;
    SetConsoleCursorPosition(hOut,
                             Position);
    return 0;
}

Of particular interest to this part of the tutorial are the values between 179 and 218. Shown below is the relevent part of the output from the program.

Char Map

If you remember part 1 of this tutorial, I said the "normal" characters in the console font filled a 7x11 grid in a larger 8x12 character cell which had the top and row and right column blank to allow for spacing. As you can see from the picture above, these are not normal characters, some have already merged with those above and below them to give some strange glyphs that look like a cross between sanskrit and klingon! Here is the same character range more spread out and easier to see.

Char Map2

Unlike the normal alpha-numerics, (0-9, A-Z, a-z), and puntuation characters, where space between the individual characters is important for clarity, these characters do not have space above and to the right, they run all the way to the edge of their character cell and are designed to be merged. With these characters one can draw lines, boxes and grids. Have a look at this program output for some idea of what you can do.

Boxes

The figures look a little stupid when drawn this size, but I have done this to keep the size of the image files down, so they load faster, you can make them any size, and if you inspect the character map, you will see that these are not the only possibilities.

To draw these examples, I wrote a very crude function which draws a character at a specified location on the screen, it is shown here.

void At(int x, int y, unsigned char What)
{
    static HANDLE hOut;
    static bool First = TRUE;
    COORD Position;

    if(First)
    {
        hOut = GetStdHandle(STD_OUTPUT_HANDLE);
        First = FALSE;
    }

    Position.X = x;
    Position.Y = y;
    
    SetConsoleCursorPosition(hOut,
                             Position);
    
    cout << What << flush;

    return;
}

As you can see, there is no error or range checking, it simply assumes you know what you are doing. The function retrieves the standard output handle and stores it statically the first time the it is invoked.

This code snippet shows the calls necessary to draw the first box.

    At(9, 0, (unsigned char) 218);
    At(10, 0, (unsigned char) 196);
    At(11, 0, (unsigned char) 191);
    At(9, 1, (unsigned char) 179);
    At(10, 1, (unsigned char) 32);
    At(11, 1, (unsigned char) 179);
    At(9, 2, (unsigned char) 192);
    At(10, 2, (unsigned char) 196);
    At(11, 2, (unsigned char) 217);

Given the character table above and this simple example, (32 is the space character by the way), you should have enough information to create all kinds of boxes, grids, mazes, forms etc. The very playable adventure game "Caverns of Moria" known to many VAX/VMS and UNIX users had a user interface that could easily be copied using these simple graphics.

----------

Whilst drawing boxes or at any time it becomes appropriate, you may want to hide or modify the appearance of the cursor. You can do this with another API routine, SetConsoleCursorInfo(). This takes 2 parameters, the standard output handle, and a pointer to a CONSOLE_CURSOR_INFO structure. This is another relatively simple Windows defined structure. It is looks like this.

typedef struct _CONSOLE_CURSOR_INFO {
    DWORD  dwSize; 
    BOOL   bVisible; 
} CONSOLE_CURSOR_INFO, *PCONSOLE_CURSOR_INFO; 

The first value is a simple integer in the range 1-100, it specifies how much of the character cell the cursor occupies is filled. The program here sets the cursor size to 50. The 3 pictures below show the sizes 1, 50 and 100, you can, of course, use any integer in the range. Note the use of the "&" in front of the ConCurInf, remember, the routine expects a pointer to the structure you have declared.

#include <windows.h>

int main()
{
    HANDLE hOut;
    CONSOLE_CURSOR_INFO ConCurInf;

    hOut = GetStdHandle(STD_OUTPUT_HANDLE);

    SetConsoleTitle("Size 50");

    ConCurInf.dwSize = 50;
    ConCurInf.bVisible = TRUE;

    SetConsoleCursorInfo(hOut,
                         &ConCurInf);

    return 0;
}
Cursor1

Cursor50

Cursor100

The other value is a boolean field and indicates whether the cursor is visible or not. A value of TRUE, (the default), means the cursor is visible, FALSE and it is invisible. The followng program turns the cursor off.

#include <windows.h>

int main()
{
    HANDLE hOut;
    CONSOLE_CURSOR_INFO ConCurInf;

    hOut = GetStdHandle(STD_OUTPUT_HANDLE);

    SetConsoleTitle("No Cursor");

    ConCurInf.dwSize = 10;
    ConCurInf.bVisible = FALSE;

    SetConsoleCursorInfo(hOut,
                         &ConCurInf);

    return 0;
}
CursorOff

To turn the cursor back on, call the function again with the bVisible member set TRUE.

It is a good idea to set up both values, especially the first time you call the function. If you set up bVisible but leave dwSize uninitialised, the unspecified value may be zeroed, or contain a random value, in either case, it could be out of the range 1-100, and the routine will fail. Similaly, if you want to change the size of the cursor, and don't set bVisible to be TRUE, your compiler may have zeroed the uninitialised field and the cursor will disappear instead of changing size. As always, if you check the return value of the call, you will see if any errors have happened along the way.

Remember, the cursor is there to show where the character insertion point is. Setting the cursor to invisible does not change that. Remember also, the cursor is very useful, it shows your user "where they are" on your screen, if you take it away, you must be sure you have other means available that enable your user to navigate the screen.

In the next part of this tutorial, we'll explore the colour issues.

posted on 2006-07-20 22:49 Gohan 閱讀(405) 評論(0)  編輯 收藏 引用 所屬分類: C++

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            美女日韩在线中文字幕| 欧美黑人国产人伦爽爽爽| 亚洲电影免费| 国内久久精品| 在线观看av一区| 亚洲欧洲日韩综合二区| 日韩写真在线| 欧美一区二区三区免费在线看| 亚洲性夜色噜噜噜7777| 欧美专区在线| 欧美激情精品久久久久久大尺度| 亚洲黄一区二区| 亚洲美女av在线播放| 亚洲永久免费视频| 久久久久se| 欧美三级在线视频| 精品av久久707| 中文精品视频| 久久亚洲国产精品日日av夜夜| 亚洲成在人线av| 午夜精品一区二区三区在线视| 免费不卡在线视频| 国产伦精品一区二区三区免费| 亚洲精品国产精品乱码不99| 亚洲欧美日韩中文在线制服| 免费成人黄色| 亚洲天堂成人在线观看| 久久综合网色—综合色88| 国产精品久久国产三级国电话系列 | 欧美专区在线播放| 久久精品成人一区二区三区| 欧美成人免费在线观看| 国产精品嫩草影院av蜜臀| 亚洲国产一区二区三区a毛片| 亚洲欧美日韩视频一区| 欧美高清视频在线观看| 香蕉久久一区二区不卡无毒影院| 欧美高清在线视频观看不卡| 国产日韩一级二级三级| 亚洲一级影院| 日韩视频一区| 欧美女同视频| 一本色道久久99精品综合| 欧美好骚综合网| 老司机亚洲精品| 樱桃视频在线观看一区| 欧美影院一区| 亚洲淫性视频| 国产精品久久久久久av下载红粉| 99视频有精品| 亚洲欧洲日韩在线| 老司机精品视频一区二区三区| 国产一区二区精品丝袜| 欧美一区二区三区的| 亚洲天堂网在线观看| 欧美日韩在线三区| 中文欧美日韩| 99精品热视频只有精品10| 欧美精品大片| 一区二区不卡在线视频 午夜欧美不卡在 | 99精品免费| 亚洲电影第1页| 美日韩在线观看| 亚洲国产天堂久久综合| 欧美成人一区在线| 欧美大成色www永久网站婷| 亚洲日本欧美日韩高观看| 欧美激情一区二区三区在线 | 国产精品免费小视频| 亚洲欧美日韩国产成人| 亚洲一区二区在线视频| 国产欧美日韩综合一区在线观看 | 国产欧美日韩另类视频免费观看| 亚洲欧美日韩国产精品| 亚洲一区二区三区四区视频| 国产精品一卡二卡| 久久久久国产精品一区二区| 久久久噜噜噜久久狠狠50岁| 亚洲人成欧美中文字幕| 99国产精品国产精品久久| 国产精品久久久久一区二区三区共| 午夜精品亚洲| 久久久久一区| 在线一区观看| 欧美在线关看| 亚洲裸体在线观看| 亚洲视频一二| 在线精品视频在线观看高清| 欧美黄色免费| 欧美亚洲成人网| 久久久91精品国产| 欧美激情一区二区三区在线| 亚洲欧美日韩一区在线观看| 久久男人资源视频| 亚洲中无吗在线| 久久先锋影音av| 午夜视频久久久| 欧美成黄导航| 久久久久久久久久久久久女国产乱| 欧美成人精品1314www| 欧美亚洲系列| 欧美日本久久| 免费中文字幕日韩欧美| 国产精品一国产精品k频道56| 欧美激情麻豆| 红桃视频国产一区| 一区二区三区日韩在线观看| 亚洲国产aⅴ天堂久久| 亚洲一二三四区| 日韩视频一区二区三区在线播放| 欧美一区二区三区在线观看 | 亚洲国产欧美一区| 欧美一区二区三区电影在线观看 | 欧美成人dvd在线视频| 国产精品乱码| 亚洲精品影视| 91久久久亚洲精品| 久久精品国产第一区二区三区最新章节 | 国产精品爽爽ⅴa在线观看| 亚洲日本精品国产第一区| 好看的亚洲午夜视频在线| 亚洲性色视频| 亚洲欧美日韩一区二区三区在线观看| 欧美激情第六页| 亚洲丶国产丶欧美一区二区三区| 一区免费视频| 久久精品人人做人人爽电影蜜月| 亚洲欧美一区二区精品久久久| 欧美乱人伦中文字幕在线| 欧美国产91| 亚洲人成毛片在线播放女女| 国产欧美在线| 麻豆国产精品777777在线| 国产日韩av一区二区| 亚洲婷婷综合久久一本伊一区| 制服丝袜亚洲播放| 欧美日韩综合另类| 一区二区三区视频免费在线观看| 亚洲私人影吧| 国产欧美在线看| 久久久精品tv| 亚洲国产精品久久久久秋霞影院| 亚洲三级电影在线观看| 免费一区二区三区| 亚洲精品中文字幕有码专区| 亚洲综合99| 好看的亚洲午夜视频在线| 欧美aⅴ一区二区三区视频| 亚洲人成在线播放网站岛国| 亚洲深夜福利网站| 国产麻豆综合| 老司机67194精品线观看| 亚洲九九精品| 欧美一区二区三区日韩| 狠狠v欧美v日韩v亚洲ⅴ| 美女脱光内衣内裤视频久久网站| 欧美大片免费久久精品三p| 一区二区三区久久久| 国产农村妇女精品一二区| 久久精品午夜| 亚洲免费不卡| 久久这里有精品15一区二区三区| 亚洲精华国产欧美| 国产精品一区=区| 欧美xxxx在线观看| 亚洲一区高清| 欧美国产在线观看| 新67194成人永久网站| 在线观看欧美视频| 国产精品福利影院| 欧美成人乱码一区二区三区| 亚洲欧美日韩国产另类专区| 欧美激情一区二区| 久久久91精品| 亚洲欧美日韩在线播放| 91久久线看在观草草青青| 国产精品入口66mio| 你懂的视频欧美| 欧美专区亚洲专区| 亚洲天堂视频在线观看| 亚洲黄网站在线观看| 久久一区二区三区四区| 午夜免费在线观看精品视频| 亚洲免费激情| 亚洲国产精品久久精品怡红院| 国产精品一区二区黑丝| 欧美精品免费在线| 久久―日本道色综合久久| 亚洲欧美另类中文字幕| 亚洲日本精品国产第一区| 免费h精品视频在线播放| 久久成人免费电影| 亚洲一区精品视频| 99成人在线| 亚洲伦理精品| 亚洲国产高清在线| 国内精品美女av在线播放| 国产欧美激情| 国产农村妇女毛片精品久久莱园子 | 欧美激情第9页|