Skip to content
Snippets Groups Projects
Commit 3bd18c37 authored by mcmlxxix's avatar mcmlxxix
Browse files

code updates, now slightly more generic

parent 32fca24a
No related branches found
No related tags found
No related merge requests found
function Window(name,x,y,w,h) load("graphic.js");
function Window(x,y,w,h)
{ {
this.name=name?name:false; this.title="";
this.x=x; this.x=x;
this.y=y; this.y=y;
this.columns=w; this.width=w;
this.rows=h; this.height=h;
this.active=false;
this.draw=function(value) this.draw=function(color)
{ {
var title=""; color=color?color:DARKGRAY;
var color=""; console.attributes=color;
if(this.name) console.gotoxy(this);
{ console.pushxy();
color=(this.active?"\1c\1h":"\1n"); console.putmsg("\xDA",P_SAVEATR);
title="\1n\1h\xB4" + color + this.name + (value?": " + value:"") + "\1n\1h\xC3"; if(console.strlen(this.title)>0) {
drawLine(false,false,this.width-4-console.strlen(this.title));
console.putmsg("\xB4",P_SAVEATR);
console.putmsg(this.title,P_SAVEATR);
console.attributes=color;
} else {
drawLine(false,false,this.width-2);
} }
console.gotoxy(this.x,this.y); console.putmsg("\xC3\xBF",P_SAVEATR);
console.putmsg("\1n\1h\xDA"); var line=2;
drawLine(false,false,this.columns-console.strlen(title),"\1n\1h"); while(line++<this.height)
console.putmsg(title + "\1n\1h\xBF");
for(line = 1; line<=this.rows; line++)
{ {
console.gotoxy(this.x,this.y+line); console.popxy();
printf("\1n\1h\xB3%*s\xB3",this.columns,""); console.down();
console.pushxy();
printf("\xB3%*s\xB3",this.width-2,"");
} }
console.gotoxy(this.x,this.y + this.rows+1); console.popxy();
console.putmsg("\1n\1h\xC0"); console.down();
drawLine(false,false,this.columns,"\1n\1h"); console.putmsg(printPadded("\xC0",this.width-1,"\xC4"),P_SAVEATR);
var spot=console.getxy(); var spot=console.getxy();
if(!(spot.y==console.screen_rows && spot.x==console.screen_columns)) console.putmsg("\1n\1h\xD9"); if(spot.y!=console.screen_rows && spot.x!=console.screen_columns) console.putmsg("\xD9",P_SAVEATR);
}
this.clear=function()
{
clearBlock(this.x,this.y,this.columns,this.rows);
}
this.init=function(title,subtitle)
{
var name="";
if(title) {
name=title;
if(subtitle) {
name+="\1n:"+subtitle;
}
}
this.title=name;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment