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); }
// 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); }
// 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)); }
void HandleLostGraphicsContext() { spriteBatch.reset(new NinjaParty::SpriteBatch(GetScreenWidth(), GetScreenHeight())); texture = assetManager->LoadTexture("Star.png", true); renderTexture.reset(new NinjaParty::RenderTexture(GetScreenWidth() / 2, GetScreenHeight())); }
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())); }
// 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! }
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(); }
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; }
/* 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*/ ); }
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; }
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); }
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); }
// 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); }
fixed MapWindowProjection::CalculateMapScale(unsigned scale) const { assert(scale < ScaleListCount); return fixed(ScaleList[scale]) * GetMapResolutionFactor() / Layout::Scale(GetScreenWidth()); }
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); }
// // 지정된영역의 백버퍼데이타를 읽어서 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()내부에서 뽀개주도록 바꿔야 한다. 버그날까봐 일단 이상태로 놔둠" ) }
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); } }
/** * 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; }
// 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(); }
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); }
void RenderSystem::v_Init() { auto sw = GetScreenWidth(); auto sh = GetScreenHeight(); m_Font.Init(sw, sh); }
// Ending Screen Draw logic void DrawEndingScreen(void) { // TODO: Draw ENDING screen here! DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), BLUE); DrawText("ENDING SCREEN", 20, 20, 40, DARKBLUE); DrawText("PRESS ENTER to RETURN to TITLE SCREEN", 120, 220, 20, DARKBLUE); }
void TakeScreenshot() { CImage32 screen(GetScreenWidth(), GetScreenHeight()); DirectGrab(0, 0, GetScreenWidth(), GetScreenHeight(), screen.GetPixels()); // try to create the screenshot directory MakeDirectory(s_ScreenshotDirectory.c_str()); char filename[MAX_PATH]; sprintf(filename, "screenshot.png"); std::string save_path; save_path = s_ScreenshotDirectory + '/'; save_path += filename; screen.Save(save_path.c_str()); }
// Gameplay Screen Draw logic void DrawGameplayScreen(void) { // TODO: Draw GAMEPLAY screen here! HideCursor(); // Background DrawTextureEx(bg, Vector2Zero(), 0, 10, WHITE); // Ground DrawRectangle(0, groundPositionY, GetScreenWidth(), 1, RED); DrawPlayer(player); // Draw triangles for (int i=0; i<maxTriangles; i++) { if (triangles[i].isActive) DrawObjectOnCameraPosition(triangleTexture, triangles[i].position); } for (int i=0; i<maxPlatforms; i++) { if (platforms[i].isActive) DrawObjectOnCameraPosition(platformTexture, platforms[i].position); //if (platforms[i].isActive) DrawRectangleRec(platforms[i].collider, RED); } if (!startGame) DrawText ("PRESS SPACE", 20, GetScreenHeight()-30, 15, WHITE); }
// Ending Screen Draw logic void DrawEndingScreen(void) { // TODO: Draw ENDING screen here! DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), BLUE); DrawTextEx(font, "ENDING SCREEN", (Vector2){ 20, 10 }, font.baseSize*3, 4, DARKBLUE); DrawText("PRESS ENTER or TAP to RETURN to TITLE SCREEN", 120, 220, 20, DARKBLUE); }
void ESVideo::Initialize () { //Init PSGL PSGLinitOptions initOpts = {PSGL_INIT_MAX_SPUS | PSGL_INIT_HOST_MEMORY_SIZE, 1, false, 0, 0, 0, 0, 32 * 1024 * 1024}; psglInit(&initOpts); Device = psglCreateDeviceAuto(GL_ARGB_SCE, GL_NONE, GL_MULTISAMPLING_NONE_SCE); Context = psglCreateContext(); psglMakeCurrent(Context, Device); psglResetCurrentContext(); //Get Screen Info psglGetRenderBufferDimensions(Device, &ScreenWidth, &ScreenHeight); WideScreen = psglGetDeviceAspectRatio(Device) > 1.5f; glViewport(0, 0, GetScreenWidth(), GetScreenHeight()); //Some settings OpenGLHelp::InitializeState(); glEnable(GL_VSYNC_SCE); // Setup vertex buffer VertexBuffer = (GLfloat*)memalign(128, VertexBufferCount * VertexSize * sizeof(GLfloat)); GLShader::ApplyVertexBuffer(VertexBuffer); //Texture for FillRectangle FillerTexture = new Texture(2, 2); FillerTexture->Clear(0xFFFFFFFF); }
// Initialize game variables void InitGame(void) { brickSize = (Vector2){ GetScreenWidth()/BRICKS_PER_LINE, 40 }; // Initialize player player.position = (Vector2){ screenWidth/2, screenHeight*7/8 }; player.size = (Vector2){ screenWidth/10, 20 }; player.life = PLAYER_MAX_LIFE; // Initialize ball ball.position = (Vector2){ screenWidth/2, screenHeight*7/8 - 30 }; ball.speed = (Vector2){ 0, 0 }; ball.radius = 7; ball.active = false; // Initialize bricks int initialDownPosition = 50; for (int i = 0; i < LINES_OF_BRICKS; i++) { for (int j = 0; j < BRICKS_PER_LINE; j++) { brick[i][j].position = (Vector2){ j*brickSize.x + brickSize.x/2, i*brickSize.y + initialDownPosition }; brick[i][j].active = true; } } }
void GLApplication::Run() { InitializeOpenGL(); Initialize(); Input::CreateSingleton(); Gizmos::create(); if (m_bDrawGUI) { ImGui_ImplGlfwGL3_Init(m_pWindow, true); ImGuiIO& io = ImGui::GetIO(); io.DisplaySize.x = GetScreenWidth(); io.DisplaySize.y = GetScreenHeight(); } m_bRunning = true; while (!glfwWindowShouldClose(m_pWindow) && m_bRunning) { m_lastTime = m_currentTime; m_currentTime = (float)glfwGetTime(); m_deltaTime = m_currentTime - m_lastTime; glClearColor(m_clearColour.r, m_clearColour.g, m_clearColour.b, 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_CULL_FACE); glCullFace(GL_BACK); Gizmos::clear(); if(m_bDrawGUI) ImGui_ImplGlfwGL3_NewFrame(); Update(m_deltaTime); UpdateFPS(m_deltaTime); if (m_pCamera) { m_pCamera->Update(m_deltaTime); Render(); Gizmos::draw(m_pCamera->GetProjectionView()); if (m_bDrawGUI) ImGui::Render(); } glfwSwapBuffers(m_pWindow); glfwPollEvents(); } if (m_bDrawGUI) { ImGui_ImplGlfwGL3_Shutdown(); } Gizmos::destroy(); glfwDestroyWindow(m_pWindow); glfwTerminate(); }
D3DXMATRIX CObjectRotateCamera::GetProjectionMatrix(float sceneSize, float fovy) const { float fAspectRatio = GetScreenWidth() / (float) GetScreenHeight(); D3DXMATRIX matProj; D3DXMatrixPerspectiveFovLH(&matProj, fovy, fAspectRatio, max(m_radius - sceneSize, 20.1f), m_radius + sceneSize); return matProj; }
void Register::InitTheButton() { //Dimensions registerButton.SetHeight(GetScreenHeight() / 12); registerButton.SetWidth(GetScreenWidth() / 9); //Coordinates registerButton.SetX(GetScreenWidth() / 4 - registerButton.GetWidth() / 2); registerButton.SetY(GetScreenHeight() / 2.5); //Texture registerButton.SetTexture(buttonTexture); registerButton.SetHoverTexture(buttonHoverTexture); //Add the button to the renderer to be ready for presenting to the screen registerButton.Render(renderer); }