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


C++ DrawBackground函数代码示例

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


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

示例1: GetClientRect

void DashboardInstrument_BaroHistory::Draw(wxGCDC* dc)
{
   m_WindowRect = GetClientRect();
   m_DrawAreaRect=GetClientRect();
   m_DrawAreaRect.SetHeight(m_WindowRect.height-m_TopLineHeight-m_TitleHeight);
   m_DrawAreaRect.SetX (m_LeftLegend+3);
   DrawBackground(dc);
   DrawForeground(dc);
}
开发者ID:LochanaThenuwara,项目名称:Siyara2D,代码行数:9,代码来源:baro_history.cpp

示例2: bounds

void
BitmapView::Draw(BRect updateRect)
{
	BRect bounds(Bounds());
	DrawBackground(bounds, updateRect);

	if (fBitmap == NULL)
		return;

	BRect bitmapBounds = fBitmap->Bounds();
	if (bitmapBounds.Width() <= 0.0f || bitmapBounds.Height() <= 0.0f)
		return;

	float scale = 1.0f;

	if (fScaleBitmap) {
		float hScale = bounds.Width() / bitmapBounds.Width();
		float vScale = bounds.Height() / bitmapBounds.Height();

		scale = std::min(hScale, vScale);
	}

	float width = bitmapBounds.Width() * scale;
	float height = bitmapBounds.Height() * scale;

	switch (LayoutAlignment().horizontal) {
		case B_ALIGN_LEFT:
			break;
		case B_ALIGN_RIGHT:
			bounds.left = floorf(bounds.right - width);
			break;
		default:
		case B_ALIGN_HORIZONTAL_CENTER:
			bounds.left = floorf(bounds.left
				+ (bounds.Width() - width) / 2.0f);
			break;
	}
	switch (LayoutAlignment().vertical) {
		case B_ALIGN_TOP:
			break;
		case B_ALIGN_BOTTOM:
			bounds.top = floorf(bounds.bottom - height);
			break;
		default:
		case B_ALIGN_VERTICAL_CENTER:
			bounds.top = floorf(bounds.top
				+ (bounds.Height() - height) / 2.0f);
			break;
	}

	bounds.right = ceilf(bounds.left + width);
	bounds.bottom = ceilf(bounds.top + height);

	SetDrawingMode(B_OP_OVER);
	DrawBitmap(fBitmap, bitmapBounds, bounds, B_FILTER_BITMAP_BILINEAR);
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:56,代码来源:BitmapView.cpp

示例3: TitleScreenOutputFrame

void TitleScreenOutputFrame(void)
{
	DrawBackground(&BG, 0);

	HighScoreDisplayDraw(&HSD);

	for (int i = 0; i < MAX_PLAYERS; i++)
	{
		Tex t = GetControlTex(i);
		SDL_Rect dest =
		{
			SCREEN_X((i + 1) * FIELD_WIDTH / (MAX_PLAYERS + 1)) -
				t.W / 2,
			(SCREEN_HEIGHT - t.H) / 2 - SCREEN_X(PLAYER_RADIUS),
			t.W, t.H
		};
		RenderTex(t.T, NULL, &dest);
	}

	for (int i = 0; i < MAX_PLAYERS; i++)
	{
		PlayerDraw(&players[i], 0);
	}

	for (int i = 0; i < MAX_PLAYERS; i++)
	{
		BlockDraw(&blocks[i], 0);
	}

	DrawTitleImg();
	// Draw player icons if winners
	if (!Start)
	{
		const int left =
			(SCREEN_WIDTH - PLAYER_SPRITESHEET_WIDTH * winners) / 2;
		for (int i = 0; i < winners; i++)
		{
			const int playerIndex = winnerIndices[i];
			SDL_Rect src = {
				0, 0, PLAYER_SPRITESHEET_WIDTH, PLAYER_SPRITESHEET_HEIGHT
			};
			SDL_Rect dest =
			{
				left + i * PLAYER_SPRITESHEET_WIDTH,
				SCREEN_HEIGHT * 0.66f,
				src.w, src.h
			};
			RenderTex(PlayerSpritesheets[playerIndex].T, &src, &dest);
		}
	}
	SDL_Color c = { 177, 177, 177, 255 };
	TextRenderCentered(
		font, WelcomeMessage, (int)(SCREEN_HEIGHT * 0.75f), c);

	SDL_RenderPresent(Renderer);
}
开发者ID:AMDmi3,项目名称:FallingTime,代码行数:56,代码来源:title.c

示例4: UIShader_Prepare

void InGameMenuScreen::render() {
	UIShader_Prepare();
	UIBegin();
	DrawBackground(1.0f);

	const char *title;
	if (UTF8StringHasNonASCII(game_title.c_str())) {
		title = "(can't display japanese title)";
	} else {
		title = game_title.c_str();
	}

	ui_draw2d.DrawText(UBUNTU48, title, dp_xres / 2, 30, 0xFFFFFFFF, ALIGN_HCENTER);

	int x = 30;
	int y = 50;
	UICheckBox(GEN_ID, x, y += 50, "Show Debug Statistics", ALIGN_TOPLEFT, &g_Config.bShowDebugStats);
	UICheckBox(GEN_ID, x, y += 50, "Show FPS", ALIGN_TOPLEFT, &g_Config.bShowFPSCounter);

	// TODO: Maybe shouldn't show this if the screen ratios are very close...
	UICheckBox(GEN_ID, x, y += 50, "Stretch to display", ALIGN_TOPLEFT, &g_Config.bStretchToDisplay);

	UICheckBox(GEN_ID, x, y += 50, "Hardware Transform", ALIGN_TOPLEFT, &g_Config.bHardwareTransform);
	bool fs = g_Config.iFrameSkip == 1;
	UICheckBox(GEN_ID, x, y += 50, "Frameskip", ALIGN_TOPLEFT, &fs);
	g_Config.iFrameSkip = fs ? 1 : 0;

	// TODO: Add UI for more than one slot.
	HLinear hlinear1(x, y + 80, 20);
	if (UIButton(GEN_ID, hlinear1, LARGE_BUTTON_WIDTH, "Save State", ALIGN_LEFT)) {
		SaveState::SaveSlot(0, 0, 0);
		screenManager()->finishDialog(this, DR_CANCEL);
	}
	if (UIButton(GEN_ID, hlinear1, LARGE_BUTTON_WIDTH, "Load State", ALIGN_LEFT)) {
		SaveState::LoadSlot(0, 0, 0);
		screenManager()->finishDialog(this, DR_CANCEL);
	}

	VLinear vlinear(dp_xres - 10, 160, 20);
	if (UIButton(GEN_ID, vlinear, LARGE_BUTTON_WIDTH, "Continue", ALIGN_RIGHT)) {
		screenManager()->finishDialog(this, DR_CANCEL);
	}
	if (UIButton(GEN_ID, vlinear, LARGE_BUTTON_WIDTH, "Return to Menu", ALIGN_RIGHT)) {
		screenManager()->finishDialog(this, DR_OK);
	}
	
	if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres - 10), LARGE_BUTTON_WIDTH*2, "Debug: Dump Next Frame", ALIGN_BOTTOMRIGHT)) {
		gpu->DumpNextFrame();
	}

	DrawWatermark();
	UIEnd();

	glsl_bind(UIShader_Get());
	ui_draw2d.Flush(UIShader_Get());
}
开发者ID:phaew,项目名称:ppsspp,代码行数:56,代码来源:MenuScreens.cpp

