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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? vt102em.cpp

?? 使用BorlandC++4.5編譯的一個MUD客戶端程序
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// vt102em.cpp - vt102 emulator methods

// $Id: vt102em.cpp 2.3 1995/10/31 02:26:20 tsurace Beta $
// $Log: vt102em.cpp $// Revision 2.3  1995/10/31  02:26:20  tsurace// Fixed ret_val uninitialized in _SysMenuCommand.//
// Revision 2.2  1995/10/30  18:28:46  tsurace
// Added debug toggle and console mode switch to system menu.
//
// Revision 2.1  1995/10/24  15:52:51  tsurace
// Roll.
//
// Revision 1.8  1995/10/19  00:58:27  tsurace
// Changed title.
//
// Revision 1.7  1995/10/18  22:58:01  tsurace
// Made MY_SOCKET_LONG message globally accessible.
//
// Revision 1.6  1995/10/15  23:33:25  tsurace
// Added one line comment.
//
// Revision 1.5  1995/10/15  23:23:39  tsurace
// Fixed bug that caused all windows to resize on SIZE_MINIMIZE.
//
// Revision 1.4  1995/10/11  21:40:43  tsurace
// Modified the "select event" handling code.
// Modified resize functionality.
// Reflects changes to the scream_and_die function.
//
// Revision 1.3  1995/10/08  23:29:29  tsurace
// Modified code to update more quickly when scrolling.  It kind
// of sucks if you have a slow display card right now.
//
// Revision 1.2  1995/10/07  00:33:48  tsurace
// Added some cursor colors and the _Size function.  Scrolling
// optimization.
//
// (End of log)

// This is a simple VT102 emulator library for 32-bit
// programs only, but supportive of win32s.  This is intended to
// support the subset of vt102 required by VaporTalk, the best MUD
// client in the world.  It may also support ANSI color, someday.

#define  STRICT
#include <windows.h>
#pragma hdrstop

#include <stdlib.h>
#include <string.h>

#include "debug.hpp"
#include "esc_seq.hpp"
#include "global.hpp"
#include "keyev.hpp"
#include "vt102em.hpp"

extern "C" {
    // Functions from VT -- these define entry points into the
    // vt code to send keyboard events, check for remote input, and
    // so on.
    //
    // Be sure to check the type of these when updating
    // to a new version of VT!  I wanted to put these in a shared header
    // file, but it was getting to be a lot of trouble.  <frown>
    
    extern int io_check(long sec, long usec);  /* remote.c */
    extern int io_cycle();                     /* main.c */
    extern void process_incoming (char * str); /* keyboard input routine */
    extern void resize_screen(int new_rows, int new_cols);
    extern void curs_input();                  /* window.c */

    extern void console();                     /* console.c */
    extern int console_mode;                   /* console.c */
    extern int debug;                          /* vtc.c */
};

#define TEXT_FORE RGB(160,160,160)
#define TEXT_BACK RGB(0,0,0)
#define TEXT_BOLD RGB(40,255,100)
#define CURSOR_FORE RGB(255,255,255)
#define CURSOR_BACK RGB(128,0,128)
//
// >>>>> VT102Emulator class <<<<< //
//

char VT102Emulator::_szClassName[] = "VT102 Emulator Window";
static const char _TITLE[] = "VT-Win 1.1 $State: Beta $";

// ------------------------------------------------------------------------
// VT102Emulator constructor
// Do not create unless previously registered.
//
VT102Emulator::VT102Emulator(int nCmdShow)
: _screen(80,35,
          TEXT_FORE, // Normal foreground
          TEXT_BOLD,  // Bold foreground
          &VT102Emulator::InvalidateStaticCB,
          this,
          &VT102Emulator::ScrollAreaStaticCB,
          this),
  _font(0),
  _cursorColor(CURSOR_FORE),
  _cursorBackground(CURSOR_BACK),
  _cursorPen(0),
  _backgroundColor(TEXT_BACK),
  _fontSize(8,16),
  _lastPaintTickCount(0),
  _forceUpdateSoon(0),
  _initialized(0)
{
    // A Windows class should be registered with Windows before any windows
    // of that type are created.
    if (! Global::PrevInstance())      // Not already registered?
        _Register();              // Register!

    // Create a window, and Pass 'this' pointer in lpParam of CreateWindow()
    _hWnd = CreateWindow(_szClassName,
                         _TITLE,
                         WS_OVERLAPPEDWINDOW,
                         CW_USEDEFAULT,
                         0,
                         CW_USEDEFAULT,
                         0,
                         NULL,
                         NULL,
                         Global::Instance(),
                         (LPSTR) this );

    // Could not create window, might as well exit
    if (!_hWnd)
        scream_and_die(EC_FatalError, ERR_CreateWindow);

    // Load the monospace font, and initialize the "screen"
    _InitScreen();
    Show(nCmdShow);    // Show the window the correct/official way
    Update();
    _initialized = 1;  // Call after construction
};

