コード例 #1
0
ファイル: TextRenderer.cpp プロジェクト: smistad/FAST
void TextRenderer::loadAttributes() {
    std::string position = getStringAttribute("position");
    if(position == "center") {
        setPosition(POSITION_CENTER);
    } else if(position == "top_left") {
        setPosition(POSITION_TOP_LEFT);
    } else if(position == "top_right") {
        setPosition(POSITION_TOP_RIGHT);
    } else if(position == "bottom_left") {
        setPosition(POSITION_BOTTOM_LEFT);
    } else if(position == "bottom_right") {
        setPosition(POSITION_BOTTOM_RIGHT);
    } else {
        throw Exception("Uknown position for TextRenderer: " + position);
    }
    setFontSize(getIntegerAttribute("font_size"));
}
コード例 #2
0
ファイル: beds.cpp プロジェクト: AhmedWaly/CastOnly
void BedItem::regeneratePlayer(Player* player) const
{
	const int32_t* sleepStart = getIntegerAttribute("sleepstart");
	int32_t sleptTime = (int32_t)time(NULL) - (sleepStart ? *sleepStart : 0);
	if(Condition* condition = player->getCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT))
	{
		int32_t amount = sleptTime / 30;
		if(condition->getTicks() != -1)
		{
			amount = std::min((condition->getTicks() / 1000), sleptTime) / 30;
			int32_t tmp = condition->getTicks() - (amount * 30000);
			if(tmp <= 0)
				player->removeCondition(condition);
			else
				condition->setTicks(tmp);
		}

		player->changeHealth(amount);
		player->changeMana(amount);
	}

	player->changeSoul((int32_t)std::max((float)0, (float)sleptTime / (60 * 15)));
}
コード例 #3
0
ファイル: item_attributes.cpp プロジェクト: RGZorzo/server
bool ItemAttributes::hasIntegerAttribute(const std::string& key) const
{
  return getIntegerAttribute(key) != NULL;
}
コード例 #4
0
int filterLoadXml(char *docname,uint8_t silent)
{
 xmlDocPtr xdoc;
 xmlNodePtr node,subnode;
int32_t nb_filters,itag;
CONFcouple *couple;
//uint16_t s16;
			UNUSED_ARG(silent);
			xdoc=xmlParseFile(docname);
			if(!xdoc)
				{
					GUI_Alert("Problem reading xml filters!");
					return 0;
				}
			node=xdoc->children;
			nb_filters=getIntegerAttribute(node,(  char *)"filters",(  char *)"FilterNumber");
			if(nb_filters==-1)
					{
							xmlFreeDoc(xdoc);
							GUI_Alert("No filter found!");
							return 0;
					}

			if(1<nb_active_filter)
			{
					  filterCleanUp();
			}

			// if there is no active filter
			// Create at least the editor output one

			if(!nb_active_filter)
			{
				// avoid going down
				aviInfo aviinf;
  				// now build infos
  				video_body->getVideoInfo(&aviinf);
				frameStart=0;
				frameEnd=aviinf.nb_frames-1;
  		 		videofilters[0].filter=  new AVDMVideoStreamNull(video_body,0,frameEnd);

    			}
			nb_active_filter=1;

			// now ready to add new ones

			subnode=node->children;
			for(uint32_t curFilter=0;curFilter<(uint32_t)nb_filters;curFilter++)
			{
				// lookup next filter_saveload
				subnode=nextByName(subnode ,(char *)"Filter");
				if(!node)
					{
						GUI_Alert("Error searching Filter");
						return 0;
					}

				itag=getIntegerAttribute(subnode,(char *)"Filter",(char *)"Tag");
				if(itag==-1)
					{
							xmlFreeDoc(xdoc);
							GUI_Alert("No tag found!");
							return 0;
					}
				// now we got the tag
				printf("\n %lu tag \n",itag);

				// and we can build a CONFCouple if necessary
				xmlNodePtr conf;
				conf=subnode->children;
				conf=nextByName(conf ,(char *)"Parameters");
				if(!conf)
					{ // no paramaters needed
						couple=NULL;
					}
				else
					{
						int32_t args=getIntegerAttribute(conf,(char *)"Parameters",(char *)"Number");
			//			printf("\n ** needs %d param :\n",args);

						conf=conf->children;
						assert(conf);
						assert(args);
						couple=buildCouple(args,conf);

					}

				// once we have tag and CONFcouple we can build the filter
			//	if(couple) couple->dump();
				videofilters[nb_active_filter].filter= filterCreateFromTag( (VF_FILTERS)itag,
													couple,
													videofilters[nb_active_filter-1].filter);
				videofilters[nb_active_filter].tag=(VF_FILTERS)itag;
				videofilters[nb_active_filter].conf=couple;;
				nb_active_filter++;


				couple=NULL;
				// next filter please!
				subnode=subnode->next;
			}
			printf("\n found : %lu filters\n",nb_filters);
	xmlFreeDoc(xdoc);
	return 1;
}
コード例 #5
0
ファイル: AMDGPUBaseInfo.cpp プロジェクト: CSI-LLVM/llvm
unsigned getInitialPSInputAddr(const Function &F) {
  return getIntegerAttribute(F, "InitialPSInputAddr", 0);
}
コード例 #6
0
ファイル: AMDGPUBaseInfo.cpp プロジェクト: CSI-LLVM/llvm
unsigned getMaximumWorkGroupSize(const Function &F) {
  return getIntegerAttribute(F, "amdgpu-max-work-group-size", 256);
}
コード例 #7
0
ファイル: ImageClassifier.cpp プロジェクト: smistad/FAST
void ClassificationToText::loadAttributes() {
    mBufferSize = getIntegerAttribute("average_size");
}