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

我住包子山

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>
            欧美a级大片| 亚洲免费在线看| 欧美日韩综合在线| 欧美α欧美αv大片| 久久久一本精品99久久精品66| 亚洲色无码播放| 在线视频你懂得一区二区三区| 亚洲黄色大片| 欧美国产日本| 亚洲精品美女在线观看播放| 日韩一区二区精品在线观看| 亚洲精品一区二区三区四区高清 | 亚洲自拍16p| 亚洲欧美不卡| 欧美一区二区三区婷婷月色| 国产午夜精品视频免费不卡69堂| 国产有码在线一区二区视频| 在线观看欧美视频| 亚洲精品一区二| 99亚洲一区二区| 在线视频欧美精品| 午夜在线精品偷拍| 欧美大片免费观看在线观看网站推荐| 亚洲国产日韩欧美综合久久 | 亚洲高清一二三区| 亚洲性图久久| 久久综合一区二区| 91久久精品国产91性色| 一级成人国产| 久久精品国产综合精品| 欧美国产日韩在线观看| 国产精品毛片a∨一区二区三区|国 | 亚洲一区999| 久久亚洲高清| 一区二区三区四区在线| 免费不卡在线视频| 久久福利影视| 欧美午夜免费| 亚洲精品永久免费| 久久综合九色九九| 亚洲综合第一页| 欧美日韩国产丝袜另类| 一区二区三区在线观看视频| 亚洲一区在线播放| 91久久在线| 久久亚洲欧美| 国产一区二区毛片| 性欧美精品高清| 亚洲精品乱码久久久久久蜜桃麻豆| 欧美制服丝袜第一页| 国产精品免费一区二区三区在线观看| 亚洲精品中文字幕在线| 老司机精品视频一区二区三区| 亚洲一区二区成人在线观看| 欧美日韩亚洲一区二区三区在线 | 午夜精品久久久久久久99樱桃| 亚洲黄网站黄| 欧美激情麻豆| 日韩视频免费在线观看| 欧美成人在线影院| 久久亚洲一区二区三区四区| 欧美一级艳片视频免费观看| 亚洲精品乱码久久久久久| 欧美成人免费全部| 久久综合色天天久久综合图片| 樱桃视频在线观看一区| 老司机精品视频网站| 久久综合久久综合久久| 亚洲精品日韩综合观看成人91| 亚洲第一精品夜夜躁人人爽| 欧美高清一区| 在线一区二区三区四区| 91久久久亚洲精品| 欧美日韩精品免费| 午夜精品福利电影| 亚洲一区二区在线| 欧美日韩在线视频一区| 久久久av毛片精品| 亚洲国产一区在线观看| 亚洲欧洲精品一区二区三区波多野1战4 | 亚洲午夜精品久久久久久浪潮| 欧美日韩中文字幕精品| 午夜久久一区| 久久久精品国产免费观看同学| 久久人人看视频| 亚洲欧美日韩另类| 欧美一区二区三区日韩视频| 在线观看中文字幕不卡| 亚洲国产高清在线| 欧美日韩爆操| 久久成人精品无人区| 久久视频国产精品免费视频在线| 亚洲区中文字幕| 一区二区三区欧美在线| 国产亚洲aⅴaaaaaa毛片| 欧美 日韩 国产 一区| 欧美日韩精品一区二区在线播放| 久久gogo国模裸体人体| 欧美xx视频| 久久国产精品久久w女人spa| 狂野欧美激情性xxxx| 亚洲一区二区免费看| 久久久999| 亚洲欧美成人| 美女国产精品| 久久久久久久国产| 欧美视频日韩视频在线观看| 久久久之久亚州精品露出| 欧美日韩色婷婷| 欧美韩日一区二区| 国产欧美日韩一区二区三区在线观看 | 亚洲福利视频免费观看| 在线一区欧美| 亚洲日本成人女熟在线观看| 亚洲欧美日韩一区二区在线| 亚洲毛片在线| 久热精品视频| 久久综合国产精品台湾中文娱乐网| 欧美国产专区| 久久久亚洲高清| 国产精品免费久久久久久| 另类综合日韩欧美亚洲| 国产精品免费在线| 亚洲人成人一区二区在线观看| 一区二区视频免费完整版观看| 亚洲一区中文| 99国产精品久久久久久久| 亚洲大片在线| 久久综合久久综合久久综合| 国产精品青草久久| 亚洲精品久久久久中文字幕欢迎你 | 亚洲久久视频| 最新亚洲视频| 美女国产一区| 欧美激情一区二区三区四区| 亚洲第一精品夜夜躁人人爽 | 国产农村妇女毛片精品久久莱园子| 欧美激情bt| 国产精品videosex极品| 亚洲国内精品在线| 91久久久亚洲精品| 欧美成年人网| 亚洲欧洲美洲综合色网| 99re这里只有精品6| 欧美日韩国产成人高清视频| 日韩一级成人av| 亚洲欧美国内爽妇网| 国产精品www.| 亚洲欧美日韩在线综合| 欧美一级播放| 国产一区自拍视频| 免费看黄裸体一级大秀欧美| 最新成人av在线| 亚洲一区免费视频| 国产一区二区看久久| 久久综合精品国产一区二区三区| 欧美激情一二区| 亚洲一区二区三区视频播放| 国产精品色婷婷| 久久久久久久久久码影片| 欧美激情一区二区三区在线 | 亚洲影院色在线观看免费| 国产伦精品一区二区三区免费 | 欧美三区免费完整视频在线观看| 在线午夜精品| 久久精品一区二区| 国产欧美一区二区白浆黑人| 久久精品在线视频| 亚洲精品乱码久久久久久日本蜜臀| 亚洲一区日韩在线| 国产一区二区三区在线播放免费观看 | 久久婷婷国产综合国色天香| 亚洲高清免费视频| 国产精品成人一区二区| 久久国产精彩视频| 亚洲另类在线视频| 久久久综合精品| 一区二区三区黄色| 韩国成人精品a∨在线观看| 欧美精品麻豆| 欧美在线在线| 日韩午夜av| 免费亚洲电影在线| 午夜精品久久久久| 亚洲美女在线看| 精品91免费| 欧美xx69| 最新亚洲激情| 国产亚洲精品久| 欧美成人午夜视频| 亚洲欧美日韩视频一区| 欧美激情精品久久久久久蜜臀| 亚洲欧美另类在线| 亚洲免费电影在线观看| 国产一区二区日韩精品欧美精品| 欧美精品粉嫩高潮一区二区 | 亚洲丰满在线| 久久婷婷丁香| 欧美一区二视频| 亚洲私人影吧|