void scroll(int direction, int lines, int x1, int y1, int x2, int y2,
            int attrib)
/* Scrolls an area of the screen */
{
  if (lines == 0)
    window(x1, y1, x2, y2);
  else switch(direction)
  {
    case UP :
      movetext(x1, y1 + lines, x2, y2, x1, y1);
      window(x1, y2 - lines + 1, x2, y2);
      break;
    case DOWN :
      movetext(x1, y1, x2, y2 - lines, x1, y1 + lines);
      window(x1, y1, x2, y1 + lines - 1);
      break;
    case LEFT :
      movetext(x1 + lines, y1, x2, y2, x1, y1);
      window(x2 - lines + 1, y1, x2, y2);
      break;
    case RIGHT :
      movetext(x1, y1, x2 - lines, y2, x1 + lines, y1);
      window(x1, y1, x1 + lines - 1, y2);
      break;
  } /* switch */
  setcolor(attrib);
  clrscr();
  window(1, 1, 80, 25);
} /* scroll */
示例#2
0
int main(void)
{
clrscr();

printf("Here is some text we will move.\n");
printf("Press key to move the text.\n");
getch();
/*parameters are left,top,right,bottom,destleft,desttop*/
movetext(1,1,30,1,1,20);

return 0;

}
/*---------------------------------------------------------------------*

Name            __scroll - scrolls the current window in text mode

Usage           static pascal __scroll(uchar dir, uchar x1, uchar y1,
                                       uchar x2, uchar y2, uchar lines);

Return value    None

*---------------------------------------------------------------------*/
void pascal near __scroll(uchar dir, uchar x1, uchar y1, uchar x2, uchar y2, uchar lines)
{
        unsigned linebuffer[80];

        if (!_video.graphicsmode && directvideo && lines == 1)
        {
                x1++;
                y1++;
                x2++;
                y2++;
                if (dir == UP)
                {
                        movetext(x1,y1+1,x2,y2,x1,y1);
                        gettext(x1,y2,x1,y2,linebuffer);
                        zapline(linebuffer,x1,x2);
                        puttext(x1,y2,x2,y2,linebuffer);
                }
                else
                {
                        movetext(x1,y1,x2,y2-1,x1,y1+1);
                        gettext(x1,y1,x1,y1,linebuffer);
                        zapline(linebuffer,x1,x2);
                        puttext(x1,y1,x2,y1,linebuffer);
                }
        }
        else
        {
                _BH = _video.attribute;
                _AH = dir;
                _AL = lines;
                _CH = y1;
                _CL = x1;
                _DH = y2;
                _DL = x2;
                _VideoInt();
        }
}
示例#4
0
static JSBool
js_conio_movetext(JSContext *cx, uintN argc, jsval *arglist)
{
	jsval *argv=JS_ARGV(cx, arglist);
	int		i;
	int32	args[6];
	jsrefcount	rc;

	JS_SET_RVAL(cx, arglist, JSVAL_VOID);

	if(argc != 6)
		return(JS_FALSE);
	for(i=0; i<6; i++) {
		if(!JSVAL_IS_NUMBER(argv[i]))
			return(JS_FALSE);
		if(!JS_ValueToInt32(cx, argv[i], &args[i]))
			return(JS_FALSE);
	}
	rc=JS_SUSPENDREQUEST(cx);
	JS_SET_RVAL(cx, arglist,BOOLEAN_TO_JSVAL(movetext(args[0], args[1], args[2], args[3], args[4], args[5])));
	JS_RESUMEREQUEST(cx, rc);
	return(JS_TRUE);
}
示例#5
0
/* ShowTank(tank #) - Displays currently selected tank IF on current map */
void showtank( int tank ) {
    int a,b,c,d;
    if (tankm[tank] == map) {
        if (tankx[tank] == 1) {
            a=0;
        
        } else if (tankx[tank] == 2) {
            a=1;
        
        } else {
            a=2;
        }
        
        if(tankx[tank]==40)
            c=0;
        else if(tankx[tank]==39)
            c=1;
        else c=2;
        
        if(tanky[tank]==1)
            b=0;
        else if(tanky[tank]==2)
            b=1;
        else b=2;
        
        if(tanky[tank]==20)
            d=0;
        else if(tanky[tank]==19)
            d=1;
        else d=2;
        
        movetext(31-a,19-b,31+c,19+d,tankx[tank]+39-a,tanky[tank]+1-b);
        
        
    }
    return(0);
}
示例#6
0
/* ShowTank(tank #) - Displays currently selected tank IF on current map
 'map' is a global showing the map that is currently being displayed  */
