예제 #1
0
static void
RefreshWindow(void)
{
	int xpos, ypos;

	GrSetGCForeground(gc1, WHITE);
	GrSetGCBackground(gc1, RED);

	/* draw the buttons */
	GrRect(buttons, gc1, 0, 0, (calc_width - 12)/2, 34);
	GrRect(buttons, gc1, (calc_width - 8)/2, 0, (calc_width - 12)/2, 34);

#if 0	/* for when center align text works */
	GrText(buttons, gc1, (calc_width - 10)/4, 22, "Again", 5, 0);
	GrText(buttons, gc1, (calc_width - 10)*3/4, 22, "Quit", 4, 0);
#else
	GrText(buttons, gc1, 5, 22, "Again", 5, 0);
	GrText(buttons, gc1, (calc_width / 2) + 5, 22, "Quit", 4, 0);
#endif
	
	/* draw the tiles */
	for (ypos=0; ypos< HEIGHT_IN_TILES; ypos++){
		for (xpos=0; xpos< WIDTH_IN_TILES; xpos++){
			DrawTile(xpos, ypos);
		}
	}
}
예제 #2
0
void draw_pause_continue_button(nstate *state)
{
	if((state->running_buttons_mapped) && (state->state == STATE_STOPPED)) {
		GrUnmapWindow(state->pause_continue_button);
		GrUnmapWindow(state->anticlockwise_button);
		GrUnmapWindow(state->clockwise_button);
		GrUnmapWindow(state->left_button);
		GrUnmapWindow(state->right_button);
		GrUnmapWindow(state->drop_button);
		state->running_buttons_mapped = 0;
		return;
	}
	if((!state->running_buttons_mapped) && (state->state == STATE_RUNNING)){
		GrMapWindow(state->pause_continue_button);
		GrMapWindow(state->anticlockwise_button);
		GrMapWindow(state->clockwise_button);
		GrMapWindow(state->left_button);
		GrMapWindow(state->right_button);
		GrMapWindow(state->drop_button);
		state->running_buttons_mapped = 1;
		return;
	}
	if(!state->running_buttons_mapped) return;
	GrFillRect(state->pause_continue_button, state->buttongcb, 0, 0,
		PAUSE_CONTINUE_BUTTON_WIDTH, PAUSE_CONTINUE_BUTTON_HEIGHT);
	if(state->state == STATE_PAUSED) {
		GrText(state->pause_continue_button, state->buttongcf,
			TEXT_X_POSITION, TEXT_Y_POSITION, " Continue", 9, 0);
	} else {
		GrText(state->pause_continue_button, state->buttongcf,
			TEXT_X_POSITION, TEXT_Y_POSITION, "   Pause", 8, 0);
	}
}
예제 #3
0
/* Draw the message if it's a mini */ 
void draw_message(char *msg1, char *msg2)
{
	int offset;

	/* Clear the window */
	GrClearWindow(message_wid, GR_FALSE);

	/* Put the foreground and background in good shapes */
	GrSetGCForeground(tuxchess_gc, GR_RGB(0,0,0));
	GrSetGCBackground(tuxchess_gc, GR_RGB(255,255,255));

	/* Draw the "window" */
	GrLine(message_wid, tuxchess_gc, 1, 0, 34, 0);
	GrLine(message_wid, tuxchess_gc, 1, 16, 34, 16);
	GrLine(message_wid, tuxchess_gc, 1, 0, 1, 110);
	GrLine(message_wid, tuxchess_gc, 34, 0, 34, 110);
	GrLine(message_wid, tuxchess_gc, 1, 110, 34, 110);
	GrText(message_wid, tuxchess_gc, 3,13, 
		"Chess", -1, GR_TFASCII);  /* Title in the text box */

	GrText(message_wid, tuxchess_gc, 3,73, msg1, -1, GR_TFASCII);

	if ((strcmp(msg2, "Play") == 0) || (strcmp(msg2, "     ") == 0))
	{
		offset = 3;
		msg2 = "Play";
	}
	else
	{
		offset = 0;
	}

	GrText(message_wid, tuxchess_gc, 4+offset,53, msg2, -1, GR_TFASCII);
}
예제 #4
0
static void idw_draw_sheet(TSheet *sheet) {
  GR_SIZE width, height, base;
  char str[50], *ap;
  int i;
	
	if (sheet == NULL) {
    sheet = game.screen->menuitems[game.select].sheet;
  }
	
	// draw the title
  pz_draw_header (sheet->title);

  GrGetGCTextSize(idw_gc, sheet->button, -1, GR_TFASCII, &width, &height, &base);
  height+=4;  
  
  // (left, top, right, bottom)
  GrSetGCForeground(idw_gc, BLACK);
  GrLine(idw_wid, idw_gc, 20, 0, 20, screen_info.rows-44);
  GrLine(idw_wid, idw_gc, 20, screen_info.rows-44, screen_info.cols-20, screen_info.rows-44);
  GrLine(idw_wid, idw_gc, screen_info.cols-20, 0, screen_info.cols-20, screen_info.rows-44);
  
	GrSetGCForeground(idw_gc, WHITE);
  GrFillRect(idw_wid, idw_gc, 21, 0, screen_info.cols-41, screen_info.rows-44);
	GrSetGCForeground(idw_gc, BLACK);
  GrSetGCUseBackground(idw_gc, GR_FALSE);
  GrSetGCMode(idw_gc, GR_MODE_SET);
  
  ap = strtok(sheet->text, "\n");
  for (i=0; ap != NULL; i++) {
    GrText(idw_wid, idw_gc, 30, 1 + ((i + 1) * height - 4), ap, -1, GR_TFASCII);
    ap = strtok(NULL, "\n");
  }
  
	if (sheet->ammount != -1)
	{
    // print ammount
    sprintf(str, "Ammount: %d", game.ammount);
    GrText(idw_wid, idw_gc, 30, 50, str, -1, GR_TFASCII);
  } else {
    // the next time the user presses the middle button the sheet will disappear
    game.dismiss_sheet = 1;
  }

  // print the single menu option
  GrSetGCForeground(idw_gc, BLACK);
  GrFillRect(idw_wid, idw_gc, 21, 1 + 4 * height-4, screen_info.cols-41, height-1);
  GrSetGCForeground(idw_gc, WHITE);
  GrSetGCUseBackground(idw_gc, GR_TRUE);

  GrText(idw_wid, idw_gc, (screen_info.cols/2)-width+4, (5 * height - 8), sheet->button, -1, GR_TFASCII);

  // we're in a transaction
  game.in_transaction = 1;  
}
예제 #5
0
static void idw_draw_screen() {
  int i, dif=0, max=0;
  GR_SIZE width, height, base;
  	
	// This white line is printed because the sheet leaves two pixels
  GrSetGCForeground(idw_gc, WHITE);
  GrLine(idw_wid, idw_gc, 0, 0, screen_info.cols, 0);
  GrSetGCForeground(idw_gc, BLACK);
	
	// calculate the biggest space you can leave for the right-side column
	for (i=0; i < game.screen->count; i++)
	{
	  GrGetGCTextSize(idw_gc, game.screen->menuitems[i].value, -1, GR_TFASCII, &width, &height, &base);
    width+=5;
    
    if (width > max) max = width;
	}

  GrGetGCTextSize(idw_gc, "M", -1, GR_TFASCII, &width, &height, &base);
	height += 4;

  
  // print all the menus
  for (i=0; i < game.screen->count; i++)
  {
    if ((game.select == i) && (game.screen->menuitems[i].sheet)) {
			GrSetGCForeground(idw_gc, BLACK);
			GrFillRect(idw_wid, idw_gc, 0, 1 + i * height, screen_info.cols, height);
			GrSetGCForeground(idw_gc, WHITE);
			GrSetGCUseBackground(idw_gc, GR_TRUE);
		} else
		{
			GrSetGCUseBackground(idw_gc, GR_FALSE);
			GrSetGCForeground(idw_gc, WHITE);
			GrFillRect(idw_wid, idw_gc, 0, 1 + i * height, screen_info.cols, height);
			GrSetGCForeground(idw_gc, BLACK);
		}
		
		// highlite drug's name if you can make a positive sale
		if ((game.screen == &sell) && (game.drugs[i])) {
      dif = (game.price[i]*game.drugs[i] - game.old_price[i]);
    
      if (dif > 0) {
        GrText(idw_wid, idw_gc, 9, 1 + ((i + 1) * height - 4), game.screen->menuitems[i].caption, -1, GR_TFASCII);
      }
    }
    
    GrText(idw_wid, idw_gc, 8, 1 + ((i + 1) * height - 4), game.screen->menuitems[i].caption, -1, GR_TFASCII);
    
    // right-side column
    GrText(idw_wid, idw_gc, screen_info.cols - max, 1 + ((i + 1) * height - 4), game.screen->menuitems[i].value, -1, GR_TFASCII);
  }
}
예제 #6
0
/* End of the game */
void draw_end(char col)
{
	int offset, off_x, off_y;

	if (end == 0) {
		end = 1;
		end_type = col;
	}
	else {
		end = 2;
		if (is_mini) {
			offset = 0;
			off_x = 11;
			off_y = 9;
		}
		else {
			offset = HEADER_TOPLINE+1;
			off_x = 0;
			off_y = 0;
		}

		end_wid = pz_new_window (0, offset, screen_info.cols,
			screen_info.rows - offset,
			tuxchess_do_draw, tuxchess_handle_event);
		GrSelectEvents(end_wid, GR_EVENT_MASK_KEY_DOWN |
				GR_EVENT_MASK_KEY_UP);

		GrMapWindow(end_wid);

		/* Put the foreground and background in good shapes */
		GrSetGCForeground(tuxchess_gc, GR_RGB(0,0,0));
		GrSetGCBackground(tuxchess_gc, GR_RGB(255,255,255));

		/* Clear the window */
		GrClearWindow(end_wid, GR_FALSE);

		if (col=='b') {
			GrText(end_wid, tuxchess_gc, 57-off_x,40-off_y, "You Lost", -1, GR_TFASCII);
		}
		else if (col=='w') {
			GrText(end_wid, tuxchess_gc, 54-off_x,40-off_y, "Well Done", -1, GR_TFASCII);
		}
		else if (col=='d') {
			GrText(end_wid, tuxchess_gc, 67-off_x,40-off_y, "Draw", -1, GR_TFASCII);
		}

		GrText(end_wid, tuxchess_gc, 52-off_x,65-off_y, 
			"Menu : Quit", -1, GR_TFASCII);
		GrText(end_wid, tuxchess_gc, 33-off_x,80-off_y, 
			"Action : New Game", -1, GR_TFASCII);
	}
}
예제 #7
0
void draw_score(nstate *state)
{
	char buf[32];

	GrFillRect(state->score_window, state->scoregcb, 0, 0,
			SCORE_WINDOW_WIDTH, SCORE_WINDOW_HEIGHT);

	sprintf(buf, "%d", state->score);
	GrText(state->score_window, state->scoregcf, TEXT_X_POSITION,
					TEXT2_Y_POSITION, buf, strlen(buf), 0);
	sprintf(buf, "%d", state->hiscore);
	GrText(state->score_window, state->scoregcf, TEXT_X_POSITION,
					TEXT_Y_POSITION, buf, strlen(buf), 0);
}
예제 #8
0
static void draw_help()
{
	//Hold:			Help Menu
	//Play/Pause:	Start/Stay
	//Action:		Hit
	//Wheel:		Dec/Inc Bid
	//Prev/Next:	Dec/Inc Bid
	//Version:		X.XX

	int i, width, height, depth;
	char *help[] =
	{
	"Hold:", "Help",
	"Play/Pause:", "Start/Stay",
	"Action:", "Hit",
	"Wheel:", "Dec/Inc Bid",
	"Prev/Next:", "Dec/Inc Bid",
	"", "",
	"Version:", VERSION,
	0
	};

	GrSetGCUseBackground(blackjack_gc, GR_TRUE);
	GrSetGCBackground(blackjack_gc, WHITE);

	GrSelectEvents(blackjack_wid, GR_EVENT_MASK_EXPOSURE|GR_EVENT_MASK_KEY_DOWN|
				   GR_EVENT_MASK_KEY_UP|GR_EVENT_MASK_TIMER);

	GrSetGCForeground(blackjack_gc, WHITE);

	GrFillRect(blackjack_wid, blackjack_gc, 0, 0,
			   screen_info.cols, screen_info.rows - HEADER_TOPLINE);


	GrSetGCForeground(blackjack_gc, BLACK);

	for(i=0; help[i] != 0; i++)
	{
		GrGetGCTextSize (blackjack_gc, help[i], -1, GR_TFASCII, &width, &height, &depth);

		if(i % 2 == 0)
		{
			GrText(blackjack_wid, blackjack_gc, 5, (i * 7) + 20, help[i], -1, GR_TFASCII);
		}else{
			GrText(blackjack_wid, blackjack_gc,
				   screen_info.cols - (width + 5),
				  ((i - 1) * 7) + 20, help[i],  -1, GR_TFASCII);
		}
	}
}
예제 #9
0
파일: demo.c 프로젝트: EPiCS/reconos_v2
/*
 * Here when a keyboard press occurs.
 */
