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


C++ Blit函数代码示例

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


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

示例1: while

void TEXTEDITBOX::GetInput(char Stringx[100]){
	MSG Msg;
	//save the original programflow variable to change it back later.
	int ProgramFlowTemp=Pass.ProgramFlow;
	Pass.ProgramFlow=PF_TEXTEDITBOX;
	Info=TEBI_NOTHING;
	//display the text box on the screen.

	//message loop
	while(Info!=TEBI_DONE){
		UpdateBox();
		if(!GetMessage(&Msg, NULL, 0, 0)){
   			//if they're trying to quit...
			Pass.SettingsInfo=SETTINGS_EXIT;
			Pass.ProgramFlow=PF_EXIT;
			Info=TEBI_DONE;
		}
		TranslateMessage(&Msg);
		DispatchMessage(&Msg);
	}	
	if(Pass.ProgramFlow!=PF_EXIT) Pass.ProgramFlow=ProgramFlowTemp;
	//now put the screen back together again.
	Blit(Pass.DDFront, StorageSurface, 0, 0, TEXTENTRYBOX_WIDTH, TEXTENTRYBOX_HEIGHT,
						TEXTENTRYBOX_LEFT, TEXTENTRYBOX_TOP);
	Blit(Pass.DDBack, StorageSurface, 0, 0, TEXTENTRYBOX_WIDTH, TEXTENTRYBOX_HEIGHT,
                         TEXTENTRYBOX_LEFT, TEXTENTRYBOX_TOP);
	lstrcpy(Stringx, String);
}
开发者ID:thenfour,项目名称:Archives,代码行数:28,代码来源:texteditbox.cpp

示例2: DrawObjectiveInfo

static void DrawObjectiveInfo(
	const struct MissionOptions *mo, const int idx, const Vec2i pos)
{
	const MissionObjective *mobj =
		CArrayGet(&mo->missionData->Objectives, idx);
	const ObjectiveDef *o = CArrayGet(&mo->Objectives, idx);
	const CharacterStore *store = &gCampaign.Setting.characters;

	switch (mobj->Type)
	{
	case OBJECTIVE_KILL:
		{
			const Character *cd = CArrayGet(
				&store->OtherChars, CharacterStoreGetSpecialId(store, 0));
			const int i = cd->looks.face;
			TOffsetPic pic;
			pic.picIndex = cHeadPic[i][DIRECTION_DOWN][STATE_IDLE];
			pic.dx = cHeadOffset[i][DIRECTION_DOWN].dx;
			pic.dy = cHeadOffset[i][DIRECTION_DOWN].dy;
			DrawTTPic(
				pos.x + pic.dx, pos.y + pic.dy,
				PicManagerGetOldPic(&gPicManager, pic.picIndex), &cd->table);
		}
		break;
	case OBJECTIVE_RESCUE:
		{
			const Character *cd = CArrayGet(
				&store->OtherChars, CharacterStoreGetPrisonerId(store, 0));
			const int i = cd->looks.face;
			TOffsetPic pic;
			pic.picIndex = cHeadPic[i][DIRECTION_DOWN][STATE_IDLE];
			pic.dx = cHeadOffset[i][DIRECTION_DOWN].dx;
			pic.dy = cHeadOffset[i][DIRECTION_DOWN].dy;
			DrawTTPic(
				pos.x + pic.dx, pos.y + pic.dy,
				PicManagerGetOldPic(&gPicManager, pic.picIndex), &cd->table);
		}
		break;
	case OBJECTIVE_COLLECT:
		{
			const Pic *p = o->pickupClass->Pic;
			Blit(&gGraphicsDevice, p, Vec2iAdd(pos, p->offset));
		}
		break;
	case OBJECTIVE_DESTROY:
		{
			Vec2i picOffset;
			const Pic *p =
				MapObjectGetPic(IntMapObject(mobj->Index), &picOffset, false);
			Blit(&gGraphicsDevice, p, Vec2iAdd(pos, picOffset));
		}
		break;
	case OBJECTIVE_INVESTIGATE:
		// Don't draw
		return;
	default:
		CASSERT(false, "Unknown objective type");
		return;
	}
}
开发者ID:Gokulakrishnansr,项目名称:cdogs-sdl,代码行数:60,代码来源:briefing_screens.c

示例3: CreditsProc

