亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? tictac1.c

?? WINCE開發(fā)的資料,很多驅(qū)動(dòng)方面的列子與源碼,
?? C
字號(hào):
//======================================================================
// TicTac1 - Simple tic-tac-toe game
//
// Written for the book Programming Windows CE
// Copyright (C) 1998 Douglas Boling
//
//======================================================================
#include <windows.h>                 // For all that Windows stuff
#include <commctrl.h>                // Command bar includes
#include "tictac1.h"                 // Program-specific stuff

//----------------------------------------------------------------------
// Global data
//
const TCHAR szAppName[] = TEXT ("TicTac1");
HINSTANCE hInst;                     // Program instance handle

// State data for game
RECT rectBoard = {0, 0, 0, 0};       // Used to place game board.
RECT rectPrompt;                     // Used to place prompt.
BYTE bBoard[9];                      // Keeps track of Xs and Os.
BYTE bTurn = 0;                      // Keeps track of the turn.

// Message dispatch table for MainWindowProc
const struct decodeUINT MainMessages[] = {
    WM_CREATE, DoCreateMain,
    WM_SIZE, DoSizeMain,
    WM_PAINT, DoPaintMain,
    WM_LBUTTONUP, DoLButtonUpMain,
    WM_DESTROY, DoDestroyMain,
};

//======================================================================
//
// Program entry point
//
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    LPWSTR lpCmdLine, int nCmdShow) {
    MSG msg;
    int rc = 0;
    HWND hwndMain;

    // Initialize application.
    rc = InitApp (hInstance);
    if (rc) return rc;

    // Initialize this instance.
    hwndMain = InitInstance (hInstance, lpCmdLine, nCmdShow);
    if (hwndMain == 0)
        return 0x10;

    // Application message loop
    while (GetMessage (&msg, NULL, 0, 0)) {
        TranslateMessage (&msg);
        DispatchMessage (&msg);
    }
    // Instance cleanup
    return TermInstance (hInstance, msg.wParam);
}
//----------------------------------------------------------------------
// InitApp - Application initialization
//
int InitApp (HINSTANCE hInstance) {
    WNDCLASS wc;

    // Register application main window class.
    wc.style = 0;                             // Window style
    wc.lpfnWndProc = MainWndProc;             // Callback function
    wc.cbClsExtra = 0;                        // Extra class data
    wc.cbWndExtra = 0;                        // Extra window data
    wc.hInstance = hInstance;                 // Owner handle
    wc.hIcon = NULL,                          // Application icon
    wc.hCursor = NULL;                        // Default cursor
    wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH);
    wc.lpszMenuName =  NULL;                  // Menu name
    wc.lpszClassName = szAppName;             // Window class name

    if (RegisterClass (&wc) == 0) return 1;

    return 0;
}
//----------------------------------------------------------------------
// InitInstance - Instance initialization
//
HWND InitInstance (HINSTANCE hInstance, LPWSTR lpCmdLine, int nCmdShow) {
    HWND hWnd;

    // Save program instance handle in global variable.
    hInst = hInstance;

    // Create main window.
    hWnd = CreateWindow (szAppName,           // Window class
                         TEXT ("TicTac1"),    // Window title
                         WS_VISIBLE,          // Style flags
                         CW_USEDEFAULT,       // x position
                         CW_USEDEFAULT,       // y position
                         CW_USEDEFAULT,       // Initial width
                         CW_USEDEFAULT,       // Initial height
                         NULL,                // Parent
                         NULL,                // Menu, must be null
                         hInstance,           // App instance
                         NULL);               // Pointer to create
                                              // parameters
    // Return fail code if window not created.
    if (!IsWindow (hWnd)) return 0;

    // Standard show and update calls
    ShowWindow (hWnd, nCmdShow);
    UpdateWindow (hWnd);
    return hWnd;
}
//----------------------------------------------------------------------
// TermInstance - Program cleanup
//
int TermInstance (HINSTANCE hInstance, int nDefRC) {

    return nDefRC;
}
//======================================================================
// Message handling procedures for MainWindow
//

