2018-01-29 16:25:32 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2022-08-08 18:02:17 +08:00
|
|
|
https://axys1.github.io/
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2018-01-29 16:25:32 +08:00
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2018-01-29 16:25:32 +08:00
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2018-01-29 16:25:32 +08:00
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
2016-10-31 14:02:02 +08:00
|
|
|
#include "WindowTest.h"
|
|
|
|
|
2022-07-15 19:17:01 +08:00
|
|
|
#if (AX_TARGET_PLATFORM == AX_PLATFORM_MAC || AX_TARGET_PLATFORM == AX_PLATFORM_WIN32 || \
|
|
|
|
AX_TARGET_PLATFORM == AX_PLATFORM_LINUX)
|
2022-07-11 17:50:21 +08:00
|
|
|
USING_NS_AX;
|
2016-10-31 14:02:02 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
WindowTests::WindowTests()
|
|
|
|
{
|
2016-10-31 14:02:02 +08:00
|
|
|
ADD_TEST_CASE(WindowTestWindowed1);
|
|
|
|
ADD_TEST_CASE(WindowTestWindowed2);
|
|
|
|
ADD_TEST_CASE(WindowTestFullscreen1);
|
|
|
|
ADD_TEST_CASE(WindowTestFullscreen2);
|
2020-08-01 13:12:29 +08:00
|
|
|
ADD_TEST_CASE(WindowTestFullscreen3);
|
2016-10-31 14:02:02 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
std::string WindowTest::title() const
|
|
|
|
{
|
2016-10-31 14:02:02 +08:00
|
|
|
return "Window Test";
|
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
void WindowTestWindowed1::onEnter()
|
|
|
|
{
|
2016-10-31 14:02:02 +08:00
|
|
|
WindowTest::onEnter();
|
|
|
|
GLViewImpl* view = (GLViewImpl*)Director::getInstance()->getOpenGLView();
|
|
|
|
view->setWindowed(480, 320);
|
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
std::string WindowTestWindowed1::subtitle() const
|
|
|
|
{
|
2016-10-31 14:02:02 +08:00
|
|
|
return "Windowed 480x320";
|
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
void WindowTestWindowed2::onEnter()
|
|
|
|
{
|
2016-10-31 14:02:02 +08:00
|
|
|
WindowTest::onEnter();
|
|
|
|
GLViewImpl* view = (GLViewImpl*)Director::getInstance()->getOpenGLView();
|
|
|
|
view->setWindowed(960, 640);
|
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
std::string WindowTestWindowed2::subtitle() const
|
|
|
|
{
|
2016-10-31 14:02:02 +08:00
|
|
|
return "Windowed 960x640";
|
|
|
|
}
|
|
|
|
|
2020-08-02 16:55:21 +08:00
|
|
|
bool WindowTestFullscreen1::init()
|
|
|
|
{
|
|
|
|
// @remark: Set full screen before layout renderer elements to ensure VisibleRect is
|
|
|
|
// correct with full screen window size
|
2016-10-31 14:02:02 +08:00
|
|
|
GLViewImpl* view = (GLViewImpl*)Director::getInstance()->getOpenGLView();
|
|
|
|
view->setFullscreen();
|
2020-08-02 16:55:21 +08:00
|
|
|
return WindowTest::init();
|
2016-10-31 14:02:02 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
std::string WindowTestFullscreen1::subtitle() const
|
|
|
|
{
|
2016-10-31 14:02:02 +08:00
|
|
|
return "Fullscreen";
|
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
bool WindowTestFullscreen2::init()
|
|
|
|
{
|
2016-10-31 14:02:02 +08:00
|
|
|
GLViewImpl* view = (GLViewImpl*)Director::getInstance()->getOpenGLView();
|
|
|
|
view->setFullscreen(1);
|
2020-08-02 16:55:21 +08:00
|
|
|
return WindowTest::init();
|
2016-10-31 14:02:02 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
std::string WindowTestFullscreen2::subtitle() const
|
|
|
|
{
|
2016-10-31 14:02:02 +08:00
|
|
|
return "Fullscreen Monitor 2 (if present)";
|
|
|
|
}
|
2016-12-14 11:55:38 +08:00
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
bool WindowTestFullscreen3::init()
|
|
|
|
{
|
2020-08-01 13:12:29 +08:00
|
|
|
GLViewImpl* view = (GLViewImpl*)Director::getInstance()->getOpenGLView();
|
2020-08-03 14:34:19 +08:00
|
|
|
view->setFullscreen(2);
|
2020-08-02 16:55:21 +08:00
|
|
|
return WindowTest::init();
|
2020-08-01 13:12:29 +08:00
|
|
|
}
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
std::string WindowTestFullscreen3::subtitle() const
|
|
|
|
{
|
2020-08-01 13:12:29 +08:00
|
|
|
return "Fullscreen Monitor 3 (if present)";
|
|
|
|
}
|
|
|
|
|
2016-12-14 11:55:38 +08:00
|
|
|
#endif
|