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


C++ GetScreenWidth函数代码示例

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


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

示例1: glClearBufferfv

	void RenderSystem::v_Render()
	{
		static const float bgColor[4] = {0.2f, 0.3f, 0.4f, 1.0f};
		glClearBufferfv(GL_COLOR, 0, bgColor);
		static const float one = 1.0f;
		glClearBufferfv(GL_DEPTH, 0, &one);

		update();

		static ogl::MvpMatrix matrix;
		matrix.view  = m_Camera.GetViewMatrix();
		matrix.proj  = glm::perspective(glm::radians(m_Camera.GetZoom() ), getAspect(), 0.1f, 1000.0f);
		matrix.model = glm::mat4(1.0f);

		// 1. Draw scene as normal in multisampled buffers
         
		m_Framebuffer.Bind();

		glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	    m_Cube.Render(matrix);

		// 2. Now blit multisampled buffer(s) to default framebuffers
		glBindFramebuffer(GL_READ_FRAMEBUFFER, m_Framebuffer.GetFbo());
		glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);				
		glBlitFramebuffer(0, 0, GetScreenWidth(), GetScreenWidth(), 0, 0, GetScreenWidth(), GetScreenWidth(), GL_COLOR_BUFFER_BIT, GL_NEAREST);     
	}
开发者ID:byhj,项目名称:byhj-Render,代码行数:28,代码来源:RenderSystem.cpp

示例2: DrawLevel07Screen

// Level07 Screen Draw logic
void DrawLevel07Screen(void)
{
    // Draw Level07 screen here!
    DrawCircleV(leftCirclePos, circleRadius, leftCircleColor);
    DrawCircleV(middleCirclePos, circleRadius, middleCircleColor);
    DrawCircleV(rightCirclePos, circleRadius, rightCircleColor);
    
    if (leftCircleActive) DrawCircleV(leftBtnPos, btnRadius, GRAY);
    else DrawCircleV(leftBtnPos, btnRadius, LIGHTGRAY);
    
    if (middleCircleActive) DrawCircleV(middleBtnPos, btnRadius, GRAY);
    else DrawCircleV(middleBtnPos, btnRadius, LIGHTGRAY);
    
    if (rightCircleActive) DrawCircleV(rightBtnPos, btnRadius, GRAY);
    else DrawCircleV(rightBtnPos, btnRadius, LIGHTGRAY);
    
    
    
    if (levelFinished)
    {
        DrawRectangleBordersRec((Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, 0, 0, 60, Fade(LIGHTGRAY, 0.6f));
        DrawText("LEVEL 07", GetScreenWidth()/2 - MeasureText("LEVEL 07", 30)/2, 20, 30, GRAY);
        DrawText(FormatText("DONE! (Seconds: %03i)", levelTimeSec), GetScreenWidth()/2 - MeasureText("DONE! (Seconds: 000)", 30)/2, GetScreenHeight() - 40, 30, GRAY);
    }
    else DrawText("LEVEL 07", GetScreenWidth()/2 - MeasureText("LEVEL 07", 30)/2, 20, 30, LIGHTGRAY);
}
开发者ID:AdanBB,项目名称:raylib,代码行数:27,代码来源:screen_level07.c

示例3: DrawTitleScreen

// Title Screen Draw logic
void DrawTitleScreen(void)
{
    // TODO: Draw TITLE screen here!
    DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), BLUE);
    //DrawTextureEx(titleTexture, (Vector2){GetScreenWidth()/2-titleTexture.width/2, GetScreenHeight()/2-titleTexture.height/2}, 0, 1, Fade(WHITE, titleAlpha));
    DrawRectangle(GetScreenWidth()/2-200, GetScreenHeight()/2-100, 400, 150, Fade(YELLOW, titleAlpha));
    DrawText("PRESS <ENTER> to START the GAME", 208, GetScreenHeight()-75, 20, Fade(BLACK, startTextAlpha));
}
开发者ID:MarcMDE,项目名称:TapToJump,代码行数:9,代码来源:screen_title.c

示例4: HandleLostGraphicsContext

 void HandleLostGraphicsContext()
 {
     spriteBatch.reset(new NinjaParty::SpriteBatch(GetScreenWidth(), GetScreenHeight()));
     
     texture = assetManager->LoadTexture("Star.png", true);
     
     renderTexture.reset(new NinjaParty::RenderTexture(GetScreenWidth() / 2, GetScreenHeight()));
 }        
开发者ID:ThirdPartyNinjas,项目名称:NinjaParty,代码行数:8,代码来源:RenderTexture.hpp