//----------------------------------------------------------------------
// MainWndProc - Callback function for application window
//
LRESULT CALLBACK MainWndProc (HWND hWnd, UINT wMsg, WPARAM wParam,
                              LPARAM lParam) {
    INT i;
    //
    // Search message list to see if we need to handle this
    // message.  If in list, call procedure.
    //
    for (i = 0; i < dim(MainMessages); i++) {
        if (wMsg == MainMessages[i].Code)
            return (*MainMessages[i].Fxn)(hWnd, wMsg, wParam, lParam);
    }
    return DefWindowProc(hWnd, wMsg, wParam, lParam);
}
//----------------------------------------------------------------------
// DoCreateMain - Process WM_CREATE message for window.
//
LRESULT DoCreateMain (HWND hWnd, UINT wMsg, WPARAM wParam, 
                      LPARAM lParam) {
    HWND hwndCB;

    // Create a command bar.
    hwndCB = CommandBar_Create (hInst, hWnd, IDC_CMDBAR);

    // Add exit button to command bar. 
    CommandBar_AddAdornments (hwndCB, 0, 0);
    return 0;
}
//----------------------------------------------------------------------
// DoSizeMain - Process WM_SIZE message for window.
//
LRESULT DoSizeMain (HWND hWnd, UINT wMsg, WPARAM wParam,
                    LPARAM lParam) {
    RECT rect;
    INT i;

    // Adjust the size of the client rect to take into account
    // the command bar height.
    GetClientRect (hWnd, &rect);
    rect.top += CommandBar_Height (GetDlgItem (hWnd, IDC_CMDBAR));

    // Init the board rectangle if not yet initialized.
    if (rectBoard.right == 0) {

        // Init the board.
        for (i = 0; i < dim(bBoard); i++)
            bBoard[i] = 0;
    }
    // Define the playing board rect.
    rectBoard = rect;
    rectPrompt = rect;
    // Layout depends on portrait or landscape screen.
    if (rect.right - rect.left > rect.bottom - rect.top) {
        rectBoard.left += 20;
        rectBoard.top += 10;
        rectBoard.bottom -= 10;
        rectBoard.right = rectBoard.bottom - rectBoard.top + 10; 

        rectPrompt.left = rectBoard.right + 10;

    } else {
        rectBoard.left += 20;
        rectBoard.right -= 20;
        rectBoard.top += 10;
        rectBoard.bottom = rectBoard.right - rectBoard.left + 10;

        rectPrompt.top = rectBoard.bottom + 10;
    }
    return 0;
}
//----------------------------------------------------------------------
// DoPaintMain - Process WM_PAINT message for window.
//
LRESULT DoPaintMain (HWND hWnd, UINT wMsg, WPARAM wParam,
                    LPARAM lParam) {
    PAINTSTRUCT ps;
    RECT rect;
    HFONT hFont, hOldFont;
    HDC hdc;

    // Adjust the size of the client rect to take into account
    // the command bar height.
    GetClientRect (hWnd, &rect);
    rect.top += CommandBar_Height (GetDlgItem (hWnd, IDC_CMDBAR));

    hdc = BeginPaint (hWnd, &ps); 

    // Draw the board.
    DrawBoard (hdc, &rectBoard);

    // Write the prompt to the screen.
    hFont = GetStockObject (SYSTEM_FONT);
    hOldFont = SelectObject (hdc, hFont);
    if (bTurn == 0)
        DrawText (hdc, TEXT (" X's turn"), -1, &rectPrompt,
                  DT_CENTER | DT_VCENTER | DT_SINGLELINE);
    else
        DrawText (hdc, TEXT (" O's turn"), -1, &rectPrompt, 
                  DT_CENTER | DT_VCENTER | DT_SINGLELINE);

    SelectObject (hdc, hOldFont);
    EndPaint (hWnd, &ps);
    return 0;
}
//----------------------------------------------------------------------
// DoLButtonUpMain - Process WM_LBUTTONUP message for window.
//
LRESULT DoLButtonUpMain (HWND hWnd, UINT wMsg, WPARAM wParam,
                         LPARAM lParam) {
    POINT pt;
    INT cx, cy, nCell = 0;

    pt.x = LOWORD (lParam);
    pt.y = HIWORD (lParam);

    // See if pen on board.  If so, determine which cell.
    if (PtInRect (&rectBoard, pt)){
        // Normalize point to upper left corner of board.
        pt.x -= rectBoard.left;
        pt.y -= rectBoard.top;

        // Compute size of each cell.
        cx = (rectBoard.right - rectBoard.left)/3;
        cy = (rectBoard.bottom - rectBoard.top)/3;

        // Find column.
        nCell = (pt.x / cx); 

        // Find row.
        nCell += (pt.y / cy) * 3; 

        // If cell empty, fill it with mark.
        if (bBoard[nCell] == 0) {
            if (bTurn) {
                bBoard[nCell] = 2;
                bTurn = 0;
            } else {
                bBoard[nCell] = 1;
                bTurn = 1;
            }
            InvalidateRect (hWnd, NULL, FALSE);
        } else {
            // Inform the user of the filled cell.
            MessageBeep (0);
            return 0;
        }
    }
    return 0;
}
//----------------------------------------------------------------------
// DoDestroyMain - Process WM_DESTROY message for window.
//
LRESULT DoDestroyMain (HWND hWnd, UINT wMsg, WPARAM wParam, 
                       LPARAM lParam) {
    PostQuitMessage (0);
    return 0;
}
//======================================================================
// Game-specific routines
//
//----------------------------------------------------------------------
// DrawXO - Draw a single X or O in a square.
//
void DrawXO (HDC hdc, HPEN hPen, RECT *prect, INT nCell, INT nType) {
    POINT pt[2];
    INT cx, cy;
    RECT rect;

    cx = (prect->right - prect->left)/3;
    cy = (prect->bottom - prect->top)/3;

    // Compute the dimensions of the target cell.
    rect.left = (cx * (nCell % 3) + prect->left) + 10;
    rect.right = rect.right =  rect.left + cx - 20;
    rect.top = cy * (nCell / 3) + prect->top + 10;
    rect.bottom = rect.top + cy - 20;

    // Draw an X ?
    if (nType == 1) {
        pt[0].x = rect.left;
        pt[0].y = rect.top;
        pt[1].x = rect.right;
        pt[1].y = rect.bottom;
        Polyline (hdc, pt, 2);

        pt[0].x = rect.right;
        pt[1].x = rect.left;
        Polyline (hdc, pt, 2);
    // How about an O ?
    } else if (nType == 2) {
        Ellipse (hdc, rect.left, rect.top, rect.right, rect.bottom);
    }
    return;
}
//----------------------------------------------------------------------
// DrawBoard - Draw the tic-tac-toe board.
//  VK_MENU
void DrawBoard (HDC hdc, RECT *prect) {
    HPEN hPen, hOldPen;
    POINT pt[2];
    LOGPEN lp;
    INT i, cx, cy;

    // Create a nice thick pen.
    lp.lopnStyle = PS_SOLID;
    lp.lopnWidth.x = 5;
    lp.lopnWidth.y = 5;
    lp.lopnColor = RGB (0, 0, 0);
    hPen = CreatePenIndirect (&lp);

    hOldPen = SelectObject (hdc, hPen);

    cx = (prect->right - prect->left)/3;
    cy = (prect->bottom - prect->top)/3;

    // Draw lines down.
    pt[0].x = cx + prect->left;
    pt[1].x = cx + prect->left;
    pt[0].y = prect->top;
    pt[1].y = prect->bottom;
    Polyline (hdc, pt, 2);

    pt[0].x += cx;
    pt[1].x += cx;
    Polyline (hdc, pt, 2);

    // Draw lines across.
    pt[0].x = prect->left;
    pt[1].x = prect->right;
    pt[0].y = cy + prect->top;
    pt[1].y = cy + prect->top;
    Polyline (hdc, pt, 2);

    pt[0].y += cy;
    pt[1].y += cy;
    Polyline (hdc, pt, 2);

    // Fill in Xs and Os.
    for (i = 0; i < dim (bBoard); i++)
        DrawXO (hdc, hPen, &rectBoard, i, bBoard[i]);

    SelectObject (hdc, hOldPen);
    DeleteObject (hPen);
    return;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一二三级电影| 欧美videossexotv100| 亚洲日本青草视频在线怡红院 | 国产精品原创巨作av| 精品噜噜噜噜久久久久久久久试看| 蜜桃一区二区三区四区| 日韩午夜av一区| 韩国在线一区二区| 欧美国产日韩在线观看| 色香色香欲天天天影视综合网| 亚洲一线二线三线久久久| 51久久夜色精品国产麻豆| 久久69国产一区二区蜜臀| 国产午夜精品一区二区三区四区| 99国产欧美久久久精品| 亚洲mv在线观看| 久久伊人中文字幕| 色婷婷国产精品| 蜜桃久久av一区| 日本一区二区三区国色天香| 91在线播放网址| 美日韩一区二区| 国产精品入口麻豆九色| 欧美日韩国产高清一区| 国产伦精品一区二区三区在线观看| 国产精品色在线| 在线综合视频播放| 成人高清视频在线| 日韩成人一区二区三区在线观看| 国产亚洲欧美日韩在线一区| 欧美在线色视频| 国产精品一二三区在线| 亚洲国产成人精品视频| 国产午夜精品美女毛片视频| 欧美在线视频日韩| 国产成人在线免费| 天天综合日日夜夜精品| 欧美精品一区二区三区高清aⅴ| 91麻豆swag| 国产精品综合久久| 午夜精品一区二区三区电影天堂| 久久伊99综合婷婷久久伊| 欧美日韩免费一区二区三区视频| 国产成人av电影| 免费成人性网站| 亚洲欧美日本韩国| 久久久国产一区二区三区四区小说| 在线看一区二区| 白白色 亚洲乱淫| 狠狠狠色丁香婷婷综合激情| 丝袜美腿高跟呻吟高潮一区| 亚洲色图在线看| 国产视频一区不卡| 精品国产一区二区三区不卡| 精品视频在线视频| 99麻豆久久久国产精品免费优播| 久久国产尿小便嘘嘘尿| 亚洲成人动漫av| 亚洲日穴在线视频| 日本一区二区成人在线| 亚洲精品在线观看视频| 欧美一区二区三区四区久久| 欧美日韩在线播| 日本道在线观看一区二区| 不卡一区二区在线| 处破女av一区二区| 国产精品66部| 懂色一区二区三区免费观看| 精品亚洲成av人在线观看| 日本vs亚洲vs韩国一区三区二区| 午夜视频久久久久久| 亚洲国产日韩一区二区| 亚洲大尺度视频在线观看| 亚洲国产sm捆绑调教视频 | 成人激情电影免费在线观看| 国产原创一区二区| 激情综合网天天干| 国产综合久久久久久久久久久久| 蜜乳av一区二区| 狠狠色丁香久久婷婷综合_中 | 7777精品伊人久久久大香线蕉超级流畅 | 91麻豆视频网站| 99国产一区二区三精品乱码| 色综合天天综合网天天看片| 日本二三区不卡| 在线成人午夜影院| 日韩一区二区在线观看视频 | 大胆亚洲人体视频| 99在线精品一区二区三区| 色综合久久综合| 欧美三级资源在线| 欧美一二三四区在线| 精品奇米国产一区二区三区| 久久精品视频在线免费观看| 中文字幕一区日韩精品欧美| 亚洲综合一区二区三区| 日本人妖一区二区| 国产大片一区二区| 97国产一区二区| 欧美日韩综合不卡| 亚洲精品一区二区精华| 中文字幕欧美一区| 亚洲第一激情av| 国产麻豆精品视频| 91精品办公室少妇高潮对白| 91精品国产91久久久久久最新毛片| 精品国产免费人成在线观看| 国产精品久久久久国产精品日日| 亚洲精品国产品国语在线app| 首页国产欧美久久| 高清shemale亚洲人妖| 在线观看日韩高清av| 91精品国产色综合久久ai换脸| 久久久精品2019中文字幕之3| 亚洲欧美日韩中文播放| 老司机免费视频一区二区三区| 成人黄色小视频| 制服丝袜亚洲精品中文字幕| 欧美激情中文不卡| 石原莉奈在线亚洲二区| 懂色av中文一区二区三区| 欧美日本一区二区三区四区 | 亚洲免费资源在线播放| 久久99精品久久久久婷婷| 成人小视频免费观看| 制服丝袜亚洲色图| 亚洲日本电影在线| 国产一区二区三区免费看| 91精品福利视频| 国产日韩亚洲欧美综合| 日韩av电影一区| 在线免费观看日韩欧美| 久久精品网站免费观看| 日韩国产精品久久久久久亚洲| 91亚洲精品一区二区乱码| 亚洲精品在线三区| 日本成人在线一区| 91精品福利在线| 亚洲婷婷国产精品电影人久久| 国产九色sp调教91| 日韩一区二区电影网| 五月天视频一区| 91麻豆6部合集magnet| 中文字幕不卡在线播放| 国产在线国偷精品产拍免费yy| 欧美亚洲一区二区在线| 国产精品另类一区| 国产老妇另类xxxxx| 精品女同一区二区| 喷白浆一区二区| 欧美精品粉嫩高潮一区二区| 亚洲一区二区三区四区在线| 成人av在线资源网站| 国产亚洲精品aa午夜观看| 久久精品国产秦先生| 欧美一级片在线看| 蜜桃av一区二区在线观看 | 久久er99精品| 91九色最新地址| 亚洲三级免费电影| 色哟哟在线观看一区二区三区| 国产精品久久综合| 国产a区久久久| 免费在线观看成人| 久久婷婷综合激情| 精品三级av在线| 国产欧美精品一区| 99久久免费视频.com| 午夜精品免费在线观看| 精品久久久网站| 91在线观看下载| 日韩avvvv在线播放| 久久精品视频免费| 欧美日韩一区不卡| 国产伦精品一区二区三区免费| 国产精品久久福利| 在线电影国产精品| hitomi一区二区三区精品| 首页亚洲欧美制服丝腿| 国产精品嫩草99a| 欧美精品亚洲一区二区在线播放| 国产成人av福利| 日韩中文字幕亚洲一区二区va在线| 国产欧美一区二区精品婷婷| 欧美日韩一级视频| 成人av影视在线观看| 蜜臀va亚洲va欧美va天堂| 1区2区3区精品视频| 亚洲精品在线观看网站| 欧美三片在线视频观看 | 久久av资源站| 亚洲一区自拍偷拍| 欧美国产视频在线| 一区二区三区欧美日韩| 91美女福利视频| 欧美日韩精品一区二区三区蜜桃 | 精品亚洲成a人在线观看| 亚洲青青青在线视频| 久久亚洲综合色一区二区三区| 色999日韩国产欧美一区二区|