Skip to content

Commit ae88955

Browse files
committed
disply rhi backend in window title
1 parent 519bd07 commit ae88955

File tree

2 files changed

+23
-70
lines changed

2 files changed

+23
-70
lines changed

tests/cpp-tests/Source/AppDelegate.cpp

Lines changed: 13 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Copyright (c) 2013 cocos2d-x.org
33
Copyright (c) 2013-2016 Chukong Technologies Inc.
44
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
5+
Copyright (c) 2019-present Axmol Engine contributors (see AUTHORS.md).
56
67
https://axmol.dev/
78
@@ -37,56 +38,6 @@
3738

3839
using namespace ax;
3940

40-
#define RUN_SAMPLE_SCENE 0
41-
static constexpr bool g_statsDisplay = false;
42-
43-
class SampleScene : public Scene
44-
{
45-
public:
46-
void onEnter() override
47-
{
48-
Scene::onEnter();
49-
const auto canvasSize = Director::getInstance()->getCanvasSize();
50-
51-
#if 1
52-
{
53-
auto sprite = Sprite::create("Images/HelloWorld.png");
54-
if (sprite)
55-
{
56-
sprite->setPosition(canvasSize.width / 2, canvasSize.height / 2);
57-
58-
this->addChild(sprite, 0, "centerSprite");
59-
}
60-
}
61-
62-
//{
63-
// auto sprite = Sprite::create("Images/HelloWorld.png");
64-
// if (sprite)
65-
// {
66-
// sprite->setGlobalZOrder(100);
67-
//
68-
// sprite->setPosition(canvasSize.width / 2, canvasSize.height / 2 - 100);
69-
70-
// this->addChild(sprite, 0, "centerSprite");
71-
// }
72-
//}
73-
#endif
74-
75-
#if 1
76-
{
77-
auto label = Label::createWithTTF("Hello World", "fonts/Marker Felt.ttf", 24);
78-
// position the label on the center of the screen
79-
label->setPosition(Vec2(canvasSize.width / 2, canvasSize.height - label->getContentSize().height));
80-
81-
// add the label as a child to this layer
82-
this->addChild(label, 1);
83-
}
84-
#endif
85-
}
86-
87-
void onExit() override { Scene::onExit(); }
88-
};
89-
9041
AppDelegate::AppDelegate() : _testController(nullptr) {}
9142

9243
AppDelegate::~AppDelegate()
@@ -136,26 +87,24 @@ bool AppDelegate::applicationDidFinishLaunching()
13687
// initialize director
13788
auto director = Director::getInstance();
13889
auto renderView = director->getRenderView();
139-
if (!renderView)
140-
{
141-
std::string title = "Cpp Tests";
90+
std::string title = "Cpp Tests";
14291
#ifndef NDEBUG
143-
title += " *Debug*",
92+
title += " *Debug*";
14493
#endif
94+
title += fmt::format("({})", axdrv->getVersion());
95+
if (!renderView)
96+
{
14597
#ifdef AX_PLATFORM_PC
146-
renderView = RenderViewImpl::createWithRect(title, Rect(0, 0, g_resourceSize.width, g_resourceSize.height),
147-
1.0F, true);
98+
renderView =
99+
RenderViewImpl::createWithRect(title, Rect(0, 0, g_resourceSize.width, g_resourceSize.height), 1.0F, true);
148100
#else
149101
renderView = RenderViewImpl::createWithRect(title, Rect(0, 0, g_resourceSize.width, g_resourceSize.height));
150102
#endif
151103
director->setRenderView(renderView);
152104
}
153105

154-
axpm->loadProgram(ProgramType::VIDEO_TEXTURE_NV12);
155-
156106
const char* const autotest_capture = std::getenv("AXMOL_AUTOTEST_CAPTURE_DIR");
157-
// director->setStatsDisplay(!autotest_capture || !autotest_capture[0]);
158-
director->setStatsDisplay(g_statsDisplay);
107+
director->setStatsDisplay(!autotest_capture || !autotest_capture[0]);
159108

160109
director->setAnimationInterval(1.0f / Device::getDisplayRefreshRate());
161110

@@ -191,7 +140,6 @@ bool AppDelegate::applicationDidFinishLaunching()
191140

192141
director->setClearColor(g_testsDefaultClearColor);
193142

194-
#if !RUN_SAMPLE_SCENE
195143
// Enable Remote Console
196144
auto console = director->getConsole();
197145
console->listenOnTCP(5678);
@@ -212,9 +160,6 @@ bool AppDelegate::applicationDidFinishLaunching()
212160
{
213161
_testController->startAutoTest();
214162
}
215-
#else
216-
director->runWithScene(utils::makeInstance<SampleScene>());
217-
#endif
218163

219164
return true;
220165
}
@@ -241,12 +186,12 @@ void AppDelegate::applicationWillEnterForeground()
241186
Director::getInstance()->startAnimation();
242187
}
243188

244-
void AppDelegate::applicationScreenSizeChanged(int newWidth, int newHeight)
189+
void AppDelegate::applicationWillQuit()
245190
{
246-
AXLOGI("AppDelegate::applicationScreenSizeChanged: ({},{})", newWidth, newHeight);
191+
TestController::destroyInstance();
247192
}
248193

249-
void AppDelegate::applicationWillQuit()
194+
void AppDelegate::applicationScreenSizeChanged(int newWidth, int newHeight)
250195
{
251-
TestController::destroyInstance();
196+
AXLOGI("AppDelegate::applicationScreenSizeChanged: ({},{})", newWidth, newHeight);
252197
}

tests/cpp-tests/Source/AppDelegate.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,18 @@ class AppDelegate : private ax::Application
6060
*/
6161
void applicationWillEnterForeground() override;
6262

63-
void applicationScreenSizeChanged(int newWidth, int newHeight) override;
64-
63+
/**
64+
@brief Called when application will quit
65+
@since axmol-2.10.0
66+
*/
6567
void applicationWillQuit() override;
6668

69+
/**
70+
@brief Called when application screen size changed
71+
@since axmol-3.0
72+
*/
73+
void applicationScreenSizeChanged(int newWidth, int newHeight) override;
74+
6775
private:
6876
TestController* _testController;
6977
};

0 commit comments

Comments
 (0)