您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DrawTexture函数代码示例

51自学网 2021-06-01 20:30:16
  C++
这篇教程C++ DrawTexture函数代码示例写得很实用,希望能帮到您。

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

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

示例1: DrawString

		bool DrawString( int x, int y, std::string str, unsigned int color = 0xFFFFFFFF, Font* fnt = 0, int caretpos = -1 )		{			if( fnt == 0 )				fnt = mDefaultFont;			int charpos = 0;			int caretx = -1;			for( int i = 0; i < (int)str.length( ); i++ )			{				char thischar = str[i];				DrawTexture( x + charpos, y, fnt->GetCharSizeX( ), fnt->GetCharSizeY( ), fnt->GetCharTexX( thischar ), 					fnt->GetCharTexY( thischar ), fnt->GetCharSizeX( ), fnt->GetCharSizeY( ), fnt->GetTexture( ), 					color, true );				if( i == caretx )					caretx = charpos;				charpos += fnt->GetCharWidth( thischar );			}			if( caretpos >= 0 && GetTickCount( ) % 1500 > 750 )			{				if( caretx < 0 )					caretx = charpos;				caretx -= ( fnt->GetCharWidth( '|' ) / 2 ) - 1;				DrawTexture( x + caretx, y, fnt->GetCharSizeX( ), fnt->GetCharSizeY( ), fnt->GetCharTexX( '|' ),					fnt->GetCharTexY( '|' ), fnt->GetCharSizeX( ), fnt->GetCharSizeY( ), fnt->GetTexture( ),					color, true );			}			return true;		};
开发者ID:brett19,项目名称:Ikarus,代码行数:33,


示例2: BlurGI

void BlurGI(RenderTarget *rt) {	blurRT->Bind();	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);	blurYShader.Bind();	blurYShader.SetUniform("resolution", (float)blurRT->Size(), (float)blurRT->Size());	// テクスチャ描画	glActiveTexture(GL_TEXTURE0);	glBindTexture(GL_TEXTURE_2D, rt->Texture());	blurYShader.SetUniform("texture", (int)0);	DrawTexture(0, 0, 1, 1);	blurYShader.Unbind();		rt->Bind();	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);	blurXShader.Bind();	blurXShader.SetUniform("resolution", (float)rt->Size(), (float)rt->Size());	// テクスチャ描画	glActiveTexture(GL_TEXTURE0);	glBindTexture(GL_TEXTURE_2D, blurRT->Texture());	blurXShader.SetUniform("texture", (int)0);	DrawTexture(0, 0, 1, 1);		blurXShader.Unbind();	}
开发者ID:RobertBeckebans,项目名称:rsm,代码行数:29,


示例3: GetColor

void GUIControl::Draw(){	if(IsVisible())	{		if(GetTexture())		{				COLOR4 c = GetColor();			glColor4ub(c.r, c.g, c.b, c.a);			if(GetCurrentPattern() == 0)			{				DrawTexture(GetX(), GetY(),					0, 0,					GetWidth(), GetHeight(),					GetTexture(),					false, false, 100, 100);			}			else			{				DrawTexture(GetX(), GetY(),					GetCurrentPattern() * GetWidth(),					0,					GetCurrentPattern() * GetWidth() + GetWidth(),					GetHeight(),					GetTexture(),					false, false, 100, 100);			}		}		if(GetCaption() && GetCaptionFont())		{			COLOR4 c = GetCurrentCaptionColor();			glColor4ub(c.r, c.g, c.b, c.a);			PrintText(GetCaption(),				GetCaptionFont(),				GetX() + GetCaptionX(),				GetY() + GetCaptionY());		}		if(GetBorder())		{			if(GetBorderType() == btAlways)			{				Box(GetX(), GetY(), GetWidth(), GetHeight());			}			else if(GetBorderType() == btOnMouseMove)			{				if(_draw_border)					Box(GetX(), GetY(), GetWidth(), GetHeight());			}		}	}}
开发者ID:lightsgoout,项目名称:interview,代码行数:54,


示例4: glMatrixMode

	// Draw texture.	MapilVoid GLSprite::DrawTexture(	SharedPointer < Texture > pTexture,										ImageTransformationMethod method,										const Vector2 < MapilFloat32 >& v )	{		// If texture hasn't been created, this function returns immediately.		if( !pTexture.GetPointer() ){			return;		}		// Set up the transformation matrix for the image.		glMatrixMode( GL_MODELVIEW );		glPushMatrix();		// Set up the transformation matrix for the image.		switch( method ){			case IMAGE_TRANSFORMATION_METHOD_MOVE:				glTranslatef( v.m_X, v.m_Y, 0.0f );				break;			default:				break;		}		// Draw texture.		DrawTexture( pTexture );		glFlush();		// Restore the transformation matrix.		glPopMatrix();	}
开发者ID:nutti,项目名称:MAPIL,代码行数:30,


示例5: DrawOptions

