MCPcopy Create free account
hub / github.com/TurningWheel/Barony / resizeWindow

Function resizeWindow

src/init.cpp:1794–1831  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1792}
1793
1794bool resizeWindow(int new_xres, int new_yres)
1795{
1796 if (!screen || !renderer) {
1797 return false;
1798 }
1799
1800 if (new_xres) {
1801 xres = std::max(100, new_xres);
1802 }
1803 if (new_yres) {
1804 yres = std::max(100, new_yres);
1805 }
1806
1807 // destroy fbos
1808 main_framebuffer.destroy();
1809 Frame::fboDestroy();
1810
1811#ifndef EDITOR
1812 if (!intro) {
1813 MainMenu::setupSplitscreen();
1814 }
1815#endif
1816
1817 // create new framebuffers
1818 Frame::fboInit();
1819 if (!hdrEnabled) {
1820 main_framebuffer.unbindForWriting();
1821 }
1822 main_framebuffer.init(xres, yres, GL_NEAREST, GL_NEAREST);
1823 if (!hdrEnabled) {
1824 main_framebuffer.bindForWriting();
1825 }
1826 GL_CHECK_ERR(glClearColor(0.f, 0.f, 0.f, 1.f));
1827 GL_CHECK_ERR(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT));
1828
1829 // success
1830 return true;
1831}

Callers 2

handleEventsFunction · 0.85
handleEventsFunction · 0.85

Calls 4

unbindForWritingMethod · 0.80
bindForWritingMethod · 0.80
destroyMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected