Пример #1
0
int endgame (int b[][SIZE + 2], char h[], int *s) {
  int c, x, y;
  char input;

  printf ("Do you want to guess now? (y/n) ");
  while (!isalpha (input = getchar ()));
  if (tolower(input) != 'y') {
    drawbox(b, h, 1);
    return 0;
  }
  drawbox(b, h, 2);
  for (c = 0; c < NUM; c++) {
    printf ("What is the location of atom #%d? <x,y> ", c + 1);
    scanf ("%d %*c %d", &x, &y);
    if (b[x][y] == 1) {
      puts ("\nCorrect");
      b[x][y] = 10;
    } else {
      puts ("\nIncorrect. Plus 5 points.");
      *s += 5;
    }
  }
  drawbox (b, h, 3);
  printf ("\nYour final score : %d\nHere's the Blackbox.\n  ", *s);
  return 1;
}
Пример #2
0
/* ----------------- DISPLAY MENU wid TYPEWRITER EFFECTS --------------------*/
void display_atik_atik_Menu(void){
  _setcursortype(_NOCURSOR);
  delay(400);
  box1(6,5,75,7,GOINGDOWN,YELLOW,16);
  drawbox(6,5,75,7,YELLOW);
  textcolor(LIGHTGREEN|BLINK);
  gotoxy(17,6); cprintf(" ®®®®®®®® Mark & Dencie in da Lost Temple  ¯¯¯¯¯¯¯¯¯");delay(30);

  box1(6,8,75,16,GOINGDOWN,YELLOW,16);
  drawbox(6,8,75,16,YELLOW);
  textcolor(WHITE);
  gotoxy(8,9); cprintf("Dencie was lost in the big forest of Lost Temple - a popular ");delay(50);
  gotoxy(8,10); cprintf("WCG map (World Cyber Games) played by gamers of Starcraft:Broodwar");delay(50);
  gotoxy(8,11); cprintf("from different parts of the world.");delay(50);
  gotoxy(8,12); cprintf("Let's help Mark to find Dencie. Be aware there maybe lots");delay(10);
  gotoxy(8,13); cprintf("of zerglings burrowing or maybe a Lurker. Dont forget to bring a");delay(10);
  gotoxy(8,14); cprintf("detector or observer. Or scan it with your COMSAT.");delay(10);
  gotoxy(8,15); cprintf("Press s to begin scanning of the burrowing zerglings or lurkers.");delay(10);


  box1(26,19,56,21,GOINGDOWN,YELLOW,16); /* container */
  drawbox(26,19,56,21,YELLOW);
  textcolor(WHITE); gotoxy(29,20); cprintf(".: What do you want ? :.");

  box1(26,22,56,23+3,GOINGDOWN,YELLOW,40); /* menu container */
  drawbox(26,22,56,23+3,YELLOW);
  textcolor(LIGHTCYAN);
  gotoxy(startx,starty+5);typewriter_effects("þ Play the game          þ",5);
  gotoxy(startx,starty+6);typewriter_effects("þ Know the developers    þ",5);
  gotoxy(startx,starty+7);typewriter_effects("þ Exit                   þ",5);
  textbackground(BLACK);
  textcolor(YELLOW);gotoxy(37,47);typewriter_effects("Use arrow keys to move the selection...",10);

}
void drawPaddle1()
{
	if(state ==  0){
		drawbox(paddleX[1], paddleY[1], paddleX[1] + PADDLE_WIDTH, paddleY[1] + PADDLE_HEIGHT, /*CYAN*/ RED);
	}else{
		drawbox(paddleX[1], paddleY[1], paddleX[1] + PADDLE_WIDTH, paddleY[1] + PADDLE_HEIGHT, /*CYAN*/ CYAN);
	}
}
void drawPaddle2()
{
	if(state == 0){
		drawbox(paddleX[2], paddleY[2], paddleX[2] + PADDLE_WIDTH, paddleY[2] + PADDLE_HEIGHT, CYAN);
	}else{
		drawbox(paddleX[2], paddleY[2], paddleX[2] + PADDLE_WIDTH, paddleY[2] + PADDLE_HEIGHT, RED);
	}
}
void printScores()
{
    char s[5];

    //erase scores
    drawbox(0,0,20,10,BLACK);
    drawbox(220,0,239,10,BLACK);

    //display scores
    sprintf(s,"%i",score1);
    print(5,0,s,WHITE);
    
    sprintf(s,"%i",score2);
    print(220,0,s,WHITE);
}
Пример #6
0
int startupmenu(int i)
{
	while (1) {
		drawbox(5, STARTUP_Y-2, 22, STARTUP_N+4, NULL);
		printmenuhelp(19);
		i = startup_menu(i-1, 8, STARTUP_Y);
# ifndef TTY_SOCKET
		if (!i)
			break;
# else
		if (i==2 && !select_2p_tty(24, STARTUP_Y+1))
			continue;
		if (!i) {
			setcurs(5, STARTUP_Y-2);
			wclrtobot(window);
			if ((i = menu_checkinvit(1, 7)) == -1) {
				refresh();
				setwcurs(0, 5, 7);
				i = 1;
				continue;
			}
			if (!i)
				break;
		}
		move(term_height-1, 0);
		clrtoeol();
		refresh();
# endif
		setcurs(5, STARTUP_Y-2);
		wclrtobot(window);
		break;
	}
	return i;
}
Пример #7
0
/********************************************************\
 * Description:	Similar to popupWin, only it prmpts the	*
 *		user for a character, such as (y/n)	*
 * Returns:	Returns character pressed		*
\********************************************************/
short int questionWin(char *msg)
{
    WINDOW *tmpwin;
    short int ch;

    int y = (LINES / 2) - 3,				/* calc location      */
        len = strlen(msg),
        x = (COLS - len)/2;

    y = (y < 2) ? 2 : y;				/* minimum height     */

    tmpwin = drawbox(y, x, 5, len + 6);			/* create window      */

    mvwprintw(tmpwin,2,3, msg);
    wmove(tmpwin,2,len+4);
    wrefresh(tmpwin);

    ch = wgetch(tmpwin);

    delwin(tmpwin);

    wtouchln(windows->hex, y - 1, 5, 1);		/* touch the lines    */
    wtouchln(windows->ascii, y - 1, 5, 1);		/* covered by win     */
    wtouchln(windows->address, y - 1, 5, 1);
    wtouchln(windows->hex_outline, y, 5, 1);
    wtouchln(windows->ascii_outline, y, 5, 1);
    wtouchln(windows->scrollbar, y, 5, 1);

    refreshall(windows);				/* refresh all wins   */

    doupdate();

    return ch;
}
Пример #8
0
/* ----------------  DISPLAY THE SOFTWARE DEVELOPERS -----------------------*/
void viewGameDevelopers(void) {
char str[9];

   box1(3,3,78,48,GOINGDOWN,BLACK,5);
   delay(300);
   box1(25,13,57,35,GOINGDOWN,YELLOW,8); /* container */
   box1(25,13,59,37,GOINGDOWN,BLACK,0);  /* dropshadow */
   box1(25,13,57,35,GOINGLEFT,YELLOW,0); /* container */
   drawbox(25,13,57,35,YELLOW);

   gotoxy(startx+7,starty-5); textcolor(YELLOW);typewriter_effects(".: About :.",5);delay(100);
   textcolor(WHITE);
   gotoxy(startx+4,starty-3); typewriter_effects(" .: Maze Game :. ",2);delay(50);
   gotoxy(startx+3,starty-1); typewriter_effects(" Version 2.25.2004",2);delay(50);
   gotoxy(startx,starty+1); textcolor(LIGHTRED); typewriter_effects("   Copyright(c) 2005",5);delay(50);
   gotoxy(startx,starty+2);typewriter_effects(" (Year of the Chicken)",2);delay(50);
   gotoxy(startx-3,starty+4); textcolor(WHITE);typewriter_effects(" .:Jastis Legs(Pinoy version):.",2);delay(50);
   gotoxy(startx,starty+5); textcolor(LIGHTGREEN); typewriter_effects(".:arman as Lipstik-Man:. ",2);delay(50);
   gotoxy(startx,starty+6); typewriter_effects("   .:Mark as Mulawin:.",2);delay(50);
   gotoxy(startx,starty+7); typewriter_effects("  .:Eunice as KrysTala:.",2);delay(50);
   gotoxy(startx,starty+8); cprintf(" .:Yulin as Wonder Boy:.");delay(50);
   gotoxy(startx+1,starty+9); cprintf(" .:Dyncie as Bintong:. ");delay(50);
   gotoxy(startx-3,starty+10); cprintf(" .:Janus as Boboy Salongga:. ");delay(50);
   gotoxy(startx-3,starty+12);textcolor(YELLOW);cprintf("You know the speed of light,");delay(50);
   gotoxy(startx-3,starty+13);textcolor(YELLOW);cprintf("   so whats the speed of dark?");delay(50);
   getch();
  //exit(0);
   box1(24,12,60,40,GOINGDOWN,BLACK,5); /* container */
}
Пример #9
0
void intern blowup( register BUFFER     *bptr,
                    register SAREA      area,
                    register char       *box,
                    register ATTR       attr )
