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


C++ DrawString函数代码示例

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


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

示例1: SetWindow

void ImportSampleDialog::DrawView() {

    SetWindow(LIST_WIDTH,LIST_SIZE+3) ;

    GUITextProperties props ;

// Draw title

//	char title[40] ;

    SetColor(CD_NORMAL) ;

//	sprintf(title,"Sample Import from %s",currentPath_.GetName()) ;
//	w_.DrawString(title,pos,props) ;

// Draw samples

    int x=1 ;
    int y=1 ;

    if (currentSample_<topIndex_) {
        topIndex_=currentSample_ ;
    } ;
    if (currentSample_>=topIndex_+LIST_SIZE) {
        topIndex_=currentSample_ ;
    } ;

    IteratorPtr<Path> it(sampleList_.GetIterator()) ;
    int count=0 ;
    char buffer[256] ;
    for(it->Begin(); !it->IsDone(); it->Next()) {
        if ((count>=topIndex_)&&(count<topIndex_+LIST_SIZE)) {
            Path &current=it->CurrentItem() ;
            const std::string p=current.GetName() ;

            if (count==currentSample_) {
                SetColor(CD_HILITE2) ;
                props.invert_=true ;
            } else {
                SetColor(CD_NORMAL) ;
                props.invert_=false ;
            }
            if (!current.IsDirectory()) {
                strcpy(buffer,p.c_str()) ;
            } else {
                buffer[0]='[' ;
                strcpy(buffer+1,p.c_str()) ;
                strcat(buffer,"]") ;
            }
            buffer[LIST_WIDTH-1]=0 ;
            DrawString(x,y,buffer,props) ;
            y+=1 ;
        }
        count++ ;
    } ;

    y=LIST_SIZE+2 ;
    int offset=LIST_WIDTH/4 ;

    SetColor(CD_NORMAL) ;

    for (int i=0; i<3; i++) {
        const char *text=buttonText[i] ;
        x=offset*(i+1)-strlen(text)/2 ;
        props.invert_=(i==selected_)?true:false ;
        DrawString(x,y,text,props) ;
    }
} ;
开发者ID:EQ4,项目名称:LittleGPTracker,代码行数:68,代码来源:ImportSampleDialog.cpp

示例2: hsStringToWString

void    plDynamicTextMsg::DrawString( int16_t x, int16_t y, const char *text )
{
    wchar_t *wString = hsStringToWString(text);
    DrawString(x,y,wString);
    delete [] wString;
}
开发者ID:JECervini,项目名称:Plasma,代码行数:6,代码来源:plDynamicTextMsg.cpp

示例3: IsEnabled


//.........这里部分代码省略.........
		if (active)
			flags |= BControlLook::B_FOCUSED;
		be_control_look->DrawTextControlBorder(this, rect, updateRect, base,
			flags);

		rect = Bounds();
		rect.right = fDivider - kLabelInputSpacing;
//		rect.right = fText->Frame().left - 2;
//		rect.right -= 3;//be_control_look->DefaultLabelSpacing();
		be_control_look->DrawLabel(this, Label(), rect, updateRect,
			base, flags, BAlignment(fLabelAlign, B_ALIGN_MIDDLE));

		return;
	}

	// outer bevel

	rgb_color noTint = ui_color(B_PANEL_BACKGROUND_COLOR);
	rgb_color lighten1 = tint_color(noTint, B_LIGHTEN_1_TINT);
	rgb_color lighten2 = tint_color(noTint, B_LIGHTEN_2_TINT);
	rgb_color lightenMax = tint_color(noTint, B_LIGHTEN_MAX_TINT);
	rgb_color darken1 = tint_color(noTint, B_DARKEN_1_TINT);
	rgb_color darken2 = tint_color(noTint, B_DARKEN_2_TINT);
	rgb_color darken4 = tint_color(noTint, B_DARKEN_4_TINT);
	rgb_color navigationColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR);

	if (enabled)
		SetHighColor(darken1);
	else
		SetHighColor(noTint);

	StrokeLine(rect.LeftBottom(), rect.LeftTop());
	StrokeLine(rect.RightTop());

	if (enabled)
		SetHighColor(lighten2);
	else
		SetHighColor(lighten1);

	StrokeLine(BPoint(rect.left + 1.0f, rect.bottom), rect.RightBottom());
	StrokeLine(BPoint(rect.right, rect.top + 1.0f), rect.RightBottom());

	// inner bevel

	rect.InsetBy(1.0f, 1.0f);

	if (active) {
		SetHighColor(navigationColor);
		StrokeRect(rect);
	} else {
		if (enabled)
			SetHighColor(darken4);
		else
			SetHighColor(darken2);

		StrokeLine(rect.LeftTop(), rect.LeftBottom());
		StrokeLine(rect.LeftTop(), rect.RightTop());

		SetHighColor(noTint);
		StrokeLine(BPoint(rect.left + 1.0f, rect.bottom), rect.RightBottom());
		StrokeLine(BPoint(rect.right, rect.top + 1.0f));
	}

	// label

	if (Label()) {
		_ValidateLayoutData();
		font_height& fontHeight = fLayoutData->font_info;

		float y = Bounds().top + (Bounds().Height() + 1 - fontHeight.ascent
			- fontHeight.descent) / 2 + fontHeight.ascent;
		float x;

		float labelWidth = StringWidth(Label());
		switch (fLabelAlign) {
			case B_ALIGN_RIGHT:
				x = fDivider - labelWidth - kLabelInputSpacing;
				break;

			case B_ALIGN_CENTER:
				x = fDivider - labelWidth / 2.0;
				break;

			default:
				x = 0.0;
				break;
		}

		BRect labelArea(x, Bounds().top, x + labelWidth, Bounds().bottom);
		if (x < fDivider && updateRect.Intersects(labelArea)) {
			labelArea.right = fText->Frame().left - kLabelInputSpacing;

			BRegion clipRegion(labelArea);
			ConstrainClippingRegion(&clipRegion);
			SetHighColor(IsEnabled() ? ui_color(B_CONTROL_TEXT_COLOR)
				: tint_color(noTint, B_DISABLED_LABEL_TINT));
			DrawString(Label(), BPoint(x, y));
		}
	}
}
开发者ID:mmanley,项目名称:Antares,代码行数:101,代码来源:TextControl.cpp

