Set full screen before layout renderer elements to ensure VisibleRect is correct with full screen window size

This commit is contained in:
halx99 2020-08-02 16:55:21 +08:00
parent 99432aa171
commit 6f274a8003
2 changed files with 13 additions and 10 deletions

View File

@ -59,30 +59,33 @@ std::string WindowTestWindowed2::subtitle() const {
return "Windowed 960x640";
}
void WindowTestFullscreen1::onEnter() {
WindowTest::onEnter();
bool WindowTestFullscreen1::init()
{
// @remark: Set full screen before layout renderer elements to ensure VisibleRect is
// correct with full screen window size
GLViewImpl* view = (GLViewImpl*)Director::getInstance()->getOpenGLView();
view->setFullscreen();
return WindowTest::init();
}
std::string WindowTestFullscreen1::subtitle() const {
return "Fullscreen";
}
void WindowTestFullscreen2::onEnter() {
WindowTest::onEnter();
bool WindowTestFullscreen2::init() {
GLViewImpl* view = (GLViewImpl*)Director::getInstance()->getOpenGLView();
view->setFullscreen(1);
return WindowTest::init();
}
std::string WindowTestFullscreen2::subtitle() const {
return "Fullscreen Monitor 2 (if present)";
}
void WindowTestFullscreen3::onEnter() {
WindowTest::onEnter();
bool WindowTestFullscreen3::init() {
GLViewImpl* view = (GLViewImpl*)Director::getInstance()->getOpenGLView();
view->setFullscreen(2);
view->setFullscreen(3);
return WindowTest::init();
}
std::string WindowTestFullscreen3::subtitle() const {

View File

@ -56,7 +56,7 @@ class WindowTestFullscreen1 : public WindowTest
{
public:
CREATE_FUNC(WindowTestFullscreen1);
virtual void onEnter() override;
bool init() override;
virtual std::string subtitle() const override;
};
@ -64,14 +64,14 @@ class WindowTestFullscreen2 : public WindowTest
{
public:
CREATE_FUNC(WindowTestFullscreen2);
virtual void onEnter() override;
bool init() override;
virtual std::string subtitle() const override;
};
class WindowTestFullscreen3 : public WindowTest
{
public:
CREATE_FUNC(WindowTestFullscreen3);
virtual void onEnter() override;
bool init() override;
virtual std::string subtitle() const override;
};