void
do_keystroke(GR_EVENT_KEYSTROKE	*kp)
{
	GR_SIZE		width;		/* width of character */
	GR_SIZE		height;		/* height of character */
	GR_SIZE		base;		/* height of baseline */

	if (kp->wid == w4) {
		if (lineok) {
			GrLine(w4, gc4, xorxpos, xorypos, linexpos, lineypos);
			lineok = GR_FALSE;
		}
		return;
	}

	GrGetGCTextSize(gc1, &kp->ch, 1, GR_TFASCII, &width, &height, &base);
	if ((kp->ch == '\r') || (kp->ch == '\n')) {
		xpos = begxpos;
		ypos += height;
		return;
	}
	if (kp->ch == '\b') {		/* assumes fixed width font!! */
		if (xpos <= begxpos)
			return;
		xpos -= width;
		GrSetGCForeground(gc3, BROWN);
		GrFillRect(w1, gc3, xpos, ypos - height + base + 1,
			width, height);
		return;
	}
	GrText(w1, gc1, xpos, ypos + base, &kp->ch, 1, 0);
	xpos += width;
}
예제 #10
0
void draw_new_game_button(nstate *state)
{
	GrFillRect(state->new_game_button, state->buttongcb, 0, 0,
			NEW_GAME_BUTTON_WIDTH, NEW_GAME_BUTTON_HEIGHT);
	GrText(state->new_game_button, state->buttongcf, TEXT_X_POSITION,
					TEXT_Y_POSITION, "New Game", 8, 0);
}
예제 #11
0
/*
 * Draw a cell on the board.
 */
