foreach (QScreen *screen, QGuiApplication::screens()) { /* pixelHeight = screen->virtualGeometry().height(); pixelWidth = screen->virtualGeometry().width(); physicalDPI = screen->physicalDotsPerInch(); */ // qDebug() << " Orientation:" << Orientation(screen->orientation()); setPixelHeight(screen->virtualGeometry().height()); setPixelWidth(screen->virtualGeometry().width()); setPhysicalDPI(screen->physicalDotsPerInch()); // qDebug() << pixelHeight << pixelWidth << physicalDPI; }
/////////////////////////////////////////////////////////////////////////////// /// @fn hapticAPI::hapticAPI(const hapticPtr& plugin, const FB::BrowserHostPtr host) /// /// @brief Constructor for your JSAPI object. You should register your methods, properties, and events /// that should be accessible to Javascript from here. /// /// @see FB::JSAPIAuto::registerMethod /// @see FB::JSAPIAuto::registerProperty /// @see FB::JSAPIAuto::registerEvent /////////////////////////////////////////////////////////////////////////////// hapticAPI::hapticAPI(const hapticPtr& plugin, const FB::BrowserHostPtr& host) : m_plugin(plugin), m_host(host) { registerMethod("echo", make_method(this, &hapticAPI::echo)); registerMethod("testEvent", make_method(this, &hapticAPI::testEvent)); //Register JHaptic library properties registerProperty("numDevice", make_property(this, &hapticAPI::getNumDevice)); registerProperty("initialized", make_property(this, &hapticAPI::getStatus)); registerProperty("deviceType", make_property(this, &hapticAPI::getDeviceType)); registerProperty("maxForce", make_property(this, &hapticAPI::getMaxForce)); registerProperty("workspaceSize", make_property(this, &hapticAPI::getWorkspaceSize)); registerProperty("position", make_property(this, &hapticAPI::getPosition)); registerProperty("pixel", make_property(this, &hapticAPI::getPixelWidth)); //Register JHaptic library methods registerMethod("startDevice", make_method(this, &hapticAPI::startDevice)); registerMethod("stopDevice", make_method(this, &hapticAPI::stopDevice)); registerMethod("sendForce", make_method(this, &hapticAPI::sendForce)); registerMethod("setContext", make_method(this, &hapticAPI::setContext)); // Read-write property registerProperty("testString", make_property(this, &hapticAPI::get_testString, &hapticAPI::set_testString)); // Read-only property registerProperty("version", make_property(this, &hapticAPI::get_version)); //State variables initialization initialized = false; deviceID = getNumDevice()-1; InitializedString = "Initialized"; NotInitializedString = "Not initialized"; ConnectionString = "Connection opened"; DisconnectionString = "Connection closed"; setPixelWidth(); }
TTFB_NewsArticle::TTFB_NewsArticle(Shader * _shader, std::string _play, int _score) : NodeUI(nullptr), soundPlayed(false), scale(1.0f) { if(_score <= ONE_STAR) { _score = 1; }else if(_score > ONE_STAR && _score < THREE_STARS){ _score = 2; }else { _score = 3; } if(_play == SPAMALOT) { switch(_score) { case 1: article = TTFB_ResourceManager::scenario->getTextureSampler("spamalot_one_star")->textureSampler->texture; sound = TTFB_ResourceManager::scenario->getAudio("spamalot_one_star_sound")->sound; break; case 2: article = TTFB_ResourceManager::scenario->getTextureSampler("spamalot_two_stars")->textureSampler->texture; sound = TTFB_ResourceManager::scenario->getAudio("spamalot_two_stars_sound")->sound; break; case 3: article = TTFB_ResourceManager::scenario->getTextureSampler("spamalot_three_stars")->textureSampler->texture; sound = TTFB_ResourceManager::scenario->getAudio("spamalot_three_stars_sound")->sound; break; default: throw "Bad score"; } }else if(_play == GRINCH) { switch(_score) { case 1: article = TTFB_ResourceManager::scenario->getTextureSampler("grinch_one_star")->textureSampler->texture; sound = TTFB_ResourceManager::scenario->getAudio("grinch_one_star_sound")->sound; break; case 2: article = TTFB_ResourceManager::scenario->getTextureSampler("grinch_two_stars")->textureSampler->texture; sound = TTFB_ResourceManager::scenario->getAudio("grinch_two_stars_sound")->sound; break; case 3: article = TTFB_ResourceManager::scenario->getTextureSampler("grinch_three_stars")->textureSampler->texture; sound = TTFB_ResourceManager::scenario->getAudio("grinch_two_stars_sound")->sound; break; default: throw "Bad score"; } }else if(_play == DRACULA) { switch(_score) { case 1: article = TTFB_ResourceManager::scenario->getTextureSampler("dracula_one_star")->textureSampler->texture; sound = TTFB_ResourceManager::scenario->getAudio("dracula_one_star_sound")->sound; break; case 2: article = TTFB_ResourceManager::scenario->getTextureSampler("dracula_two_stars")->textureSampler->texture; sound = TTFB_ResourceManager::scenario->getAudio("dracula_two_stars_sound")->sound; break; case 3: article = TTFB_ResourceManager::scenario->getTextureSampler("dracula_three_stars")->textureSampler->texture; sound = TTFB_ResourceManager::scenario->getAudio("dracula_three_stars_sound")->sound; break; default: throw "Bad score"; } }else { throw "Bad play name"; } container = new Transform(); container->addChild(this); background->mesh->pushTexture2D(article); setPixelWidth(800); setPixelHeight(1000); firstParent()->translate(-350, -650, 0.f); }