示例5: DrawHighlightedButton

void DrawHighlightedButton(buttonT & button) {
    SetPenColor("ACTIVATED_BACKGROUND");
    DrawBackground(button);
    SetPenColor("ACTIVATED_INNERSHADE");
    DrawInnerShade(button);
    SetPenColor("ACTIVATED_BORDER");
    DrawOutline(button);
    SetPenColor("ACTIVATED_TEXT");
    DrawButtonText(button);
}
开发者ID:Nikvand,项目名称:glass_bonus_challenge,代码行数:10,代码来源:gpathfinder.cpp

示例6: GetClientRect

void TacticsInstrument_WindDirHistory::Draw(wxGCDC* dc)
{
    m_WindowRect = GetClientRect();
    m_DrawAreaRect = GetClientRect();
    m_DrawAreaRect.SetHeight(m_WindowRect.height - m_TopLineHeight - m_TitleHeight);
    m_DrawAreaRect.SetX(m_LeftLegend + 3);
//  wxLogMessage("WindHist: m_WindowRect.height=%d,m_DrawAreaRect.height=%d,m_TopLineHeight=%d,m_TitleHeight=%d", m_WindowRect.height, m_DrawAreaRect.height, m_TopLineHeight, m_TitleHeight);
    DrawBackground(dc);
    DrawForeground(dc);
}
开发者ID:tom-r,项目名称:tactics_pi,代码行数:10,代码来源:wind_history.cpp