/********************************************/
{
//    register    ORD                     rows;
//    register    ORD                     cols;
    register    int                     inccol;
    register    int                     incrow;
    auto        SAREA                   grow;

//    rows = area.height - 2;
//    cols = area.width - 2;
    incrow = 1;
    inccol = 3;
    grow.row = area.row + area.height/2 - 1;
    grow.col = area.col + area.width/2 - 1;
    grow.height = 2;
    grow.width = 2;
    while( ( grow.height < area.height ) || ( grow.width < area.width ) ) {
        grow.row = (ORD)max( area.row, grow.row - incrow );
        grow.col = (ORD)max( area.col, grow.col - inccol );
        grow.height = (ORD)min( area.height, grow.height + 2*incrow );
        grow.width = (ORD)min( area.width, grow.width + 2*inccol );
        drawbox( bptr, grow, box, attr, TRUE );
        if( ( grow.height == area.height ) &&
            ( grow.width == area.width ) ) {
            break;
        }
    }
}
Пример #10
0
void cwindow::enabledscroll()
{                            
/*	int	i = m_nmaxrows;
	_itemnode*	pitem = m_pitemhead;
	                                
	while(pitem != NULL)
	{
		if(--i == 0) break;
		pitem = pitem->pnext;
	}	                     
	if(i == 0)           */
	if(m_nitemcount > m_nmaxrows)
		drawbox(m_nrow1, m_ncol1, m_nrow2, m_ncol2, 177);
	else
		drawbox(m_nrow1, m_ncol1, m_nrow2, m_ncol2);
}
Пример #11
0
void uidrawbox( VSCREEN *vs, SAREA *area, ATTR attr, const char *title )
/**********************************************************************/
{
    int         length;
    int         col;

    if( area->width < 2 ) {
        return;
    }

    drawbox( &(vs->window.type.buffer), *area, (char *)&UiGChar[ UI_SBOX_TOP_LEFT ],
             attr, FALSE );

    if( title == NULL ) {
        return;
    }

    length = strlen( title );
    col = area->col + 1;

    if( length >= area->width - 2 ) {
        length = area->width;
    }

    uivtextput( vs, area->row, col, attr, title, length );
}
Пример #12
0
void
resize()
{
	endwin();
	refresh();
	drawbox();
}
Пример #13
0
static void tetrom_colors_menu(int x, int y)
{
	const char *menu[7] = {"I", "J", "L", "O", "S", "T", "Z"};
	menuhandler handlers[7] = {
		op_tcolor, op_tcolor, op_tcolor, op_tcolor,
		op_tcolor_gt4, op_tcolor_gt4, op_tcolor_gt4
	};
	int i = 0;
	if (y+6 >= term_height)
		y -= 7;
	drawbox(x, y, 19, 6, (char *) 0);
	x++;
	y++;
	drawmenu(menu, 4, 0, x, y, handlers);
	drawmenu(menu+4, 3, -1, x+9, y, handlers+4);
	autorep_a_b_btns = 1;
	while (1) {
		setcurs(x, y+i%4);
		refreshwin(-1);
		switch (handle_menuitem_2cols(menu, 7, &i, 4, x, y+i%4,
				handlers, getkeypress_block(SINGLE_PL))) {
		case 0:
		case 2:
			autorep_a_b_btns = 0;
			if (i >= 4)
				x -= 9;
			clearbox(x-1, y-1, 19, 6);
			return;
		case 3:
			x += i>=4 ? 9 : -9;
			setcurs(x, y+i%4);
			printmenuitem(menu[i], 1);
		}
	}
}
Пример #14
0
void comfirm_box(int x, int y, int type, int covercolor, const char *msg)
{
	int len = strlen(msg),
		c,
		fcolor, bcolor, mode;

	getcolors(&fcolor, &bcolor);
	getcntmode(&mode);
	
	if (len < 10) len = 10;
	if (type == WARNMSG) setcolor(F_GRAY, B_RED);
	else setcolor(F_YELLOW, B_BLUE);

	setcntmode(ATTR_HIGHLIGHT);
	draw3Dwindow(x, y, x+7, y+3+len, type == WARNMSG ? B_RED : B_BLUE);
	cprintfxy(x, y+1, type == WARNMSG ? "-| WARN |-" :  "-| NOTE|-");
	cprintfxy(x+2, y+2, msg);
	resetcntmode();

	if (type == WARNMSG) setcolor(F_BLUE, B_RED);
	else setcolor(F_GREEN, B_BLUE);

	drawbox(x+4, y+(len+2)/2-5, x+6, y+(len+2)/2+4);
	setcolor(F_BLACK, B_WHITE);
	cprintfxy(x+5, y+len/2-3, "   OK   ");
	gotoxy(0, 0);
	fflush(stdout);
	while (c = getchar(), c != '\n' && c != 'q') putchar('\a');
	fillrectangle(x, y, x+7+1, y+3+len+1, ' ', covercolor);
	setcolor(fcolor, bcolor);
	setcntmode(mode);
}
Пример #15
0
/*
 * simplewin() draws a simple window
 */