VT102Emulator::~VT102Emulator()
{
    // _cursorPen is a stock object
    // _font is a stock object, maybe
}

// ------------------------------------------------------------------------
// ScrollAreaStaticCB - callback function, calls ScrollArea
//
int VT102Emulator::ScrollAreaStaticCB(int target,
                                      int source,
                                      int size,
                                      void * this_ptr)
{
    return ((VT102Emulator *)this_ptr)->ScrollArea(target, source, size);
}

// ------------------------------------------------------------------------
// ScrollArea - Scrolls the specified area of the screen
//
// Parameters:
//   top - first line to scroll (zero-indexed)
//   bottom - last line to scroll (also zero-indexed)
//   amount - amount to scroll, may be negative
//
// Returns:
//   nonzero if the row was successfully copied
//
int VT102Emulator::ScrollArea(int top, int bottom, int amount)
{
    ASSERT(bottom >= top, "No area to scroll");
    ASSERT(top >= 0, "Top is off screen");
    ASSERT(bottom < _screen.Height(), "Bottom is off screen");

    if (amount != 0)
    {
        RECT area;   
        area.top = top * _fontSize.Height();
        area.bottom = ((bottom + 1) * _fontSize.Height()) - 1;
        area.left = 0;
        area.right = (_screen.Width() * _fontSize.Width());

        ScrollWindow(Handle(),
                     0,         // No scroll of x
                     - (amount * _fontSize.Height()),  
                     NULL,      // Must be null so that exposed regions scroll
                     &area);     // Clip area

        _forceUpdateSoon = 1;
    };
    
    return 1;  // Successful scroll
}

// ------------------------------------------------------------------------
// _InvalidateStaticCB - invalidate rect - static callback calls builtin
void VT102Emulator::InvalidateStaticCB(const Pos & pos,
                                       const Size & size,
                                       void * this_ptr)
{
    ((VT102Emulator *)this_ptr)->Invalidate(pos, size);
}

void VT102Emulator::Invalidate(const Pos & pos, const Size & size)
{
    RECT area;
    area.left = pos.X() * _fontSize.Width();
    area.top = pos.Y() * _fontSize.Height();
    area.right = (pos.X() + size.Width()) * _fontSize.Width();
    area.bottom = (pos.Y() + size.Height()) * _fontSize.Height();
    
    // Don't clear, because it causes an annoying flicker, and the
    // textbackmode is opaque anyway
    InvalidateRect(Handle(), &area, TRUE);
}

// ------------------------------------------------------------------------
// NewSocket - tell windows about this new socket.
//
// Returns:
//   NULL on success or an error string on failure.
const char * VT102Emulator::NewSocket (SOCKET s, long events)
{
    // Select soctet messages
    if (SOCKET_ERROR == WSAAsyncSelect (s, Handle(), VT_SOCKET_MSG, events))
    {
        switch (WSAGetLastError())
        {
          case WSAENETDOWN: // Net is dead!
            return "The network is dead";

          case WSAEINPROGRESS:
            return "Blocking WinSock operation in progress";
            
          default:
            return "A horrible unknown WinSock error occurred";
        };
    };
    return NULL; // No problem
};


// ------------------------------------------------------------------------
void VT102Emulator::Output(char * str, int len)
{
    for (int i=0; i < len; i++)
    {
        _screen.Put(str[i]);   // Output the next character
        
        // Update screen at LEAST every quarter of a second, which is
        // generally accepted as the minimum acceptable delay.
        if (_forceUpdateSoon
            || ((GetTickCount() - _lastPaintTickCount) > 200))
        {
            Update();
        };
    };
}

// >>>>> PRIVATE and PROTECTED functions <<<<< //

// ------------------------------------------------------------------------
// This is the expose function, the critical heart of any graphic
// program!  :>
//
// Only call this in response to a WM_PAINT event!
//
void VT102Emulator::_Paint()
{
    _lastPaintTickCount = GetTickCount(); // Now
    _forceUpdateSoon = 0;                 // We are updating now.
    
    PAINTSTRUCT ps; // Begin paint, get info
    BeginPaint(Handle(), &ps);
    
    RECT clip_rect;
    GetClipBox(ps.hdc, &clip_rect);
    HRGN clip_reg = CreateRectRgnIndirect(&clip_rect);
    SelectClipRgn(ps.hdc, clip_reg);
    
    _PutText(ps.hdc, clip_reg);
    _PutCursor(ps.hdc);
    
    DeleteObject(clip_reg); // Don't need this region any more
    
    EndPaint(Handle(), &ps ); // Done, yay!
}

