Exemple #1
0
void AnimatedSprite::update(uint64 timestamp, bool isPaused) {
	if (isPaused && isPausable()) return;
	bool isEmpty = true;
	for (MIter p = messages.begin(); p != messages.end(); ++p) {
		if (p->timestamp <= lastTimestamp) continue;
		if (p->timestamp <= timestamp) {
			doMessage(p->id, p->data, p->timestamp);
			continue;
		}
		isEmpty = false;
	}
	if (isEmpty) {
		messages.clear();
	}
	isEmpty = true;
	for (CIter p = currentMessages.begin(); p != currentMessages.end(); ++p) {
		if (p->isEmpty) continue;
		uint64 timeDelta = timestamp - p->timestamp;
		if (!p->message->update(timeDelta, p->lastTimeDelta)) {
			p->isEmpty = true;
			continue;
		}
		p->lastTimeDelta = timeDelta;
		isEmpty = false;
	}
	if (isEmpty) {
		currentMessages.clear();
	}
	lastTimestamp = timestamp;
}
Exemple #2
0
void AnimatedSprite::refresh() {
	if (isAnimated) {
		if (--refreshCnt <= 0) {
			refreshCnt = REFRESH_CNT;
			doMessage(emtSwitch);
		}
	}
	Sprite::refresh();
}
Exemple #3
0
bool AnimatedSprite::sendMessage(int msg, uint64 timestamp, void* data) {
	if (!isValidMessage(msg)) {
		return false;
	}
	if (timestamp <= lastTimestamp) {
		doMessage(msg, data);
		return true;
	}
	messages.push_back(Message(msg, timestamp, data));
	return true;
}
Exemple #4
0
void TCParser::_parseMessage(const std::vector<std::string> &args)
{
	if (args.size() == 0)
    {
		_parserError(tcrec_cmd_message, "Empty message content");
        return;
	}
	
	std::string * msg = createJoin(args, " ");
	
	doMessage(*msg);
	
	delete msg;
}