示例7: GetItemRectClient

void CDreamSkinWindow::DrawItem(HDC hDC, SKINITEM *pItem, RECT rcItem, WCHAR *wstrTitle)
{
	RECT rcClient = GetItemRectClient(pItem, rcItem);
	DrawBackground(hDC, rcItem, &pItem->skinBk);

	DrawBorder(hDC, &pItem->skinLBorder, &pItem->skinRBorder, &pItem->skinTBorder, &pItem->skinBBorder, rcItem);

	if (wstrTitle)
		DrawTitle(hDC, &pItem->skinTxt, rcClient, wstrTitle);
}
开发者ID:zephyrer,项目名称:dreamskin,代码行数:10,代码来源:DreamSkinWindow.cpp

示例8: UpdateTarget

void GBDebuggerView::Draw() {
	UpdateTarget();
	DrawBackground();
	GBRect box;
	if ( ! target ) {
		DrawStringLeft("No robot selected", 4, 20, 12);
		box.top = kEdgeSpace;
		box.bottom = box.top + kProfileBoxHeight;
		box.right = Width() - kEdgeSpace;
		box.left = box.right - kProfileBoxWidth;
		DrawProfileBox(box);
	} else {
	// draw robot name
		box.left = box.top = kEdgeSpace;
		box.right = Width() - kEdgeSpace;
		box.bottom = box.top + kStatusBoxHeight;
		DrawStatusBox(box);
	// get brain
		const GBStackBrain * sbrain = dynamic_cast<GBStackBrain *>(target->Brain());
		if ( sbrain ) {
		// draw pc
			box.top = box.bottom + kEdgeSpace;
			box.bottom = box.top + kPCBoxHeight;
			box.right -= kHardwareBoxWidth + kEdgeSpace;
			DrawPCBox(box, sbrain);
		// draw stack
			box.top = box.bottom + kEdgeSpace;
			box.bottom = box.top + kStackBoxHeight;
			box.right = (Width() - kHardwareBoxWidth - kEdgeSpace) / 2;
			DrawStackBox(box, sbrain);
		// draw return stack
			box.left = (Width() - kHardwareBoxWidth + kEdgeSpace) / 2;
			box.right = Width() - kHardwareBoxWidth - kEdgeSpace * 2;
			DrawReturnStackBox(box, sbrain);
		// draw variables
			box.top = box.bottom + kEdgeSpace;
			box.bottom = box.top + (sbrain->NumVariables() + sbrain->NumVectorVariables()) * 10 + 15;
			box.left = kEdgeSpace;
			DrawVariablesBox(box, sbrain);
		// draw prints
			box.top = box.bottom + kEdgeSpace;
			box.bottom = box.top + kPrintBoxHeight;
			DrawPrintBox(box, sbrain);
		}
	// draw hardware
		box.top = kStatusBoxHeight + kEdgeSpace * 2;
		box.right = Width() - kEdgeSpace;
		box.left = box.right - kHardwareBoxWidth;
		box.bottom = box.top + kHardwareBoxHeight;
		DrawHardwareBox(box);
	}
// record
	worldChanges = world.ChangeCount();
	redrawAnyway = false;
}
开发者ID:manofsteel76667,项目名称:Grobots_Java,代码行数:55,代码来源:GBDebugger.cpp

示例9: UIShader_Prepare

