Ejemplo n.º 1
0
void DrawLine::pushDraw(CCNode* removeNode1,CCNode* removeNode2){
	//test
	/*listPoints->clear();
	addPoint(ccp(610.5,292.5));
	addPoint(ccp(313.5,370.5));

	addPoint(ccp(610.5,409.5));
	addPoint(ccp(313.5,409.5));*/
	//endtest
	int size = listPoints->size();
	if(size > 0){
		isDraw = true;
		for(int i = 0 ; i < size ; i++){
			vertices[i] = listPoints->at(i);
		}
		generateLines();
		/*CCPoint point = vertices[1];
		vertices[1] = vertices[size-1];
		vertices[size-1] = point;
		*/
		CCDelayTime* delayTime = CCDelayTime::create(Config::TIME_DRAWING_LINE);
		CCCallFunc* callfunc = CCCallFunc::create(this,callfunc_selector(DrawLine::endDraw));
		runAction(CCSequence::create(delayTime,callfunc,NULL));
		//removing node
		CCCallFuncND* callfuncND1 = CCCallFuncND::create(this,callfuncND_selector(DrawLine::removeNode),removeNode1);
		CCCallFuncND* callfuncND2 = CCCallFuncND::create(this,callfuncND_selector(DrawLine::removeNode),removeNode2);

		runAction(CCSequence::create(CCDelayTime::create(Config::TIME_DRAWING_LINE),callfuncND1,NULL));
		runAction(CCSequence::create(CCDelayTime::create(Config::TIME_DRAWING_LINE),callfuncND2,NULL));
	}
}
Ejemplo n.º 2
0
LSystem::LSystem(char* s)
{
	string = new char[strlen(s)];
	strcpy(string, s);
	printf("Initializing LSystem using %s\n",string);
	for(int j = 0; j < numRecursions; j++)
	{
		for(int i = 0; i < strlen(string); i++)
		{
			for(int k = 0; k < strlen(conditions); k++)
			{
				if(string[i] == conditions[k]) {
					applyRule(i,k);
					i = i + strlen(rules[k]) - 1;
				}
			}
		}
	}
	generateLines();
}