void
simplewin(WINDOW *win,			/* ... in the given WINDOW */
	  int lines,			/* of this many lines */
	  int cols,			/* and this many cols */
	  char *title,			/* with this title */
	  int formy,			/* starting here */
	  int withbuttons)		/* and with buttons, perhaps? */
{
    werase(win);
    drawbox(win, 0, 0, lines, cols, withbuttons ? lines-3 : 0,
				    RELIEF_COLOR, WINDOW_COLOR);

    if (title) {
	int titlex = (cols - strlen(title)) / 2;

	setcolor(win, TITLE_COLOR);
	if (titlex < 1) {
	    wmove(win, 0, 0);
	    waddnstr(win, title, cols-2);
	}
	else
	    mvwaddstr(win, 0, titlex, title);
    }
    setcolor(win, WINDOW_COLOR);
} /* simplewin */
Пример #16
0
int startupmenu(int i)
{
	while (1) {
		drawbox(5, STARTUP_Y-2, 22, STARTUP_N+4, NULL);
		printmenuhelp(19);
		i = startup_menu(i-1, 8, STARTUP_Y);
# ifndef TTY_SOCKET
		if (!i)
			break;
# else
		if (i==2 && !select_2p_tty(24, STARTUP_Y+1))
			continue;
		if (!i) {
			clearbox(0, 6, 0, 16);
			if ((i = menu_checkinvit(1, 7)) == -1) {
				i = 1;
				continue;
			}
			if (!i)
				break;
		}
		setcurs_end();
		cleartoeol();
		textgfx_entermenu();
# endif
		clearbox(0, 6, 0, 16);
		break;
	}
	return i;
}
Пример #17
0
static int hiscore_congrats(const char **menu)
{
	char name[8] = "       ";
	int x = 9;
	int y = _HEIGHT_24L ? 7 : 3;
	setwcurs(0, 9, y);
	while (is_outside_screen(x+26, 0))
		x--;
	drawbox(x, y, 26, 9, "CONGRATULATIONS!");
	setcurs(x+2, y+2);
	printstr("You have a highscore!");  newln(x+2);
	printstr("Please enter your name");
entername:
	switch (hiscore_entername_menu(name, menu, x+4, y+4)) {
	case 0:
		return 0;
	case 1:
		if (savehiscore(name)) {
			if (x > 7)
				clearbox(33, y, 2, 9);
			return hiscorebox(menu, 9, y);
		}
		setcurs(x+2, y+2);
		printstr("ERROR! Could not save");  newln(x+2);
		printstr("score to file.        ");
		goto entername;
	case 2:
		clearbox(32, y, 0, 9);
		return 1;
	}
}
Пример #18
0
void initGameBasicParameters()
{
	//clear buffer
	ClearBuffer();
	
	//Change video mode to MODE_3 with background 2 enabled
	setMode(MODE_3 | BG1_ENABLE);
	
	//select the country paddle.
	selectCountryPaddle();
   	
    //init the ball
    ballX = SCREEN_W / 2 - BALL_SIZE / 2;
    ballY = 40;
    
    //init the left paddle
    paddleX[1] = 10;
    paddleY[1] = SCREEN_H / 2 - PADDLE_HEIGHT / 2;
    
    //init the right paddle
    paddleX[2] = SCREEN_W - 20;
    paddleY[2] = SCREEN_H / 2 - PADDLE_HEIGHT / 2;

    //clear the screen
    drawbox(0, 0, 239, 159, BLACK);
    
    //display title
    print(55-16,1,"PING-PONG DIPLOMACY", MAGENTA);	
}
Пример #19
0
unsigned box(tgui_Window *tmp) {


 cleanscrn(tmp);


  //if (tmp->x1<0 || tmp->x1>35)             { return(10);}    // x1 out of bounds
  //if (tmp->x2 < tmp->x1+4 || tmp->x2 > 39) { return(11);}    // x2 out of bounds
  //if (tmp->y1<0 || tmp->y1>20)             { return(20);}    // y1 out of bounds
  //if (tmp->y2>24 || tmp->y2<tmp->y1+3)     { return(21);}    // y2 out of bounnds
  //if (tmp->color < 0 || tmp->color > 15)   { return(30);}    // invalid color


  //if (tmp->parent == 0 ) revers(1);

  drawbox(tmp->x1, tmp->y1, tmp->x2, tmp->y2);


  cputsxy(tmp->x1+1,tmp->y1,tmp->title);



   return(0);

} /* end box */
Пример #20
0
void mopen( short n, short row, short col, short width, short height, char * title )
{
//	if (n==0) return;

	if (! mono_present()) return;	//error! no mono card

	if (OPEN) mclose(n);

	OPEN = 1;
	ROW = row;
	COL = col;
	WIDTH = width;
	HEIGHT = height;

	for (row=-1; row<HEIGHT+1; row++ )
		for (col=-1; col<WIDTH+1; col++ )  {
			CHAR(row,col) = 32;
			ATTR(row,col) = 7;
			XCHAR(row,col) = 32;
			XATTR(row,col) = 7;
		}

	drawbox(n);
	CROW=-1; CCOL=0;
	mprintf( n, title );
	CROW=0; CCOL=0;
	msetcursor( ROW+CROW, COL+CCOL );

}
Пример #21
0
/******************************************************\
 * Description: Inits the menu and the user interface *
 *		that the hex editor uses.             *
\******************************************************/
void init_menu(WINS *windows)
{   
    int x;
    WINDOW *win;

    /*signal(SIGCHLD,  SIG_DFL);                                              */
    signal(SIGSEGV,  catchSegfault);			/* catch segfault sig */
    /* the following is still under development, please report any bugs found */
    signal(SIGWINCH, checkScreenSize);		 	/*catch resize screen */

							/* draw the windows   */
    windows->hex_outline = drawbox(0, 0, LINES, hex_outline_width);
    windows->ascii_outline = drawbox(0, hex_outline_width + 1, LINES, 
	    			     ascii_outline_width);
    windows->scrollbar = newwin(LINES, 1, 0, hex_outline_width);

    windows->hex = newwin(LINES - 2, hex_win_width, 1, MIN_ADDR_LENGTH + 2);
    windows->ascii = newwin(LINES - 2, ascii_win_width, 1, 
	                    hex_outline_width + 2);
    windows->address = newwin(LINES - 2, MIN_ADDR_LENGTH + 1, 1, 1);

    windows->cur_address = newwin(1, MIN_ADDR_LENGTH, 0, 1);

    waddch(windows->scrollbar, ACS_UARROW);
    wattron(windows->scrollbar, A_REVERSE);
    waddch(windows->scrollbar, ACS_DIAMOND);
    wattroff(windows->scrollbar, A_REVERSE);
    for (x = 0; x < LINES - 2; x++)
        waddch(windows->scrollbar, ACS_CKBOARD);
    waddch(windows->scrollbar, ACS_DARROW);
    wrefresh(windows->scrollbar);
    
    cbreak();						/* allow cbreak()     */
    noecho();						/* disable echoing    */
    raw();

    win = windows->hex;
    for (x = 0; x <= 2; x++)				
    {
	idlok(win, TRUE);				/* enable scrolling   */

        keypad(win, TRUE);				/* enable the keypad  */

	win = (x == 0) ? windows->ascii:windows->address;
    }

}
Пример #22
0
// Difference between this and regular menu, is that only 
// OPT_INVISIBLE, OPT_SEP are honoured 
void printradiomenu(pt_menu menu, int curr, char top, char left)
{
  int x,row; // x = index, row = position from top
  int numitems,menuwidth;
  char fchar[5],lchar[5]; // The first and last char in for each entry
  const char *str;  // and inbetween the item or a seperator is printed
  char *attr;  // all in the attribute attr
  char sep[MENULEN];// and inbetween the item or a seperator is printed
  pt_menuitem ci;
  
  calc_visible(menu);
  numitems = menu->numvisible;
  menuwidth = menu->menuwidth+3;
  clearwindow(top,left-2, top+numitems+1, left+menuwidth+1,
	      ms->menupage, ms->fillchar, ms->shadowattr);
  drawbox(top-1, left-3, top+numitems, left+menuwidth, 
	  ms->normalattr[NOHLITE], ms->menupage);
  memset(sep,HORIZ,menuwidth); // String containing the seperator string
  sep[menuwidth-1] = 0; 
  // Menu title
  x = (menuwidth - strlen(menu->title) - 1) >> 1;
  gotoxy(top-1,left+x,ms->menupage);
  printmenuitem(menu->title,ms->normalattr);
  row = -1; // 1 less than inital value of x
  for (x=0; x < menu->numitems; x++)
    {
      ci = menu->items[x];
      if (ci->action == OPT_INVISIBLE) continue;
      row++;
      // Setup the defaults now
      fchar[0] = RADIOUNSEL; fchar[1]='\0'; // Unselected ( )
      lchar[0] = '\0'; // Nothing special after 
      str = ci->item; // Pointer to item string
      attr = ms->normalattr; // Always same attribute
      fchar[0] = (x==curr ? RADIOSEL : RADIOUNSEL); 
      switch (ci->action) // set up attr,str,fchar,lchar for everything
        {
	case OPT_INACTIVE:
	  attr = ms->inactattr;
	  break;
	case OPT_SEP:
	  fchar[0] = '\b'; fchar[1] = LTRT; fchar[2] = HORIZ; fchar[3] = HORIZ; fchar[4] = 0;
	  lchar[0] = HORIZ; lchar[1] = RTLT; lchar[3] = 0;
	  str = sep;
	  break;
	default: // To keep the compiler happy
	  break;
        }
      gotoxy(top+row,left-2,ms->menupage);
      cprint(ms->spacechar,attr[NOHLITE],menuwidth+2,ms->menupage); // Wipe area with spaces
      gotoxy(top+row,left-2,ms->menupage);
      csprint(fchar,attr[NOHLITE]); // Print first part
      gotoxy(top+row,left,ms->menupage);
      printmenuitem(str,attr); // Print main part
      gotoxy(top+row,left+menuwidth-1,ms->menupage); // Last char if any
      csprint(lchar,attr[NOHLITE]); // Print last part
    }
  if (ms->handler) ms->handler(ms,menu->items[curr]);
}
Пример #23
0
/*
 * fancywin() draws a fancy window.  A fancy window is an ordinary
 * window (with optional buttonbar slice) with an extra window inside,
 * for a cheesy 3-d effect.
 */
