Пример #1
0
int main() {
    clrscr();
    bordercolor(0);
    bgcolor(6);

    renderMenu(100);

    textcolor(7);
    gotoxy(0, 1);
    updateStatus(' ');
    cursor(1);
    while(1) {
        char c;
/*
        uint8_t row;
        uint8_t col;
        for (row = 0;  row < 16;  row++) {
            gotoxy(0, row + 3);
            cprintf("%3d ", row * 16);
            for (col = 0;  col < 16;  col++) {
                cputc(row * 16 + col);
                cputc(' ');
            }
        }
*/
        c = cgetc();

        if (c == 20) {
            // backspace
        } else if (c == 13) {
            // Return
        } else if (c == 157) {
            // Left
            uint8_t xpos = wherex() - 1;
            gotox(xpos);
        } else if (c == 29) {
            // Right
            uint8_t xpos = wherex() + 1;
            gotox(xpos);
        } else if (c == 17) {
            // Down
            uint8_t ypos = wherey() + 1;
            gotoy(ypos);
        } else if (c == 145) {
            // Up
            uint8_t ypos = wherey() - 1;
            gotoy(ypos);
        } else if (c == 19) {
            // Pos1
        } else if (c == 3) {
            // ESC -> Menu
            processMenu();
        } else {
            cputc(c);
        }        

        
        updateStatus(c);
    }
}
Пример #2
0
void erase_backward(uint8_t count)
{
    cclear(1); /* Erase cursor */
    gotox(wherex() - (count + 1));
    cclear(count);
    gotox(wherex() - count);
}
Пример #3
0
/*-----------------------------------------------------------------------------------*/
void
ctk_draw_menus(struct ctk_menus *menus)
{
  struct ctk_menu *m;

  /* Draw menus */
  (void)textcolor(MENUCOLOR);
  gotoxy(0, 0);
  revers(1);
  cputc(' ');
  for(m = menus->menus->next; m != NULL; m = m->next) {
    draw_menu(m, m == menus->open);
  }

  /* Draw desktopmenu */
  if(wherex() + strlen(menus->desktopmenu->title) + 1 >= sizex) {
    gotoxy(sizex - (unsigned char)strlen(menus->desktopmenu->title) - 1, 0);
  } else {
    cclear(sizex - wherex() -
	   (unsigned char)strlen(menus->desktopmenu->title) - 1);
  }
  draw_menu(menus->desktopmenu, menus->desktopmenu == menus->open);

  revers(0);
}
Пример #4
0
void Mlecz::rysowanie(){
	int x = wherex();
	int y = wherey();
	gotoxy(this->x, this->y);
	cputs("M");
	gotoxy(x, y);
}
Пример #5
0
void screen_draw_border(char *help_msg)
{
    int px, py;
    int i, msg_len;

    trim(help_msg);

    px = wherex(); py = wherey();
    gotoxy(0, 0);
    for (i = 0;i <= WIN_WIDTH;i++)
        cprintf("%c", BORDER_HOR);

    for (i = 1;i < WIN_HEIGHT;i++) {
        gotoxy(0, i);
        cprintf("%c", BORDER_VER);
        gotoxy(WIN_WIDTH, i);
        cprintf("%c", BORDER_VER);
    }

    gotoxy(0, WIN_HEIGHT);
    for (msg_len = strlen(help_msg), i = 0;i < (WIN_WIDTH - msg_len) / 2;i++)
        cprintf("%c", BORDER_HOR);
    cprintf("%s", help_msg);
    for (i += msg_len;i <= WIN_WIDTH;i++)
        cprintf("%c", BORDER_HOR);

    gotoxy(px, py);
}
Пример #6
0
void Zolw::rysowanie(){
	int x = wherex();
	int y = wherey();
	gotoxy(this->x, this->y);
	cputs("Z");
	gotoxy(x, y);
}
Пример #7
0
void renderMenu(uint8_t current) {
    uint8_t idx = 0;

    textcolor(1);
    revers(1);
    gotoxy(0, 0);
    for (idx = 0;  idx < menuSize;  idx++) {
        if (idx == current) {
            textcolor(3);
            cputs(menu[idx]);
            
            /*****************/
            cputsxy(0, 1, "\xf0\xc0\xc0\xc0\xc0\xee");
            gotoxy(0, 2);
            cprintf("\xdd%s\xdd", fileMenu[0]);
            gotoxy(0, 3);
            cprintf("\xdd%s\xdd", fileMenu[1]);
            gotoxy(0, 4);
            cprintf("\xdd%s\xdd", fileMenu[2]);
            gotoxy(0, 5);
            cprintf("\xdd%s\xdd", fileMenu[3]);
            cputsxy(0, 6, "\xed\xc0\xc0\xc0\xc0\xfd");
            /*****************/
            
        } else {
            cputs(menu[idx]);
        }
        textcolor(1);
        cputs("  ");
    }
    for (idx = wherex();  idx < 40;  idx++) {
        cputc(' ');
    }
}
Пример #8
0
void drawchatwin(box_t *boxch, char* topname, char* botname) {
	struct text_info ti;
	int	i;

	_wscroll=0;
	gettextinfo(&ti);
	textcolor(WHITE);
	textbackground(BLACK);
	clrscr();
	uwin.top=1;
	uwin.left=1;
	uwin.right=ti.screenwidth;
	uwin.bottom=ti.screenheight/2-1;
	uwin.colour=GREEN;
	swin.top=ti.screenheight/2+1;
	swin.left=1;
	swin.right=ti.screenwidth;
	swin.bottom=ti.screenheight;
	swin.colour=LIGHTGREEN;

	gotoxy(1,ti.screenheight/2);
	putch(196);
	putch(196);
	putch(196);
	putch(196);
	putch(180);
	cputs(topname);
	putch(195);
	for(i=wherex();i<=ti.screenwidth;i++)
		putch(196);

	_wscroll=1;
}
Пример #9
0
	void ATCInput::Echo (char *Msg)	{
		SelectScreen();
		gotoxy (CrntColumn_c, INPUT_LINE);

		cprintf(Msg);
		CrntColumn_c = wherex();
	}
