#include "Display.h" #include #include #include #include using namespace std; /* *-------------------------------------------------------------------- * Method: * Purpose: * Arguments: * Returns: *-------------------------------------------------------------------- */ namespace MKBasic { /* *-------------------------------------------------------------------- * Method: * Purpose: * Arguments: * Returns: *-------------------------------------------------------------------- */ Display::Display() { InitScr(); } /* *-------------------------------------------------------------------- * Method: * Purpose: * Arguments: * Returns: *-------------------------------------------------------------------- */ Display::~Display() { } /* *-------------------------------------------------------------------- * Method: InitScr() * Purpose: Initialize screen. * Arguments: n/a * Returns: n/a *-------------------------------------------------------------------- */ void Display::InitScr() { ClrScr(); } /* *-------------------------------------------------------------------- * Method: * Purpose: * Arguments: * Returns: *-------------------------------------------------------------------- */ void Display::ScrollUp() { for (int row=0; row= SCREENDIM_ROW) { ScrollUp(); mCursorCoord.row = SCREENDIM_ROW-1; } } else if (c == SCREENSPECCHARS_CR) { mCursorCoord.col = 0; } else if (c == SCREENSPECCHARS_TB) { mCursorCoord.col += TABSIZE; if (mCursorCoord.col >= SCREENDIM_COL) { mCursorCoord.col = SCREENDIM_COL-1; // must work on it some more } } else if (c == SCREENSPECCHARS_BS) { if (mCursorCoord.col > 0) mCursorCoord.col--; } else if (c == SCREENSPECCHARS_BE) { // no action } else { mScreen[mCursorCoord.col][mCursorCoord.row] = c; mCursorCoord.col++; if (mCursorCoord.col >= SCREENDIM_COL) { mCursorCoord.col = 0; mCursorCoord.row++; if (mCursorCoord.row >= SCREENDIM_ROW) { ScrollUp(); mCursorCoord.row = SCREENDIM_ROW-1; } } } } } /* *-------------------------------------------------------------------- * Method: ClrScr() * Purpose: Fill the screen with spaces. Set cursor in left-upper * corner. * Arguments: n/a * Returns: n/a *-------------------------------------------------------------------- */ void Display::ClrScr() { for (int col=0; col