本文整理汇总了C++中GetScreenWidth函数的典型用法代码示例。如果您正苦于以下问题:C++ GetScreenWidth函数的具体用法?C++ GetScreenWidth怎么用?C++ GetScreenWidth使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetScreenWidth函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: XERROR
//
// 지정된영역의 백버퍼데이타를 읽어서 surface에 옮긴다.
// GL은 프론트만 읽을수 있는줄알았는데 반대였다. 백버퍼만 읽을수 있다
// w,y,width,height: 스크린 좌표
void XGraphicsOpenGL::ScreenToSurface( int x, int y, int width, int height, XSurface *pSurface )
{
if( GetPixelFormat() != xPIXELFORMAT_RGB565 )
XERROR( "아직은 RGB565포맷만 사용가능함." );
int px, py, pw, ph; // 물리적스크린크기와 좌표.
float fRatioX, fRatioY;
// phyScreen과 screen의 비율로 좌표들을 변환.
fRatioX = (float)GetPhyScreenWidth() / GetScreenWidth();
fRatioY = (float)GetPhyScreenHeight() / GetScreenHeight();
px = x * fRatioX; py = y * fRatioY; // screen->physcreen 좌표로 변환
pw = width * fRatioX; ph = height * fRatioY;
//GL_NO_ERROR
DWORD *pdwBuffer = new DWORD[ pw * ph ];
glReadPixels(px, py, pw, ph, GL_RGBA, GL_UNSIGNED_BYTE, pdwBuffer ); // 위아래 뒤집혀진 이미지
DWORD *pDst = new DWORD[ pw * ph ];
// 위아래를 바꿈
for( int i = 0; i < ph; i ++ )
for( int j = 0; j < pw; j ++ )
pDst[ i * pw + j ] = pdwBuffer[ (ph-1-i) * pw + j ];
SAFE_DELETE_ARRAY( pdwBuffer );
pSurface->Create( pw, ph, 0, 0, xALPHA, pDst, sizeof(DWORD), 0, 0 );
#pragma messages( "pdwBuffer를 XSurfaceOpenGL::Create()내부에서 뽀개주도록 바꿔야 한다. 버그날까봐 일단 이상태로 놔둠" )
}
开发者ID:xahgo,项目名称:tama,代码行数:29,代码来源:XGraphicsOpenGL.cpp
示例17: GetScreenWidth
void MouseDevice::CheckForWrap()
{
#define WRAP_MARGIN 10
//int sy = GetSystemMetrics(SM_CYSCREEN);
//int sx = GetSystemMetrics(SM_CXSCREEN);
// CCJ 6.6.00 These new maxutil functions supports multiple monitors
int sx = GetScreenWidth();
int sy = GetScreenHeight();
POINT pt;
GetCursorPos(&pt);
if (pt.y<WRAP_MARGIN) {
ybase += sy-WRAP_MARGIN-pt.y;
pt.y = sy-WRAP_MARGIN;
SetCursorPos(pt.x, pt.y);
} else
if (pt.y>sy-WRAP_MARGIN) {
ybase += WRAP_MARGIN-pt.y;
pt.y = WRAP_MARGIN;
SetCursorPos(pt.x, pt.y);
}
if (pt.x<WRAP_MARGIN) {
xbase += sx-WRAP_MARGIN-pt.x;
pt.x = sx-WRAP_MARGIN;
SetCursorPos(pt.x, pt.y);
} else
if (pt.x>sx-WRAP_MARGIN) {
xbase += WRAP_MARGIN-pt.x;
pt.x = WRAP_MARGIN;
SetCursorPos(pt.x, pt.y);
}
}
开发者ID:artemeliy,项目名称:inf4715,代码行数:32,代码来源:mcdevice.cpp
示例18: GetScreenCenter
/**
* Returns the raster coordinates at the center of the map.
*/
gcc_pure
RasterPoint GetScreenCenter() const {
RasterPoint pt;
pt.x = GetScreenWidth() / 2;
pt.y = GetScreenHeight() / 2;
return pt;
}
开发者ID:damianob,项目名称:xcsoar,代码行数:10,代码来源:WindowProjection.hpp
示例19: DrawGame
// Draw game (one frame)
void DrawGame(void)
{
BeginDrawing();
ClearBackground(RAYWHITE);
if (!gameOver)
{
DrawRectangleRec(player.rec, player.color);
if (wave == FIRST) DrawText("FIRST WAVE", screenWidth/2 - MeasureText("FIRST WAVE", 40)/2, screenHeight/2 - 40, 40, Fade(BLACK, alpha));
else if (wave == SECOND) DrawText("SECOND WAVE", screenWidth/2 - MeasureText("SECOND WAVE", 40)/2, screenHeight/2 - 40, 40, Fade(BLACK, alpha));
else if (wave == THIRD) DrawText("THIRD WAVE", screenWidth/2 - MeasureText("THIRD WAVE", 40)/2, screenHeight/2 - 40, 40, Fade(BLACK, alpha));
for (int i = 0; i < activeEnemies; i++)
{
if (enemy[i].active) DrawRectangleRec(enemy[i].rec, enemy[i].color);
}
for (int i = 0; i < NUM_SHOOTS; i++)
{
if (shoot[i].active) DrawRectangleRec(shoot[i].rec, shoot[i].color);
}
DrawText(FormatText("%04i", score), 20, 20, 40, GRAY);
if (victory) DrawText("YOU WIN", screenWidth/2 - MeasureText("YOU WIN", 40)/2, screenHeight/2 - 40, 40, BLACK);
if (pause) DrawText("GAME PAUSED", screenWidth/2 - MeasureText("GAME PAUSED", 40)/2, screenHeight/2 - 40, 40, GRAY);
}
else DrawText("PRESS [ENTER] TO PLAY AGAIN", GetScreenWidth()/2 - MeasureText("PRESS [ENTER] TO PLAY AGAIN", 20)/2, GetScreenHeight()/2 - 50, 20, GRAY);
EndDrawing();
}
开发者ID:tws0002,项目名称:raylib,代码行数:35,代码来源:space_invaders.c
示例20: glBindFramebuffer
void shadowmapping_app::render_scene(double currentTime)
{
static const GLfloat ones[] = { 1.0f };
static const GLfloat zero[] = { 0.0f };
static const GLfloat gray[] = { 0.1f, 0.1f, 0.1f, 0.0f };
static const GLenum attachments[] = { GL_COLOR_ATTACHMENT0 };
static const vmath::mat4 scale_bias_matrix = vmath::mat4(vmath::vec4(0.5f, 0.0f, 0.0f, 0.0f),
vmath::vec4(0.0f, 0.5f, 0.0f, 0.0f),
vmath::vec4(0.0f, 0.0f, 0.5f, 0.0f),
vmath::vec4(0.5f, 0.5f, 0.5f, 1.0f));
glBindFramebuffer(GL_FRAMEBUFFER, depth_fbo);
glDrawBuffers(1, attachments);
glViewport(0, 0, GetScreenWidth(), GetScreenHeight());
glClearBufferfv(GL_COLOR, 0, gray);
glClearBufferfv(GL_DEPTH, 0, ones);
glUseProgram(view_program);
glUniformMatrix4fv(uniforms.view.proj_matrix, 1, GL_FALSE, camera_proj_matrix);
glClearBufferfv(GL_DEPTH, 0, ones);
int i;
for (i = 0; i < OBJECT_COUNT; i++)
{
vmath::mat4& model_matrix = objects[i].model_matrix;
glUniformMatrix4fv(uniforms.view.mv_matrix, 1, GL_FALSE, camera_view_matrix * objects[i].model_matrix);
glUniform3fv(uniforms.view.diffuse_albedo, 1, objects[i].diffuse_albedo);
objects[0].obj.render();
}
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
开发者ID:byhj,项目名称:OpenGL-Bluebook,代码行数:33,代码来源:ch10-03-Depth-of-Filed.cpp
注:本文中的GetScreenWidth函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论