MCPcopy Create free account
hub / github.com/EasyRPG/Player / UpdateDisplay

Method UpdateDisplay

src/platform/switch/ui.cpp:461–497  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

459}
460
461void NxUi::UpdateDisplay() {
462 // skip, when out of focus
463 if(appletGetFocusState() != AppletFocusState_InFocus) {
464 return;
465 }
466
467 float aspectX = 1.0f;
468 float aspectY = 1.0f;
469
470 // clear
471 glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
472 glClear(GL_COLOR_BUFFER_BIT);
473
474 // touch texture
475 if (!is_docked && !vcfg.touch_ui.IsLocked() && vcfg.touch_ui.Get()) {
476 glActiveTexture(GL_TEXTURE0);
477 glUniform1i(texLocation, 0);
478 glBindTexture(GL_TEXTURE_2D, textures[0]);
479 glUniform2f(dimsLocation, aspectX, aspectY);
480 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
481 }
482
483 // screen texture
484 glActiveTexture(GL_TEXTURE1);
485 glUniform1i(texLocation, 1);
486 glBindTexture(GL_TEXTURE_2D, textures[1]);
487 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, main_surface->GetWidth(),
488 main_surface->GetHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE,
489 main_surface->pixels());
490 if (!vcfg.stretch.Get())
491 aspectX = 0.75f;
492 glUniform2f(dimsLocation, aspectX, aspectY);
493 glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
494
495 // display
496 eglSwapBuffers(eglDisplay, eglSurface);
497}
498
499void NxUi::ToggleStretch() {
500 vcfg.stretch.Toggle();

Callers

nothing calls this directly

Calls 5

IsLockedMethod · 0.80
pixelsMethod · 0.80
GetMethod · 0.45
GetWidthMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected