Category : Files from Magazines
Archive   : CGAZV4N3.ZIP
Filename : SCRNBOX.CPP

 
Output of file : SCRNBOX.CPP contained in archive : CGAZV4N3.ZIP
// SCRNBOX.CPP : methods for drawing boxes on the screen in text
// mode. Note that all display manipulations are handled here,
// so if you want to change to a different type of display (or
// use a different display package) this is the only place you
// need to change.
// by Bruce Eckel. (c) The C Gazette

#include // Zortech's text display package
// All variables and functions starting with "disp_" are
// described in the Zortech function reference manual.
#include "scrnbox.hpp"

// special class and static object to insure proper
// initialization and cleanup.
class __display_init {
public:
__display_init() {
if(!disp_inited) {
disp_open(); // initialize ...
disp_move(0,0);
disp_eeop(); // ... and clear the screen
}
}
~__display_init() { if(disp_inited) disp_close(); }
} __display_initializer;

screen_box::screen_box(unsigned ypos, unsigned xpos,
unsigned bheight, unsigned bwidth) :
x(xpos), y(ypos), height(bheight), width(bwidth) {
// Extra space for box, + 1 in each dimension for screen memory:
oldscreen = new unsigned[(height + 2) * (width + 3)];
disp_peekbox(oldscreen, y, x, y + height + 1, x + width + 2);
// blank the menu area:
disp_fillbox(DISP_NORMAL*256 + ' ',y, x, y + height + 1, x + width + 2);
// draw the box:
disp_box(1, DISP_NORMAL, y, x, y + height + 1, x + width + 2);
disp_flush();
}

screen_box::~screen_box() {
// Restore the screen underneath the box:
disp_pokebox(oldscreen, y, x, y + height + 1, x + width + 2);
disp_flush();
delete oldscreen;
}

void screen_box::move(int line) {
if(line < height && line >= 0)
disp_move(y+line + 1, x + 1);
}

void screen_box::put_c(char c) {
disp_putc(c);
}

void screen_box::emphasize(char c) {
disp_startstand();
disp_putc(c);
disp_endstand();
}

  3 Responses to “Category : Files from Magazines
Archive   : CGAZV4N3.ZIP
Filename : SCRNBOX.CPP

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/