void SystemScreen::render() {
	UIShader_Prepare();
	UIBegin(UIShader_Get());
	DrawBackground(1.0f);

	I18NCategory *s = GetI18NCategory("System");
	I18NCategory *g = GetI18NCategory("General");

	ui_draw2d.SetFontScale(1.5f, 1.5f);
	ui_draw2d.DrawText(UBUNTU24, s->T("System Settings"), dp_xres / 2, 20, 0xFFFFFFFF, ALIGN_HCENTER);
	ui_draw2d.SetFontScale(1.0f, 1.0f);

	if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres-10), LARGE_BUTTON_WIDTH, 0, g->T("Back"), ALIGN_RIGHT | ALIGN_BOTTOM)) {
		screenManager()->finishDialog(this, DR_OK);
	}

	int x = 30;
	int y = 30;
	int stride = 40;
	int columnw = 400;

	UICheckBox(GEN_ID, x, y += stride, s->T("Dynarec", "Dynarec (JIT)"), ALIGN_TOPLEFT, &g_Config.bJit);
	if (g_Config.bJit)
		UICheckBox(GEN_ID, x, y += stride, s->T("Fast Memory", "Fast Memory (unstable)"), ALIGN_TOPLEFT, &g_Config.bFastMemory);
	UICheckBox(GEN_ID, x, y += stride, s->T("Show Debug Statistics"), ALIGN_TOPLEFT, &g_Config.bShowDebugStats);
	UICheckBox(GEN_ID, x, y += stride, s->T("Show FPS"), ALIGN_TOPLEFT, &g_Config.bShowFPSCounter);

	VGrid vlang(530, 100, dp_yres - 50, 10, 10);

	for (size_t i = 0; i < langs_.size(); i++) {
		std::string code;
		size_t dot = langs_[i].name.find('.');
		if (dot != std::string::npos)
			code = langs_[i].name.substr(0, dot);

		std::string buttonTitle = langs_[i].name;
		if (!code.empty())
			buttonTitle = code;

		if (UIButton(GEN_ID_LOOP(i), vlang, LARGE_BUTTON_WIDTH, 0, buttonTitle.c_str(), ALIGN_TOPLEFT)) {
			std::string oldLang = g_Config.languageIni;
			g_Config.languageIni = code;
			if (i18nrepo.LoadIni(g_Config.languageIni)) {
				// Dunno what else to do here.

				// After this, g and s are no longer valid. Let's return, some flicker is okay.
				g = GetI18NCategory("General");
				s = GetI18NCategory("System");
			} else {
				g_Config.languageIni = oldLang;
			}
		}
	}
	UIEnd();
}
开发者ID:wargio,项目名称:ppsspp,代码行数:55,代码来源:MenuScreens.cpp

示例10: UIShader_Prepare

void DeveloperScreen::render() {
	UIShader_Prepare();
	UIBegin(UIShader_Get());
	DrawBackground(1.0f);

	I18NCategory *g = GetI18NCategory("General");
	I18NCategory *d = GetI18NCategory("Developer");
	I18NCategory *s = GetI18NCategory("System");

	ui_draw2d.SetFontScale(1.5f, 1.5f);
	ui_draw2d.DrawText(UBUNTU24, d->T("Developer Tools"), dp_xres / 2, 10, 0xFFFFFFFF, ALIGN_HCENTER);
	ui_draw2d.SetFontScale(1.0f, 1.0f);

	int x = 50;
	int y = 40;
	const int stride = 40;
	const int w = 400;

	UICheckBox(GEN_ID, x, y += stride, s->T("Show Debug Statistics"), ALIGN_TOPLEFT, &g_Config.bShowDebugStats);

	bool reportingEnabled = Reporting::IsEnabled();
	const static std::string reportHostOfficial = "report.ppsspp.org";
	if (UICheckBox(GEN_ID, x, y += stride, s->T("Enable Compatibility Server Reports"), ALIGN_TOPLEFT, &reportingEnabled)) {
		g_Config.sReportHost = reportingEnabled ? reportHostOfficial : "";
	}

	VLinear vlinear(x, y + stride + 12, 16);

	if (UIButton(GEN_ID, Pos(dp_xres - 10, dp_yres - 10), LARGE_BUTTON_WIDTH, 0, g->T("Back"), ALIGN_RIGHT | ALIGN_BOTTOM)) {
		screenManager()->finishDialog(this, DR_OK);
	}

	if (UIButton(GEN_ID, vlinear, w, 0, d->T("Load language ini"), ALIGN_LEFT)) {
		i18nrepo.LoadIni(g_Config.languageIni);
		// After this, g and s are no longer valid. Need to reload them.
		g = GetI18NCategory("General");
		d = GetI18NCategory("Developer");
	}

	if (UIButton(GEN_ID, vlinear, w, 0, d->T("Save language ini"), ALIGN_LEFT)) {
		i18nrepo.SaveIni(g_Config.languageIni);	
	}

	if (UIButton(GEN_ID, vlinear, w, 0, d->T("Run CPU tests"), ALIGN_LEFT)) {
		// TODO: Run tests
		RunTests();
		// screenManager()->push(new EmuScreen())
	}

	if (UIButton(GEN_ID, vlinear, w, 0, d->T("Dump frame to log"), ALIGN_LEFT)) {
		gpu->DumpNextFrame();
	}

	UIEnd();
}
开发者ID:jack00,项目名称:ppsspp,代码行数:55,代码来源:MenuScreens.cpp

