GameFrameworkAndroid::GameFrameworkAndroid(const char* pStoragePath)
	{
		setStoragePath(pStoragePath);
		createApplication();
		m_touch.id = 0;
		m_hasTouch = false;
	}
Exemplo n.º 2
0
AssetsManagerEx::AssetsManagerEx(const std::string& manifestUrl, const std::string& storagePath)
: _updateState(State::UNCHECKED)
, _assets(nullptr)
, _storagePath("")
, _tempVersionPath("")
, _cacheManifestPath("")
, _tempManifestPath("")
, _manifestUrl(manifestUrl)
, _localManifest(nullptr)
, _tempManifest(nullptr)
, _remoteManifest(nullptr)
, _updateEntry(UpdateEntry::NONE)
, _percent(0)
, _percentByFile(0)
, _totalToDownload(0)
, _totalWaitToDownload(0)
, _nextSavePoint(0.0)
, _maxConcurrentTask(32)
, _currConcurrentTask(0)
, _versionCompareHandle(nullptr)
, _verifyCallback(nullptr)
, _inited(false)
{
    // Init variables
    _eventDispatcher = Director::getInstance()->getEventDispatcher();
    std::string pointer = StringUtils::format("%p", this);
    _eventName = EventListenerAssetsManagerEx::LISTENER_ID + pointer;
    _fileUtils = FileUtils::getInstance();

    network::DownloaderHints hints =
    {
        static_cast<uint32_t>(_maxConcurrentTask),
        DEFAULT_CONNECTION_TIMEOUT,
        ".tmp"
    };
    _downloader = std::shared_ptr<network::Downloader>(new network::Downloader(hints));
    _downloader->onTaskError = std::bind(&AssetsManagerEx::onError, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4);
    _downloader->onTaskProgress = [this](const network::DownloadTask& task,
                                         int64_t /*bytesReceived*/,
                                         int64_t totalBytesReceived,
                                         int64_t totalBytesExpected)
    {
        this->onProgress(totalBytesExpected, totalBytesReceived, task.requestURL, task.identifier);
    };
    _downloader->onFileTaskSuccess = [this](const network::DownloadTask& task)
    {
        this->onSuccess(task.requestURL, task.storagePath, task.identifier);
    };
    setStoragePath(storagePath);
    _tempVersionPath = _tempStoragePath + VERSION_FILENAME;
    _cacheManifestPath = _storagePath + MANIFEST_FILENAME;
    _tempManifestPath = _tempStoragePath + TEMP_MANIFEST_FILENAME;

    initManifests(manifestUrl);
}
AssetsManager::AssetsManager(const std::string& manifestUrl, const std::string& storagePath)
: _updateState(State::UNCHECKED)
, _waitToUpdate(false)
, _totalToDownload(0)
, _totalWaitToDownload(0)
, _percent(0)
, _percentByFile(0)
, _manifestUrl(manifestUrl)
, _storagePath("")
, _cacheVersionPath("")
, _cacheManifestPath("")
, _tempManifestPath("")
, _assets(nullptr)
, _localManifest(nullptr)
, _tempManifest(nullptr)
, _remoteManifest(nullptr)
{
    // Init variables
    _eventDispatcher = Director::getInstance()->getEventDispatcher();
    std::string pointer = StringUtils::format("%p", this);
    _eventName = EventListenerAssetsManager::LISTENER_ID + pointer;
    _fileUtils = FileUtils::getInstance();
    _updateState = State::UNCHECKED;

    _downloader = std::make_shared<Downloader>();
    _downloader->setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
    _downloader->_onError = std::bind(&AssetsManager::onError, this, std::placeholders::_1);
    _downloader->_onProgress = std::bind(&AssetsManager::onProgress,
                                         this,
                                         std::placeholders::_1,
                                         std::placeholders::_2,
                                         std::placeholders::_3,
                                         std::placeholders::_4);
    _downloader->_onSuccess = std::bind(&AssetsManager::onSuccess, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3);
    setStoragePath(storagePath);
    _cacheVersionPath = _storagePath + VERSION_FILENAME;
    _cacheManifestPath = _storagePath + MANIFEST_FILENAME;
    _tempManifestPath = _storagePath + TEMP_MANIFEST_FILENAME;

    // Init and load local manifest
    _localManifest = new Manifest();
    loadLocalManifest(manifestUrl);
    
    // Init and load temporary manifest
    _tempManifest = new Manifest();
    _tempManifest->parse(_tempManifestPath);
    if (!_tempManifest->isLoaded())
        _fileUtils->removeFile(_tempManifestPath);

    // Init remote manifest for future usage
    _remoteManifest = new Manifest();
}
Exemplo n.º 4
0
WebView::WebView(QWidget *parent, CookieJar *cookieJar) :
    QWebView(parent),
    cookieJar(cookieJar)
{
    WebPage *page = new WebPage();
    page->setView(this);
    this->setPage(page);
    settings()->setAttribute(QWebSettings::JavascriptEnabled, true);
    settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true);
    settings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true);
    settings()->setAttribute(QWebSettings::JavascriptCanCloseWindows, true);
    settings()->setAttribute(QWebSettings::NotificationsEnabled, true);
    settings()->setThirdPartyCookiePolicy(QWebSettings::ThirdPartyCookiePolicy::AlwaysAllowThirdPartyCookies);
    settings()->setFontFamily(QWebSettings::StandardFont, "Segoe UI");
    settings()->setFontSize(QWebSettings::DefaultFontSize, 16);
    setContextMenuPolicy(Qt::ContextMenuPolicy::PreventContextMenu);
    setStoragePath();
    setCookies();
}
Exemplo n.º 5
0
bool Platform::initialize()
{
	setStoragePath();

	ms_pWindow	= Window::create();
	
	if (NULL == ms_pWindow)
	{
		return	false;
	}

	System::ms_pDisplay	= createDisplay();

	if (NULL == System::ms_pDisplay)
	{
		return	false;
	}

	ms_pTimer	= Timer::create();

	if (NULL == ms_pTimer)
	{
		return	false;
	}

	System::ms_pInput	= Input::create();

	if (NULL == System::ms_pInput)
	{
		return	false;
	}

	// Initialize sound
	if (false == initializeSound())
	{
		return	false;
	}

	return	true;
}
ModuleMgr::ModuleMgr(const std::string &remoteManifestUrl, const std::string& storagePath)
: _updateState(State::UNCHECKED)
, _waitToUpdate(false)
, _totalToDownload(0)
, _totalWaitToDownload(0)
, _percent(0)
, _percentByFile(0)
, _storagePath("")
, _assets(nullptr)
, _remoteManifestUrl(remoteManifestUrl)
, _remoteManifest(nullptr)

{
    // Init variables
    _eventDispatcher = Director::getInstance()->getEventDispatcher();
    std::string pointer = StringUtils::format("%p", this);
    _eventName = ModuleMgrEventListener::LISTENER_ID + pointer;
    _fileUtils = FileUtils::getInstance();
    _updateState = State::UNCHECKED;

    _downloader = std::make_shared<ModuleDownloader>();
    _downloader->setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
    _downloader->setErrorCallback(std::bind(&ModuleMgr::onError, this, std::placeholders::_1));
    _downloader->setProgressCallback(std::bind(&ModuleMgr::onProgress,
                                         this,
                                         std::placeholders::_1,
                                         std::placeholders::_2,
                                         std::placeholders::_3,
                                         std::placeholders::_4));
    _downloader->setSuccessCallback(std::bind(&ModuleMgr::onSuccess, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
    setStoragePath(storagePath);
    
    // Init remote manifest for future usage
    _remoteManifest = new ModuleManifest();
    _remoteManifestPath = storagePath + MANIFEST_FILENAME;
    FileUtils::getInstance()->removeFile(_remoteManifestPath);
}