int CreditsProc(PASSPROCVARS Params){
	int r=0;
	r+=ccbOK.ProcFunction(Params);
	if(r){
		//we have to flip the screen
		Flip(Pass.DDFront);
		Blit(Pass.DDBack, ddsCredits, 0, 0, 640, 480, 0, 0);
	}
//now handle some messages
	switch(Params.uMsg){
	case WM_CLOSE:
		Pass.ProgramFlow=PF_EXIT;
		CreditsInfo=CREDITS_EXIT;
		break;
	case WM_PAINT:
		ddsCredits->Restore();
		ddsCreditsh->Restore();
		DDReLoadBitmap(ddsCredits,BMP_CREDITS);
		DDReLoadBitmap(ddsCreditsh,BMP_CREDITSH);
		Blit(Pass.DDFront, ddsCredits, 0, 0, 640, 480, 0, 0);
		Blit(Pass.DDBack, ddsCredits, 0, 0, 640, 480, 0, 0);
		break;
	case WM_KEYDOWN:
   	switch(Params.wParam){
      	case VK_ESCAPE:
         	CreditsInfo=CREDITS_EXIT;
         break;
      }
	break;
	}
	return 0;
}
开发者ID:thenfour,项目名称:Archives,代码行数:32,代码来源:credits.cpp

示例4: settingsRedrawScreen

void settingsRedrawScreen(){
	ScreenHighlighted->Restore();
	ScreenUnhighlighted->Restore();
	DDReLoadBitmap(ScreenHighlighted,BMP_SETTINGSH);
	DDReLoadBitmap(ScreenUnhighlighted,BMP_SETTINGS);
	DrawString("Setting up alpha table/@", 0, 0, 8);
	Blit(Pass.DDFront, ScreenUnhighlighted, 0, 0, 640, 480, 0, 0);
	Blit(Pass.DDBack, ScreenUnhighlighted, 0, 0, 640, 480, 0, 0);
}
开发者ID:thenfour,项目名称:Archives,代码行数:9,代码来源:settings.cpp

示例5: image

void dd_Window::activate()
{
	image *tempimg = new image(xres,yres);
	Blit(0,0,img,tempimg);
	if(bActive)
		return;
	bActive = true;
	set_win(xres,yres,vid_bpp);
	Blit(0,0,tempimg,img);
	if(bVisible)
		ShowWindow(hwnd,SW_SHOWNA);
}
开发者ID:Bananattack,项目名称:verge3,代码行数:12,代码来源:vid_ddbase.cpp

示例6: Mouvement_depart

void Mouvement_depart(SDL_Surface *ecran, int *a)
{
    Blit(ecran, TAILLE_X/8*7-TAILLE_CARRE,TAILLE_Y/8-TAILLE_CARRE,TAILLE_CARRE*2,TAILLE_CARRE*2,255,0,255);
    Blit(ecran, TAILLE_X/8*7-TAILLE_CARRE,TAILLE_Y/8*7-TAILLE_CARRE,TAILLE_CARRE*2,TAILLE_CARRE*2,255,0,255);

    if(a[1]<=TAILLE_Y/8+TAILLE_CARRE) a[3]= 6;
    else if(a[1]>=TAILLE_Y/8*7-TAILLE_CARRE*2) a[3]= -6;

    a[1] += a[3];

    Blit(ecran,a[0],a[1],TAILLE_CARRE,TAILLE_CARRE,255,0,0);

}
开发者ID:mniank,项目名称:c-stuff,代码行数:13,代码来源:Longer_Higher.c

示例7: calcBlitsInt

static BlitVec calcBlitsInt(ColumnVec &srcCols, ColumnVec &dstCols)
{
	BlitVec blits;

	/* Using signed indices here is safer, as we
	 * might decrement dstI while it is zero. */
	int dstI = 0;

	for (size_t srcI = 0; srcI < srcCols.size(); ++srcI)
	{
		Column &srcCol = srcCols[srcI];

		for (; dstI < (int) dstCols.size() && srcCol.h > 0; ++dstI)
		{
			Column &dstCol = dstCols[dstI];

			if (srcCol.h > dstCol.h)
			{
				/* srcCol doesn't fully fit into dstCol */
				blits.push_back(Blit(srcCol.x, srcCol.y,
				                     dstCol.x, dstCol.y, dstCol.h));

				srcCol.y += dstCol.h;
				srcCol.h -= dstCol.h;
			}
			else if (srcCol.h < dstCol.h)
			{
				/* srcCol fits into dstCol with space remaining */
				blits.push_back(Blit(srcCol.x, srcCol.y,
				                     dstCol.x, dstCol.y, srcCol.h));

				dstCol.y += srcCol.h;
				dstCol.h -= srcCol.h;

				/* Queue this column up again for processing */
				--dstI;

				srcCol.h = 0;
			}
			else
			{
				/* srcCol fits perfectly into dstCol */
				blits.push_back(Blit(srcCol.x, srcCol.y,
				                     dstCol.x, dstCol.y, dstCol.h));
			}
		}
	}

	return blits;
}
开发者ID:Lobomon,项目名称:mkxp,代码行数:50,代码来源:tileatlas.cpp