void
fancywin(WINDOW *win, int lines, int cols, char *title, int formy, int wb)
{
    int dx;
    simplewin(win, lines, cols, title, formy, wb);

    dx = (lines - (wb ? 4 : 2)) - formy + 2;
    drawbox(win, formy-1, 1, dx, cols-2, 0, WINDOW_COLOR, RELIEF_COLOR);
} /* fancywin */
Пример #24
0
main()
{
disp_open();

drawbox(10,10,10,10);

disp_close();


}
Пример #25
0
int main(void)
{
	OSInit();
	volatile short * pixel_ctrl_ptr = pixel_buffer_start;
	volatile char * char_ctrl_ptr = character_buffer;
	int err = ALT_SEM_CREATE(&display,1);
	if(err != 0)
		printf("Semaphore not created\n");
	 err = ALT_SEM_CREATE(&audio,1);
	if(err != 0)
		printf("Semaphore not created\n");

	*(dma_control) &= (1<<2); //Enable DMA controller

	clearscreen(pixel_ctrl_ptr);
	drawbox(pixel_ctrl_ptr, 34*4, 9*4, 48, 10,0xFA01);

	wait_for_vsync(buffer_register,dma_control);




	OSTaskCreateExt(task1,
			pixel_ctrl_ptr,
			(void *)&task1_stk[TASK_STACKSIZE-1],
			TASK1_PRIORITY,
			TASK1_PRIORITY,
			task1_stk,
			TASK_STACKSIZE,
			NULL,
			0);


	OSTaskCreateExt(task2,
			char_ctrl_ptr,
			(void *)&task2_stk[TASK_STACKSIZE-1],
			TASK2_PRIORITY,
			TASK2_PRIORITY,
			task2_stk,
			TASK_STACKSIZE,
			NULL,
			0);

	OSTaskCreateExt(getcontrols,
			char_ctrl_ptr,
			(void *)&getcontrols_stk[TASK_STACKSIZE-1],
			GETCONTROLS_PRIORITY,
			GETCONTROLS_PRIORITY,
			getcontrols_stk,
			TASK_STACKSIZE,
			NULL,
			0);
	OSStart();
	return 0;
}
Пример #26
0
void main(void)
  {
  register int  j;
  char          name[31];            // user name
  char          num[12];             // serial number string for f f
  char          cnum[12];            // check sum string for fake file
  FILE          *fp;
  char          done=0;

  clrbox(0,1,79,23,1);
  drawbox (27,5,51,7,1,2,8);
  writestr(29,6,2,"GM "GMVER" Registration");
  name[0]=0; num[0]=0; cnum[0]=0;
  if ((!qwindow(5,14,30,"Enter your name (Exactly as on card): ",name))||(name[0]==0))
    {
    errorbox("ABORTING REGISTRATION","(O)k");
    done = 1;
    }
  else                          // zero the rest of the name.
    {
    j=0;                                
    while (name[j]!=0) j++;
    while (j<30) { name[j]=0; j++; }
    name[29]=0;
    }

  if (!done)
    {
    unsigned long int temp=GetMoreData();
    if (temp==0)
      {
      errorbox("Please run this program from","your GameMaker directory.");
      done=TRUE;
      }
    sprintf(num,"%lu",temp);
    }
  if (!done)
    {
    if ((!qwindow(13,14,12,"Enter registration number from card: ",cnum))||(cnum[0] == 0))
      {
      errorbox("ABORTING REGISTRATION","(O)k");
      done = 1;
      }
    }
  if (!done)
    {
    fp=fopen("playgame.reg","wt");
    fprintf(fp,"%s\n%s\n%s\n",name,num,cnum);
    fclose(fp);
//    errorbox("REGISTRATION   COMPLETE","Hit any key to start GM");
    TextMode();
    printf("Registration Finished\n");
    }
  }
