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

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

?? ascscrn.cpp

?? 使用BorlandC++4.5編譯的一個MUD客戶端程序
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
// AsciiScreen methods
//
// $Id: ascscrn.cpp 2.2 1996/02/04 22:31:39 tsurace Exp $
// $Log: ascscrn.cpp $// Revision 2.2  1996/02/04  22:31:39  tsurace// Added code to handle illegal cursor placement gracefully.//
// Revision 2.1  1995/10/24  15:52:51  tsurace
// Roll.
//
// Revision 1.5  1995/10/15  23:27:50  tsurace
// Added a comment.
//
// Revision 1.4  1995/10/11  20:58:37  tsurace
// Switched to my ASSERT macro.
// Fixed reverse-scroll bug that caused core (or ASSERT failure).
// Added try/catch blocks to stop memory leaks.
//
// Revision 1.3  1995/10/08  23:27:10  tsurace
// Added ansi (foreground) color support.
//
// (end of log)

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

#include <except.h> // xalloc
#include <string.h> // memset()

#include "ascscrn.hpp"
#include "debug.hpp"

// ANSI color definitions are given names here to make it easier to tweak
// individual colors by name instead of figuring where they are in the
// lookup table

#define _BLACK RGB(0,0,0)
#define _RED RGB(160,0,0)
#define _GREEN RGB(0,160,0)
#define _YELLOW RGB(160,160,0)
#define _BLUE RGB(0,0,160)
#define _MAGENTA RGB(160,0,160)
#define _CYAN RGB(0,160,160)
#define _WHITE RGB(192,192,192)

// These are used if the bold attribute is set
#define _LT_BLACK RGB(128,128,128)
#define _LT_RED RGB(255,0,0)
#define _LT_GREEN RGB(0,255,0)
#define _LT_YELLOW RGB(255,255,0)
#define _LT_BLUE RGB(0,0,255)
#define _LT_MAGENTA RGB(255,0,255)
#define _LT_CYAN RGB(0,255,255)
#define _LT_WHITE RGB(255,255,255)


// Non-bold colors lookup table
COLORREF _ansiColorLookup[2][8] = // 8 colors normal, 8 colors bold
{
{_BLACK, _RED, _GREEN, _YELLOW,
 _BLUE, _MAGENTA, _CYAN, _WHITE},
{_LT_BLACK, _LT_RED, _LT_GREEN, _LT_YELLOW,
 _LT_BLUE, _LT_MAGENTA, _LT_CYAN, _LT_WHITE},
};

// ------------------------------------------------------------------------
// _LookupAnsiColor - a silly function to find a function in the
// lookup array.
//
// Parameters:
//   bold - 0 if not bold, 1 if bold
//   color - 0-7 to get the respective ibm pc color thingy
//
static inline COLORREF _LookupAnsiColor(int bold, int color)
{
    ASSERT(0 == bold || 1 == bold, "Bold can be either 0 or 1");
    ASSERT(color >= 0 && color <= 7, "Color out of range");

    return _ansiColorLookup[bold][color];
};

// Constructor - Allocates memory for a screen width X height
//
// Interesting parameters:
//   f - function that is called when an area of the screen needs to be
//     redrawn.  May not be NULL
//   copy_func - called to request a copy of one area of the screen to
//     another.  If this returns 1, the area is not invalidated, otherwise
//     it is.  May not be NULL

AsciiScreen::AsciiScreen(int width,
                         int height,
                         COLORREF foreground,
                         COLORREF boldForeground,
                         void (*f)(const Pos & pos,
                                   const Size & size,
                                   void * extra),
                         void * invalidateFuncExtra,
                         int (*scroll_func)(int, int, int, void *),
                         void * scrollFuncExtra)
