Example #1
0
void SE_ElementManager::handleXmlChild(SE_Element* parent, TiXmlNode* currNode, unsigned int indent)
{
    if(!currNode)
        return;
    TiXmlNode* pChild;
    TiXmlText* pText;
    int t = currNode->Type();
    int num = 0;
    switch(t)
    {
    case TiXmlNode::TINYXML_DOCUMENT:
        LOGI("...Document\n");
        for(pChild = currNode->FirstChild() ; pChild != NULL ; pChild = pChild->NextSibling())
        {
            handleXmlChild(parent, pChild, indent + 1);
        }
        break;
    case TiXmlNode::TINYXML_ELEMENT:
        LOGI("...Element[%s]\n", currNode->Value());
        handleElement(parent, currNode->Value(), currNode->ToElement(), indent + 1);
        break;
    case TiXmlNode::TINYXML_COMMENT:
        LOGI("...Comment:[%s]\n", currNode->Value());
        break;
    case TiXmlNode::TINYXML_TEXT:
        pText = currNode->ToText();
        LOGI("...Text: [%s]\n", pText->Value());
        handleText(parent, pText);
        break;
    case TiXmlNode::TINYXML_DECLARATION:
        LOGI("...Declaration\n");
        handleDeclaration(currNode->ToDeclaration());
        break;
    }
}
Example #2
0
void RenderSystem::handleEntity(entityx::Entity &A) {
	if(A.has_component<Sprite>()) {
		handleSprite(A);
	} if(A.has_component<ProgressBar>()) {
		handleProgressBar(A);
	} if(A.has_component<Text>()) {
		handleText(A);
	}
}
Example #3
0
void RenderSystem::update(entityx::EntityManager &enm, entityx::EventManager&, entityx::TimeDelta) {
	Game::renderTexture.setView(Game::registerEntity["camera"].component<Camera>()->view);
	Game::renderTexture.clear();

	spritesZ.swap(std::vector<std::pair<float, sf::Sprite*>>());
	for(auto &A : enm.entities_with_components<Sprite>()) {
		if(A.has_component<UI>()) continue;
		for(auto &i : A.component<Sprite>()->sprites) {
			spritesZ.push_back(std::pair<float, sf::Sprite*>(i.z, &i));
		}
		handleEntity(A);
	}
	std::sort(spritesZ.begin(), spritesZ.end(), compare<sf::Sprite*>);

	for(auto it : spritesZ) {
		Game::renderTexture.draw(*it.second);
	}

	for(auto &A : enm.entities_with_components<Text>(texts)) {
		if(A.has_component<UI>()) continue;
		handleText(A);
	}
	for(auto &A : enm.entities_with_components<CircleShape>(circleShapes)) {
		handleCircleShape(A);
	}
	for(auto &A : enm.entities_with_components<ProgressBar>(progressBars)) {
		handleProgressBar(A);
	}
	for(auto &A : enm.entities_with_components<TriangleShape>(triangleShapes)) {
		handleTriangleShape(A);
	}
	if(sf::Keyboard::isKeyPressed(sf::Keyboard::Multiply)) {
		for(auto &A : enm.entities_with_components<HitCircle>()) {
			drawDebug(A);
		}
	}
	Game::renderTexture.setView(uiView);
	for(auto &A : enm.entities_with_components<UI>()) {
		handleEntity(A);
		if(A.has_component<Sprite>()) {
			for(auto &s : A.component<Sprite>()->sprites)
				Game::renderTexture.draw(s, (A.has_component<Shader>()) ? &A.component<Shader>()->shader : sf::RenderStates::Default);
		} if(A.has_component<ProgressBar>()) {
			Game::renderTexture.draw(sampleProgressBar);
		} if(A.has_component<Text>()) {
			Game::renderTexture.draw(*texts.get());
		}
	}
	Game::renderTexture.setView(Game::registerEntity["camera"].component<Camera>()->view);
	Game::renderTexture.display();

	Game::window.clear();
	Game::window.draw(sf::Sprite(Game::renderTexture.getTexture()));
	Game::window.display();
}
void TextLayout::getTextPath(SkPaint *paint, const jchar *text, jsize len,
                             jint bidiFlags, jfloat x, jfloat y, SkPath *path) {
    handleText(paint, text, len, bidiFlags, x, y, path);
}
Example #5
0
void Robot::handleDownload(QNetworkReply* reply)
{
    Info info = _replys[reply];

    if(info.isText())
    {
        QString what;

        QString codestr;

        what = QString::fromUtf8(reply->readAll());
        int pos = what.indexOf(answer_code);

        for(int i = pos + 6; ; i++)
        {
            if(what.at(i) == QChar(','))
            {
                break;
            }

            if(what.at(i) == QChar('}'))
            {
                break;
            }

            if(what.at(i) == QChar('"'))
            {
                break;
            }

            if(i >= what.size())
            {
                break;
            }
            codestr += what.at(i);
        }

        if(codestr == "100000")
        {
            QString &answer = handleText(what);
            addAnswer(answer);
        }
        else if(codestr == "305000")
        {
            QString &answer = handleText(what);
            addAnswer(answer);
            handleTrainSchedule(what);
        }
    }
    else
    {
        //这个时候下截来的图片,肯定是属于某一个对话的
        Dialog* d = info.getDialog();

        QPixmap pix;
        pix.loadFromData(reply->readAll());
        d->setPix(pix);
    }

    _replys.erase(reply);
    reply->deleteLater();
}
Example #6
0
void AGOSEngine_FeebleDemo::mainMenu() {
    for (int i = 1; i <= 6; i++)
        enableBox(i);

    for (int i = 11; i <= 19; i++)
        disableBox(i);

    playVideo("mmfadein.smk", true);

    startInteractiveVideo("mainmenu.smk");

    HitArea *ha = 0;
    do {
        _lastHitArea = NULL;
        _lastHitArea3 = NULL;

        while (_lastHitArea3 == 0) {
            if (shouldQuit())
                return;
            handleText();
            delay(1);
        }

        ha = _lastHitArea;
    } while (ha == NULL || !(ha->id >= 1 && ha->id <= 6));

    if (shouldQuit())
        return;

    stopInteractiveVideo();

    if (ha->id == 1) {
        // Feeble Files Data
        playVideo("ffade5.smk");
        playVideo("ftext0.smk");
        playVideo("ftext1.smk", true);
        waitForSpace();
        playVideo("ftext2.smk", true);
        waitForSpace();
        playVideo("ftext3.smk", true);
        waitForSpace();
        playVideo("ftext4.smk", true);
        waitForSpace();
        playVideo("ftext5.smk", true);
        waitForSpace();
    } else if (ha->id == 2) {
        // Opening Sequence
        playVideo("ffade1.smk");
        playVideo("musosp1.smk");
        playVideo("newcred.smk");
        playVideo("fasall.smk");
        playVideo("mus5p2.smk");
        playVideo("coach.smk");
        playVideo("outmin.smk");
    } else if (ha->id == 3) {
        // Technical Information
        playVideo("ffade3.smk");
        playVideo("idfx4a.smk");
        playVideo("idfx4b.smk");
        playVideo("idfx4c.smk");
        playVideo("idfx4d.smk");
        playVideo("idfx4e.smk");
        playVideo("idfx4f.smk");
        playVideo("idfx4g.smk");
    } else if (ha->id == 4) {
        // About AdventureSoft
        playVideo("ffade2.smk");
        playVideo("fscene3b.smk");
        playVideo("fscene3a.smk");
        playVideo("fscene3c.smk");
        playVideo("fscene3g.smk");
    } else if (ha->id == 5) {
        // Video Clips
        playVideo("ffade4.smk");
        filmMenu();
    } else if (ha->id == 6) {
        // Exit InfoDisk
        playVideo("ffade6.smk");
        exitMenu();
    }
}
Example #7
0
/********************************************************************
*
* 描述:					对给定的文件进行加密
*
* 参数:
*	sourcename			要加密的文件的文件名
*	destname			存储密文的文件的文件名
*	key1				密钥1
*	key2				密钥2
*	msg					要隐藏在文中的信息
*
* 返回值:
*
********************************************************************/
void encrypt(const char* sourename, const char* destname, const char* key1, const char* key2, const char* msg)
{
	setKeys(key1, key2);
	const char* tmpfile = "tmpfile";
	handleText(sourename, tmpfile, msg);
	FILE* tmpfp;
	FILE* destfp;
	fopen_s(&tmpfp, tmpfile, "r");
	fopen_s(&destfp, destname, "w");
	char ch[2] = {};
	int ptr = 0;//ch的当前下标
	int qn = 0;//处于两个有效加密字符之间q的个数
	int count = 0;//整篇文章的字符个数
	int countq = 0;//整篇文章q的总个数
	char c = NULL;
	int left_up_row=0;
	int left_up_column=0;
	int right_down_row=0;
	int right_down_column=0;
	int i = 0;
	while ((c = fgetc(tmpfp)) != EOF)
	{
		count++;
		if (c == 'q')
		{
			countq++;
			if (ptr == 0)//q出现在第一个位置
			{
				fputc('Q', destfp);
			}
			if (ptr == 1)//q出现在中间
			{
				qn++;//记录中间出现的q的个数
			}
		}
		else
		{
			ch[ptr++] = c;
			if (ptr == 2)
			{
				getPosition(ch[0], left_up_row, left_up_column, matrix);
				getPosition(ch[1], right_down_row, right_down_column, matrix);
				fputc(matrix_right_up[left_up_row][right_down_column],destfp);
				for (i = 0; i < qn; i++)
				{
					fputc('Q', destfp);
				}
				fputc(matrix_left_down[right_down_row][left_up_column], destfp);
				qn = 0;
				ptr = 0;
			}
		}
	}
	if ((count - countq) % 2)//最后一个字符未加密,变成大写字母显示
	{
		fputc(toupper(ch[0]), destfp);
	}
	fclose(tmpfp);
	fclose(destfp);
	//remove(tmpfile);
	tmpfp = NULL;
	destfp = NULL;
}
/* ----------------------------------------------------------------------
 * Author: Julian
 * Date: 27 January 2014
 * Description: Handles all the events
 * ----------------------------------------------------------------------
 */