示例4: FillRect

void TextInput::Draw( Rect area )
{
   FillRect( Bounds(), 0x888888 );
   DrawRect( Bounds(), 0x999999 );
   DrawString( 2,2, m_text, 0 );
}
开发者ID:AdamRLukaitis,项目名称:spoon,代码行数:6,代码来源:TextInput.cpp

示例5: DrawTrainDetails

/**
 * Draw the details for the given vehicle at the given position
 *
 * @param v     current vehicle
 * @param left  The left most coordinate to draw
 * @param right The right most coordinate to draw
 * @param y     The y coordinate
 * @param vscroll_pos Position of scrollbar
 * @param vscroll_cap Number of lines currently displayed
 * @param det_tab Selected details tab
 */
void DrawTrainDetails(const Train *v, int left, int right, int y, int vscroll_pos, uint16 vscroll_cap, TrainDetailsWindowTabs det_tab)
{
	/* get rid of awkward offset */
	y -= WD_MATRIX_TOP;

	int sprite_height = ScaleGUITrad(GetVehicleHeight(VEH_TRAIN));
	int line_height = max(sprite_height, WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM);
	int sprite_y_offset = line_height / 2;
	int text_y_offset = (line_height - FONT_HEIGHT_NORMAL) / 2;

	/* draw the first 3 details tabs */
	if (det_tab != TDW_TAB_TOTALS) {
		bool rtl = _current_text_dir == TD_RTL;
		Direction dir = rtl ? DIR_E : DIR_W;
		int x = rtl ? right : left;
		for (; v != NULL && vscroll_pos > -vscroll_cap; v = v->GetNextVehicle()) {
			GetCargoSummaryOfArticulatedVehicle(v, &_cargo_summary);

			/* Draw sprites */
			uint dx = 0;
			int px = x;
			const Train *u = v;
			do {
				Point offset;
				int width = u->GetDisplayImageWidth(&offset);
				if (vscroll_pos <= 0 && vscroll_pos > -vscroll_cap) {
					int pitch = 0;
					const Engine *e = Engine::Get(v->engine_type);
					if (e->GetGRF() != NULL) {
						pitch = ScaleGUITrad(e->GetGRF()->traininfo_vehicle_pitch);
					}
					PaletteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
					VehicleSpriteSeq seq;
					u->GetImage(dir, EIT_IN_DETAILS, &seq);
					seq.Draw(px + (rtl ? -offset.x : offset.x), y - line_height * vscroll_pos + sprite_y_offset + pitch, pal, v->vehstatus & VS_CRASHED);
				}
				px += rtl ? -width : width;
				dx += width;
				u = u->Next();
			} while (u != NULL && u->IsArticulatedPart());

			bool separate_sprite_row = (dx > (uint)ScaleGUITrad(TRAIN_DETAILS_MAX_INDENT));
			if (separate_sprite_row) {
				vscroll_pos--;
				dx = 0;
			}

			uint num_lines = max(1u, _cargo_summary.Length());
			for (uint i = 0; i < num_lines; i++) {
				int sprite_width = max<int>(dx, ScaleGUITrad(TRAIN_DETAILS_MIN_INDENT)) + 3;
				int data_left  = left + (rtl ? 0 : sprite_width);
				int data_right = right - (rtl ? sprite_width : 0);
				if (vscroll_pos <= 0 && vscroll_pos > -vscroll_cap) {
					int py = y - line_height * vscroll_pos + text_y_offset;
					if (i > 0 || separate_sprite_row) {
						if (vscroll_pos != 0) GfxFillRect(left, py - WD_MATRIX_TOP - 1, right, py - WD_MATRIX_TOP, _colour_gradient[COLOUR_GREY][5]);
					}
					switch (det_tab) {
						case TDW_TAB_CARGO:
							if (i < _cargo_summary.Length()) {
								TrainDetailsCargoTab(&_cargo_summary[i], data_left, data_right, py);
							} else {
								DrawString(data_left, data_right, py, STR_QUANTITY_N_A, TC_LIGHT_BLUE);
							}
							break;

						case TDW_TAB_INFO:
							if (i == 0) TrainDetailsInfoTab(v, data_left, data_right, py);
							break;

						case TDW_TAB_CAPACITY:
							if (i < _cargo_summary.Length()) {
								TrainDetailsCapacityTab(&_cargo_summary[i], data_left, data_right, py);
							} else {
								SetDParam(0, STR_EMPTY);
								DrawString(data_left, data_right, py, STR_VEHICLE_INFO_NO_CAPACITY);
							}
							break;

						default: NOT_REACHED();
					}
				}
				vscroll_pos--;
			}
		}
	} else {
		CargoArray act_cargo;
		CargoArray max_cargo;
		Money feeder_share = 0;
//.........这里部分代码省略.........
开发者ID:tony,项目名称:openttd,代码行数:101,代码来源:train_gui.cpp

示例6: _jGetString

int _jGetString(char *dest, char *start, int maxlen, GS_TYPE type)
{
	/*
	 * Returns 1 if OK; 0 if rejected or quit.
	 */

	int y;
	event e;
	int i;
	int startx;
   int key;

   curpos = 0;
	HideCursor();
	startx = QueryX();
	y = QueryY();

	lrects = malloc(maxlen * sizeof(rect));
	for (i = 0; i < maxlen; i++)
	{
		rect R;

		R.Xmin = startx + i * StringWidthX;
		R.Xmax = R.Xmin + StringWidthX - 1;
		R.Ymax = y;
		R.Ymin = R.Ymax - FontHeight + 1;
		lrects[i] = R;
	}


	tbuf = malloc(maxlen + 1);
	memset(tbuf, ' ', maxlen);
	tbuf[maxlen] = 0;

	i = 0;
	if (start)
	{
		for (i = 0; i < maxlen && start[i]; i++)
			tbuf[i] = start[i];
	}
	curpos = min(i, maxlen - 1);



	TextAlign(alignLeft, alignBottom);

	DrawString(tbuf);

	/* Now highlight somebody */
	InvertRect(&lrects[curpos]);


	while (1)
	{
      key = 0;

		KeyEvent(true, &e);
      if (e.ASCII && e.ASCII != 0xe0)
         key = e.ASCII;
      else if (e.ScanCode != 0xff)
         key = e.ScanCode << 8;

      



		if (key)
		{
			if (key == 0x0d || key == 0x1b)
				break;

			if (key == 0x08)	/* backspace */
            backspace(maxlen);
         else if (key == 0x15)      /* control U */
         {
            while(curpos)
               backspace(maxlen);
         }
			else
			{
				int acceptable = 0;

				if (type == GS_ANYTHING)
					acceptable = isprint(key);
				else if (type == GS_INTEGER)
					acceptable = isdigit(key) || key == '-';
				else if (type == GS_UNSIGNED)
					acceptable = isdigit(key);
				else if (type == GS_FLOAT)
					acceptable = isdigit(key) || key == '.' || key == '-' || key == 'E' || key == 'e';

				if (acceptable)
				{
					InvertRect(&lrects[curpos]);
					MoveTo(lrects[curpos].Xmin, lrects[curpos].Ymax);
					DrawChar(key);
					tbuf[curpos] = key;

					if (curpos < maxlen - 1)
						curpos++;
//.........这里部分代码省略.........
开发者ID:mrchurrisky,项目名称:chaos,代码行数:101,代码来源:JGETSTRI.C

示例7: SO_Display

void SO_Display()
{
	// kolor tła - zawartośæ bufora koloru
	glClearColor(1.0, 1.0, 1.0, 1.0);

	// czyszczenie bufora koloru i bufora głębokości
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	// wybór macierzy modelowania
	glMatrixMode(GL_MODELVIEW);

	// macierz modelowania = macierz jednostkowa
	glLoadIdentity();

	// przesunięcie układu współrzędnych sześcianu do środka bryły odcinania
	glTranslatef(0, 0, -(near + far) / 2);

	// obroty sześcianu
	glRotatef(rotatex, 1.0, 0, 0);
	glRotatef(rotatey, 0, 1.0, 0);

	// włączenie oświetlenia
	glEnable(GL_LIGHTING);

	// parametry globalnego światła otaczającego
	glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient_light);

	// włączenie obsługi właściwości materiałów
	glEnable(GL_COLOR_MATERIAL);

	// właściwości materiału określone przez kolor wierzchołków
	glColorMaterial(GL_FRONT, GL_AMBIENT);

	// włączenie testu bufora głębokości
	glEnable(GL_DEPTH_TEST);

	glBegin(GL_TRIANGLES);
	glColor3fv(Red);
	glVertex3f(0.0, 0.0, -0.5);
	glVertex3f(0.5, 0.0, 0.5);
	glVertex3f(-0.5, 0.0, 0.5);

	glColor3fv(Cyan);
	glVertex3f(0.0, 0.8, 0.0);
	glVertex3f(-0.5, 0.0, 0.5);
	glVertex3f(0.5, 0.0, 0.5);

	glColor3fv(Yellow);
	glVertex3f(0.0, 0.8, 0.0);
	glVertex3f(0.0, 0.0, -0.5);
	glVertex3f(-0.5, 0.0, 0.5);

	glColor3fv(Blue);
	glVertex3f(0.0, 0.8, 0.0);
	glVertex3f(0.5, 0.0, 0.5);
	glVertex3f(0.0, 0.0, -0.5);

	glEnd();


	// wyłączenie oświetlenia
	glDisable(GL_LIGHTING);

	// wyłączenie obsługi właściwości materiałów
	glDisable(GL_COLOR_MATERIAL);

	// wyświetlenie składowych globalnego światła otaczającego
	char string[100];
	GLfloat rgba[4];
	glColor3fv(Black);

	// pobranie wartości składowych światła otaczającego
	// (oczywiście wartości te odpowiadają tablicy ambient_light)
	glGetFloatv(GL_LIGHT_MODEL_AMBIENT, rgba);
	sprintf(string, "AMBIENT: R=%f G=%f B=%f A=%f", rgba[0], rgba[1], rgba[2], rgba[3]);

	// trzeba odpowiednio przekształciæ układ współrzędnych
	// aby napis znajdował się na samej "górze" bryły obcinania
	glLoadIdentity();
	glTranslatef(0, 0, -near);

	// narysowanie napisu
	DrawString((float)left, (float)bottom, string);


	// skierowanie poleceñ do wykonania
	glFlush();

	// zamiana buforów koloru
	glutSwapBuffers();
}
开发者ID:DamianS1994,项目名称:GRAFIKA,代码行数:91,代码来源:5-zad1.cpp

示例8: DrawString

void UIFont::DrawString(float x, float y, int32 align, const tchar *string, const uint32 color)
{
	DrawString(x, y, align, string, color, 0.0f, 1.0f, 1.0f);
}
开发者ID:BGCX261,项目名称:zjh-dev-svn-to-git,代码行数:4,代码来源:UIFont.cpp

示例9: InstallData

int InstallData(char* drive){
	FIL firmfile;
	char* progressbar = "[       ]";
	char* progress = progressbar+1;
	print("%s", progressbar);  ConsolePrevLine();
	
	//Create the workdir
	sprintf(tmpstr, "%s:%s", drive, DATAFOLDER);
	f_mkdir(tmpstr);
	f_chmod(tmpstr, AM_HID, AM_HID);
	
	//Read firmware data
	if(f_open(&firmfile, "firmware.bin", FA_READ | FA_OPEN_EXISTING) == FR_OK){
		//... We'll see
	}else return CONF_NOFIRMBIN;
	*progress++ = '.'; DrawString(BOT_SCREEN, progressbar, 130, 50, ConsoleGetTextColor(), ConsoleGetBackgroundColor());
	
	//Create patched native_firm
	f_read(&firmfile, WORKBUF, NAT_SIZE, &tmpu32);
	u8* n_firm = decryptFirmTitle(WORKBUF, NAT_SIZE, 0x00000002);
	u8* n_firm_patch = GetFilePack("nat_patch.bin");
	applyPatch(n_firm, n_firm_patch);
	u8 keyx[16] = {0};
	if(GetSystemVersion() < 3){
		FileOpen(&tempfile, KEYFILENAME, 0);
		FileRead(&tempfile, &keyx[0], 16, 0);
		FileClose(&tempfile);
	}
	*progress++ = '.'; DrawString(BOT_SCREEN, progressbar, 130, 50, ConsoleGetTextColor(), ConsoleGetBackgroundColor());
	for(int i = 0; i < NAT_SIZE; i+=0x4){
		if(!strcmp((char*)n_firm + i, "Shit")){
			if(1){
				memcpy((char*)n_firm + i, rxmode_emu_label, 4);
			}else{
				memcpy((char*)n_firm + i, rxmode_sys_label , 4);
			}
		}
		if(!strcmp((char*)n_firm + i, "InsertKeyXHere!") && keyx[0] != 0){
			memcpy(n_firm + i, keyx, 16);
		}
		if(*((unsigned int*)(n_firm + i)) == 0xAAAABBBB){
			*((unsigned int*)(n_firm + i)) = (checkEmuNAND() / 0x200) - 1;
		}
	}
	*progress++ = '.'; DrawString(BOT_SCREEN, progressbar, 130, 50, ConsoleGetTextColor(), ConsoleGetBackgroundColor());
	sprintf(tmpstr, "%s:%s/0004013800000002.bin", drive, DATAFOLDER);
	if(FileOpen(&tempfile, tmpstr, 1)){
		FileWrite(&tempfile, n_firm, NAT_SIZE, 0);
		FileClose(&tempfile);
		//FileCopy("0004013800000002.bin", tmpstr);
	}else return CONF_ERRNFIRM;
	*progress++ = '.'; DrawString(BOT_SCREEN, progressbar, 130, 50, ConsoleGetTextColor(), ConsoleGetBackgroundColor());
	
	//Create AGB patched firmware
	f_read(&firmfile, WORKBUF, AGB_SIZE, &tmpu32);
	u8* a_firm = decryptFirmTitle(WORKBUF, AGB_SIZE, 0x00000202);
	u8* a_firm_patch = GetFilePack("agb_patch.bin");
	if(a_firm){
		applyPatch(a_firm, a_firm_patch);
		sprintf(tmpstr, "%s:%s/0004013800000202.bin", drive, DATAFOLDER);
		if(FileOpen(&tempfile, tmpstr, 1)){
			FileWrite(&tempfile, a_firm, AGB_SIZE, 0);
			FileClose(&tempfile);
		}else return CONF_ERRNFIRM;
		*progress++ = '.';
	}else{	
		//If we cannot decrypt it from firmware.bin becouse of titlekey messed up, it probably means that AGB has been modified in some way.
		//So we read it from his installed ncch...
		FindApp(0x00040138, 0x00000202, 1);
		char* path = getContentAppPath();
		FileOpen(&tempfile, path, 0);
		FileRead(&tempfile, WORKBUF, AGB_SIZE, 0);
		FileClose(&tempfile);
		a_firm = decryptFirmTitleNcch(WORKBUF, AGB_SIZE);
		if(a_firm){
			applyPatch(a_firm, a_firm_patch);
			sprintf(tmpstr, "%s:%s/0004013800000202.bin", drive, DATAFOLDER);
			if(FileOpen(&tempfile, tmpstr, 1)){
				FileWrite(&tempfile, a_firm, AGB_SIZE, 0);
				FileClose(&tempfile);
			}else return CONF_ERRNFIRM;
			*progress++ = '.';
		}else{
			*progress++ = 'x'; //If we get here, then we'll play without AGB, lol
		}
	}
	DrawString(BOT_SCREEN, progressbar, 130, 50, ConsoleGetTextColor(), ConsoleGetBackgroundColor());
	
	//Create TWL patched firmware
	f_read(&firmfile, WORKBUF, TWL_SIZE, &tmpu32);
	u8* t_firm = decryptFirmTitle(WORKBUF, TWL_SIZE, 0x00000102);
	u8* t_firm_patch = GetFilePack("twl_patch.bin");
	if(t_firm){
		applyPatch(t_firm, t_firm_patch);
		sprintf(tmpstr, "%s:%s/0004013800000102.bin", drive, DATAFOLDER);
		if(FileOpen(&tempfile, tmpstr, 1)){
			FileWrite(&tempfile, t_firm, TWL_SIZE, 0);
			FileClose(&tempfile);
			//FileCopy("0004013800000102.bin", tmpstr);
		}else return CONF_ERRNFIRM;
//.........这里部分代码省略.........
开发者ID:ApacheThunder,项目名称:rxTools,代码行数:101,代码来源:configuration.c

示例10: ShowAdditionsWin

void
ShowAdditionsWin(void)
{
	Str255		next, back;
	Str255		compDescTitle;
	StringPtr	selCompMsg;
	Handle		listBoxRect;
	Rect 		dataBounds, listBoxFrame, viewRect;
	short		reserr;
	int			totalRows = 0, i, instChoice;
	Point		cSize;
	Boolean		bCellSelected;
	GrafPtr		oldPort;
	GetPort(&oldPort);
		
	SetPort(gWPtr);
	
	gCurrWin = kAdditionsID; 
	/* gControls->aw = (CompWin *) NewPtrClear(sizeof(CompWin)); */
	
	GetResourcedString(next, rInstList, sNextBtn);
	GetResourcedString(back, rInstList, sBackBtn);

	// get controls
	listBoxRect = Get1Resource('RECT', rCompListBox);
	reserr = ResError(); 
	if (reserr == noErr && listBoxRect != NULL)
	{
		HLock((Handle)listBoxRect);
		SetRect(&gControls->aw->compListBox, 	((Rect*)*listBoxRect)->left,
												((Rect*)*listBoxRect)->top,
												((Rect*)*listBoxRect)->right,
												((Rect*)*listBoxRect)->bottom);
		HUnlock((Handle)listBoxRect);
	}
	else
	{
		ErrorHandler(reserr, nil);
		return;
	}
	gControls->aw->compDescBox = NULL;
	gControls->aw->compDescBox = GetNewControl(rCompDescBox, gWPtr);
	if (!gControls->aw->compDescBox)
	{
		ErrorHandler(eMem, nil);
		return;
	}

	gControls->aw->compListBox.right -= kScrollBarWidth;
	instChoice = gControls->opt->instChoice-1;
	for (i=0; i<kMaxComponents; i++)
	{
		if (totalRows >= gControls->cfg->numComps)
			break;
		if (!gControls->cfg->comp[i].invisible && gControls->cfg->comp[i].additional &&
			(gControls->cfg->st[instChoice].comp[i] == kInSetupType))
			totalRows++;
	}
		
	SetRect(&dataBounds, 0, 0, 1, totalRows);
	SetPt( &cSize, 0, 0);
	gControls->aw->compList = LNew((const Rect*)&gControls->aw->compListBox, (const Rect*)&dataBounds,
									cSize, rCheckboxLDEF, gWPtr, true, false, false, true);
	(*gControls->aw->compList)->selFlags = lExtendDrag + lUseSense + lDoVAutoscroll;
	
	HLock((Handle)gControls->aw->compDescBox);
	SetRect(&viewRect, (*gControls->aw->compDescBox)->contrlRect.left,
					   (*gControls->aw->compDescBox)->contrlRect.top,
					   (*gControls->aw->compDescBox)->contrlRect.right,
					   (*gControls->aw->compDescBox)->contrlRect.bottom);
	HUnlock((Handle)gControls->aw->compDescBox);
	viewRect.top += kInterWidgetPad;
	SetRect(&viewRect, viewRect.left + kTxtRectPad,
						viewRect.top + kTxtRectPad,
						viewRect.right - kTxtRectPad,
						viewRect.bottom - kTxtRectPad);
	TextFont(applFont);
	TextSize(9);
	gControls->aw->compDescTxt = TENew(&viewRect, &viewRect);
	TextFont(systemFont);
	TextSize(12);
	
	// populate controls
	bCellSelected = AddPopulateCompInfo();
	
	// show controls
	GetResourcedString(compDescTitle, rInstList, sCompDescTitle);
	SetControlTitle(gControls->aw->compDescBox, compDescTitle);
	
	MoveTo( gControls->aw->compListBox.left, gControls->aw->compListBox.top - kInterWidgetPad);
	HLock(gControls->cfg->selCompMsg);
	selCompMsg = CToPascal(*gControls->cfg->selAddMsg);
	if (selCompMsg)
		DrawString( selCompMsg );
	HUnlock(gControls->cfg->selCompMsg);
	SetRect(&listBoxFrame, gControls->aw->compListBox.left, 
						 --gControls->aw->compListBox.top,
						   gControls->aw->compListBox.right + kScrollBarWidth,
						 ++gControls->aw->compListBox.bottom);
	FrameRect(&listBoxFrame);
//.........这里部分代码省略.........
开发者ID:rn10950,项目名称:RetroZilla,代码行数:101,代码来源:AdditionsWin.c

示例11: SetDrawingMode

/*=============================================================================================*\
|	Draw																						|
+-----------------------------------------------------------------------------------------------+
|	Effet: Redessiner une partie de la view.													|
|	Entre: 																						|
|		BRect frame: Rectagle qui a besoin d'etre redessine.									|
\*=============================================================================================*/
void ShrinkView::Draw(BRect updateRect)
{
	BPoint pPointList[8];		//Utilise pour dessiner les polygone.
	rgb_color color = {0,0,0,0};
	rgb_color colorHigh = {0,0,0,0};
	
	SetDrawingMode(B_OP_COPY);
	if(m_pBmp)
	{
		uint32 * uiBits = (uint32*)m_pBmp->Bits();
		uint32 uiColor = uiBits[141];
		uint32 uiColorHigh = uiBits[289];
		
		color.red = ( uiColor & 0xFF0000) / 0x10000;
		color.green = (uiColor & 0xFF00) / 0x100;
		color.blue = (uiColor & 0xFF) ;
		colorHigh.red = ( uiColorHigh & 0xFF0000) / 0x10000;
		colorHigh.green = (uiColorHigh & 0xFF00) / 0x100;
		colorHigh.blue = (uiColorHigh & 0xFF) ;
			
	}

	//if(updateRect.left < 10)
	{
		if(m_pBmp)
		{
			DrawBitmap(m_pBmp, BRect(140,15,147,15), BRect(Bounds().Width() - 7, 16, Bounds().Width(), Bounds().Height() - 7));				 
		}

	}
	//if(updateRect.right > Bounds().Width()-10)
	{
		if(m_pBmp)
		{
			DrawBitmap(m_pBmp, BRect(140,14,147,14), BRect(0, 16, 7, Bounds().Height() - 7));

		}
	}
	
	
	//Dessiner l'etiquette si necessaire.
	if(updateRect.top < 16 && updateRect.right >= 16)
	{
		
		if(m_pBmp)
		{
			
			if(m_bShrink && m_bMouseOver)
			{
				DrawBitmap(m_pBmp, BRect(80,0,95,15), BRect(Bounds().Width() - 15,0,Bounds().Width(),15));
				DrawBitmap(m_pBmp, BRect(137,0,137,15), BRect(16, 0, Bounds().Width() - 15, 15)); 
			}
			else if(m_bShrink)
			{
				DrawBitmap(m_pBmp, BRect(64,0,79,15), BRect(Bounds().Width() - 15,0,Bounds().Width(),15));
				DrawBitmap(m_pBmp, BRect(136,0,136,15), BRect(16, 0, Bounds().Width() - 15, 15)); 
			}
			else if(m_bMouseOver)
			{
				DrawBitmap(m_pBmp, BRect(112,0,127,15), BRect(Bounds().Width() - 15,0,Bounds().Width(),15));
				DrawBitmap(m_pBmp, BRect(139,0,139,15), BRect(16, 0, Bounds().Width() - 15, 15)); 
			}
			else
			{
				DrawBitmap(m_pBmp, BRect(96,0,111,15), BRect(Bounds().Width() - 15,0,Bounds().Width(),15));
				DrawBitmap(m_pBmp, BRect(138,0,138,15), BRect(16, 0, Bounds().Width() - 15 , 15)); 
			}
			SetFont(be_bold_font);
					
			if(m_bMouseOver)
			{
				SetHighColor(colorHigh);
			}
			else
			{
				SetHighColor(color);
			}	
			SetDrawingMode(B_OP_OVER);
			DrawString(m_pzLabel, BPoint(18,12), NULL);	
			SetDrawingMode(B_OP_COPY);	
		}
		else
		{
			if(m_bShrink)
			{
				DrawDegrader(BRect(16,0,Bounds().Width(),4), 255, 192);
				DrawDegrader(BRect(16,11,Bounds().Width(),15), 192, 128);
			
				//Remplir le milieu de l'etiquette en gris
				SetHighColor(192, 192, 192, 0);
				FillRect(BRect(16, 5, Bounds().Width(), 10));
			}
			else	//Degrader du blanc au gris
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:dengon-svn,代码行数:101,代码来源:ShrinkView.cpp

示例12: Draw_Stage5

void Draw_Stage5(){ //ステージ5の描画に関する関数
	DrawString(0, 30, "ステージ5です。", WHITE);
	DrawBox(320, 120, 380, 180, PINK, true);
	DrawBox(520, 320, 580, 380, PINK, true);
	DrawBox(600, 0, 640, 70, PINK, true);
}
开发者ID:Kurowasi,项目名称:Roleplaying-game,代码行数:6,代码来源:Stage5.cpp

示例13: SetColor

void Label::OnPaint()
{
	SetColor(color.r, color.g, color.b);
	DrawString(this->text, this->X, this->Y);
}
开发者ID:ngn15002,项目名称:DVA222_Projekt2,代码行数:5,代码来源:Label.cpp

示例14: lineStart

void MyApp::DrawHelp()
{
	int lineStart(LINE_START);
	int lineStep(LINE_STEP);

	//! 显示地图信息
	DrawString(0, lineStart, CLR_WHITE, "-------Help Info-------");
	lineStart += lineStep;

	DrawString(0, lineStart, CLR_WHITE, "ShowHelpInfo: H");
	lineStart += lineStep;
	DrawString(0, lineStart, CLR_WHITE, "ResetSpaceRect: Home");
	lineStart += lineStep;
	DrawString(0, lineStart, CLR_WHITE, "Quit: ESC");
	lineStart += lineStep;
	DrawString(0, lineStart, CLR_WHITE, "ShowConfigValue: C");
	lineStart += lineStep;
	DrawString(0, lineStart, CLR_WHITE, "SetSingleMode: S");
	lineStart += lineStep;
	DrawString(0, lineStart, CLR_WHITE, "ChangeNextSpace: N");
	lineStart += lineStep;
	DrawString(0, lineStart, CLR_WHITE, "ShowEntityProp: P");
	lineStart += lineStep;
	DrawString(0, lineStart, CLR_WHITE, "ShowEntityID: I");
	lineStart += lineStep;
	DrawString(0, lineStart, CLR_WHITE, "ShowRobotID: R");
	lineStart += lineStep;
	DrawString(0, lineStart, CLR_WHITE, "ShowEntityPos: Z");
	lineStart += lineStep;

	DrawString(0, lineStart, CLR_WHITE, "-------Cmd Info-------");
	lineStart += lineStep;

	int w,h;
	GetWindowSize(w,h);
	int infoHeight = h-lineStart-LINE_BOTTOM;
	if(infoHeight < lineStep)
		return;

	const FvRobotCfg::Items& kItems = FvRobotCfg::Instance().GetItems();
	if(kItems.empty())
		return;

	int iItemsPerPage = infoHeight / lineStep;
	int iPages = (kItems.size() + iItemsPerPage-1) / iItemsPerPage;
	if(m_iInfoPage4Help >= iPages)
		m_iInfoPage4Help = iPages-1;

	int iStart = m_iInfoPage4Help*iItemsPerPage;
	int i = iStart;
	for(; i<iStart+iItemsPerPage && i<(int)kItems.size(); ++i)
	{
		DrawString(0, lineStart, CLR_WHITE, kItems[i].GetCmdStr().c_str());
		lineStart += lineStep;
	}

	if(m_iInfoPage4Help==0 && m_iInfoPage4Help<iPages-1)
	{
		DrawString(0, lineStart, CLR_WHITE, "-------Press Page Down-------");
		lineStart += lineStep;
	}
	else if(0<m_iInfoPage4Help && m_iInfoPage4Help<iPages-1)
	{
		DrawString(0, lineStart, CLR_WHITE, "-------Press Page UP/Down-------");
		lineStart += lineStep;
	}
	else if(0<m_iInfoPage4Help && m_iInfoPage4Help==iPages-1)
	{
		DrawString(0, lineStart, CLR_WHITE, "-------Press Page UP-------");
		lineStart += lineStep;
	}
}
开发者ID:Kiddinglife,项目名称:geco-game-engine,代码行数:72,代码来源:MyApp.cpp

示例15: rect


//.........这里部分代码省略.........

	// fill the button area
	SetHighColor(buttonBgColor);
	FillRect(fillArea);

	BeginLineArray(22);
	// bevel around external border
	AddLine(BPoint(rect.left, rect.bottom),
			BPoint(rect.left, rect.top), borderBevelShadow);
	AddLine(BPoint(rect.left + 1, rect.top),
			BPoint(rect.right, rect.top), borderBevelShadow);

	AddLine(BPoint(rect.right, rect.top + 1),
			BPoint(rect.right, rect.bottom), borderBevelLight);
	AddLine(BPoint(rect.left + 1, rect.bottom),
			BPoint(rect.right - 1, rect.bottom), borderBevelLight);

	rect.InsetBy(1.0, 1.0);

	// external border
	AddLine(BPoint(rect.left, rect.bottom),
			BPoint(rect.left, rect.top), dark1BorderColor);
	AddLine(BPoint(rect.left + 1, rect.top),
			BPoint(rect.right, rect.top), dark1BorderColor);
	AddLine(BPoint(rect.right, rect.top + 1),
			BPoint(rect.right, rect.bottom), dark2BorderColor);
	AddLine(BPoint(rect.right - 1, rect.bottom),
			BPoint(rect.left + 1, rect.bottom), dark2BorderColor);

	rect.InsetBy(1.0, 1.0);

	// Light
	AddLine(BPoint(rect.left, rect.top),
			BPoint(rect.left, rect.top), buttonBgColor);
	AddLine(BPoint(rect.left, rect.top + 1),
			BPoint(rect.left, rect.bottom - 1), lightColor);
	AddLine(BPoint(rect.left, rect.bottom),
			BPoint(rect.left, rect.bottom), bevelColor2);
	AddLine(BPoint(rect.left + 1, rect.top),
			BPoint(rect.right - 1, rect.top), lightColor);
	AddLine(BPoint(rect.right, rect.top),
			BPoint(rect.right, rect.top), bevelColor2);
	// Shadow
	AddLine(BPoint(rect.left + 1, rect.bottom),
			BPoint(rect.right - 1, rect.bottom), bevelColor1);
	AddLine(BPoint(rect.right, rect.bottom),
			BPoint(rect.right, rect.bottom), bevelColorRBCorner);
	AddLine(BPoint(rect.right, rect.bottom - 1),
			BPoint(rect.right, rect.top + 1), bevelColor1);

	rect.InsetBy(1.0, 1.0);

	// Light
	AddLine(BPoint(rect.left, rect.top),
			BPoint(rect.left, rect.bottom - 1), maxLightColor);
	AddLine(BPoint(rect.left, rect.bottom),
			BPoint(rect.left, rect.bottom), buttonBgColor);
	AddLine(BPoint(rect.left + 1, rect.top),
			BPoint(rect.right - 1, rect.top), maxLightColor);
	AddLine(BPoint(rect.right, rect.top),
			BPoint(rect.right, rect.top), buttonBgColor);
	// Shadow
	AddLine(BPoint(rect.left + 1, rect.bottom),
			BPoint(rect.right, rect.bottom), bevelColor2);
	AddLine(BPoint(rect.right, rect.bottom - 1),
			BPoint(rect.right, rect.top + 1), bevelColor2);

	rect.InsetBy(1.0,1.0);

	EndLineArray();

	// Invert if clicked
	if (enabled && pushed) {
		rect.InsetBy(-2.0, -2.0);
		InvertRect(rect);
	}

	// Label color
	if (enabled) {
		if (pushed) {
			SetHighColor(maxLightColor);
			SetLowColor(255 - buttonBgColor.red,
						255 - buttonBgColor.green,
						255 - buttonBgColor.blue);
		} else {
			SetHighColor(ui_color(B_CONTROL_TEXT_COLOR));
			SetLowColor(buttonBgColor);
		}
	} else {
		SetHighColor(tint_color(panelBgColor, B_DISABLED_LABEL_TINT));
		SetLowColor(buttonBgColor);
	}

	// Draw the label
	DrawString(text.String(), BPoint(x, labelY));

	// Focus line
	if (enabled && IsFocus() && Window()->IsActive() && !pushed)
		_DrawFocusLine(x, focusLineY, stringWidth, true);
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:101,代码来源:Button.cpp


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