Пример #10
0
Boolean aceptar_cancelar(){
 int  i = 0, lasti = 0, key, fila = wherey(), x = wherex();
 char *buttons[] = {" Aceptar ", " Cancelar "};
 gotoxy(x + 1, fila);
 cputs(" Aceptar  Cancelar ");
 gotoxy(x + calculate_xpos(buttons, i), fila);
 marcar_texto(buttons[i], strlen(buttons[i]));
 msg_snd();
 do{
  key = bioskey(0);
  if((key & SC_IZQ) == SC_IZQ){
   i--;
   if((i>=0)&&(i<=1))JVGtecla();
  }
  if((key & SC_DER) == SC_DER){
   i++;
   if((i>=0)&&(i<=1))JVGtecla();
  }
  if(i >= 2)  i = 1;
  if(i < 0) i = 0;
  gotoxy(x + calculate_xpos(buttons, lasti), fila);
  desmarcar_texto(buttons[lasti], strlen(buttons[lasti]));
  gotoxy(x + calculate_xpos(buttons, i), fila);
  marcar_texto(buttons[i], strlen(buttons[i]));
  lasti = i;
 }while(((key & SC_ENTER)!= SC_ENTER) && ((key & SC_ABAJO) != SC_ABAJO));
 gotoxy(x + calculate_xpos(buttons, i), fila);
 desmarcar_texto(buttons[i], strlen(buttons[i]));
 _setcursortype(_NORMALCURSOR);
 if(i == 0) return Verdadero;
 return Falso;
}
Пример #11
0
/*
 * get_input_terminated_by() reads input (handling backspace correctly) until
 * a terminator of |terminators| is encountered or |out| is full (outlen-1
 * characters were read).
 *
 * get_input_terminated_by() returns the terminator it encountered.
 *
 */
