当前位置: 首页>>代码示例>>C++>>正文


C++ GrText函数代码示例

本文整理汇总了C++中GrText函数的典型用法代码示例。如果您正苦于以下问题:C++ GrText函数的具体用法?C++ GrText怎么用?C++ GrText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GrText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RefreshWindow

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);
		}
	}
}
开发者ID:ghaerr,项目名称:microwindows,代码行数:27,代码来源:slider.c

示例2: draw_pause_continue_button

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);
	}
}
开发者ID:Joel397,项目名称:Ongoing_work_files,代码行数:33,代码来源:ntetris.c

示例3: draw_message

/* 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);
}
开发者ID:iPodLinux-Community,项目名称:ZacZilla,代码行数:35,代码来源:main.c

示例4: idw_draw_sheet

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;  
}
开发者ID:ProjectZeroSlackr,项目名称:Floydzilla,代码行数:54,代码来源:dopewars.c

示例5: idw_draw_screen

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);
  }
}
开发者ID:ProjectZeroSlackr,项目名称:Floydzilla,代码行数:53,代码来源:dopewars.c

示例6: draw_end

/* 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);
	}
}
开发者ID:iPodLinux-Community,项目名称:ZacZilla,代码行数:53,代码来源:main.c

示例7: draw_score

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);
}
开发者ID:Joel397,项目名称:Ongoing_work_files,代码行数:14,代码来源:ntetris.c

示例8: draw_help

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);
		}
	}
}
开发者ID:ProjectZeroSlackr,项目名称:Floydzilla,代码行数:50,代码来源:blackjack.c

示例9: do_keystroke

/*
 * 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;
}
开发者ID:EPiCS,项目名称:reconos_v2,代码行数:36,代码来源:demo.c

示例10: draw_new_game_button

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);
}
开发者ID:Joel397,项目名称:Ongoing_work_files,代码行数:7,代码来源:ntetris.c

示例11: drawcell

/*
 * 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);
}
开发者ID:thegeek82000,项目名称:lepton,代码行数:36,代码来源:landmine.c

示例12: showcoords

/*
 * 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;
}
开发者ID:allanshin,项目名称:DirectFB_Microwindows,代码行数:35,代码来源:world.c

示例13: run

/**
 * 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();
    }
}
开发者ID:elmux,项目名称:yacm,代码行数:31,代码来源:uiViewInit.c

示例14: drawText

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);
}
开发者ID:houzhenggang,项目名称:mt7688_mips_ecos,代码行数:34,代码来源:dynacal.c

示例15: draw_drop_button

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);
}
开发者ID:Joel397,项目名称:Ongoing_work_files,代码行数:8,代码来源:ntetris.c


注:本文中的GrText函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。