| 286 | } |
| 287 | |
| 288 | void Workspace::InitGameView(const std::shared_ptr<ThunderSdkParams>& params) { |
| 289 | this->resize(def_window_size_); |
| 290 | |
| 291 | bool support_vulkan = this->params_->support_vulkan_; |
| 292 | |
| 293 | for (int index = 0; index < settings_->max_number_of_screen_window_; ++index) { |
| 294 | GameView* game_view = nullptr; |
| 295 | if (0 == index) { |
| 296 | game_view = new GameView(context_, sdk_, params, this); // main view |
| 297 | game_view->resize(def_window_size_); |
| 298 | game_view->show(); |
| 299 | game_view->SetMainView(true); |
| 300 | setCentralWidget(game_view); |
| 301 | if (support_vulkan) { |
| 302 | auto hwnd = game_view->GetVideoHwnd(); |
| 303 | uintptr_t obj = reinterpret_cast<uintptr_t>(game_view); |
| 304 | bool res = pl_vulkan_->Initialize(obj, hwnd); |
| 305 | if (!res) { |
| 306 | LOGE("pl_vulkan_->Initialize failed."); |
| 307 | } |
| 308 | } |
| 309 | params->render_type_name_ = render_type_name_ = game_view->GetRenderTypeName(); |
| 310 | } |
| 311 | else { |
| 312 | game_view = new GameView(context_, sdk_, params, nullptr); // extend view |
| 313 | game_view->InitOverlayWidget(); |
| 314 | game_view->resize(def_window_size_); |
| 315 | game_view->hide(); |
| 316 | game_view->SetMainView(false); |
| 317 | game_view->installEventFilter(this); |
| 318 | game_view->setWindowTitle(origin_title_name_ + QStringLiteral(" (Desktop:%1)").arg(QString::number(index + 1))); |
| 319 | |
| 320 | uintptr_t obj = reinterpret_cast<uintptr_t>(game_view); |
| 321 | if (support_vulkan) { |
| 322 | auto hwnd = game_view->GetVideoHwnd(); |
| 323 | bool res = pl_vulkan_->CreateRenderComponent(obj, hwnd); |
| 324 | if (!res) { |
| 325 | LOGE("pl_vulkan_->CreateRenderComponent failed."); |
| 326 | } |
| 327 | } |
| 328 | } |
| 329 | game_views_.push_back(game_view); |
| 330 | } |
| 331 | QTimer::singleShot(1, this, [=, this]() { |
| 332 | { |
| 333 | QRect screenGeometry = QGuiApplication::primaryScreen()->geometry(); |
| 334 | int x = (screenGeometry.width() - this->width()) / 2; |
| 335 | int y = (screenGeometry.height() - this->height()) / 2; |
| 336 | this->move(x, y); |
| 337 | } |
| 338 | |
| 339 | QPoint ws_pos = this->pos(); |
| 340 | const int x_offset = 80; |
| 341 | const int y_offset = 40; |
| 342 | const int start_x = ws_pos.x(); |
| 343 | const int start_y = ws_pos.y(); |
| 344 | int index = 0; |
| 345 | for (auto game_view : game_views_) { |
nothing calls this directly
no test coverage detected