示例11: ASSERT

void CBarGraphEditor::OnPaint()
{
	ASSERT(m_pBackDC != NULL);

	CPaintDC dc(this);
	
	DrawBackground(m_pBackDC, m_iLevels, false, 0);
	DrawRange(m_pBackDC, m_iLevels, 0);

	// Return now if no sequence is selected
	if (!m_pSequence) {
		PaintBuffer(m_pBackDC, &dc);
		return;
	}

	// Draw items
	int Count = m_pSequence->GetItemCount();

	if (!Count) {
		PaintBuffer(m_pBackDC, &dc);
		return;
	}

	int StepWidth = GetItemWidth();
	int StepHeight = m_GraphRect.Height() / m_iLevels;

	if (m_iHighlightedValue > 0 && m_iHighlightedItem >= 0 && m_iHighlightedItem < Count) {
		int x = m_GraphRect.left + m_iHighlightedItem * StepWidth + 1;
		int y = m_GraphRect.top + StepHeight * (m_iLevels - m_iHighlightedValue);
		int w = StepWidth;
		int h = StepHeight * m_iHighlightedValue;
		DrawShadowRect(m_pBackDC, x, y, w, h);
	}

	// Draw items
	for (int i = 0; i < Count; i++) {
		int x = m_GraphRect.left + i * StepWidth + 1;
		int y = m_GraphRect.top + StepHeight * (m_iLevels - m_pSequence->GetItem(i));
		int w = StepWidth;
		int h = StepHeight * m_pSequence->GetItem(i);

		if (m_iCurrentPlayPos == i)
			DrawPlayRect(m_pBackDC, x, y, w, h);
		else if ((m_iHighlightedItem == i) && (m_pSequence->GetItem(i) >= m_iHighlightedValue) && !IsEditLine())
			DrawCursorRect(m_pBackDC, x, y, w, h);
		else
			DrawRect(m_pBackDC, x, y, w, h);
	}
	
	DrawLoopPoint(m_pBackDC, StepWidth);
	DrawReleasePoint(m_pBackDC, StepWidth);
	DrawLine(m_pBackDC);

	PaintBuffer(m_pBackDC, &dc);
}
开发者ID:WhoIsLudwig,项目名称:nesicide,代码行数:55,代码来源:GraphEditor.cpp

示例12: GameOutputFrame