input_terminator_t get_input_terminated_by(input_terminator_mask_t terminators, char *out, BYTE outlen) {
	BYTE i = strlen(out);
	BYTE c, x, y;
	x = wherex() - i;
	y = wherey();
	while (1) {
		c = cgetc();
		if (((terminators & INPUT_TERMINATOR_RETURN) == INPUT_TERMINATOR_RETURN) && (c == PETSCII_CR)) {
			return INPUT_TERMINATOR_RETURN;
		} else if (((terminators & INPUT_TERMINATOR_SPACE) == INPUT_TERMINATOR_SPACE) && (c == PETSCII_SP)) {
			return INPUT_TERMINATOR_SPACE;
		} else if (c == PETSCII_DEL) {
			/* If you are at the left-most position, do nothing */
			if (i == 0)
				continue;
			out[--i] = '\0';
			cputcxy(x+i, y, ' ');
			gotoxy(x+i, y);
			continue;
		}
		if (i == (outlen-1)) {
			continue;
		}
		cputc(c);
		out[i++] = c;
	}
}
Пример #12
0
void Guarana::rysowanie(){
	int x = wherex();
	int y = wherey();
	gotoxy(this->x, this->y);
	cputs("G");
	gotoxy(x, y);
}
Пример #13
0
unsigned int _8254CounterIEN(unsigned Base, unsigned irq, unsigned F96,int df)
{
  unsigned int CBase;
  int t;
  ADDRESS = Base;
  CBase = Base + 0x10;
  if(F96==1){
      flag2 = 1;          //for setcountflag isr
      CtrMode(CBase,0,2);
      CtrLoad(CBase,0,0x10);
  }

  do{
    CtrMode(CBase,1,2);
    CtrLoad(CBase,1,0x10);
    CtrMode(CBase,2,2);
    CtrLoad(CBase,2,0x10);
    initirq(irq,setcountflag);
    outportb(Base+0x0E,0x02);//enable COUNTER IRQ on PCIe-DIO-24DCS
    if(F96==1){
      outportb(Base+0x1E, 0x00); //enable interrupt for dio-96CT
      outportb(Base+0x1F, 0x00); //clear interrupt latch for dio-96CT
    }

    outportb(Base+0xF, 0x00);    // clear interrupt latch for dio-24
    isrflag = 0;
    outportb(0x20, 0x20);
    outportb(0xA0, 0x20);
    delay(1000);
    outportb(Base+0xD, 0x00);    // turn off interrupt for dio-24
    outportb(Base+0x0f, 0);      // clear left over IRQs
    if(F96==1)
      outportb(Base+0x1E, 0x00); //disable interrupt for dio-96CT
    outportb(0x20, 0x20);
    outportb(0xA0, 0x20);
    restoreirq(irq);
    t = isrflag;
    textcolor(t?GREEN:RED);
    cprintf("%s",t?"IRQ    ":"NoIRQ    ");
    if((80 - wherex()) < 10)
      gotoxy(1,wherey());
    t = 0;
  }while((!kbhit()) && (df)); //exit after running once if !Debug mode

  if (df) {
    getch();
    printf("\n");
  }
  if(F96==1){
    CtrMode(CBase,0,2);          //stop counters counting
    CtrMode(CBase,1,2);
    CtrMode(CBase,2,2);
    outportb(Base+0x1E,0x00); //disable interrupt for dio-96CT
  }
  if (isrflag)
    return 0;
  else
    return 1;
}
Пример #14
0
void gettextinfo(struct text_info *info) {
	info->curx = wherex();
	info->cury = wherey();
	info->attribute = thData.attrib;
	info->normattr = 0x07;
	info->screenwidth = thData.width;
	info->screenheight = thData.height;
};
/*---------------------------------------------------------------------*

Name            gettextinfo - give the user information on video mode,
                              window coordinates and video attributes

Usage           #include <conio.h>
                void gettextinfo(struct text_info *r);

Prototype in    conio.h

Description     fills the text_info structure with the current video
                information.

Return value    None

NOTE: text_info structure is partial prefix of _video structure

*---------------------------------------------------------------------*/
void gettextinfo(struct text_info *r)
{
        *r = *(struct text_info *)& _video;     /* move data all at once */
        r->winleft      += 1;                   /* 1,1 origin */
        r->wintop       += 1;
        r->winright     += 1;
        r->winbottom    += 1;
        r->curx = wherex();
        r->cury = wherey();
}
Пример #16
0
void 
GetCurs(int *x, int *y)
{
#ifdef UNIX
    getsyx(*y, *x);
#else
    /* X and Y are zero-based */
    *x = wherex() - 1;
    *y = wherey() - 1;
#endif
}
Пример #17
0
void save_curs(POINT * p){

    ///\fn void save_curs(POINT * p)
    ///\brief Salvarea pozitiei cursorului.
    ///\param p Variabila tip POINT care stocheaza pozitia cursorului
    ///
    ///Implementarea salvarii pozitiei cursorului.

    p->x = wherex();
    p->y = wherey();
}
Пример #18
0
static char Input (char* Prompt, char* Buf, unsigned char Count)
/* Read input from the user, return 1 on success, 0 if aborted */
{
    int Frame;
    unsigned char OldColor;
    unsigned char OldCursor;
    unsigned char x1;
    unsigned char i;
    unsigned char done;
    char c;

    /* Clear the current prompt line */
    cclearxy (0, MAX_Y-1, MAX_X);

    /* Display the new prompt */
    OldColor = textcolor (COLOR_TEXTHIGH);
    cputsxy (0, MAX_Y-1, Prompt);
    (void) textcolor (COLOR_TEXTLOW);

    /* Remember where we are, enable the cursor */
    x1 = wherex ();
    OldCursor = cursor (1);

    /* Get input and handle it */
    i = done = 0;
    do {
        c = cgetc ();
        if (isalnum (c) && i < Count) {
            Buf [i] = c;
            cputcxy (x1 + i, MAX_Y-1, c);
            ++i;
        } else if (i > 0 && c == CH_DEL) {
            --i;
            cputcxy (x1 + i, MAX_Y-1, ' ');
            gotoxy (x1 + i, MAX_Y-1);
        } else if (c == '\n') {
            Buf [i] = '\0';
            done = 1;
        } else if (IsAbortKey (c)) {
            /* Abort */
            done = 2;
        }
    } while (!done);

    /* Reset settings, display old prompt line */
    cursor (OldCursor);
    (void) textcolor (OldColor);
    DrawFrames ();
    Frame = ActiveFrame;
    ActiveFrame = -1;
    ActivateFrame (Frame, 0);

    return (done == 1);
}
Пример #19
0
int LireNbreFilmValide(void) {
    int NbrFilms;
    cout << "Nombre de film lou\x82s (1 \x85 3) : ";
    int CurrX = wherex();
    int CurrY = wherey();
    do {
        gotoxy(CurrX,CurrY);
        NbrFilms = ConvertireUnCharEnInt(_getche());
    } while(NbrFilms > 3 || NbrFilms < 1);
    return NbrFilms;
}
Пример #20
0
void Screen::myCprintf( uint8_t attr, char *fmt, ... ) {

    int x = wherex( );
    int y = wherey( );

    va_list ap;
    va_start( ap, fmt );
    myCprintf_internal( x, y, attr, fmt, ap );
    va_end( ap );

}
Пример #21
0
int chatchar(WINDOW *win, int ch) {
	window(win->left,win->top,win->right,win->bottom);
	gotoxy(win->x,win->y);
	textcolor(win->colour);
	putch(ch);
	if(ch=='\r')
		putch('\n');
	win->x=wherex();
	win->y=wherey();
	return(0);
}
Пример #22
0
void clreol (void)
{
    int X, Y;
    char Spaces[100];

    memset (Spaces, ' ', sizeof (Spaces));
    X = wherex ();
    Y = wherey ();
    Spaces[80-X] = 0;
    printf ("%s", Spaces);
    gotoxy (X, Y);
}
Пример #23
0
/* Output a vertical line with the given length at the current cursor
 * position.
 */