示例8: Blit

///////////////////////////////////////////////////////////
/// Stretch blit
///////////////////////////////////////////////////////////
void Bitmap::StretchBlit(Rect dst_rect, Bitmap* src_bitmap, Rect src_rect, int opacity) {
	if (src_rect.width == dst_rect.width && src_rect.height == dst_rect.height) {
		Blit(dst_rect.x, dst_rect.y, src_bitmap, src_rect, opacity);
	} else {
		src_rect.Adjust(src_bitmap->GetWidth(), src_bitmap->GetHeight());
		if (src_rect.IsOutOfBounds(src_bitmap->GetWidth(), src_bitmap->GetHeight())) return;

		Bitmap* resampled = src_bitmap->Resample(dst_rect.width, dst_rect.height, src_rect);
		Rect rect(0, 0, dst_rect.width, dst_rect.height);
		Blit(dst_rect.x, dst_rect.y, resampled, rect, opacity);
		delete resampled;
	}

	Changed();
}
开发者ID:cstrahan,项目名称:argss,代码行数:18,代码来源:bitmap.cpp

示例9: GetExtent

void Image::Resize(const Extent3D& extent, const ColorRGBAd& fillColor, const Offset3D& offset)
{
    if (extent != GetExtent())
    {
        /* Store ownership of current image buffer in temporary image */
        Image prevImage;

        prevImage.extent_   = GetExtent();
        prevImage.format_   = GetFormat();
        prevImage.dataType_ = GetDataType();
        prevImage.data_     = std::move(data_);

        if ( extent.width  > GetExtent().width  ||
             extent.height > GetExtent().height ||
             extent.depth  > GetExtent().depth )
        {
            /* Resize image buffer with fill color */
            extent_ = extent;
            data_   = GenerateImageBuffer(GetFormat(), GetDataType(), GetNumPixels(), fillColor);
        }
        else
        {
            /* Resize image buffer with uninitialized image buffer */
            extent_ = extent;
            data_   = GenerateEmptyByteBuffer(GetDataSize(), false);
        }

        /* Copy previous image into new image */
        Blit(offset, prevImage, { 0, 0, 0 }, prevImage.GetExtent());
    }
}
开发者ID:LukasBanana,项目名称:LLGL,代码行数:31,代码来源:Image.cpp

示例10: Surface

void VideoSystem::DrawRectAlpha(SDL_Rect *r, Uint32 color) {
#if 0
    SDL_Surface *surf = Surface(r->w, r->h, screen->format->BitsPerPixel);
    if (!surf)
        return;

    for (int y=0;y<surf->h;y++) {
        Uint16 *src = (Uint16*)(screen->pixels + ((r->y+y)*screen->pitch) + (r->x*2));
        Uint16 *dst = (Uint16*)(surf->pixels + (y*surf->pitch));
        for (int x=0;x<surf->w;x++) {
            Uint8 r1, g1, b1;
            Uint8 r2, g2, b2;
            int r3, g3, b3;
            Uint16 px;
            SDL_GetRGB(*src, screen->format, &r1, &g1, &b1);
            SDL_GetRGB(color, surf->format, &r2, &g2, &b2);
            r3 = std::min(255, ((r1*256)/256 + (r2*256)/256));
            g3 = std::min(255, ((g1*256)/256 + (g2*256)/256));
            b3 = std::min(255, ((b1*256)/256 + (b2*256)/256));
            px = SDL_MapRGB(surf->format, r3, g3, b3);
            *dst = px;
            src++;
        }
    }
    Blit(surf, NULL, r);
    SDL_FreeSurface(surf);
#endif
}
开发者ID:thuskey,项目名称:sidescroller,代码行数:28,代码来源:videosystem.cpp

示例11: Fastclic

int Fastclic(SDL_Surface *ecran)
{
    int score=0;
    int combo=0;
    int temps=SDL_GetTicks();
    int carre_x[20]={-1}, carre_y[20]={-1}, carre_t[20]={-1}, carre_c[20]={255};

    while(Genere_carre(ecran,carre_x,carre_y,carre_t,carre_c) && !Situation.exit)
    {
        SDL_Flip(ecran);
        Blit(ecran,0,0,TAILLE_X,TAILLE_Y,0,0,0);
        Changer_situation();
        switch(Gerer_clic(carre_x, carre_y, carre_t))
        {
            case 1: combo+=N; score += combo; break;
            case -1: combo=0; break;
            case 0: break;
        }
        if(combo >= 5*N*(N+2)) N++;

        Affichage_score2(ecran,score*100,TAILLE_X-67,TAILLE_Y-15);

        temps=SDL_GetTicks()-temps;
        if(temps<15) SDL_Delay(15- temps);
        temps=SDL_GetTicks();
    }

    return score*100;
}
开发者ID:mniank,项目名称:c-stuff,代码行数:29,代码来源:Fastclic.c