void GameOutputFrame(void)
{
	const float screenYOff =
		(float)MAX(-SCREEN_HEIGHT, SCREEN_Y(camera.Y) - SCREEN_HEIGHT / 2);
	// Draw the background.
	DrawBackground(&BG, screenYOff);

	SpaceDraw(&space, screenYOff);
	PickupsDraw(Screen, screenYOff);
	ParticlesDraw(Screen, screenYOff);

	int c = 0;
	for (int i = 0; i < MAX_PLAYERS; i++)
	{
		PlayerDraw(&players[i], screenYOff);

		if (!players[i].Enabled) continue;

		// Draw each player's current score.
		char buf[17];
		sprintf(buf, "%d", players[i].Score);
		const SDL_Color white = { 255, 255, 255, 255 };
#ifdef TTF
		SDL_Surface *t = TTF_RenderText_Blended(font, buf, white);
#endif
		const int x = (c + 1) * SCREEN_WIDTH / (PlayerEnabledCount() + 1);
#ifdef TTF
		const int wHalf = (t->w + PLAYER_SPRITESHEET_WIDTH) / 2;
#else
		const int wHalf = (16 + PLAYER_SPRITESHEET_WIDTH) / 2;
#endif
		// Draw the player icon, followed by the score number
		SDL_Rect src = {
			0, 0, PLAYER_SPRITESHEET_WIDTH, PLAYER_SPRITESHEET_HEIGHT
		};
		SDL_Rect dest = { (Sint16)(x - wHalf), 0, 0, 0 };
		SDL_BlitSurface(PlayerSpritesheets[i], &src, Screen, &dest);
		// Draw score number
		dest.x = (Sint16)(x - wHalf + PLAYER_SPRITESHEET_WIDTH);
#ifdef TTF
		dest.y = (Sint16)(PLAYER_SPRITESHEET_HEIGHT - t->h) / 2;
#else
		dest.y = (Sint16)(PLAYER_SPRITESHEET_HEIGHT - 16) / 2;
#endif
		
#ifdef TTF
		SDL_BlitSurface(t, NULL, Screen, &dest);
		SDL_FreeSurface(t);
#endif

		c++;
	}

	SDL_Flip(Screen);
}
开发者ID:gameblabla,项目名称:fallingtime,代码行数:55,代码来源:game.c

示例13: dc

void ControlToolBar::OnPaint(wxPaintEvent & evt)
{
   wxPaintDC dc(this);

   int width, height;
   GetSize(&width, &height);


   #if defined __WXMAC__
      // Mac has an Aqua background...
      DrawBackground(dc, width, height); 
   #else
      if (mShowTools)
      {
         //TODO: Get rid of all the magic numbers used in sizing.
         // On other platforms put the big buttons on a beveled platform.
         DrawBackground(dc, 81, height);
         // Width is reduced by an extra two pixels to visually separate
         // the control toolbar from the next grab bar on the right.
         wxRect bevelRect( 81, 0, width-84, height-1 );
         AColor::Bevel( dc, true, bevelRect );
      }
      else
      {
         DrawBackground(dc, width, height); 
         wxRect bevelRect(0, 0, width - 1, height - 1);
         AColor::Bevel(dc, true, bevelRect);
      }
   #endif

   #ifndef __WXMAC__
      if (mShowTools)
      {
         // JKC: Grey horizontal spacer line between buttons.
         // Not quite ideal, but seems the best solution to 
         // make the tool button heights add up to the 
         // main control button height.
         AColor::Dark( &dc, false);
         dc.DrawLine(0, 27, 81, 27);
      }
   #endif
}
开发者ID:andreipaga,项目名称:audacity,代码行数:42,代码来源:ControlToolBar.cpp

示例14: EraseScreen

VOID EraseScreen(VOID)
{
    RC rc;
    HDC HdcSet();

    if(!FGetHdc())
        return;
    GetClientRect(hwndApp, (LPRECT) &rc);
    DrawBackground(rc.xLeft, rc.yTop, rc.xRight, rc.yBot);
    ReleaseHdc();
}
开发者ID:andyvand,项目名称:ms-ported,代码行数:11,代码来源:util.c

示例15: DrawBackground

void JMChattControl::SetBackImage(Bitmap* strImageFileName, bool bRedraw)
{

	__stScreenInfo.pBitmapBackground = strImageFileName;


	DrawBackground(__pCanvasBack);

	if( bRedraw )
		this->RequestRedraw();
}
开发者ID:JunminLee,项目名称:Winwin,代码行数:11,代码来源:JMChattControl.cpp


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