示例5: LoadContent

 void LoadContent(const std::string &assetPath, const std::string &assetArchivePath)
 {
     assetManager.reset(new NinjaParty::AssetManager(assetPath, assetArchivePath));
     spriteBatch.reset(new NinjaParty::SpriteBatch(GetScreenWidth(), GetScreenHeight()));
     
     texture = assetManager->LoadTexture("Star.png");
     
     renderTexture.reset(new NinjaParty::RenderTexture(GetScreenWidth() / 2, GetScreenHeight()));
 }
开发者ID:ThirdPartyNinjas,项目名称:NinjaParty,代码行数:9,代码来源:RenderTexture.hpp

示例6: DrawAisle01Screen

// Gameplay Screen Draw logic
void 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,代码来源:screen_aisle01.c

示例7: Draw

 void Draw()
 {
     ClearScreen(NinjaParty::Color::Black);
     
     spriteBatch->Begin();
     spriteBatch->Draw(texture, NinjaParty::Vector2::ZERO, nullptr, NinjaParty::Vector2::ZERO, rotation, NinjaParty::Color(0, 1, 0, 1));
     spriteBatch->Draw(texture, NinjaParty::Vector2(GetScreenWidth() / 2, GetScreenHeight() / 2), nullptr, NinjaParty::Vector2(0.5f, 0.5f), rotation, NinjaParty::Color(1, 1, 1, 0.5f));
     spriteBatch->Draw(texture, NinjaParty::Vector2(GetScreenWidth(), GetScreenHeight()), nullptr, NinjaParty::Vector2(1.0f, 1.0f), rotation, NinjaParty::Color(1, 0, 0, 1));
     spriteBatch->End();
 }
开发者ID:ThirdPartyNinjas,项目名称:NinjaParty,代码行数:10,代码来源:SpriteBatch.hpp

示例8: GetScreenWidth

void Home::InitTheUsernameLabel()
{
    usernameLabelColor = {255, 255, 255, 0}; //White color as rgba
    usernameLabelText = "Welcome " + User::username + "...";

    usernameLabelRect.x = GetScreenWidth() / 16;
    usernameLabelRect.y = GetScreenHeight() / 15;
    usernameLabelRect.w = GetScreenWidth() / usernameLabelText.length() * 3;
    usernameLabelRect.h = GetScreenHeight() / usernameLabelText.length() * 2;
}
开发者ID:nooro,项目名称:Kagan,代码行数:10,代码来源:Home.cpp

示例9: sprintf

/* Draw text labels */
void MyProjectMain::DrawStrings()
{
	// Build the string to print
	char buf[128];
	sprintf( buf, "Changing text %6d %6d", rand(), rand() );
	// Clear the top of the screen, since we about to draw text on it.
	CopyBackgroundPixels( 0, 0, GetScreenWidth(), 35 );
	// Then draw the strings
	DrawScreenString( 150, 10, buf, 0xffffff, NULL );
	// And mark that area of the screen as having been changed, so it gets redrawn
	SetNextUpdateRect( 0/*X*/, 0/*Y*/, GetScreenWidth(), 35/*Height*/ );
}
开发者ID:tun57,项目名称:StephenSowoleG52CPP,代码行数:13,代码来源:MyProjectMain.cpp

示例10: Initialize

	bool Framework::Initialize()
	{
		Time::Reset();
		if( false == InitializeWindow(_T("Prototype"), GetScreenWidth(), GetScreenHeight() ) ) return false;

		if( false == InitializeGraphicSystem( GetScreenWidth(), GetScreenHeight() ) ) return false;

		if( false == InitializeInputSystem() ) return false;

		m_rpFrameRate = new FrameRate();

		DebugFont::GetInstance().Initialize();
		return true;
	}
开发者ID:PPNav,项目名称:prototype,代码行数:14,代码来源:Framework.cpp

示例11: GetSize

void MaterialEditor::WillAppear()
{
    UIScreen *activeScreen = UIScreenManager::Instance()->GetScreen();
    if(activeScreen)
    {
        float32 height = GetSize().y;
        SetRect(Rect(GetScreenWidth()/8.f, (GetScreenHeight() - height) / 2.f, GetScreenWidth()/4.f*3.f, height));
    }
    
    UpdateInternalMaterialsVector();
    UpdateNodeMaterialsVector();
    
    OnAllPressed(NULL, NULL, NULL);
}
开发者ID:abaradulkin,项目名称:dava.framework,代码行数:14,代码来源:MaterialEditor.cpp

示例12: SetCaption

