Beispiel #1
0
bool GameMainState::init(Layer* layer){
	mSceneState = FADEIN;
	mUpdateState = UPDATESTART;
	parentLayer = layer;
    
    
	auto mediator = GameDataMediator::create();
	mediator->setTag(12345);
	parentLayer->addChild(mediator);

	mediator->setFollow(parentLayer);

	auto lis = PhysicsListener::create();
	parentLayer->addChild(lis);

	uiLayer = UiObjectLayer::create();

	parentLayer->addChild(uiLayer);

	auto back = BackGround::create(parentLayer);
	back->setTag(1004);
	parentLayer->addChild(back);

	auto startStand = StartStand::create("Texture/GamePlay/GameStage/StartBlockAfter.png");
	startStand->setName("StartStand");
	startStand->setPosition(Vec2(140, 200));

	parentLayer->addChild(startStand);

	createPauseBotton();

	return true;
}
Beispiel #2
0
void
Dynamic::AlbumPlayBias::selectionChanged( int which )
{
    if( QComboBox *box = qobject_cast<QComboBox*>(sender()) )
        setFollow( followForName( box->itemData( which ).toString() ) );
}
Beispiel #3
0
void RigThread::run() {
    int retcode, status;

    termStatus = 0;
    
    std::cout << "Rig thread starting." << std::endl;

    rig = rig_init(rigModel);
	strncpy(rig->state.rigport.pathname, rigFile.c_str(), FILPATHLEN - 1);
	rig->state.rigport.parm.serial.rate = serialRate;
	retcode = rig_open(rig);
    
    if (retcode != 0) {
        std::cout << "Rig failed to init. " << std::endl;
        IOThread::terminate();
        return;
    }
    
	char *info_buf = (char *)rig_get_info(rig);

    if (info_buf) {
        std::cout << "Rig info: " << info_buf << std::endl;
    } else {
        std::cout << "Rig info was NULL." << std::endl;
    }
    
    while (!stopping) {
        std::this_thread::sleep_for(std::chrono::milliseconds(150));
        
        auto activeDemod = wxGetApp().getDemodMgr().getActiveDemodulator();
        auto lastDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();

        if (freqChanged.load() && (controlMode.load() || setOneShot.load())) {
            status = rig_get_freq(rig, RIG_VFO_CURR, &freq);
            if (status == 0 && !stopping) {
                
                if (freq != newFreq && setOneShot.load()) {
                    freq = newFreq;
                    rig_set_freq(rig, RIG_VFO_CURR, freq);
    //                std::cout << "Set Rig Freq: %f" <<  newFreq << std::endl;
                }
                
                freqChanged.store(false);
                setOneShot.store(false);
            } else {
                termStatus = 0;
                break;
            }
        } else {
            freq_t checkFreq;
            
            status = rig_get_freq(rig, RIG_VFO_CURR, &checkFreq);

            if (status == 0 && !stopping) {
                if (checkFreq != freq && followMode.load()) {
                    freq = checkFreq;
                    if (followModem.load()) {
                        if (lastDemod) {
                            lastDemod->setFrequency(freq);
                            lastDemod->updateLabel(freq);
                            lastDemod->setFollow(true);
                        }
                    } else {
                        wxGetApp().setFrequency((long long)checkFreq);
                    }
                } else if (wxGetApp().getFrequency() != freq && controlMode.load() && !centerLock.load() && !followModem.load()) {
                    freq = wxGetApp().getFrequency();
                    rig_set_freq(rig, RIG_VFO_CURR, freq);
                } else if (followModem.load()) {
                    if (lastDemod) {
                        if (lastDemod->getFrequency() != freq) {
                            lastDemod->setFrequency(freq);
                            lastDemod->updateLabel(freq);
                            lastDemod->setFollow(true);
                        }
                    }
                }
            } else {
                termStatus = 0;
                break;
            }
        }
        
        if (!centerLock.load() && followModem.load() && wxGetApp().getFrequency() != freq && (lastDemod && lastDemod != activeDemod)) {
            wxGetApp().setFrequency((long long)freq);
        }
        
//        std::cout <<  "Rig Freq: " << freq << std::endl;
    }
    
    rig_close(rig);
    rig_cleanup(rig);
    
    std::cout << "Rig thread exiting status " << termStatus << "." << std::endl;
};