Пример #27
0
int dropdownlist(const char **items, int n, int i, int x, int y)
{
	int w = getdropdownwidth(items, n);
	int j;
	while (is_outside_screen(0, y+n+1))
		y--;
	setattr_standout();
	drawbox(x, y, w+2, n+2, NULL);
	x++;
	y++;
	setcurs(x, y);
	for (j = 0; j < n; j++) {
		printdropdownitem(items[j], i==j, w);
		newln(x);
	}
	while (1) {
		setcurs(x-1, y+i);
		refreshwin(-1);
		switch (getkeypress_block(SINGLE_PL) & 0xFF) {
		case STARTBTN:
		case A_BTN:
			goto out;
		case 'q':
			exit(0);
		case MVUP:
			if (!i)
				continue;
			j = -1;
			break;
		case '\t':
			if (i == n-1) {
				j = -i;
				break;
			}
		case MVDOWN:
			if (i < n-1) {
				j = 1;
				break;
			}
		case MVRIGHT:
			continue;
		default:
			i = -1;
			goto out;
		}
		setcurs(x, y+i);
		printdropdownitem(items[i], 0, w);
		i += j;
		setcurs(x, y+i);
		printdropdownitem(items[i], 1, w);
	}
out:	clearbox(x-1, y-1, w+2, n+2);
	return i+1;
}
Пример #28
0
int gameovermenu()
{
	const char *menu[2] = {"Play again", "Exit"};
	return hiscore_congrats(menu); //WILLIAMICED

	readhiscores(NULL);
	if (ishiscore())
		return hiscore_congrats(menu);
	setwcurs(1, 2, 3);
	drawbox(2, 3, 17, 5, "GAME OVER");
	return playagain_menu(menu, 4, 5);
}
Пример #29
0
char showprogresswin()
{
	char	str[256];
	char	*szMethod[] = {"overwrite with 00","overwrite with FF",
						"random data","NSA method",
						"Old NSA method","DoD STD method",
						"NATO method","Gutmann method"};
	
	_setvisualpage(PAGE_PROGRESS);  
	_setactivepage(PAGE_PROGRESS);
    
    drawbox(1, 1, g_SysInfo.nmaxrows, g_SysInfo.nmaxcols);

	_settextposition(7, 4);
	sprintf(str,"Delete Method : %s",szMethod[g_nMethod]);
	_outtext(str);

	_settextposition(7, 6+strlen(str)); 
	if (g_bBeepOff)
		sprintf(str,"Beep Status : Off");
	else
		sprintf(str,"Beep Status : On");
	_outtext(str);
	
    drawbox(11, 4, 13, g_SysInfo.nmaxcols - 3);
	              
	_settextposition(12,6 );     
	charstostr(str,PROGRESS_CHAR,g_SysInfo.nmaxcols - 10);
	_outtext(str); 
	if(deletecontent())
	{
		_clearscreen(_GCLEARSCREEN);
	    return 's';
	}
	else
	{
		_clearscreen(_GCLEARSCREEN);
		return 'e';
	}
}
Пример #30
0
void selectCountryPaddle()
{
	state = 0;
	
	drawbox(0, 0, 239, 159, BLACK);
		
	print(23-16,1,"PING-PONG DIPLOMACY REFERS TO", WHITE);
	print(23-16,11,"THE EXCHANGE OF TABLE TENNIS", WHITE);
	print(23-16,22,"PLAYERS BETWEEN USA AND CHINA", WHITE);
	print(23-16,33,"IN THE EARLYS 1970S. THE", WHITE);
	print(23-16,44,"EVENT MARKED A THAW IN SINO-", WHITE);
	print(23-16,55,"AMERICAN RELATIONS THAT PAVED", WHITE);
	print(23-16,66,"THE VISIT TO BEIJING BY R.N.", WHITE);
	
	print(23-16,77,"SELECT YOUR COUNRTY AND PRESS", MAGENTA);
	print(23-16,87,"THE A-BUTTON OF THE PAD.", MAGENTA);
	
	print(30-16,100,"*", WHITE);
	print(38-16,100,"PEOPLES REPUBLIC OF CHINA", RED);
	print(38-16,110,"UNITED STATES OF AMERICA", CYAN);
	
	print(110-16,130,"2016", WHITE);
	print(25-16,140,"PROGRAMMED BY JDURANMASTER", WHITE);
	
	while((((KEYS) & KEYA))){
		if(!((KEYS) & KEYUP)){
			if(state == 0){
				print(30-16,110,"*", WHITE);
				print(30-16,100,"*", BLACK);
				state = 1;
			}
			else{
				print(30-16,100,"*", WHITE);
				print(30-16,110,"*", BLACK);
				state = 0;
			}	
		}
		if(!((KEYS) & KEYDOWN)){
			if(state == 1){
				print(30-16,100,"*", WHITE);
				print(30-16,110,"*", BLACK);
				state = 0;
			}
			else{
				print(30-16,110,"*", WHITE);
				print(30-16,100,"*", BLACK);
				state = 1;
			}	
		}
	}
}