// ------------------------------------------------------------------------
// _PutTextOneLine - puts just this line of text on the screen
//
void VT102Emulator::_PutTextOneLine(HDC hdc, int row)
{
    ASSERT(_screen.Width() > 0, "Assuming the screen has width");
    
    // TextOut is very slow...count characters that are all the
    // same color and put them all at once.
    
    int y_pixel_location = row * _fontSize.Height();
    int x_text_location = 0;
    int start = _screen.IndexOf(0,row); // Start of string to put
    int row_end_marker = start + _screen.Width();
    int width = 0; // Width of current segment
    COLORREF thisColor = _screen.ForegroundElement(start);
    while(1)   // Loop forever
    {
        ++width;
        int end = start + width; // End of string
        if ((end >= row_end_marker)
            || (_screen.ForegroundElement(end) != thisColor))
        {
            // New color, flush text.
            SetTextColor(hdc, thisColor);
            TextOut(hdc,
                    x_text_location * _fontSize.Width(),
                    y_pixel_location,
                    &_screen.TextElement(start),
                    width);
            
            if (end >= row_end_marker) // Done with this line
                break;
            
            start += width; // Increment array offset
            x_text_location += width; // Increment column offset
            width = 0;        
            thisColor = _screen.ForegroundElement(end); // Save new color
        };
    };
}