static void
drawcell(POS pos)
{
    GR_COORD	x;
    GR_COORD	y;
    GR_SIZE		chwidth;
    GR_SIZE		chheight;
    GR_SIZE		chbase;
    CELL		cell;
    GR_CHAR		ch;

    cell = board[pos];
    if (!isknown(cell))
        return;

    ch = displaychar(cell);
    if (ch == F_WRONG) {
        drawbomb(pos, greengc, GR_FALSE);
        return;
    }

    if (isold(cell)) {
        clearcell(pos);
        cellcenter(pos, &x, &y);
        GrGetGCTextSize(boardgc, &ch, 1, GR_TFASCII, &chwidth,
                        &chheight, &chbase);
        GrText(boardwid, boardgc, x - chwidth / 2 + 1,
               y + chheight / 2, &ch, 1, GR_TFBOTTOM);
        return;
    }

    drawbomb(pos, redgc, GR_FALSE);
}
예제 #12
0
/*
 * Draw or erase the coordinate string of the current pointer position.
 * Both of these are the same operation because of the XOR operation.
 */
static void
showcoords(GR_BOOL show)
{
	long	curlong;
	long	curlat;
	FLOAT	ptrlat;
	FLOAT	ptrlong;

	if (((show == 0) == (coordvisible == 0)) || !coordenabled)
		return;

	if (show) {
		ptrlat = FIDIV(FIMUL(viewlat, ptry), mapheight - 1);
		ptrlong = FIDIV(FIMUL(viewlong, ptrx), mapwidth - 1);

		curlat = FTOI(Latitude + latradius - ptrlat);
		curlong = FTOI(Longitude - longradius + ptrlong);

		if (curlong > 180*60)
			curlong -= 360*60;
		if (curlong < -180*60)
			curlong += 360*60;

		mintostr(coordstring, curlong);
		strcat(coordstring, "  ");
		mintostr(coordstring + strlen(coordstring), curlat);
	}

	GrText(mapwid, xorgc, coordx, coordy, coordstring, -1, GR_TFBOTTOM);
	coordvisible = show;
}
예제 #13
0
파일: uiViewInit.c 프로젝트: elmux/yacm
/**
 * run action of init view
 */
