SuperflatSettings::SuperflatSettings(QString text) { if (text != "") setStringRepresentation(text); else { // by default we have a "classic flat" configuration biome = PLAINS; addTopLayer(BEDROCK, 1); addTopLayer(DIRT, 2); addTopLayer(GRASSBLOCK, 1); } }
void SuperflatSettings::addLayer(int position, BlockType element, int height) { if (position >= layers.size()) addTopLayer(element, height); else if (position <= 0) addBottomLayer(element, height); else { if (layers.at(position).first == element) layers[position].second += height; else if (layers.at(position-1).first == element) layers[position-1].second += height; else layers.insert(position, QPair<BlockType, int>(element, height)); } }
// on "init" you need to initialize your instance bool GameLayer::init() { ////////////////////////////// // 1. super init first if ( !Layer::init()) { return false; } addTouch(); loadUI(); addPig(); objManager = ObjManager::getInstance(); test(); addTopLayer(); this->schedule( schedule_selector(GameLayer::generateUpdate), speep ); return true; }