示例12: Blit

void PixmanBitmap::FlipBlit(int x, int y, Bitmap* _src, Rect src_rect, bool horizontal, bool vertical) {
	if (!horizontal && !vertical) {
		Blit(x, y, _src, src_rect, 255);
		return;
	}

	PixmanBitmap* src = (PixmanBitmap*) _src;

	pixman_transform_t xform;
	pixman_transform_init_scale(&xform,
								pixman_int_to_fixed(horizontal ? -1 : 1),
								pixman_int_to_fixed(vertical ? -1 : 1));

	pixman_transform_translate((pixman_transform_t*) NULL, &xform,
							   pixman_int_to_fixed(horizontal ? src_rect.width : 0),
							   pixman_int_to_fixed(vertical ? src_rect.height : 0));

	pixman_image_set_transform(bitmap, &xform);

	pixman_image_composite32(PIXMAN_OP_SRC,
							 src->bitmap, (pixman_image_t*) NULL, bitmap,
							 src_rect.x, src_rect.y,
							 0, 0,
							 x, y,
							 src_rect.width, src_rect.height);

	pixman_transform_init_identity(&xform);
	pixman_image_set_transform(bitmap, &xform);

	RefreshCallback();
}
开发者ID:take-cheeze,项目名称:EasyRPG,代码行数:31,代码来源:pixman_bitmap.cpp

示例13: SettingsWindowProc

int SettingsWindowProc(PASSPROCVARS Params){
	int r=0;
	r+=cbHighScores.ProcFunction(Params);
	r+=cbPlay.ProcFunction(Params);
	r+=cbExit.ProcFunction(Params);
	r+=cbOptions.ProcFunction(Params);
	r+=cbCredits.ProcFunction(Params);

	if(r){
//DrawString("Setting up alpha table/@", 0, 10, 8);
//DrawString("Setting up alpha table/@", 0, 20, 12);
//DrawString("Setting up alpha table/@", 0, 35, 13);
//DrawString("Setting up alpha table/@", 0, 50, 21);
		Flip(Pass.DDFront);
		Blit(Pass.DDBack, ScreenUnhighlighted, 0,0,640,480,0,0);
	}
	switch(Params.uMsg){
	case WM_PAINT:
		settingsRedrawScreen();
		break;
	case WM_CLOSE:
		Pass.SettingsInfo=SETTINGS_EXIT;
		Pass.ProgramFlow=PF_EXIT;
		break;
	}

return 0;
}
开发者ID:thenfour,项目名称:Archives,代码行数:28,代码来源:settings.cpp

示例14: DrawEndGame

int DrawEndGame(void *pCtx, state *ptr) {
	attron(A_BOLD | A_BLINK);
	mvprintw(14, 9, "GAME OVER");
	attroff(A_BOLD | A_BLINK);
	Blit(pCtx);
	return 0;
}
开发者ID:snehaltiwari10,项目名称:pacman_project,代码行数:7,代码来源:render.c

示例15: OBJECT_TO_JSVAL

int
Stage::DrawScreen(int h) {
	jsval rval;
	int x, y, ytimesw;

	if (SDL_MUSTLOCK(screen)) {
		if (SDL_LockSurface(screen) < 0) {
			return 0;
		}
	}

	jsval argv[5];
	argv[0] = OBJECT_TO_JSVAL(screenArrayBuffer);
	argv[1] = INT_TO_JSVAL(WIDTH);
	argv[2] = INT_TO_JSVAL(HEIGHT);
	argv[3] = INT_TO_JSVAL(screen->pitch);
	argv[4] = INT_TO_JSVAL(BPP);
	JSBool ok = JS_CallFunctionName(cx, global, "paint", 5, argv, &rval);


	Blit((char *)screen->pixels, screenBuffer, screenBufferSize);

	if (SDL_MUSTLOCK(screen))
		SDL_UnlockSurface(screen);

	SDL_Flip(screen);
}
开发者ID:EgoIncarnate,项目名称:Broadway264,代码行数:27,代码来源:Stage.cpp


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