static void run(void) {
    char initMessage[40] = "Initializing";
    if (isTimerElapsed(initTimer)) {

        /* set new timer */
        initTimer = setUpTimer(RUN_INTERVAL);
        if (intervals < 25) {
            intervals++;
        }
        for (int i = 1; i < intervals; i++) {
            strcat(initMessage,".");
        }
        DisplayState *displaystate = getDisplayState();

        /* Select fonts */
        displaystate->font = GrCreateFont((unsigned char *) FONTNAME, 14, NULL);
        GrSetGCFont(displaystate->gContextID, displaystate->font);
        GrText(displaystate->gWinID, displaystate->gContextID, 120, 30, initMessage, -1, GR_TFASCII | GR_TFTOP);
        GrDestroyFont(displaystate->font);
    }
    /* Did someone turn the coffeemaker off? */
    if (getSwitchState(POWER_SWITCH) == switch_off) {
#ifdef DEBUG
        printf("Detected power switch to off\n");
#endif
        switchOff();
    }
}
예제 #14
0
void drawText(GR_WINDOW_ID id, char **text, int count) {

    int tw, th, tb;
    int xpos, ypos;
    int i;

    GR_GC_ID gc = GrNewGC();
    GR_FONT_ID font = GrCreateFont(GR_FONT_GUI_VAR, 12, 0);
    GR_WINDOW_INFO info;

    GrGetWindowInfo(id, &info);

    GrSetGCFont(gc, font);
    GrSetGCForeground(gc, FGCOLOR);
    GrSetGCBackground(gc, BGCOLOR);

    /* Get the first line of text from the array, and check the size */
    GrGetGCTextSize(gc, text[0], -1, GR_TFTOP, &tw, &th, &tb);

    ypos = (info.height - ((count * th)+ 3)) / 2;

    /* Draw each line of the instructions */

    for(i = 0; i < count; i++) {
        GrGetGCTextSize(gc, text[i], -1, GR_TFTOP, &tw, &th, &tb);
        xpos = (info.width - tw) / 2;
        GrText(id, gc, xpos, ypos, text[i], -1, GR_TFTOP);

        ypos += th + 3;
    }

    GrDestroyGC(gc);
    GrDestroyFont(font);
}
예제 #15
0
void draw_drop_button(nstate *state)
{
	if(!state->running_buttons_mapped) return;
	GrFillRect(state->drop_button, state->buttongcb, 0, 0,
			DROP_BUTTON_WIDTH, DROP_BUTTON_HEIGHT);
	GrText(state->drop_button, state->buttongcf, TEXT_X_POSITION,
					TEXT_Y_POSITION, "    Drop", 8, 0);
}
예제 #16
0
void draw_left_button(nstate *state)
{
	if(!state->running_buttons_mapped) return;
	GrFillRect(state->left_button, state->buttongcb, 0, 0,
			LEFT_BUTTON_WIDTH, LEFT_BUTTON_HEIGHT);
	GrText(state->left_button, state->buttongcf, TEXT_X_POSITION,
					TEXT_Y_POSITION, "  <", 3, 0);
}
예제 #17
0
void draw_right_button(nstate *state)
{
	if(!state->running_buttons_mapped) return;
	GrFillRect(state->right_button, state->buttongcb, 0, 0,
			RIGHT_BUTTON_WIDTH, RIGHT_BUTTON_HEIGHT);
	GrText(state->right_button, state->buttongcf, TEXT_X_POSITION,
					TEXT_Y_POSITION, "   >", 4, 0);
}
예제 #18
0
void draw_clockwise_button(nstate *state)
{
	if(!state->running_buttons_mapped) return;
	GrFillRect(state->clockwise_button, state->buttongcb, 0, 0,
			CLOCKWISE_BUTTON_WIDTH, CLOCKWISE_BUTTON_HEIGHT);
	GrText(state->clockwise_button, state->buttongcf, TEXT_X_POSITION,
					TEXT_Y_POSITION, "   \\", 4, 0);
}
예제 #19
0
static void
GrTextWrapper(void *r)
{
	nxTextReq *req = r;

	GrText(req->drawid, req->gcid, req->x, req->y, GetReqData(req),
		req->count, req->flags);
}
예제 #20
0
/* redraw everything */
static void lights_do_draw( void )
{
	int w;
	int x, y;
	char buf[32];

	/* start clear */
	GrSetGCForeground( lights_gc, GR_RGB(0,0,0) );
	GrFillRect( lights_bufwid, lights_gc, 0, 0,
		    lights_screen_info.cols, lights_height );

	/* draw the buttons */
	w=0;
	for( y=0 ; y<lights_count ; y++ )
	{
		for( x=0 ; x<lights_count ; x++ )
		{
			lights_draw_button( lights_x+(lights_size*x),
				     1+(lights_size*y), w );
			w++;
		}
	}

	/* draw the stats */
	GrSetGCForeground( lights_gc, GR_RGB(255,255,255) );
	GrText( lights_bufwid, lights_gc, 3, 20, "Mov", 3, GR_TFASCII );
	snprintf( buf, 16, "%2d", lights_nmoves );
	GrText( lights_bufwid, lights_gc, 5, 35, buf, 3, GR_TFASCII );

	GrText( lights_bufwid, lights_gc, 3, 70, "Lit", 3, GR_TFASCII );
	snprintf( buf, 16, "%2d", lights_litcount );
	GrText( lights_bufwid, lights_gc, 5, 85, buf, 3, GR_TFASCII );

	/* copy the buffer into place */
	GrCopyArea( lights_wid, lights_gc, 0, 0,
		    lights_screen_info.cols, 
		    (screen_info.rows - (HEADER_TOPLINE + 1)),
		    lights_bufwid, 0, 0, MWROP_SRCCOPY);

	if( !lights_won && lights_litcount==0 )
	{
		lights_won = 1;
		snprintf( buf, 32, "You won in %d moves!", lights_nmoves );
		new_message_window( buf );
	}
}
예제 #21
0
static void draw_volume()
{
	int vol;
	int bar_length;

	vol = dsp_get_volume(&dspz);
	bar_length = (vol * (rect_x2-rect_x1-4)) / 100;

	GrSetGCForeground(mp3_gc, GR_RGB(255,255,255));
	GrFillRect(mp3_wid, mp3_gc, rect_x1, rect_y1-12, rect_x2-rect_x1+1, 10);
	GrSetGCForeground(mp3_gc, GR_RGB(0,0,0));

	GrText(mp3_wid, mp3_gc, rect_x1, rect_y1-2, "0", -1, GR_TFASCII);
	GrText(mp3_wid, mp3_gc, rect_x2-20, rect_y1-2, "100", -1, GR_TFASCII);
	GrText(mp3_wid, mp3_gc, 50, rect_y1-2, "volume", -1, GR_TFASCII);
	draw_bar(bar_length);
}
예제 #22
0
void
draw_set(char *name, int mode)
{
	int x;
	int tw, th, tb;
	GR_POINT points[4];
	GR_GC_ID gc = GrNewGC();

	GrSetGCForeground(gc, WHITE);
	GrSetGCBackground(gc, GRAY);

	GrGetGCTextSize(gc, name, -1, GR_TFTOP, &tw, &th, &tb);

	x = g_x + (tw - 50) / 2;

	GrText(g_main, gc, g_x, 5, name, -1, GR_TFTOP);

	g_x += (tw + 10);

	GrSetGCFillMode(gc, mode);

	if (mode == GR_FILL_STIPPLE)
		GrSetGCForeground(gc, YELLOW);
	else {
		GrSetGCForeground(gc, WHITE);
		GrSetGCBackground(gc, BLUE);
	}

	if (mode == GR_FILL_TILE) {
		GrSetGCTile(gc, g_pixmap, 16, 16);
	}

	if (mode == GR_FILL_STIPPLE || mode == GR_FILL_OPAQUE_STIPPLE)
		GrSetGCStipple(gc, g_stipple2, 2, 2);

	GrFillRect(g_main, gc, x, 25, 50, 50);

	if (mode == GR_FILL_STIPPLE || mode == GR_FILL_OPAQUE_STIPPLE)
		GrSetGCStipple(gc, g_stipple1, 7, 7);

	GrFillEllipse(g_main, gc, x + 25, 105, 25, 25);

	if (mode == GR_FILL_STIPPLE || mode == GR_FILL_OPAQUE_STIPPLE)
		GrSetGCStipple(gc, g_stipple3, 3, 2);

	points[0].x = points[3].x = x;
	points[0].y = points[3].y = 165;

	points[1].x = x + 50;
	points[1].y = 165;

	points[2].x = x + 25;
	points[2].y = 215;

	GrFillPoly(g_main, gc, 4, points);

	GrDestroyGC(gc);
}
예제 #23
0
static void draw_dialer() {
    GR_SIZE width, height, base;

    GrSetGCUseBackground(dialer_gc, GR_FALSE);
    GrSetGCForeground(dialer_gc, GR_RGB(0,0,0));
    GrGetGCTextSize(dialer_gc, digitdisplay, -1, GR_TFASCII, &width, &height, &base);
    /*
    GrRect(dialer_wid, dialer_gc, CXOFF, CYOFF, CWIDTH, cbh);
    GrSetGCForeground(dialer_gc, GR_RGB(255,255,255));
    GrFillRect(dialer_wid, dialer_gc, CXOFF+1, CYOFF+1, CWIDTH-2, cbh-2);
    GrSetGCForeground(dialer_gc, GR_RGB(0,0,0));
    GrText(dialer_wid, dialer_gc, CXOFF+(CWIDTH-width-4),
    	CYOFF+((cbh/2)-(height/2)), digitdisplay, -1, GR_TFASCII|GR_TFTOP);
    */

    /* range check */
    if(current_dialer_button < 0)
        current_dialer_button = 15;
    else if(current_dialer_button >= 16)
        current_dialer_button = 0;

    /* compute button sizings */
    xlocal=CXOFF+((cbw+cxgap)*(current_dialer_button%4));
    ylocal=CBYOFF+((cbh+cygap)*(current_dialer_button/4));
    lastxlocal=CXOFF+((cbw+cxgap)*(last_bouvet_item%4));
    lastylocal=CBYOFF+((cbh+cygap)*(last_bouvet_item/4));

    GrSetGCForeground(dialer_gc, GR_RGB(255,255,255));
    GrFillRect(dialer_wid, dialer_gc, lastxlocal+1, lastylocal+1, cbw-2, cbh-2);
    GrSetGCForeground(dialer_gc, GR_RGB(0,0,0));
    GrGetGCTextSize(dialer_gc, dialerpad[last_bouvet_item], -1, GR_TFASCII,
                    &width, &height, &base);
    GrText(dialer_wid, dialer_gc,
           lastxlocal+((cbw/2)-(width/2)), lastylocal+((cbh/2)-(height/2)),
           dialerpad[last_bouvet_item], -1, GR_TFASCII|GR_TFTOP);
    GrFillRect(dialer_wid, dialer_gc, xlocal, ylocal, cbw, cbh);
    GrSetGCForeground(dialer_gc, GR_RGB(255,255,255));
    GrGetGCTextSize(dialer_gc, dialerpad[current_dialer_button], -1, GR_TFASCII,
                    &width, &height, &base);
    GrText(dialer_wid, dialer_gc,
           xlocal+((cbw/2)-(width/2)), ylocal+((cbh/2)-(height/2)),
           dialerpad[current_dialer_button], -1, GR_TFASCII|GR_TFTOP);
    GrSetGCUseBackground(dialer_gc, GR_FALSE);
    GrSetGCMode(dialer_gc, GR_MODE_SET);
}
예제 #24
0
/* ***********************************************************/
void draw_historic(void)
{
	/* Clear the window */
	GrClearWindow (historic_wid, GR_FALSE);

	/* Put the foreground and background in good shapes */
	GrSetGCForeground(tuxchess_gc, GR_RGB(0,0,0));
	GrSetGCBackground(tuxchess_gc, GR_RGB(255,255,255));

	/* Draw the "window" */
	GrLine(historic_wid, tuxchess_gc, 1, 1, 55, 1);
	GrLine(historic_wid, tuxchess_gc, 1, 1, 1, 104);
	GrLine(historic_wid, tuxchess_gc, 1, 105, 55, 105);
	GrLine(historic_wid, tuxchess_gc, 55, 1, 55, 105);
	GrText(historic_wid, tuxchess_gc, 14,14, 
		"Moves", -1, GR_TFASCII);	/* Title in the text box */
	GrLine(historic_wid, tuxchess_gc, 1, 17, 56, 17);

	/* So ugly code since char* arrays seem to confuse my iPod - writes 6 lines */
	GrText(historic_wid, tuxchess_gc, 6, 33, historic_line1, -1, GR_TFASCII);
	GrText(historic_wid, tuxchess_gc, 6, 46, historic_line2, -1, GR_TFASCII);
	GrText(historic_wid, tuxchess_gc, 6, 59, historic_line3, -1, GR_TFASCII);
	GrText(historic_wid, tuxchess_gc, 6, 72, historic_line4, -1, GR_TFASCII);
	GrText(historic_wid, tuxchess_gc, 6, 85, historic_line5, -1, GR_TFASCII);
	GrText(historic_wid, tuxchess_gc, 6, 99, historic_line6, -1, GR_TFASCII);
}
예제 #25
0
// Draws a box with the score a person got and their high score.
static void draw_result()
{
	char strScore[30];
	char strHighScore[35];
	int height, width, base;
	sprintf(strScore, "Score:%li", score);
	if (highScore < score)
		highScore = score;
	sprintf(strHighScore, "High Score:%li", highScore);
	GrGetGCTextSize(tunnel_gc, strHighScore, -1, GR_TFASCII, &width, &height, &base);
	
	GrSetGCForeground(tunnel_gc, WHITE);
	GrFillRect(tunnel_wid, tunnel_gc, (wi.width - width) / 2 - 3, wi.height / 2 - height - 3, width + 8, height * 2 + 2);
	GrSetGCForeground(tunnel_gc, BLACK);
	GrRect(tunnel_wid, tunnel_gc, (wi.width - width) / 2 - 3, wi.height / 2 - height - 3, width + 8, height * 2 + 2);
	GrText (tunnel_wid, tunnel_gc, (wi.width - width) / 2, wi.height / 2 - height / 2 + 2, strScore, -1, GR_TFASCII );
	GrText (tunnel_wid, tunnel_gc, (wi.width - width) / 2, wi.height / 2 + height / 2 + 2, strHighScore, -1, GR_TFASCII );
	
}
예제 #26
0
static void mp3_do_draw()
{
	GrSetGCForeground(mp3_gc, GR_RGB(255,255,255));
	GrFillRect(mp3_wid, mp3_gc, 0, 0, screen_info.cols, screen_info.rows);
	GrSetGCForeground(mp3_gc, GR_RGB(0,0,0));

	GrText(mp3_wid, mp3_gc, 8, 20, current_pos, -1, GR_TFASCII);
	GrText(mp3_wid, mp3_gc, 8, 34, current_title, -1, GR_TFASCII);
	GrText(mp3_wid, mp3_gc, 8, 48, current_artist, -1, GR_TFASCII);
	GrText(mp3_wid, mp3_gc, 8, 62, current_album, -1, GR_TFASCII);
	rect_x1 = 8;
	rect_x2 = screen_info.cols - 8;
	rect_y1 =  screen_info.rows - (HEADER_TOPLINE + 1) - 18;
	rect_y2 =  screen_info.rows - (HEADER_TOPLINE + 1) - 8;
	GrRect(mp3_wid, mp3_gc, rect_x1, rect_y1, rect_x2-rect_x1, rect_y2-rect_y1);

	rect_wait = 0;
	draw_time();
}
예제 #27
0
static int incall_handler(struct lgsm_handle *lh, int evt, struct gsmd_evt_auxdata *aux)
{
	printf("EVENT: Incoming call type = %u\n", aux->u.call.type);

	GrMapWindow(dialer_window);
	GrSetFocus(dialer_window);
	GrText(dialer_window, gc, 10, 10, "Incoming call", 0, 0);


	return 0;
}
예제 #28
0
static void draw_time()
{
	int bar_length, elapsed;
	char buf[256];
	struct tm *tm;
	time_t tot_time;

	elapsed= total_time - remaining_time;
	bar_length= (elapsed * (rect_x2-rect_x1-4)) / total_time;

	GrSetGCForeground(mp3_gc, GR_RGB(255,255,255));
	GrFillRect(mp3_wid, mp3_gc, rect_x1, rect_y1-12, rect_x2-rect_x1+1, 10);
	GrSetGCForeground(mp3_gc, GR_RGB(0,0,0));

	GrText(mp3_wid, mp3_gc, rect_x1, rect_y1-2, "0", -1, GR_TFASCII);
	tot_time = total_time / 1000;
	tm = gmtime(&tot_time);
	sprintf(buf, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec);
	GrText(mp3_wid, mp3_gc, rect_x2-43, rect_y1-2, buf, -1, GR_TFASCII);
	GrText(mp3_wid, mp3_gc, 50, rect_y1-2, "time", -1, GR_TFASCII);
	draw_bar(bar_length);
}
예제 #29
0
/*
 * Draw a button which has a specified label string centered in it.
 */