void Console::handleEvent(const sf::Event& windowEvent)
{
	// Switches between the events
	switch(windowEvent.type)
	{
		case(sf::Event::KeyPressed):

			// Changes the visibility of the console
			if(windowEvent.key.code == sf::Keyboard::Tilde || windowEvent.key.code == sf::Keyboard::F1)
				visible = !visible;
			else if(windowEvent.key.code == sf::Keyboard::Up)
			{
				if(!commandList.empty())
				{
					if(iCommand != commandList.begin())
						--iCommand;
					consoleTextList[0] = (*iCommand);
					const float x = consoleWindow.getPosition().x;
					const float y = consoleWindow.getPosition().y;
					consoleTextList[0].setPosition(sf::Vector2f(x + 20, y + consoleWindow.getSize().y - characterSize - 6));
				}
			}
			else if(windowEvent.key.code == sf::Keyboard::Down)
			{
				if(!commandList.empty() && iCommand != commandList.end())
				{
					if(iCommand != commandList.end() - 1)
					{
						++iCommand;
						consoleTextList[0] = (*iCommand);
					}
					else
					{
						consoleTextList[0].setString("");
						iCommand = commandList.end();
					}
					const float x = consoleWindow.getPosition().x;
					const float y = consoleWindow.getPosition().y;
					consoleTextList[0].setPosition(sf::Vector2f(x + 20, y + consoleWindow.getSize().y - characterSize - 6));
				}
			}
		break;


		case(sf::Event::TextEntered):

			// Writes a command
			if(visible && windowEvent.text.unicode < 128)
				handleText(windowEvent); 
		break;


		case(sf::Event::MouseWheelMoved):

			// Depending on the mousewheel, it moves up or down
			if(windowEvent.mouseWheel.delta > 0)
			{
				scrollBar[0].move(0, -3.0f);
				updateScroll();
			}
			if(windowEvent.mouseWheel.delta < 0)
			{
				scrollBar[0].move(0, 3.0f);
				updateScroll();
			}
		break;
	}
}
Example #9
0
void TextLayout::getTextPath(SkPaint *paint, const Char16 *text, Int32 len,
                             Int32 bidiFlags, Float x, Float y, SkPath *path)
{
    handleText(paint, text, len, bidiFlags, x, y, path);
}