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

我住包子山

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 閱讀(410) 評論(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一区二区三区网页| 欧美国产亚洲视频| 欧美另类videos死尸| 一区二区三区四区精品| 一本色道久久| 国产欧美91| 久久女同精品一区二区| 美女主播一区| 亚洲四色影视在线观看| 亚洲午夜视频| 精品电影在线观看| 欧美午夜不卡| 欧美一级片久久久久久久| 欧美一区三区二区在线观看| 雨宫琴音一区二区在线| 亚洲经典视频在线观看| 国产精品久久九九| 久久夜色精品国产欧美乱极品| 另类av导航| 亚洲中字在线| 美女精品在线观看| 午夜精品一区二区三区四区 | 久久精品二区亚洲w码| 久久蜜桃香蕉精品一区二区三区| 亚洲精华国产欧美| 亚洲欧美在线x视频| 91久久精品日日躁夜夜躁国产| 日韩视频在线永久播放| 一区二区三区在线观看欧美| 亚洲美女中文字幕| 在线播放豆国产99亚洲| 亚洲视频在线观看视频| 亚洲国产欧美精品| 性18欧美另类| 亚洲一品av免费观看| 久久久噜噜噜| 欧美在线视频一区| 欧美国产专区| 欧美成人三级在线| 国产一二三精品| 亚洲伦伦在线| 亚洲毛片在线看| 久久精品中文字幕免费mv| 亚洲一区精品视频| 欧美极品一区| 亚洲国产你懂的| 在线观看国产成人av片| 欧美在线日韩精品| 午夜免费久久久久| 国产精品高精视频免费| 亚洲日韩成人| 91久久中文| 另类激情亚洲| 免费成人高清视频| 一区二区三区无毛| 欧美在线亚洲综合一区| 久久成人18免费网站| 国产精品日本一区二区 | 亚洲综合三区| 欧美偷拍另类| 999亚洲国产精| 中国成人在线视频| 欧美日韩美女| 亚洲免费观看| 亚洲性视频网站| 欧美色道久久88综合亚洲精品| 亚洲欧洲日本在线| 一本久久知道综合久久| 欧美日韩国产成人在线免费 | 久久久久成人精品| 国产模特精品视频久久久久| 亚洲曰本av电影| 亚洲国产精品久久91精品| 在线免费观看日本一区| 欧美中文字幕视频| 免费一级欧美片在线播放| 黄页网站一区| 欧美成人精品不卡视频在线观看 | 蜜桃久久av一区| 免费成人你懂的| 91久久午夜| 欧美日韩精品系列| 亚洲午夜精品一区二区三区他趣| 欧美一区二区三区久久精品| 国产在线国偷精品产拍免费yy| 久久久国产亚洲精品| 你懂的网址国产 欧美| 亚洲人午夜精品免费| 欧美特黄a级高清免费大片a级| 亚洲女性裸体视频| 蜜臀va亚洲va欧美va天堂| 亚洲人线精品午夜| 国产精品美女久久久久久久| 性18欧美另类| 亚洲欧洲日产国产网站| 午夜精品久久久久久久| 伊人久久大香线蕉综合热线| 欧美精品一区二| 亚洲欧美日韩一区二区在线| 欧美成人午夜免费视在线看片| 夜夜嗨av一区二区三区四季av| 国产精品无人区| 男男成人高潮片免费网站| 亚洲一区二区动漫| 亚洲电影有码| 久久不射网站| 9l视频自拍蝌蚪9l视频成人| 国产专区欧美精品| 欧美日韩一区二区在线观看视频| 欧美影院精品一区| 99riav久久精品riav| 久久在线免费视频| 香蕉成人伊视频在线观看| 亚洲免费大片| 伊人婷婷久久| 国产九九精品| 国产精品h在线观看| 免费成人黄色片| 欧美影片第一页| 亚洲天堂偷拍| 亚洲美女视频| 亚洲国产精品女人久久久| 久久综合伊人77777| 亚洲欧美日韩在线一区| 日韩亚洲欧美精品| 亚洲国产精品日韩| 国内精品久久久久影院优| 国产精品久久久| 欧美日韩另类视频| 欧美国产国产综合| 免费在线成人| 免费一区二区三区| 毛片一区二区三区| 久久久久久久国产| 久久成人一区二区| 欧美专区18| 欧美一区免费| 午夜国产一区| 香蕉亚洲视频| 欧美一区二区成人6969| 午夜视频一区二区| 亚洲欧美日韩精品综合在线观看| 在线一区二区日韩| 一区二区三区视频免费在线观看| 日韩午夜电影| 一区二区三区免费看| 在线视频一区观看| 亚洲在线观看| 久久国产精品第一页| 久久夜色精品国产欧美乱| 久久一区免费| 欧美激情亚洲激情| 欧美日韩在线三区| 国产精品视频专区| 极品少妇一区二区三区| 在线日韩日本国产亚洲| 亚洲人成在线观看一区二区| 亚洲美女免费视频| 亚洲免费一在线| 久久久精品国产免大香伊| 老鸭窝91久久精品色噜噜导演| 欧美福利一区| 一级成人国产| 欧美一区二区三区另类| 老司机久久99久久精品播放免费| 欧美成年网站| 国产精品国产三级国产aⅴ浪潮| 国产欧美一级| 亚洲黄色在线观看| 亚洲免费视频一区二区| 久久久久久久久久久成人| 欧美高清在线视频| 一区二区三区高清视频在线观看| 亚洲欧美在线x视频| 欧美高清视频| 国产麻豆午夜三级精品| 亚洲国产视频一区| 午夜一区二区三区不卡视频| 欧美777四色影视在线| 一区二区国产精品| 久久伊人精品天天| 国产精品色婷婷久久58| 亚洲高清一区二| 午夜久久久久久| 欧美激情在线| 欧美一区亚洲| 国产精品国产馆在线真实露脸| 狠狠久久综合婷婷不卡| 宅男66日本亚洲欧美视频| 另类综合日韩欧美亚洲| 一本色道久久加勒比88综合| 久久久水蜜桃| 国产欧美日韩综合一区在线播放 | 国产精品久久久久天堂| 亚洲高清av| 欧美伊人久久久久久午夜久久久久|