: _cursor(0,0),
  _normalForeground(foreground),
  _cursorForeground(foreground),
  _cursorIsBold(0),
  _boldForeground(boldForeground),
  _width(width),
  _height(height),
  _scrollRegionTop(0),
  _scrollRegionBottom(height-1),
  _text(new char[width * height]),
  _invalidateFunc(f),
  _invalidateFuncExtra(invalidateFuncExtra),
  _scrollFunc(scroll_func),
  _scrollFuncExtra(scrollFuncExtra),
  _foreground(new COLORREF[width * height])
{
    ASSERT(NULL != _invalidateFunc, "Bad function pointer");
    ASSERT(NULL != _scrollFunc, "Bad function pointer");
    
    _ClearScreen();
}

AsciiScreen::~AsciiScreen()
{
    // delete [] _text; // Don't even bother
    delete [] _foreground;
}

void AsciiScreen::Foreground(COLORREF foreground)
{
    _cursorForeground = foreground;
}

// Goto - just updates the cursor position
void AsciiScreen::Goto(Pos & pos)
{
    ASSERT(IsOnScreen(pos), "Cannot go off screen");
    _cursor = pos;
}

// PutChar - puts char c at the current pos, and increments the
//   cursor position
//
// c - char to put
// pos - position that this character was put at
//
// This is the fundamental put, where actual "writing to memory" happens

void AsciiScreen::Put(char c)
{
    // if the buffer is full, give up--lose data
    if (_inputBuffer.Length() >= ASBUFFER_LEN)
        _inputBuffer.Clear(); 
    
    _inputBuffer.Append(c);     // Append string to buffer

    // Scan for escape sequences
    EscapeSequence seq(_inputBuffer);
    if (seq.IsEscapeSequence())
    {
        if (seq.IsComplete()) // Got complete sequence
        {
            _inputBuffer.Clear();
            _EscapeSequence(seq); // Do escape thingy (clears buffer)
        };
    }
    else  // Send the buffer directly to the console
    {
        for (int i = 0; i < _inputBuffer.Length(); i++)
        {
            char put_me = _inputBuffer[i];
                        
            // Check for "special characters"
            if (put_me == '\r')        // CR, no line feed!
                _CarriageReturn();     
            else if (put_me == '\n')
                _NewLine(1);
            else if (put_me == '\010') // Backspace
                _BackSpace();
            else
            {
                _TextElement(_cursor) = put_me;
                _ForegroundElement(_cursor) = _cursorForeground;
                _IncrementPos(); // Just put a char, move the cursor
            };
        };
        _inputBuffer.Clear();
    };
}

// PutString - puts an entire string on the display
void AsciiScreen::Put(char * c)
{
    ASSERT(NULL != c, "Null string pointer?");

    // Copy string into memory one char at a time.
    int len = strlen(c);
    for (int i = 0; i < len; i++) 
        Put(c[i]);
}

// ------------------------------------------------------------------------
// Resize - resizes the screen buffer
//
// Does not attempt to preserve the contents.
//
// Throws:
//   rethrows xalloc - in this case, the window was NOT resized, but
//    the contents are still valid, and everything is cool!
//
void AsciiScreen::Resize(int width, int height)
{
    char * new_text = NULL;
    COLORREF * new_fg;
    try
    {
        new_text = new char[width * height];
        new_fg = new COLORREF[width * height];
    }
    catch (xalloc &)        // New failed?
    {
        if (new_text)       // Maybe this was successfully allocated
            delete new_text;

        throw;              // Pass the buck
    }
    delete [] _text;        // Success!
    delete [] _foreground;
    _text = new_text;
    _foreground = new_fg;
    
    _width = width;
    _height = height;
    _scrollRegionTop = 0;
    _scrollRegionBottom = height - 1;
    _cursor.X() = 0;
    _cursor.Y() = 0;

    _ClearScreen();
}


// Scroll - Scrolls the indicated range the indicated amount
//
// Note that a newline actually scrolls the "current window" area.
// Note that the internal text data array is up-to-date at the time
// of the call to the scrollfunc.
//
// Parameters:
//   top - top of the area to scroll
//   bottom - bottom of the area to scroll
//   range - amount to scroll (may be negative)