void showtank( int tank ) {
    /* what are a, b, c, d ??? */
    int a, b, c, d;
    
    /* this assumes submaps of size 40 X x 20 Y */
    
    /* a is how far to the left of the tank's position the viewport starts
     if the tank is adjacent to a wall (x = 1), the tank is left justified in the viewport
    */
    
    /* c is how far to the right of the tanks position the viewport ends
     if the tank is adjacent to a wall (x = 40), the tank is right justified in the viewport
    */
    
    /* b is how far to the top of the tanks position the viewport ends
     if the tank is adjacent to the top, (y = 1), the tank is top justified in the viewport
    */

    /* d is how far to the bottom of the tanks position the viewport ends
     if the tank is adjacent to the bottom, (y = 20), the tank is bottom justified in the viewport
     */

    if (tankm[tank] == map) {
        if (tankx[tank] == 1) {
            a = 0;
            
        } else if (tankx[tank] == 2) {
            a = 1;
            
        } else {
            a = 2;
        }
        
        if (tankx[tank] == 40) {
            c = 0;
        
        } else if (tankx[tank] == 39) {
            c = 1;
        
        } else {
            c = 2;
        }
        
        if (tanky[tank] == 1) {
            b = 0;
        } else if (tanky[tank] == 2) {
            b = 1;
        } else {
            b = 2;
        }
        
        if (tanky[tank] == 20) {
            d = 0;
        } else if (tanky[tank] == 19) {
            d = 1;
        } else {
            d = 2;
        }
        
        /*   int movetext(int left, int top, int right, int bottom, int destleft, int desttop); */

        movetext(31-a, 19-b, 31+c, 19+d, tankx[tank]+39-a,tanky[tank]+1-b);
        
        
    }
}
示例#7
0
//Draw the GUI (lifes, meters, speed), the road and the player
void Draw()
{
	//gotoxy(x,y): set cursor at (x,y) position
	//Screen resolution = 80x50 => x=1..80, y=1..50

	int i;

	if(!end)
	{
		//GUI
		//Speed
		gotoxy(5,1);
		textcolor(CYAN);
		printf("Speed: ");
		textcolor(LIGHTCYAN);
		for(i=0;i<speed;i++)
			printf("%c",0x04);
		textcolor(CYAN);
		for(i=0;i<(10-speed);i++)
			printf("%c",0x04);
		//Meters
		gotoxy(40,1);
		textcolor(YELLOW);
		printf("%d Meters",meters);
		//Lifes
		gotoxy(70,1);
		textcolor(RED);
		printf("Life: ");
		textcolor(LIGHTRED);
		for(i=0;i<lifes;i++)
			printf("%c",0x03);
		textcolor(RED);
		for(i=0;i<(3-lifes);i++)
			printf("%c",0x03);

		//ROAD
		if(begin)
		{
			//Clear screen
			clrscr();
			//Draw the road
			for(i=0;i<LENGTH;i++)
			{
				gotoxy(1,i+2);
				DrawRoadLine(i);
			}
			begin = false;
		}
		else
		{
			//Delete player
			textcolor(LIGHTGRAY);
			gotoxy(x_prev,42);
			printf("%c",0xDB);
			if(x_prev!=x) x_prev = x;

			//-- TODO:
			//Road scrolling

			//New piece of road

			gotoxy(1,2);
			DrawRoadLine(2);

			movetext(1,2,80,48,1,3);




			//--
		}

		//PLAYER
		textcolor(BLUE);
		textbackground(LIGHTGRAY);
		gotoxy(x,42);
		printf("%c",0x02);
		textbackground(BLACK);
	}
	else
	{
		textcolor(BLUE);
		gotoxy(34,20); printf("-------------");
		gotoxy(34,21); printf("| GAME OVER |");
		gotoxy(34,22); printf("-------------");

		//Wait 500ms showing game over message
		i=GetTickCount();
		while((GetTickCount()-i)<500) {}
		//Wait for a user key down to continue
		while(!kbhit()) {}
	}
}
示例#8
0
EXTERNC
void insline() {
	int y;
	y = wherey();
	movetext(1, y, thData.width, thData.height - 1, 1, y + 1);
};
示例#9
0
EXTERNC
void delline() {
	int y;
	y = wherey();
	movetext(1, y + 1, thData.width, thData.height, 1, y);
};
示例#10
0
文件: KOM.c 项目: punktniklas/NiKom
void DoExecuteCommand(struct Kommando *cmd) {
  switch(cmd->nummer) {
  case 201: Cmd_GoConf(); break; // ga(argument);
  case 210: Cmd_NextText(); break;
  case 211: Cmd_NextReply(); break;
  case 221: Cmd_NextConf(); break;
  case 222: GoConf(MAILBOX_CONFID); break;
  case 301: Cmd_Logout(); break;
  case 101: listmot(argument); break;
  case 102: Cmd_ListUsers(); break;
  case 103: listmed(); break;
  case 104: sendfile("NiKom:Texter/ListaKommandon.txt"); break;
  case 105: listratt(); break;
  case 106: listasenaste(); break;
  case 107: listnyheter(); break;
  case 108: listaarende(); break;
  case 109: listflagg(); break;
  case 111: listarea(); break;
  case 112: listnyckel(); break;
  case 113: listfiler(); break;
  case 114: listagrupper(); break;
  case 115: listgruppmed(); break;
  case 116: listabrev(); break;
  case 202: skriv(); break;
  case 203: Cmd_Reply(); break;
  case 204: personlig(); break;
  case 205: skickabrev(); break;
  case 206: igen(); break;
  case 207: atersekom(); break;
  case 208: medlem(argument); break;
  case 209: uttrad(argument); break;
  case 212: Cmd_Read(); break;
  case 213: endast(); break;
  case 214: Cmd_SkipReplies(); break;
  case 215: addratt(); break;
  case 216: subratt(); break;
  case 217: radtext(); break;
  case 218: skapmot(); break;
  case 219: radmot(); break;
  case 220: var(mote2); break;
  case 223: andmot(); break;
  case 224: radbrev(); break;
  case 225: rensatexter(); break;
  case 226: rensabrev(); break;
  case 227: gamlatexter(); break;
  case 228: gamlabrev(); break;
  case 229: dumpatext(); break;
  case 231: movetext(); break;
  case 232: motesstatus(); break;
  case 233: hoppaarende(); break;
  case 234: flyttagren(); break;
  case 235: Cmd_FootNote(); break;
  case 236: Cmd_Search(); break;
  case 237: Cmd_Like(); break;
  case 238: Cmd_Dislike(); break;
  case 302: sendfile("NiKom:Texter/Help.txt"); break;
  case 303: Cmd_ChangeUser(); break;
  case 304: slaav(); break;
  case 305: slapa(); break;
  case 306: tiden(); break;
  case 307: ropa(); break;
  case 308: Cmd_Status(); break;
  case 309: Cmd_DeleteUser(); break;
  case 310: vilka(); break;
  case 311: visainfo(); break;
  case 312: getconfig(); break;
  case 313: writeinfo(); break;
  case 314: sag(); break;
  case 315: skrivlapp(); break;
  case 316: radlapp(); break;
  case 317: grab(); break;
  case 318: skapagrupp(); break;
  case 319: andragrupp(); break;
  case 320: raderagrupp(); break;
  case 321: adderagruppmedlem(); break;
  case 322: subtraheragruppmedlem(); break;
  case 323: DisplayVersionInfo(); break;
  case 324: alias(); break;
  case 325: Cmd_ReLogin(); break;
  case 326: bytnodtyp(); break;
  case 327: bytteckenset(); break;
  case 328: SaveCurrentUser(inloggad, nodnr); break;
  case 329: Cmd_ChangeLanguage(); break;
  case 401: bytarea(); break;
  case 402: filinfo(); break;
  case 403: upload(); break;
  case 404: download(); break;
  case 405: Cmd_CreateArea(); break;
  case 406: radarea(); break;
  case 407: andraarea(); break;
  case 408: skapafil(); break;
  case 409: radfil(); break;
  case 410: andrafil(); break;
  case 411: lagrafil(); break;
  case 412: flyttafil(); break;
  case 413: sokfil(); break;
  case 414: filstatus(); break;
  case 415: typefil(); break;
  case 416: nyafiler(); break;
  case 417: validerafil(); break;
  default:
    if(cmd->nummer >= 500) {
      sendrexx(cmd->nummer);
    } else {
      LogEvent(SYSTEM_LOG, ERROR,
               "Trying to execute undefined command %d", cmd->nummer);
      DisplayInternalError();
    }
  }
}