void __fastcall__ cvline( unsigned char length )
{
	// FIXME: Optimize me.
	unsigned char x = wherex();
	unsigned char y = wherey();
	unsigned char i;
	for( i=0; i<length; i++ )
	{
		gotoxy( x, y+i );
		cputc( 1 );
	}
}
Пример #24
0
static void
draw_menu(struct ctk_menu *m, unsigned char open)
{
  unsigned char x, x2, y;

  if(open) {
    x = x2 = wherex();
    if(x2 + CTK_CONF_MENUWIDTH > sizex) {
      x2 = sizex - CTK_CONF_MENUWIDTH;
    }

    for(y = 0; y < m->nitems; ++y) {
      if(y == m->active) {
	(void)textcolor(ACTIVEMENUITEMCOLOR);
	revers(0);
      } else {
	(void)textcolor(MENUCOLOR);	  
	revers(1);
      }
      gotoxy(x2, y + 1);
      if(m->items[y].title[0] == '-') {
	chline(CTK_CONF_MENUWIDTH);
      } else {
	cputs(m->items[y].title);
      }
      if(x2 + CTK_CONF_MENUWIDTH > wherex()) {
	cclear(x2 + CTK_CONF_MENUWIDTH - wherex());
      }
    }

    gotoxy(x, 0);
    (void)textcolor(OPENMENUCOLOR);
    revers(0);
  }

  cputs(m->title);
  cputc(' ');
  (void)textcolor(MENUCOLOR);
  revers(1);
}
Пример #25
0
void GetPass (char *Pass, int Len)
{
        int     index = 0;
        WORD    x,y;

	// Get the y co-ordinate
        y = wherey ();

        do   
        {
                // get the current x co-ordinate
		
		x = wherex ();
                
		// get the next character from the input buffer
		Pass [index] = (char) getch ();
		
		// if its an enter, terminate the string
                if (Pass [index] == 0x0D)
                        Pass [index] = '\0';
		
		// if its a delete move the cursor back, and remove the last character from the string
                else if (Pass [index] == 0x08)
                {
                        if (index-1 >= 0)
                        {
                                index -= 2;
                                
				// blank out the last *
				gotoxy ((WORD) (x-1), y);
                                putch (' ');
                                gotoxy ((WORD) (x-1), y);
                        }
                        else 
                        {
                                index = -1;
                        }
                }
                else
			// display a * for the character
                        putch ('*');
		
		// move to the next character in the array
                index++;
        } while (Pass [index-1] && index < Len);

        
	// apply a newline character if needed
	if (Pass [index-1])
                Pass [index-1] = NULL;
        putch ('\n');
}
Пример #26
0
/* move cursor back one char with 
** recognition of row change
*/   
void chBack(void){
    signed char x, y;
    
    x = wherex();
    y = wherey();
    
    x-=1;
    if (x < 0) {
        x=39;
        y-=1;
    }
    gotoxy(x,y);
}
void main (void)
{
    int linha, coluna;

    clrscr ();
    cprintf ("Esta e a linha 1\r\n");
    cprintf ("A linha 2 e um pouco mais longa\r\n");
    cprintf ("Esta e a ultima linha");
    linha = wherey();
    coluna = wherex ();
    cprintf ("\r\nA posicao do cursor era linha %d coluna %d\n", linha, coluna);

}
Пример #28
0
/*-----------------------------------------------------------------------------------*/
static void
draw_menu(struct ctk_menu *m)
{
  unsigned char x, x2, y;

  textcolor(VNC_OUT_MENUCOLOR);
  x = wherex();
  cputs(m->title);
  cputc(' ');
  x2 = wherex();
  if(x + CTK_CONF_MENUWIDTH > sizex) {
    x = sizex - CTK_CONF_MENUWIDTH;
  }
  
  
  for(y = 0; y < m->nitems; ++y) {
    if(y == m->active) {
      textcolor(VNC_OUT_ACTIVEMENUCOLOR);
      revers(0);
    } else {
      textcolor(VNC_OUT_MENUCOLOR);	  
    }
    gotoxy(x, y + 1);
    if(m->items[y].title[0] == '-') {
      chline(CTK_CONF_MENUWIDTH);
    } else {
      cputs(m->items[y].title);
    }
    if(x + CTK_CONF_MENUWIDTH > wherex()) {
      cclear(x + CTK_CONF_MENUWIDTH - wherex());
    }
    revers(1);
  }
  
  gotoxy(x2, 0);
  textcolor(VNC_OUT_MENUCOLOR);  

  update_area(x, 0, CTK_CONF_MENUWIDTH, m->nitems + 1);
}
Пример #29
0
void updateStatus(uint8_t c) {
    uint8_t xpos = wherex();
    uint8_t ypos = wherey();

    gotoxy(0, 24);
    textcolor(1);
    revers(1);
    cprintf("Ln: %-2d Col: %-2d  %3d   INS               ", ypos, xpos, c);

    textcolor(7);
    revers(0);
    gotoxy(xpos, ypos);
}
Пример #30
0
/* move cursor forth one char with 
** recognition of row change
*/
void chForth(void){
    signed char x, y;
    
    x = wherex();
    y = wherey();
    
    x+=1;
    if (x >= 40) {
        x=0;
        y+=1;
    }
    gotoxy(x,y);
}