void AsciiScreen::Scroll(int top, int bottom, int amount)
{
    ASSERT(bottom >= top, "Nothing to scroll");
    ASSERT(top >= 0, "Top off screen?");
    ASSERT(bottom < Height(), "Bottom off screen?");

    int i; // A counter
    int too_big_just_clear = 0;

    // Move the region up or down.  Just lose the stuff that scrolls
    // out of the region.  
    
    if (0 < amount)         // Scroll forward
    {
        if (amount > (bottom - top + 1))
        {
            _ClearRows(top, bottom);
            too_big_just_clear = 1;
        }
        else
        {
            // Copy rows
            for (i = top; (i + amount) <= bottom; i++)
                _CopyRow(i, i + amount);
            
            // Clear everything that had no source for copying
            for (i = (bottom - amount + 1); i <= bottom; i++)
                _ClearRow(i);
        };    
    }
    else                   // Scroll back (amount is negative)
    {
        if ((-amount) > (bottom - top + 1))
        {
            _ClearRows(top, bottom);
            too_big_just_clear = 1;
        }
        else
        {
            for (i = bottom; (i + amount) >= top; i--)
                _CopyRow(i, i + amount);
            
            for (i = top; i < (top - amount); i++)
                _ClearRow(i);
        };
    };

    // Now that the memory is updated, update the screen
    
    if (too_big_just_clear)      // Everything scrolled away?
        _ClearRows(top, bottom);
    else
    {
        // Try to scroll the screen by calling the callback.  If this fails,
        // invalidate the area we tried to scroll.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区三区视频在线播放| 偷拍与自拍一区| 日韩av电影免费观看高清完整版在线观看| 91精品国产综合久久久久久| 91麻豆精品国产91久久久久| 国产91露脸合集magnet| 日韩中文欧美在线| 亚洲特黄一级片| 久久久欧美精品sm网站| 欧美精品在线观看一区二区| 不卡视频在线观看| 激情图片小说一区| 日韩高清不卡一区| 亚洲丰满少妇videoshd| 亚洲蜜臀av乱码久久精品| 久久久久国产精品人| 欧美一级高清片| 欧美日韩一区二区三区在线看| 成人免费视频一区| 国产精品一区二区三区99| 日本中文字幕不卡| 日日嗨av一区二区三区四区| 亚洲乱码一区二区三区在线观看| 日本一二三不卡| 国产亚洲一区字幕| 久久婷婷成人综合色| 日韩欧美色综合网站| 欧美一区二区三区在线观看视频| 在线观看一区二区精品视频| 色综合中文字幕国产| 国产精品88888| 国产麻豆精品95视频| 黑人精品欧美一区二区蜜桃| 美日韩一区二区三区| 欧美疯狂性受xxxxx喷水图片| 91丨porny丨首页| 99热这里都是精品| 不卡的电影网站| 99热精品一区二区| 91欧美激情一区二区三区成人| 91日韩在线专区| 日本韩国欧美一区| 欧美日韩一级黄| 欧美久久一区二区| 欧美一区三区四区| 欧美www视频| 久久久久久久免费视频了| 久久久国产午夜精品| 欧美国产欧美综合| 亚洲免费伊人电影| 亚洲午夜久久久久中文字幕久| 午夜伦欧美伦电影理论片| 日本va欧美va瓶| 国产最新精品精品你懂的| 国产成人99久久亚洲综合精品| 成人av小说网| 欧美色图激情小说| 日韩欧美国产一二三区| 国产色婷婷亚洲99精品小说| 国产人妖乱国产精品人妖| 国产精品动漫网站| 亚洲一区二区三区四区的| 免费看日韩a级影片| 国产高清在线精品| 91碰在线视频| 6080yy午夜一二三区久久| 精品国产三级a在线观看| 国产精品视频你懂的| 一区二区理论电影在线观看| 午夜伦欧美伦电影理论片| 国产一区二区三区美女| 成人av在线资源网| 欧美喷潮久久久xxxxx| 欧美videos中文字幕| 国产精品国产三级国产aⅴ原创| 亚洲一区在线视频| 激情六月婷婷久久| 色呦呦国产精品| 精品蜜桃在线看| 亚洲欧美激情小说另类| 久热成人在线视频| 91网站在线播放| 欧美电影免费观看高清完整版在线 | 91网上在线视频| 日韩一级黄色大片| 亚洲蜜桃精久久久久久久| 国产综合久久久久久久久久久久| 91丝袜呻吟高潮美腿白嫩在线观看| 欧美一区二区三区不卡| 国产精品网站在线观看| 日本欧美一区二区三区| 不卡的av电影在线观看| 精品福利一二区| 一区二区三区四区在线播放| 国产麻豆视频一区| 欧美日本一道本在线视频| 国产亚洲精品精华液| 亚洲成a人片综合在线| 99久久99精品久久久久久| 日韩欧美一区中文| 洋洋av久久久久久久一区| 国产高清视频一区| 91精品久久久久久久99蜜桃 | 亚洲视频你懂的| 精品一区二区三区在线观看| 欧美综合亚洲图片综合区| 亚洲国产岛国毛片在线| 精品人在线二区三区| 亚洲在线中文字幕| 成人sese在线| 精品福利一区二区三区| 日韩高清欧美激情| 精品视频一区二区不卡| 亚洲视频在线一区二区| 国产成人av一区| 欧美大胆一级视频| 日韩精品一二三四| 欧美视频一区二区在线观看| 国产精品美女久久久久高潮| 国产一区二区导航在线播放| 日韩免费福利电影在线观看| 午夜精品久久久久久久99水蜜桃| 一本一道综合狠狠老| 中文字幕一区二区三中文字幕| 国产成人综合精品三级| 久久久午夜电影| 国产一区二区在线观看免费| 日韩精品中文字幕一区二区三区| 天堂在线亚洲视频| 欧美日韩的一区二区| 亚洲成人精品影院| 欧美在线制服丝袜| 亚洲bt欧美bt精品777| 欧美三级电影网站| 亚洲成人免费观看| 91麻豆精品国产91久久久资源速度 | 国产精品一区二区黑丝| 精品电影一区二区| 国产一区二区在线视频| 久久久亚洲精品一区二区三区| 久久99久久99小草精品免视看| 日韩一区二区免费电影| 麻豆精品一区二区综合av| 亚洲精品一区二区三区精华液| 久久97超碰国产精品超碰| 欧美成人女星排名| 91麻豆精品国产91久久久久久久久| 男女视频一区二区| 欧美电视剧在线看免费| 国产成人精品综合在线观看| 国产精品久久久久久户外露出| 色综合天天在线| 亚洲福利电影网| 精品国产一区久久| 成人性生交大片免费看中文网站| 国产精品午夜在线观看| 色婷婷久久综合| 美女视频一区在线观看| 精品入口麻豆88视频| 99麻豆久久久国产精品免费优播| 亚洲久草在线视频| 欧美一区二区私人影院日本| 久久狠狠亚洲综合| 国产精品色哟哟| 欧美午夜理伦三级在线观看| 日韩国产一区二| 久久精品一区蜜桃臀影院| 91美女在线视频| 毛片一区二区三区| 综合婷婷亚洲小说| 欧美一级欧美一级在线播放| 国产精品自拍网站| 亚洲午夜影视影院在线观看| 日韩美女一区二区三区| 99re66热这里只有精品3直播| 亚洲成av人片观看| 欧美国产日韩精品免费观看| 欧美日韩在线免费视频| 国产伦精一区二区三区| 亚洲精品国产精华液| 欧美成人性福生活免费看| 一本在线高清不卡dvd| 国产自产v一区二区三区c| 亚洲精品高清在线| 日韩精品一区二区三区swag| 色拍拍在线精品视频8848| 六月婷婷色综合| 夜夜嗨av一区二区三区网页| 久久久亚洲欧洲日产国码αv| 欧美午夜免费电影| av电影天堂一区二区在线 | 亚洲福利视频导航| 国产清纯美女被跳蛋高潮一区二区久久w | 精品视频一区 二区 三区| 国产不卡视频在线观看| 男女性色大片免费观看一区二区| 亚洲免费观看高清完整版在线观看熊 | 蜜臀久久久久久久| 亚洲乱码国产乱码精品精可以看| 精品999在线播放|