void CTestGame::Init()
{
    CGame::Init();

    SetCaption("Test Game");
    mouse->SetVisible(false);

    //create game space
    SDL_Rect bounds;
    bounds.x = 0;
    bounds.y = 0;
    bounds.w = GetScreenWidth();
    bounds.h = GetScreenHeight();
    space = new CEntitySpace(bounds);

    //create entity
    CSurface* surf = CSurface::Load("smile.png");
    surf->SetColorKey(255,0,106);
    entity = new CEntity(surf,10.0,false);
    entity->position.x = entity->GetWidth()/2;
    entity->position.y = entity->GetHeight()/2;

    space->Add(entity);

    //create segments
    seg = new CSegment(SDL_MapRGB(Display_Surface->GetSDLSurface()->format,
                                            0,0,0));
    seg->v1.x = 0;
    seg->v1.y = 500;
    seg->v2.x = 500;
    seg->v2.y = 500;

    space->Add(seg);
}
开发者ID:conwill708,项目名称:Code-Blocks-Projects,代码行数:34,代码来源:CTestGame.cpp

示例13: DrawTitleScreen

// Title Screen Draw logic
void DrawTitleScreen(void)
{
    // TODO: Draw TITLE screen here!
    DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), GREEN);
    DrawText("TITLE SCREEN", 20, 20, 40, DARKGREEN);
    DrawText("PRESS ENTER to JUMP to GAMEPLAY SCREEN", 160, 220, 20, DARKGREEN);
}
开发者ID:AdanBB,项目名称:raylib,代码行数:8,代码来源:screen_title.c

示例14: assert

fixed
MapWindowProjection::CalculateMapScale(unsigned scale) const
{
  assert(scale < ScaleListCount);
  return fixed(ScaleList[scale]) *
    GetMapResolutionFactor() / Layout::Scale(GetScreenWidth());
}
开发者ID:galippi,项目名称:xcsoar,代码行数:7,代码来源:MapWindowProjection.cpp

示例15: FillRect

void XGraphicsOpenGL::FillRect( float x, float y, float w, float h, XCOLOR collt, XCOLOR colrt, XCOLOR collb, XCOLOR colrb  )
{
	if( w == 0 || h == 0 )	return;
    if( w < 0 )
    {
        x -= w;     // 좌측 좌표를 -w만큼 이동시켜주고
        w = -w;     // w는 부호 바꿈
    }
    if( h < 0 )
    {
        y -= h;
        h = -h;
    }
	if( x > GetScreenWidth() || y > GetScreenHeight() )	// w, h가 마이너스가 올수도 있기땜에 이렇게 함
		return;
	if( x + w < 0 || y + h < 0 )
		return;
	
	//	if( x > GetScreenWidth() || y > GetScreenHeight() )
	//		return;
	//	if( w < 0 || h < 0 )
	//		return;
	
	
//	GLfloat r, g, b, a;
//	r = XCOLOR_RGB_R(color) / 255.0f;
//	g = XCOLOR_RGB_G(color) / 255.0f;
//	b = XCOLOR_RGB_B(color) / 255.0f;
//	a = XCOLOR_RGB_A(color) / 255.0f;
	//	if( a != 255 )	glEnable(GL_BLEND);		// 이거 자주불러주면 부하걸릴거 같다. 외부에서 블럭단위로 셋하게 하자.
	
	// width-1이 맞나? 안하는게 맞나?
	GLfloat pos[8] = { 0, h, w, h, 0, 0, w, 0 };
	GLfloat col[16] = {  _R(collb), _G(collb),_B(collb),_A(collb),	// 좌하
						_R(colrb), _G(colrb),_B(colrb),_A(colrb),	// 우하
						_R(collt), _G(collt),_B(collt),_A(collt),	// 좌상
						_R(colrt), _G(colrt),_B(colrt),_A(colrt)	};	// 우상
	glPushMatrix();
	glLoadIdentity();
	glTranslatef(x, y, 0);
	glScalef(1.0f, 1.0f, 1.0f);
	//    glLoadIdentity();
	
	glDisable( GL_TEXTURE_2D );
	glBindBuffer(GL_ARRAY_BUFFER, 0);
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);	// 이건 안해줘도 되네.
	glVertexPointer(2, GL_FLOAT, 0, pos);
	glEnableClientState(GL_VERTEX_ARRAY);
	glColorPointer(4, GL_FLOAT, 0, col);
	glEnableClientState(GL_COLOR_ARRAY);
	glDisableClientState(GL_TEXTURE_COORD_ARRAY);
	
	glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
	
	glDisableClientState(GL_COLOR_ARRAY);
	glEnable( GL_TEXTURE_2D );
	glPopMatrix();
	//	if( a != 255 )	glDisable(GL_BLEND);
	
}
开发者ID:xahgo,项目名称:tama,代码行数:60,代码来源:XGraphicsOpenGL.cpp


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