/* * Cheats Code Options Menu */void DrawOptions(struct option_entry option, u8 alpha, int y_inc, int selIndex){    if (!option.name || !option.value)        return;        int c = 0, yOff = 80, cIndex = 0;        int maxPerPage = (512 - (yOff * 2)) / y_inc;    int startDrawX = selIndex - (maxPerPage / 2);    int max = maxPerPage + startDrawX;        SetFontSize(y_inc-6, y_inc-4);    for (c = startDrawX; c < max; c++)    {        if (c >= 0 && c < option.size)        {            SetFontColor(0x00000000 | ((alpha * CalculateAlphaList(c, selIndex, maxPerPage)) / 0xFF), 0);                        if (option.name[c])                DrawString(MENU_SPLIT_OFF + MENU_ICON_OFF, yOff, option.name[c]);                        //Selector            if (c == selIndex)            {                int i = 0;				for (i = MENU_SPLIT_OFF; i < 848; i++)					DrawTexture(menu_textures[mark_line_png_index], i, yOff, 0, menu_textures[mark_line_png_index].texture.width, menu_textures[mark_line_png_index].texture.height, 0xFFFFFF00 | alpha);            }                        cIndex++;        }        yOff += y_inc;    }}
开发者ID:Dnawrkshp,项目名称:ArtemisPS3,代码行数:38,


示例6: BltSmartBuffer

void BltSmartBuffer(IDirect3DDevice9* Device){    if (SmartGlobal != nullptr)    {        std::uint8_t* Ptr = reinterpret_cast<std::uint8_t*>(SmartGlobal->dbg);        for (int I = 0; I < SmartGlobal->height; ++I)        {            for (int J = 0; J < SmartGlobal->width; ++J)            {                std::uint8_t B = *(Ptr++);                std::uint8_t G = *(Ptr++);                std::uint8_t R = *(Ptr++);                *(Ptr++) = (B == 0 && G == 0 && R == 0) ? 0 : 0xFF;            }        }        if (!Texture) /**Set Device->Reset for more info.**/        {            LoadTexture(Device, static_cast<unsigned char*>(SmartGlobal->dbg), SmartGlobal->width, SmartGlobal->height, Texture);        }        /*else        {            memcpy(TexturePixels, SmartGlobal->dbg, SmartGlobal->width * SmartGlobal->height * 4);        }*/        DrawTexture(Device, Texture, 0, 0, SmartGlobal->width, SmartGlobal->height);        SafeRelease(Texture);    }}
开发者ID:Brandon-T,项目名称:DXI,代码行数:29,


示例7: Render

int Render() {	RenderVPL();	RenderVPLPos();	RenderVPLNormal();	RenderGI();	for (int i = 0; i < 6; i ++)		BlurGI(giRT);	RenderShadowmap();	RenderObject();		glViewport(0, 0, windowWidth, windowHeight);	glBindFramebuffer(GL_FRAMEBUFFER, 0);	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);	postShader.Bind();	// テクスチャ描画	glActiveTexture(GL_TEXTURE0);	glBindTexture(GL_TEXTURE_2D, cameraRT->Texture());	postShader.SetUniform("texture", (int)0);	postShader.SetUniform("resolution", (float)windowWidth, (float)windowHeight);	postShader.SetUniform("time", (float)SDL_GetTicks());	DrawTexture(0, 0, 1, 1);	postShader.Unbind();		SDL_GL_SwapBuffers();	return 0;}
开发者ID:RobertBeckebans,项目名称:rsm,代码行数:29,


示例8: GetMaxGLTexCoords

DWORD SpoutSenderSDK2::ProcessOpenGL(ProcessOpenGLStruct *pGL){		// We need a texture to process	if (pGL->numInputTextures < 1) return FF_FAIL;	if (pGL->inputTextures[0] == NULL) return FF_FAIL;  	FFGLTextureStruct &InputTexture = *(pGL->inputTextures[0]);	// get the max s,t that correspond to the width, height	// of the used portion of the allocated texture space	FFGLTexCoords maxCoords = GetMaxGLTexCoords(InputTexture);	// Draw now whether a sender has initialized or not	DrawTexture(InputTexture.Handle, maxCoords);	// If there is no sender name yet, the sender cannot be created	if(!UserSenderName[0]) {		return FF_SUCCESS; // keep waiting for a name	}		// Otherwise create a sender if not initialized yet	else if(!bInitialized) {		// Update the sender name		strcpy_s(SenderName, 256, UserSenderName); 		// Set global width and height so any change can be tested		m_Width  = (unsigned int)InputTexture.Width;		m_Height = (unsigned int)InputTexture.Height;		// Create a new sender		bInitialized = sender.CreateSender(SenderName, m_Width, m_Height);		if(!bInitialized) {			sender.spout.SelectSenderPanel("Could not create sender/nTry another name");			UserSenderName[0] = 0; // wait for another name to be entered		}		return FF_SUCCESS; // give it one frame to initialize	}	// Has the texture size or user entered sender name changed	else if(m_Width  != (unsigned int)InputTexture.Width 	 || m_Height != (unsigned int)InputTexture.Height	 || strcmp(SenderName, UserSenderName) != 0 ) {			// Release existing sender			sender.ReleaseSender();			bInitialized = false;			return FF_SUCCESS; // return for initialization on the next frame	}	// Render the Freeframe texture into the shared texture	// Important - pass the FFGL host FBO to restore the binding because Spout uses a local fbo	// Default aspect = 1.0, default invert flag = true	if(bMemoryMode)		sender.SendTexture(InputTexture.Handle, GL_TEXTURE_2D, m_Width, m_Height);	else		sender.DrawToSharedTexture(InputTexture.Handle, GL_TEXTURE_2D,  m_Width, m_Height, (float)maxCoords.s, (float)maxCoords.t, 1.0f, true, pGL->HostFBO);	return FF_SUCCESS;}
开发者ID:demondias,项目名称:Spout2,代码行数:59,


示例9: RenderObject

void RenderObject() {	cameraRT->Bind();	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);		glEnable(GL_DEPTH_TEST);	shader.Bind();	shader.SetUniform("resolution", (float)cameraRT->Size(),  (float)cameraRT->Size());	shader.SetUniform("uAmbient", ambient[0], ambient[1], ambient[2], ambient[3]);	shader.SetUniform("uLightIntensity", lightIntensity[0], lightIntensity[1], lightIntensity[2], lightIntensity[3]);	glActiveTexture(GL_TEXTURE0);	glBindTexture(GL_TEXTURE_2D, lightRT->Texture());	shader.SetUniform("shadowMap", (int)0);		glActiveTexture(GL_TEXTURE1);	glBindTexture(GL_TEXTURE_2D, giRT->Texture());	shader.SetUniform("giTexture", (int)1);	SetMatrix(shader);	DrawObjects(shader);	shader.Unbind();	// テクスチャ描画	const float aspect = (float)windowWidth / windowHeight;	glActiveTexture(GL_TEXTURE0);	glBindTexture(GL_TEXTURE_2D, lightRT->Texture());	DrawTexture(0.9f, -0.8f, 0.1f, 0.1f * aspect);		glBindTexture(GL_TEXTURE_2D, vplRT->Texture());	DrawTexture(0.6f, -0.8f, 0.1f, 0.1f * aspect);		glBindTexture(GL_TEXTURE_2D, vplPosRT->Texture());	DrawTexture(0.3f, -0.8f, 0.1f, 0.1f * aspect);		glBindTexture(GL_TEXTURE_2D, vplNormalRT->Texture());	DrawTexture(0.0f, -0.8f, 0.1f, 0.1f * aspect);		glBindTexture(GL_TEXTURE_2D, giRT->Texture());	DrawTexture(-0.3f, -0.8f, 0.1f, 0.1f * aspect);}
开发者ID:RobertBeckebans,项目名称:rsm,代码行数:46,


示例10: DrawGameList

/* * Cheats Codes Selection Menu */void DrawGameList(int selIndex, struct game_entry * games, int glen, u8 alpha){    SetFontSize(14, 16);	SetCurrentFont(font_comfortaa_regular);        int game_y = 80, y_inc = 20;    int maxPerPage = (512 - (game_y * 2)) / y_inc;        int x = selIndex - (maxPerPage / 2);    int max = maxPerPage + selIndex;        if (max > glen)        max = glen;            for (; x < max; x++)    {        int xo = 0; //(((selIndex - x) < 0) ? -(selIndex - x) : (selIndex - x));                if (x >= 0)        {			u8 a = ((alpha * CalculateAlphaList(x, selIndex, maxPerPage)) / 0xFF);			if (isGameActivated(games[x]))			{				DrawTextureCentered(menu_textures[mark_arrow_png_index], MENU_ICON_OFF + (MENU_TITLE_OFF / 2), game_y + (y_inc / 2), 0, MENU_TITLE_OFF / 3, y_inc / 2, 0xFFFFFF00 | a);			}            SetFontColor(0x00000000 | a, 0x00000000);			if (games[x].name)			{				char * nBuffer = (char*)malloc(strlen(games[x].name));				strcpy(nBuffer, games[x].name);				int game_name_width = 0;				while ((game_name_width = WidthFromStr(nBuffer)) > 0 && (MENU_ICON_OFF + (MENU_TITLE_OFF * 1) - xo + game_name_width) > (800 - (MENU_ICON_OFF * 3) - xo))					nBuffer[strlen(nBuffer) - 1] = '/0';				DrawString(MENU_ICON_OFF + (MENU_TITLE_OFF * 1) - xo, game_y, nBuffer);				free(nBuffer);			}			if (games[x].title_id)				DrawString(800 - (MENU_ICON_OFF * 3) - xo, game_y, games[x].title_id);			if (games[x].version)				DrawString(800 - (MENU_ICON_OFF * 1) - xo, game_y, games[x].version);        }                if (x == selIndex)        {            int c;            for (c = 0; c < 848; c++)				DrawTexture(menu_textures[mark_line_png_index], c, game_y, 0, menu_textures[mark_line_png_index].texture.width, menu_textures[mark_line_png_index].texture.height, 0xFFFFFF00 | alpha);        			DrawTextureCenteredX(menu_textures[mark_arrow_png_index], MENU_ICON_OFF - 20, game_y, 0, (2 * y_inc) / 3, y_inc + 2, 0xFFFFFF00 | alpha);		}                game_y += y_inc;    }        DrawScrollBar(selIndex, glen, y_inc, 800, alpha);    }
开发者ID:Dnawrkshp,项目名称:ArtemisPS3,代码行数:61,


示例11: DrawTexture

void UUTBetrayalScoreboard::DrawDaggers(AUTBetrayalPlayerState* PRI, float RenderDelta, float XOffset, float YOffset){	float BarOpacity = 0.75f;	float DaggerAspect = DaggerTexCoords.VL == 0.0 ? 0.0 : DaggerTexCoords.UL / DaggerTexCoords.VL;	if (PRI->BetrayalCount >= 100)	{		// draw simple format "x NUM"		DrawTexture(UT3GHudTexture, XOffset, YOffset, 32 * DaggerAspect, 32, DaggerTexCoords.U, DaggerTexCoords.V, DaggerTexCoords.UL, DaggerTexCoords.VL, BarOpacity, FLinearColor::White);		XOffset += 32 * DaggerAspect + (DaggerSpacing * RenderScale);		FText DaggerString = FText::Format(NSLOCTEXT("UTBetrayalScoreboard", "DaggersShortString", "x {0}"), FText::AsNumber(PRI->BetrayalCount));		DrawText(DaggerString, XOffset, YOffset + ColumnY, UTHUDOwner->SmallFont, 1.0f, 1.0f, FLinearColor::Gray, ETextHorzPos::Left, ETextVertPos::Center);	}	else	{		int32 NumGoldDaggers = PRI->BetrayalCount / 5;		int32 NumSilverDaggers = PRI->BetrayalCount % 5;		//Start drawing the daggers		for (int32 i = 0; i < NumGoldDaggers; i++)		{			DrawTexture(UT3GHudTexture, XOffset, YOffset, 32 * DaggerAspect, 32, DaggerTexCoords.U, DaggerTexCoords.V, DaggerTexCoords.UL, DaggerTexCoords.VL, BarOpacity, GoldLinearColor);			//Don't bump for the last gold dagger drawn			if (i<NumGoldDaggers - 1)			{				XOffset += (DaggerSpacing * RenderScale);			}		}		//Add spacing between gold/silver daggers		if (NumGoldDaggers > 0)		{			XOffset += (SilverDaggerOffset * RenderScale);		}		for (int32 i = 0; i < NumSilverDaggers; i++)		{			DrawTexture(UT3GHudTexture, XOffset, YOffset, 32 * DaggerAspect, 32, DaggerTexCoords.U, DaggerTexCoords.V, DaggerTexCoords.UL, DaggerTexCoords.VL, BarOpacity, SilverLinearColor);			XOffset += (DaggerSpacing * RenderScale);		}	}}
开发者ID:RattleSN4K3,项目名称:UT4-Gametype-Betrayal,代码行数:45,


示例12: main

int main(){    // Initialization    //--------------------------------------------------------------------------------------    int screenWidth = 800;    int screenHeight = 450;    InitWindow(screenWidth, screenHeight, "raylib [texture] example - texture rectangle");    const char textLine1[] = "Lena image is a standard test image which has been in use since 1973.";    const char textLine2[] = "It comprises 512x512 pixels, and it is probably the most widely used";    const char textLine3[] = "test image for all sorts of image processing algorithms.";    // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)    Texture2D texture = LoadTexture("resources/lena.png");        // Texture loading    Rectangle eyesRec = { 225, 240, 155, 50 };  // Part of the texture to draw    Vector2 position = { 369, 241 };    //--------------------------------------------------------------------------------------    // Main game loop    while (!WindowShouldClose())    // Detect window close button or ESC key    {        // Update        //----------------------------------------------------------------------------------        // TODO: Update your variables here        //----------------------------------------------------------------------------------        // Draw        //----------------------------------------------------------------------------------        BeginDrawing();            ClearBackground(RAYWHITE);            DrawText("LENA", 220, 100, 20, PINK);            DrawTexture(texture, screenWidth/2 - 256, 0, Fade(WHITE, 0.1f)); // Draw background image            DrawTextureRec(texture, eyesRec, position, WHITE);  // Draw eyes part of image            DrawText(textLine1, 220, 140, 10, DARKGRAY);            DrawText(textLine2, 220, 160, 10, DARKGRAY);            DrawText(textLine3, 220, 180, 10, DARKGRAY);        EndDrawing();        //----------------------------------------------------------------------------------    }    // De-Initialization    //--------------------------------------------------------------------------------------    UnloadTexture(texture);       // Texture unloading    CloseWindow();                // Close window and OpenGL context    //--------------------------------------------------------------------------------------    return 0;}
开发者ID:Libertium,项目名称:raylib,代码行数:57,


示例13: DrawTexture

void CFrameBufferObject::DrawTexture( CDrawContext * pDrawContext ) {     CMatrix< float > mat;    mat.Identity();    mat.Translate( 0.0f, m_Height, 0.0f );        DrawTexture( pDrawContext, &mat );    }
开发者ID:jntessier,项目名称:Sora,代码行数:9,


示例14: DrawAisle01Screen

// Gameplay Screen Draw logicvoid DrawAisle01Screen(void){    DrawTexture(background, -scroll, 0, WHITE);        // Draw monsters	DrawMonster(lamp, scroll);    DrawMonster(picture, scroll);        // Draw door    Vector2 doorScrollPos = { doorCenter.position.x - scroll, doorCenter.position.y };    if (doorCenter.selected) DrawTextureRec(doors, doorCenter.frameRec, doorScrollPos, GREEN);    else DrawTextureRec(doors, doorCenter.frameRec, doorScrollPos, WHITE);        doorScrollPos = (Vector2){ doorLeft.position.x - scroll, doorLeft.position.y };    if (doorLeft.selected) DrawTextureRec(doors, doorLeft.frameRec, doorScrollPos, GREEN);    else DrawTextureRec(doors, doorLeft.frameRec, doorScrollPos, WHITE);        doorScrollPos = (Vector2){ doorRight.position.x - scroll, doorRight.position.y };    if (doorRight.selected) DrawTextureRec(doors, doorRight.frameRec, doorScrollPos, GREEN);    else DrawTextureRec(doors, doorRight.frameRec, doorScrollPos, WHITE);        // Draw messsages    if (msgState < 2) DrawRectangle(0, 40, GetScreenWidth(), 200, Fade(LIGHTGRAY, 0.5f));    else if (msgState == 2) DrawRectangle(0, 80, GetScreenWidth(), 100, Fade(LIGHTGRAY, 0.5f));    if (msgState == 0)     {        DrawTextEx(font, msgBuffer, (Vector2){ msgPosX, 80 }, font.baseSize, 2, WHITE);    }    else if (msgState == 1)    {        DrawTextEx(font, message, (Vector2){ msgPosX, 80 }, font.baseSize, 2, WHITE);                if ((msgCounter/30)%2) DrawText("PRESS ENTER or CLICK", GetScreenWidth() - 280, 200, 20, BLACK);    }    else if (msgState == 2)    {        if ((msgCounter/30)%2)        {            DrawTextEx(font, "CHOOSE WISELY!", (Vector2){ 300, 95 }, font.baseSize*2, 2, WHITE);                        DrawRectangleRec(lamp.bounds, Fade(RED, 0.6f));            DrawRectangleRec(picture.bounds, Fade(RED, 0.6f));        }    }    else    {        if ((monsterHover) && ((msgCounter/30)%2))        {            DrawRectangle(0, 0, GetScreenWidth(), 50, Fade(LIGHTGRAY, 0.5f));            DrawText("PRESS SPACE or CLICK to INTERACT", 420, 15, 20, BLACK);        }    }    DrawPlayer();       // NOTE: Also draws mouse pointer!}
开发者ID:raysan5,项目名称:raylib,代码行数:57,


示例15: DrawTexture

void nGraphics::DrawTexture(IDirect3DTexture9* texture,const nPoint& point,const nColor& color){	// Don't draw if fully transparent	if(color.a <= 0.0f)		return;	D3DSURFACE_DESC desc;	texture->GetLevelDesc(0,&desc);	DrawTexture(texture,nRect(point.x,point.y,point.x+desc.Width,point.y+desc.Height),color);}
开发者ID:m1h4,项目名称:MissleCommand,代码行数:10,


示例16: glColor4f

void Sprite::Draw(){    glColor4f(drawColor[0], drawColor[1], drawColor[2], drawColor[3]);    if(texture != 0)    {        // Bind the texture        glBindTexture(GL_TEXTURE_2D, texture);        DrawTexture();    }}
开发者ID:EvanCGriffin,项目名称:soccergame,代码行数:11,


示例17: main

int main(){        // Initialization    //--------------------------------------------------------------------------------------    int screenWidth = 800;    int screenHeight = 450;    InitWindow(screenWidth, screenHeight, "raylib test - DDS texture loading and drawing");        // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)    //Texture2D texture = LoadTexture("resources/raylib_logo.dds");               // Texture loading    //Texture2D texture = LoadTexture("resources/raylib_logo_uncompressed.dds");  // Texture loading        Image image = LoadImage("resources/raylib_logo_uncompressed.dds");    Texture2D texture = CreateTexture(image, false);        // NOTE: With OpenGL 3.3 mipmaps generation works great        SetTargetFPS(60);    //---------------------------------------------------------------------------------------        // Main game loop    while (!WindowShouldClose())    // Detect window close button or ESC key    {        // Update        //----------------------------------------------------------------------------------        // TODO: Update your variables here        //----------------------------------------------------------------------------------                // Draw        //----------------------------------------------------------------------------------        BeginDrawing();                    ClearBackground(RAYWHITE);                        DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE);                        DrawText("this IS a texture!", 360, 370, 10, GRAY);                EndDrawing();        //----------------------------------------------------------------------------------    }    // De-Initialization    //--------------------------------------------------------------------------------------    //UnloadTexture(texture);       // Texture unloading        CloseWindow();                // Close window and OpenGL context    //--------------------------------------------------------------------------------------        return 0;}
开发者ID:Danlestal,项目名称:raylib,代码行数:53,


示例18: DrawPoints

void golly_render::pixblit(int x, int y, int w, int h, char* pmdata, int pmscale){    // is Tom's hashdraw code doing unnecessary work???    if (x >= currwd || y >= currht) return;    if (x + w <= 0 || y + h <= 0) return;    // stride is the horizontal pixel width of the image data    int stride = w/pmscale;    // clip data outside viewport    if (pmscale > 1) {        // pmdata contains 1 byte per `pmscale' pixels, so we must be careful        // and adjust x, y, w and h by multiples of `pmscale' only        if (x < 0) {            int dx = -x/pmscale*pmscale;            pmdata += dx/pmscale;            w -= dx;            x += dx;        }        if (y < 0) {            int dy = -y/pmscale*pmscale;            pmdata += dy/pmscale*stride;            h -= dy;            y += dy;        }        if (x + w >= currwd + pmscale) w = (currwd - x + pmscale - 1)/pmscale*pmscale;        if (y + h >= currht + pmscale) h = (currht - y + pmscale - 1)/pmscale*pmscale;    }    int numstates = currlayer->algo->NumCellStates();    if (pmscale == 1) {        // draw rgb pixel data at scale 1:1        if (drawing_paste || numstates == 2) {            // we can't use DrawTexture to draw paste image because glTexImage2D clobbers            // any background pattern, so we use DrawPoints which is usually faster than            // DrawTexture in a sparsely populated universe with only 2 states (eg. Life)            DrawPoints((unsigned char*) pmdata, x, y, w, h);        } else {            DrawTexture((unsigned char*) pmdata, x, y, w, h);        }    } else if (showicons && pmscale > 4 && icontextures) {        // draw icons at scales 1:8 or above        DrawIcons((unsigned char*) pmdata, x, y, w/pmscale, h/pmscale, pmscale, stride);    } else {        // draw magnified cells, assuming pmdata contains (w/pmscale)*(h/pmscale) bytes        // where each byte contains a cell state        if (numstates == 2) {            DrawMagnifiedTwoStateCells((unsigned char*) pmdata, x, y, w/pmscale, h/pmscale, pmscale, stride);        } else {            DrawMagnifiedCells((unsigned char*) pmdata, x, y, w/pmscale, h/pmscale, pmscale, stride, numstates);        }    }}
开发者ID:boscorillium,项目名称:golly,代码行数:53,


示例19: glDrawTexfOES

/*********************************************************************************** Function Name      : glDrawTexfOES Inputs             :  Outputs            :  Returns            :  Description        : ************************************************************************************/GL_API_EXT void GL_APIENTRY glDrawTexfOES(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height){	__GLES1_GET_CONTEXT();	PVR_DPF((PVR_DBG_CALLTRACE,"glDrawTexfOES"));	GLES1_TIME_START(GLES1_TIMES_glDrawTexfOES);	DrawTexture(gc, x, y, z, width, height);	GLES1_TIME_STOP(GLES1_TIMES_glDrawTexfOES);}
开发者ID:aosp,项目名称:gfx_linux_ddk,代码行数:20,


示例20: glDrawTexfvOES

/*********************************************************************************** Function Name      : glDrawTexfvOES Inputs             :  Outputs            :  Returns            :  Description        : ************************************************************************************/GL_API_EXT void GL_APIENTRY glDrawTexfvOES(const GLfloat *coords){	__GLES1_GET_CONTEXT();	PVR_DPF((PVR_DBG_CALLTRACE,"glDrawTexfvOES"));	GLES1_TIME_START(GLES1_TIMES_glDrawTexfvOES);	DrawTexture(gc, coords[0], coords[1], coords[2], coords[3], coords[4]);	GLES1_TIME_STOP(GLES1_TIMES_glDrawTexfvOES);}
开发者ID:aosp,项目名称:gfx_linux_ddk,代码行数:20,


示例21: glDrawTexiOES

/*********************************************************************************** Function Name      : glDrawTexiOES Inputs             :  Outputs            :  Returns            :  Description        : ************************************************************************************/GL_API_EXT void GL_APIENTRY glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height){	__GLES1_GET_CONTEXT();	PVR_DPF((PVR_DBG_CALLTRACE,"glDrawTexiOES"));	GLES1_TIME_START(GLES1_TIMES_glDrawTexiOES);	DrawTexture(gc, (GLfloat)x, (GLfloat)y, (GLfloat)z, (GLfloat)width, (GLfloat)height);	GLES1_TIME_STOP(GLES1_TIMES_glDrawTexiOES);}	
开发者ID:aosp,项目名称:gfx_linux_ddk,代码行数:20,


示例22: Draw_CheatsMenu_Options

void Draw_CheatsMenu_Options(void){	int c = 0, w = 0, h = 0;	//------------ Backgrounds	Draw_CheatsMenu_Selection(menu_old_sel[5], 0xD0D0D0FF);	DrawTexture(menu_textures[edit_shadow_png_index], MENU_SPLIT_OFF - (menu_textures[edit_shadow_png_index].texture.width * 1) + 1, -marginVertical, 0, menu_textures[edit_shadow_png_index].texture.width, 512 + (marginVertical * 2), 0x000000FF);	DrawHeader(menu_textures[header_ico_opt_png_index], MENU_SPLIT_OFF, "Cheat Option", selected_centry.name, 0x000000ff, 0xffffffff, 1);	DrawOptions(selected_centry.options[option_index], 0xFF, 20, menu_sel);	DrawScrollBar(menu_sel, selected_centry.options[option_index].size, 20, 800, 0xFF);}
开发者ID:Dnawrkshp,项目名称:ArtemisPS3,代码行数:13,


示例23: DrawTextLine

/** * Render a single line. Do not use for formatted text! * Authors: C-Junkie, GreatEmerald */ void DrawTextLine(char* text, SizeF location){	GLuint texture;    Size TextureSize;    texture = TextToTexture(Fonts[Font_Message], text);        TTF_SizeText(Fonts[Font_Message], text, &(TextureSize.X), &(TextureSize.Y));    DrawTexture(texture, TextureSize, AbsoluteTextureSize(TextureSize), location, 1.0);	/* Clean up */	glDeleteTextures(1, &texture);}
开发者ID:GreatEmerald,项目名称:Arcomage-Clone,代码行数:17,


示例24: Mode

Title::Title( Sequence* ptr )	:	 Mode( ptr ){	DrawFps = dynamic_cast< DxFont* >( FindObjectBox( "MS_UI_Gothic_16" ) );	title = dynamic_cast< DxFont* >( FindObjectBox( "MS_MINCHO_52" ) );	column = dynamic_cast< DxFont* >( FindObjectBox( "MS_UI_Gothic_28" ) );	column_italic = dynamic_cast< DxFont* >( FindObjectBox( "HGS_GYOSYOTAI_32_Italic" ) );	Cursor = _NEW DrawTexture( dynamic_cast< Texture* >( FindObjectBox( "Cursor" ) ) );	Cursor->SetSpriteRect( 0, 0, 24, 24 );		Count = 0;	frame = 0;	cursorpos = 0;}
开发者ID:RYUSAchan,项目名称:3TimesIcecream,代码行数:14,


示例25: Draw_CheatsMenu_View

void Draw_CheatsMenu_View(void){	int c = 0, w = 0, h = 0;        //------------ Backgrounds    	Draw_CheatsMenu_Selection(menu_old_sel[5], 0xD0D0D0FF);	DrawTexture(menu_textures[edit_shadow_png_index], MENU_SPLIT_OFF - (menu_textures[edit_shadow_png_index].texture.width * 1) + 1, -marginVertical, 0, menu_textures[edit_shadow_png_index].texture.width, 512 + (marginVertical * 2), 0x000000FF);	DrawHeader(menu_textures[header_ico_opt_png_index], MENU_SPLIT_OFF, "Cheat View", selected_centry.name, 0x000000ff, 0xffffffff, 1);    int nlines = DrawCodes(selected_centry, 0xFF, 20, MENU_SPLIT_OFF, menu_sel);    //DrawScrollBar2(menu_sel, nlines, 18, 700, 0xFF);    DrawScrollBar(menu_sel, nlines, 20, 800, 0xFF);}
开发者ID:Dnawrkshp,项目名称:ArtemisPS3,代码行数:15,


示例26: main

int main(){    // Initialization    //--------------------------------------------------------------------------------------    int screenWidth = 800;    int screenHeight = 450;    InitWindow(screenWidth, screenHeight, "raylib [textures] example - image loading");    // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)    Image image = LoadImage("resources/raylib_logo.png");     // Loaded in CPU memory (RAM)    Texture2D texture = LoadTextureFromImage(image);          // Image converted to texture, GPU memory (VRAM)    UnloadImage(image);   // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM    //---------------------------------------------------------------------------------------    // Main game loop    while (!WindowShouldClose())    // Detect window close button or ESC key    {        // Update        //----------------------------------------------------------------------------------        // TODO: Update your variables here        //----------------------------------------------------------------------------------        // Draw        //----------------------------------------------------------------------------------        BeginDrawing();            ClearBackground(RAYWHITE);            DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, WHITE);            DrawText("this IS a texture loaded from an image!", 300, 370, 10, GRAY);        EndDrawing();        //----------------------------------------------------------------------------------    }    // De-Initialization    //--------------------------------------------------------------------------------------    UnloadTexture(texture);       // Texture unloading    CloseWindow();                // Close window and OpenGL context    //--------------------------------------------------------------------------------------    return 0;}
开发者ID:AdanBB,项目名称:raylib,代码行数:48,


示例27: DrawMissionScreen

// Mission Screen Draw logicvoid DrawMissionScreen(void){    // Draw MISSION screen here!    DrawTexture(texBackground, 0,0, WHITE);    DrawTexturePro(texBackline, sourceRecBackLine, destRecBackLine, (Vector2){0,0},0, Fade(WHITE, fadeBackLine));    if (writeNumber) DrawTextEx(fontMission, FormatText("Filtración #%02i ", currentMission + 1), numberPosition, missionSize + 10, 0, numberColor);    DrawTextEx(fontMission, TextSubtext(missions[currentMission].brief, 0, missionLenght), missionPosition, missionSize, 0, missionColor);    if (writeKeyword && blinkKeyWord) DrawTextEx(fontMission, FormatText("Keyword: %s", missions[currentMission].key), keywordPosition, missionSize + 10, 0, keywordColor);    if (showButton)    {        if (!writeEnd) DrawButton("saltar");        else DrawButton("codificar");    }}
开发者ID:raysan5,项目名称:raylib,代码行数:17,


示例28: TTF_RenderText_Blended

void FWApplication::DrawText(const std::string & message, uint32_t offsetX, uint32_t offsetY){	SDL_Color color = { mColor.r, mColor.g, mColor.b, mColor.a };	//SDL_Color bgColor = { mTextBackgroundColor.r, mTextBackgroundColor.g, mTextBackgroundColor.b, mTextBackgroundColor.a };	SDL_Surface * surface = TTF_RenderText_Blended(mFont, message.c_str(), color);	if (surface)	{		SDL_Texture * texture = SDL_CreateTextureFromSurface(mRenderer, surface);		if (texture)		{			DrawTexture(texture, offsetX, offsetY, surface->w, surface->h);		}		SDL_FreeSurface(surface);		SDL_DestroyTexture(texture);	}}
开发者ID:AntoineKoeman,项目名称:AI,代码行数:17,


示例29: SDL_Point

//Draws the specified texture//param:texture->the index given from load texture//param:color->the tint to apply to the texture//param:sourceRect->the rectangle to pull a smaller image from the texture with. NULL for the whole texture//param:position->the point to draw to//param:angle->the rotation to apply//param:scale->the scale to apply. This is uniform across x and y//param:flip->SDL_RendererFlip::None/FlipHorizontal/FlipVertical. If you want both Flip Horizontal and Flip Vertical,//use the bitwise operator '|'//param:origin->Origin to rotate around. If NULL, uses center of destRect created by position and scale//param:layerDepth->The depth to draw the image at//returns -1 on error, 0 for successint SpriteBatch::DrawTexture(Uint32 texture, SDL_Color color, const SDL_Rect* sourceRect, const SDL_Point* position,		float angle, float scale, SDL_RendererFlip flip, const SDL_Point* origin, float layerDepth){	//Check if spritebatch.begin has been called	if(!begun)	{		std::cout<<"Begin must be called before attempting to draw"<<std::endl;		return -1;	}	///create a temporary point	SDL_Point pos = SDL_Point();	//if position is null, set our temp to 0,0	if(!position)	{		pos = CreatePoint(0, 0);	}	else	{		//otherwise set with position		pos = CreatePoint(position->x, position->y);	}	SDL_Rect destRect = SDL_Rect();	//If we were given a source rectangle	if(sourceRect)	{		//create a dest rectangle using position and source rectangle's dimensions		destRect = CreateRect(pos.x, pos.y, (int)(sourceRect->w * scale), (int)(sourceRect->h * scale));	}	else	{		int w = 0;		int h = 0;		//get the width and height		SDL_QueryTexture(textureList[texture], NULL, NULL, &w, &h);		//create a dest rect using position and the image dimensions		destRect = CreateRect(pos.x, pos.y, (int)(w * scale), (int)(h * scale));	}	//Call other DrawTexture to do the actual drawing	return DrawTexture(texture, color, sourceRect, &destRect, angle, origin, flip, layerDepth);}
开发者ID:cs253074,项目名称:SpaceGladiators,代码行数:58,



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


C++ DrawThemeBackground函数代码示例
C++ DrawTextW函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。