예제 #1
0
파일: ren44.c 프로젝트: zyouyowa/pro2-c
int main(int argc, char const *argv[])
{
	printf("\x1b[2J");
		color(34);
		draw_t(5,1);
		color(33);
		draw_p(30,1);
		color(0);
	return 0;
}
예제 #2
0
void QuadTree::add_entities_in_range(Entity * e, float dist, std::vector<Entity*> & res) {
	draw_p();
	if(circle_intersect_rect(e->pos, dist, pos, size)) {

		if(entity != nullptr) {
			add_entities(res, e);
			return;
		}
		for(int i = 0; i < 4; ++i) {
			if(children[i] != nullptr) {
				children[i]->add_entities_in_range(e, dist, res);
			}
		}
	}
}
예제 #3
0
void QuadTree::add_entities(std::vector<Entity*> & res, Entity * excluded_entity){
	draw_p();
	if(entity != nullptr) {
		if(entity == excluded_entity) {
			return;
		}
		res.push_back(entity);
		return;
	}
	for(size_t i = 0; i < 4; i++) {
		if(children[i] != nullptr) {
			children[i]->add_entities(res, excluded_entity);
		}
	}
	return;
}