File: TEXTMODE.C | Size: 3,472 bytes | Download file | Back to directory listing | BWPOW's homepage
#include <string.h>
#include <conio.h>
#include <all312.h>
 
typedef struct TEMP{
  int temp[2000];
  unsigned char zx1,zx2,zy1,zy2;
}TEMP;
TEMP temp[10];
 
int t=-1;
 
void _box_maker(int x1,int y1,int x2,int y2,char c1,char c2,char text[60])
{
  char tbuf[80];
  int x,y,c;
  t++;
  gettext(x1,y1,x2+2,y2+1,temp[t].temp);
  temp[t].zx1=x1;temp[t].zx2=x2;
  temp[t].zy1=y1;temp[t].zy2=y2;
 
  textcolor(c1);textbackground(c2);
 
  tbuf[0]='É';
  for(x=0;x<x2-x1;x++)
    tbuf[x+1]='Í';
  tbuf[x]='»';
  tbuf[x+1]=0;
 
  gotoxy(x1,y1);
  cprintf("%s",tbuf);
 
  for(y=y1+1;y<y2;y++)
  {
    tbuf[0]='º';
    for(x=0;x<x2-x1;x++)
      tbuf[x+1]=' ';
    tbuf[x]='º';
    tbuf[x+1]=0;
 
    gotoxy(x1,y);
    cprintf("%s",tbuf);
  }
 
  tbuf[0]='È';
  for(x=0;x<x2-x1;x++)
    tbuf[x+1]='Í';
  tbuf[x]='¼';
  tbuf[x+1]=0;
 
  gotoxy(x1,y2);
  cprintf("%s",tbuf);
  textcolor(8);
  textbackground(0);
 
  for(y=y1+1;y<=y2;y++)
    for(x=0;x<2;x++){
      ScreenGetChar(&c,NULL,x+x2,y-1);
      gotoxy(x+1+x2,y);
      cprintf("%c",c);
    }
 
  for(x=x1+2;x<=x2+2;x++){
    ScreenGetChar(&c,NULL,x-1,y2);
    gotoxy(x,y2+1);
    cprintf("%c",c);
  }
 
  textcolor(c1);textbackground(c2);
  gotoxy(x1+2,y1);cprintf(" %s ",text);
}
 
void outtext_centre(char text[80])
{
  gotoxy(wherex()-strlen(text)/2,wherey());
  cprintf("%s",text);
}
 
 
 
void _delete_box()
{
  puttext(temp[t].zx1,temp[t].zy1,temp[t].zx2+2,temp[t].zy2+1,temp[t].temp);
  t--;
}
 
 
void smkalert3(char text1[40],char text2[40],char text3[40])
{
  _box_maker(18,9,61,16,15,7,text1);
 
  textcolor(0);
 
  gotoxy(40,11);
  outtext_centre(text2);
  gotoxy(40,12);
  outtext_centre(text3);
 
  gotoxy(40,14);
  textcolor(8);
  outtext_centre("Press ENTER");
 
  while(!key[KEY_ENTER]);
  while(key[KEY_ENTER]);
  clear_keybuf();
  _delete_box();
 
}
 
void make_background(char ver)
{
  short i;
  _set_screen_lines(25);
  _setcursortype(_NOCURSOR);
  textbackground(7);
  clrscr();
 
  textcolor(1);
  gotoxy(1,2);
  for(i=0;i<1840;i++) cprintf("%c",176);
 
  textcolor(0);
  gotoxy(40,1);
  outtext_centre("Universal File Hacker - by Samuel Kupka");
 
  gotoxy(2,25);
 
  textcolor(4);cprintf("F1 ");
  textcolor(0);cprintf("About ");
 
  textcolor(4);cprintf("F3 ");
  textcolor(0);cprintf("Reload ");
 
  textcolor(4);cprintf("F5 ");
  textcolor(0);cprintf("Extract ");
 
  textcolor(4);cprintf("F6 ");
  textcolor(0);cprintf("Upload ");
 
  textcolor(4);cprintf("Ins ");
  textcolor(0);cprintf("Select ");
 
  textcolor(4);cprintf("Del ");
  textcolor(0);cprintf("Connect files ");
 
  textcolor(4);cprintf("Esc ");
  textcolor(0);cprintf("Quit ");
 
}
 
void koniec1()
{
  _setcursortype(_NORMALCURSOR);
  allegro_exit();
  window(1,1,80,25);
  textcolor(7);textbackground(0);
  clrscr();
  printf("\nBy Samuel Kupka\n");
  exit(0);
}
 
void koniec(char text[80])
{
  _box_maker(18,10,61,15,15,3,"File Hacker");
 
  gotoxy(40,12);outtext_centre(text);
  gotoxy(40,14);
  textcolor(8);
  outtext_centre("Press ENTER");
 
  while(!key[KEY_ENTER]);
 
  _delete_box();
  clear_keybuf();
  koniec1();
}
 
void nekoniec(char text[80])
{
  _box_maker(18,10,61,15,15,3,"File Hacker");
 
  gotoxy(40,12);outtext_centre(text);
  gotoxy(40,14);
  textcolor(8);
  outtext_centre("Press ENTER");
 
  while(!key[KEY_ENTER]);
 
  _delete_box();
  clear_keybuf();
}