#include "window.h" #include "input.h" void Window::Initialize() { initialized=1; videoadr=(char*)0xb8000000L; scrwid=80; scrhig=25; } Window::Window(unsigned x,unsigned y,unsigned wid,unsigned hig,color fg,color bg,frame_t ft,char *tit) { if (!initialized) Initialize(); w=wid; h=hig; if (ft) {x--; y--; w+=2; h+=2;} if (w>scrwid) w=scrwid; if (h>scrhig) h=scrhig; x0=y0=0; x1=x; y1=y; x2=x+w-1; y2=y+h-1; if (x2>scrwid-1) {x1-=(x2-scrwid+1);x2=scrwid+1;} if (y2>scrhig-1) {y1-=(y2-scrhig+1); y2=scrhig+1;} if (ft) {x1++; y1++; x2--; y2--; w-=2; h-=2;} hide_cursor(); showcursor=0; cursortype=2; attrib=0; frame=ft; title=tit; Color(fg,bg); Fill(bg); DrawFrames(); Goto(0,0); } void Window::FramePlot(int x,int y,char c) { char *adr=videoadr+(x1+x)*2+(y1+y)*2*scrwid; *adr=c; *(adr+1)=attrib; } void Window::DrawFrames() { int i,tlen,xplot; char *t; static char chr[2][9]={ {'É','Í','»','º',' ','º','È','Í','¼'}, {'Ú','Ä','¿','³',' ','³','À','Ä','Ù'} }; if (frame) { FramePlot(-1,-1,chr[frame-1][0]); FramePlot(w,-1,chr[frame-1][2]); FramePlot(-1,h,chr[frame-1][6]); FramePlot(w,h,chr[frame-1][8]); for(i=0;i=w) {cx=0;cy++;} switch(*str) { case '\n': cy++; cx=0; break; default: Plot(*str); } } } void Window::PrintAt(unsigned x,unsigned y,char *str) { Goto(x,y); Print(str); } void Window::Fill(color col) { int i,j; if (col!=NO_COLOR) Bg(col); for(i=0;i