// ------------------------------------------------------------------------
// _PutText - _Paint helper function that updates all modified text areas
//
// Parameters:
//   hdc - dc to paint to
//   clip_reg - current exposed region
//
void VT102Emulator::_PutText(HDC hdc, HRGN clip_reg)
{
    RECT exposeRect;
    GetRgnBox(clip_reg, &exposeRect); // What area of the screen to paint?
    
    int firstRow = (exposeRect.top+1) / _fontSize.Height();
    if (firstRow < 0) // Off top of screen?
        firstRow = 0;              
    else if (firstRow >= _screen.Height()) // Or bottom?
        firstRow = _screen.Height();
    
    int lastRow = (exposeRect.bottom) / _fontSize.Height();
    if (lastRow < 0) // Off top of screen
        lastRow = 0;
    else if (lastRow >= _screen.Height()) // Off bottom of screen?

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本欧美韩国一区三区| 亚洲国产精品高清| 色老汉一区二区三区| 成人免费av资源| 成人一区在线看| 欧洲av在线精品| 欧美日韩欧美一区二区| 欧美在线视频不卡| 欧美日韩国产影片| 欧美剧在线免费观看网站| 555夜色666亚洲国产免| 欧美日韩不卡视频| 欧美一区二区免费观在线| 欧美一二三四在线| 精品国产不卡一区二区三区| 久久综合九色综合欧美就去吻 | 国产精品久久久一区麻豆最新章节| 精品国产区一区| 国产精品女人毛片| 悠悠色在线精品| 日本美女一区二区三区| 精品伊人久久久久7777人| 国产精品一区二区不卡| 99久久综合精品| 欧美精品丝袜中出| 久久你懂得1024| 亚洲乱码日产精品bd| 丝袜a∨在线一区二区三区不卡| 免费观看成人鲁鲁鲁鲁鲁视频| 麻豆成人av在线| 不卡的av中国片| 91精品国产全国免费观看| 午夜精品国产更新| 国产精品一区二区三区乱码| 99麻豆久久久国产精品免费| 51久久夜色精品国产麻豆| 国产丝袜欧美中文另类| 亚洲午夜视频在线观看| 高清不卡在线观看av| 欧美性大战久久| 国产精品久久久久久一区二区三区| 一区二区三区四区视频精品免费| 麻豆精品国产91久久久久久| 99久免费精品视频在线观看| 日韩一区二区在线观看视频播放| 中文字幕av不卡| 久久99精品久久久久婷婷| 97久久超碰精品国产| 精品国产免费人成电影在线观看四季| 亚洲狠狠丁香婷婷综合久久久| 久久激情五月婷婷| 欧美亚洲国产一卡| 国产精品久久久久一区二区三区| 免费精品视频最新在线| 色婷婷av一区二区三区软件 | 国产精品亚洲专一区二区三区 | 亚洲精品国产a| 国产成人精品一区二区三区四区| 欧美日韩小视频| 亚洲专区一二三| 色中色一区二区| 亚洲日本护士毛茸茸| 成人精品国产免费网站| 久久精品人人做人人爽人人| 麻豆国产欧美日韩综合精品二区 | 夫妻av一区二区| 日韩午夜在线影院| 亚洲一卡二卡三卡四卡无卡久久 | 欧美影视一区在线| 中文字幕不卡在线| 国产精品一区二区在线观看不卡| 欧美性受xxxx黑人xyx| 久久精品日产第一区二区三区高清版| 久久精品国产亚洲a| 欧美伊人久久大香线蕉综合69| 国产精品理论片在线观看| 国产91精品久久久久久久网曝门| 精品毛片乱码1区2区3区| 老司机一区二区| 欧美不卡一区二区| 国产成人亚洲综合色影视 | 色综合久久中文综合久久牛| 欧美激情在线看| 不卡在线观看av| 国产欧美精品日韩区二区麻豆天美| 激情综合色播激情啊| 2014亚洲片线观看视频免费| 日韩av一级片| 欧美成人性战久久| 秋霞电影一区二区| 2022国产精品视频| 久久99这里只有精品| 久久久五月婷婷| 成人黄色小视频在线观看| 欧美经典三级视频一区二区三区| 97久久超碰国产精品| 亚洲妇熟xx妇色黄| www精品美女久久久tv| 99re66热这里只有精品3直播 | 久久亚区不卡日本| 成人自拍视频在线| 亚洲一区二三区| 制服丝袜日韩国产| 国产高清亚洲一区| 国产精品国产三级国产普通话99| 欧美午夜电影一区| 经典三级在线一区| 国产精品狼人久久影院观看方式| 丁香一区二区三区| 午夜免费久久看| 国产日产欧产精品推荐色| 91福利在线播放| 国内精品久久久久影院一蜜桃| 国产精品国产三级国产| 欧美肥大bbwbbw高潮| 国产91综合网| 爽爽淫人综合网网站| 国产精品美女久久久久久久网站| 在线视频中文字幕一区二区| 精品一区二区三区的国产在线播放| 亚洲女同ⅹxx女同tv| 精品国产凹凸成av人网站| 在线亚洲精品福利网址导航| 国产一区二区伦理| 日韩精品亚洲专区| 国产精品久久久久久久久久久免费看| 日韩欧美在线不卡| 欧美在线制服丝袜| 高清不卡一区二区在线| 美腿丝袜在线亚洲一区 | 欧美大黄免费观看| 欧美喷潮久久久xxxxx| 91视频免费看| 国产成人啪午夜精品网站男同| 蜜臂av日日欢夜夜爽一区| 亚洲自拍偷拍麻豆| 亚洲精品精品亚洲| 中文字幕在线不卡国产视频| 久久午夜电影网| 欧美精品第1页| 欧洲一区二区av| 91在线播放网址| 国产成人免费在线| 国产精品69久久久久水密桃| 美女网站一区二区| 美女视频网站久久| 亚洲高清在线视频| 亚洲一二三区视频在线观看| 国产精品不卡一区二区三区| 国产视频一区二区三区在线观看| 欧美二区在线观看| 欧美一区二区三区日韩视频| 日本乱码高清不卡字幕| 色婷婷狠狠综合| 欧美日韩在线直播| 91麻豆精品国产91久久久使用方法 | 本田岬高潮一区二区三区| 韩国av一区二区三区| 激情五月婷婷综合网| 国产在线精品不卡| 国产成人自拍网| 国产成人精品免费网站| 国产美女精品在线| 国产91精品一区二区| 粉嫩aⅴ一区二区三区四区五区| 成人精品视频一区| 91久久久免费一区二区| 色哟哟一区二区| 欧美日韩国产三级| 精品国产一区二区在线观看| 欧美国产97人人爽人人喊| 中文字幕亚洲区| 亚洲电影一区二区三区| 一区二区三区久久久| 日韩精品一级二级| 国产精品一区不卡| 成人激情免费视频| 欧美日韩午夜精品| 欧美成人vps| 亚洲精品国产视频| 婷婷中文字幕一区三区| 韩国三级中文字幕hd久久精品| 成人综合日日夜夜| 欧美美女激情18p| 久久精品在线观看| 国产不卡视频在线观看| 99久久99精品久久久久久 | 国产盗摄一区二区| 91极品视觉盛宴| 26uuu精品一区二区三区四区在线 26uuu精品一区二区在线观看 | 欧美色成人综合| 欧美大胆一级视频| 亚洲欧美一区二区不卡| 久久丁香综合五月国产三级网站 | 日本伊人色综合网| 99久久精品免费看国产免费软件| 欧美日韩一区三区| 国产日韩欧美亚洲| 日本不卡不码高清免费观看| eeuss鲁一区二区三区|