static void
drawbutton(GR_WINDOW_ID window, char *label)
{
    GR_SIZE		width;
    GR_SIZE		height;
    GR_SIZE		base;

    GrGetGCTextSize(buttongc, label, strlen(label), GR_TFASCII, &width,
                    &height, &base);
    GrText(window, buttongc, (BUTTONWIDTH - width) / 2,
           (BUTTONHEIGHT - height) / 2 + height - 1,
           label, -1, GR_TFBOTTOM);
}
예제 #30
0
void text_keypad_thumbscript_draw(GR_GC_ID gc)
{
    char s[2];
    GrLine(text_get_bufwid(), gc, 0, text_get_height()-16, text_get_width(), text_get_height()-16);
    switch (text_keypad_thumbscript_mode) {
    case 1:
        GrText(text_get_bufwid(), gc, text_get_width()/2, text_get_height()-4, "shift", -1, GR_TFASCII);
        break;
    case 3:
    case 2:
    case 4:
    case 5:
    case 6:
        GrText(text_get_bufwid(), gc, text_get_width()/2, text_get_height()-4, "mod", -1, GR_TFASCII);
        break;
    }
    if (text_keypad_thumbscript_last != 0) {
        s[0] = (text_keypad_thumbscript_last + '1');
        s[1] = 0;
        GrText(text_get_bufwid(), gc, (text_get_width()*3)/4, text_get_height()-4, s, -1, GR_TFASCII);
    }
}