int algo_proc(void *_img) { img = (typeof(img))_img; process(); if (selected(sock)) { char buf[128]; udprecv(sock, buf, sizeof(buf)); printf("got %c\n", *buf); if (*buf == 'q') return 1; if (*buf == 'a') { acting = 1; readxml("./act.xml"); acting = 0; } if (*buf == 's') writexml("./config.xml"); if (*buf == 'l') readxml("./config.xml"); if (*buf == 'r') readxml("./default.xml"); writexml("./cur.xml"); } return 0; }
void MainWindow::sendfun() { if (tein->toPlainText() == "") { QMessageBox::information(this, tr("..."), tr("消息为空")); return; } l = new QLabel(teout); if (str1 != showTime()) { l->setText(showTime()); } str1 = showTime(); l->setGeometry((this->size().width()) / 2 - 80, a - 10 , 100, 66); l->setWordWrap(true); l->setAlignment(Qt::AlignHCenter); l->show(); QString str = tein->toHtml(); str.replace("%3A", ":"); qDebug() << str; TextEdit *t = new TextEdit(teout); readxml(str, t); pArea->ensureVisible(5, a + 20); tein->clear(); }
bool TcharacterDrawnode::init(string hz,CCSize showrect,CharacterExtend* p){ strokedrawList = CCArray::create(); strokedrawList->retain(); CReadXML readxml(p->getXML()->getCString()); this->m_character = readxml.getCharacter(); myChar = readxml.getCharacter(); this->showRect = showrect; this->m_character.getBox(); this->m_character.resize(showRect); this->m_character.resample(); vector<Bujian> bujianList = this->m_character.bujianList; vector<Bujian>::iterator iter = bujianList.begin(); for (iter ; iter != bujianList.end() ; ++ iter) { Bujian bujian = (Bujian)*iter; vector<Stroke> strokeList = bujian.strokeList; for (int i = 0 ; i < strokeList.size() ; i++) { this->getstrokedrawList()->addObject(StrokeDrawnode::create(strokeList.at(i))); } } return true; }
int spumux_parse(const char *fname) { return readxml(fname,spu_elems,spu_attrs); }
// on "init" you need to initialize your instance bool HelloWorld::init() { ////////////////////////////// // 1. super init first if ( !Layer::init() ) { return false; } Size visibleSize = Director::getInstance()->getVisibleSize(); Vec2 origin = Director::getInstance()->getVisibleOrigin(); auto label = Label::createWithTTF("Hello World", "fonts/Marker Felt.ttf", 24); // position the label on the center of the screen label->setPosition(Vec2(origin.x + visibleSize.width/2, origin.y + visibleSize.height - label->getContentSize().height)); // add the label as a child to this layer this->addChild(label, 1); // add "HelloWorld" splash screen" auto sprite = Sprite::create("HelloWorld.png"); // position the sprite on the center of the screen sprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y)); // add the sprite as a child to this layer this->addChild(sprite, 0); copyFile("testRapid.xml"); di=Sprite::create("di.png"); di->setPosition(Vec2(visibleSize.width/2, visibleSize.height/4)); addChild(di,1); content="石家庄t苍,放大!镜和科技发达ui啊是否能卡的岚互娱科技有限公司德克萨斯大"; labelcontent=Label::createWithSystemFont("", "", 12); labelcontent->setAnchorPoint(Vec2(0, 0.5)); labelcontent->setPosition(Vec2(70,di->getContentSize().height/3 )); labelcontent->setTag(5); labelcontent->setWidth(330); labelcontent->setHeight(di->getContentSize().height/1.5); labelcontent->setLineBreakWithoutSpace(true); di->addChild(labelcontent,1); labelname=Label::createWithSystemFont("苍岚", "", 16); labelname->setPosition(Vec2(50, di->getContentSize().height-10 )); di->addChild(labelname,1); auto touchlistener=EventListenerTouchOneByOne::create(); touchlistener->onTouchBegan=CC_CALLBACK_2(HelloWorld::onTouchBegan, this); Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(touchlistener, di); role1=Sprite::create("icon1.png"); role1->setAnchorPoint(Vec2(0, 0)); role1->setPosition(Vec2(visibleSize.width-di->getContentSize().width,di->getContentSize().height)); di->addChild(role1,1); role2=Sprite::create("icon2.png"); role2->setScale(2); role2->setAnchorPoint(Vec2(1, 0)); role2->setPosition(Vec2(di->getContentSize().width, di->getContentSize().height)); di->addChild(role2,2); dizuo=Sprite::create("dizuo.png"); dizuo->setScale(0.6); dizuo->setAnchorPoint(Vec2(1, 0.8)); dizuo->setPosition(Vec2(di->getContentSize().width, dizuo->getContentSize().height)); di->addChild(dizuo); jiantou=Sprite::create("jiantou.png"); jiantou->setAnchorPoint(Vec2(0.15, 0.5)); jiantou->setScale(0.6); jiantou->setPosition(Point(dizuo->getPositionX()-dizuo->getContentSize().width/2,dizuo->getPositionY())); di->addChild(jiantou,1); auto moveup=MoveTo::create(0.5, Point(dizuo->getPositionX()-dizuo->getContentSize().width/2,dizuo->getPositionY()+jiantou->getContentSize().height/3)); auto movedown=MoveTo::create(0.5, Point(dizuo->getPositionX()-dizuo->getContentSize().width/2,dizuo->getPositionY())); auto seq=Sequence::create(moveup,movedown,NULL); jiantou->runAction(RepeatForever::create(seq)); schedule(schedule_selector(HelloWorld::logic),time); n = 0 ; readxml(); return true; }