KBlocksWin::KBlocksWin(KBlocksGameLogic * p, KBlocksPlayManager * pM, int capacity, int gamecount) : KXmlGuiWindow() { //Use up to 3MB for global application pixmap cache QPixmapCache::setCacheLimit(3*1024); mFirstInit = true; mpKBPlayer = new KBlocksKeyboardPlayer(this); mpAIPlayer = new KBlocksAIPlayer(); mMaxGameCapacity = capacity; mGameCount = gamecount; mpGameLogic = p; mpPlayManager = pM; mpGameScene = new KBlocksScene(mpGameLogic, capacity); mpGameView = new KBlocksView(mpGameScene, this); mpGameView->show(); setCentralWidget(mpGameView); connect(mpGameView, SIGNAL(focusEvent(bool)), this, SLOT(focusEvent(bool))); setAutoSaveSettings(); setupGUILayout(); }
KBlocksWin::KBlocksWin(KBlocksGameLogic *p, KBlocksPlayManager *pM, int capacity, int gamecount) : KXmlGuiWindow() { //Use up to 3MB for global application pixmap cache QPixmapCache::setCacheLimit(3 * 1024); mpKBPlayer = new KBlocksKeyboardPlayer(this); mpAIPlayer = new KBlocksAIPlayer(); mMaxGameCapacity = capacity; mGameCount = gamecount; mpGameLogic = p; connect(mpGameLogic, &KBlocksGameLogic::allGamesStopped, this, &KBlocksWin::onAllGamesStopped); mpPlayManager = pM; mpGameScene = new KBlocksScene(mpGameLogic, capacity); connect(mpKBPlayer, &KBlocksKeyboardPlayer::blockMoved, mpGameScene, &KBlocksScene::playMoveSound); connect(mpKBPlayer, &KBlocksKeyboardPlayer::blockDropped, mpGameScene, &KBlocksScene::playDropSound); mpGameView = new KBlocksView(mpGameScene, this); mpGameView->show(); setCentralWidget(mpGameView); connect(mpGameView, &KBlocksView::focusEvent, this, &KBlocksWin::focusEvent); setAutoSaveSettings(); setupGUILayout(); }