//キー入力によって移動させる void PlayerController::Think(){ UpdateKey(); //キーが押されているなら if(GetJoypadInputState( DX_INPUT_KEY_PAD1 )){ //Sキーが押されているなら走る if(CheckHitKey( KEY_INPUT_S )==1){ if( CheckHitKey( KEY_INPUT_RIGHT ) == 1 ) character_->Run(true); else if(CheckHitKey( KEY_INPUT_LEFT ) == 1) character_->Run(false); else character_->NoMove(); } //そうでない場合は歩く else{ //右が押されているなら右に移動 if( CheckHitKey( KEY_INPUT_RIGHT ) == 1 ) character_->Walk(true); //左が押されているなら左に移動 else if(CheckHitKey( KEY_INPUT_LEFT ) == 1) character_->Walk(false); //それ以外は静止 else character_->NoMove(); } //Aか上が押されていて、ジャンプ中でないならジャンプ if(( CheckHitKey( KEY_INPUT_A )==1 ||CheckHitKey( KEY_INPUT_UP ) == 1) &&character_->isAerial()==false) character_->Jump(); //Dが押された場合弾発射 if(key[KEY_INPUT_D]==1){ character_->DoAttack(); } } //キーが押されていないなら静止 else character_->NoMove(); }
void CBindPanel::OnThink( void ) { if ( gpGlobals->curtime > m_fUpdateTime ) { UpdateKey(); } }
void CInstrumentEditorDPCM::OnCbnSelchangeSamples() { CComboBox *m_pSampleBox = reinterpret_cast<CComboBox*>(GetDlgItem(IDC_SAMPLES)); CComboBox *pPitchBox = reinterpret_cast<CComboBox*>(GetDlgItem(IDC_PITCH)); int PrevSample = m_pInstrument->GetSample(m_iOctave, m_iSelectedKey); int Sample = m_pSampleBox->GetCurSel(); if (Sample > 0) { char Name[256]; m_pSampleBox->GetLBText(Sample, Name); Name[2] = 0; if (Name[0] == _T('0')) { Name[0] = Name[1]; Name[1] = 0; } Sample = atoi(Name); Sample++; if (PrevSample == 0) { int Pitch = pPitchBox->GetCurSel(); m_pInstrument->SetSamplePitch(m_iOctave, m_iSelectedKey, Pitch); } } m_pInstrument->SetSample(m_iOctave, m_iSelectedKey, Sample); UpdateKey(m_iSelectedKey); }
void CInstrumentEditorDPCM::OnBnClickedAdd() { // Add sample to key list CComboBox *pPitchBox = reinterpret_cast<CComboBox*>(GetDlgItem(IDC_PITCH)); int Pitch = pPitchBox->GetCurSel(); if (GetDocument()->GetSampleSize(m_iSelectedSample) > 0) { m_pInstrument->SetSample(m_iOctave, m_iSelectedKey, m_iSelectedSample + 1); m_pInstrument->SetSamplePitch(m_iOctave, m_iSelectedKey, Pitch); UpdateKey(m_iSelectedKey); } m_pSampleListCtrl = reinterpret_cast<CListCtrl*>(GetDlgItem(IDC_SAMPLE_LIST)); m_pTableListCtrl = reinterpret_cast<CListCtrl*>(GetDlgItem(IDC_TABLE)); if (m_iSelectedKey < 12 && m_iSelectedSample < MAX_DSAMPLES) { m_pSampleListCtrl->SetItemState(m_iSelectedSample, 0, LVIS_FOCUSED | LVIS_SELECTED); m_pTableListCtrl->SetItemState(m_iSelectedKey, 0, LVIS_FOCUSED | LVIS_SELECTED); if (m_iSelectedSample < m_pSampleListCtrl->GetItemCount() - 1) m_iSelectedSample++; m_iSelectedKey++; m_pSampleListCtrl->SetSelectionMark(m_iSelectedSample); m_pTableListCtrl->SetSelectionMark(m_iSelectedKey); m_pSampleListCtrl->SetItemState(m_iSelectedSample, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED); m_pTableListCtrl->SetItemState(m_iSelectedKey, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED); } }
void KeyboardState::SetKeyInternal(Key key, bool kepPressed, double timeCurrent) { auto keyPressedPrevious = at(key).mPressed; auto keyPressedCurrent = kepPressed; auto& keyState = at(key); keyState.mKeyChanged = true; UpdateKey(keyState, keyPressedCurrent, keyPressedPrevious, timeCurrent); }
void CInstrumentEditorDPCM::OnNMRClickTable(NMHDR *pNMHDR, LRESULT *pResult) { LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR); // Create a popup menu for key list with samples CDSample *pDSample; CMenu PopupMenu; CPoint point; m_pTableListCtrl = reinterpret_cast<CListCtrl*>(GetDlgItem(IDC_TABLE)); m_iSelectedKey = m_pTableListCtrl->GetSelectionMark(); GetCursorPos(&point); PopupMenu.CreatePopupMenu(); PopupMenu.AppendMenu(MF_STRING, 1, _T("(no sample)")); // Fill menu for (int i = 0; i < MAX_DSAMPLES; i++) { pDSample = GetDocument()->GetDSample(i); if (pDSample->SampleSize > 0) { PopupMenu.AppendMenu(MF_STRING, i + 2, A2T(pDSample->Name)); } } UINT Result = PopupMenu.TrackPopupMenu(TPM_RIGHTBUTTON | TPM_RETURNCMD, point.x, point.y, this); if (Result == 1) { // Remove sample m_pInstrument->SetSample(m_iOctave, m_iSelectedKey, 0); UpdateKey(m_iSelectedKey); } else if (Result > 1) { // Add sample CComboBox *pPitchBox = reinterpret_cast<CComboBox*>(GetDlgItem(IDC_PITCH)); int Pitch = pPitchBox->GetCurSel(); m_pInstrument->SetSample(m_iOctave, m_iSelectedKey, Result - 1); m_pInstrument->SetSamplePitch(m_iOctave, m_iSelectedKey, Pitch); UpdateKey(m_iSelectedKey); } *pResult = 0; }
void CInstrumentEditorDPCM::OnBnClickedLoop() { int Pitch = m_pInstrument->GetSamplePitch(m_iOctave, m_iSelectedKey) & 0x0F; if (IsDlgButtonChecked(IDC_LOOP)) Pitch |= 0x80; m_pInstrument->SetSamplePitch(m_iOctave, m_iSelectedKey, Pitch); UpdateKey(m_iSelectedKey); }
void CBindPanel::SetBind( const char *szBind, int iSlot ) { if ( !szBind ) { m_szBind[0] = '\0'; return; } Q_snprintf( m_szBind, sizeof( m_szBind ), "%s", szBind ); m_iSlot = iSlot; UpdateKey(); }
void CInstrumentEditorDPCM::OnBnClickedRemove() { // Remove sample from key list m_pInstrument->SetSample(m_iOctave, m_iSelectedKey, 0); UpdateKey(m_iSelectedKey); if (m_iSelectedKey > 0) { m_pTableListCtrl->SetItemState(m_iSelectedKey, 0, LVIS_FOCUSED | LVIS_SELECTED); m_iSelectedKey--; m_pTableListCtrl->SetSelectionMark(m_iSelectedKey); m_pTableListCtrl->SetItemState(m_iSelectedKey, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED); } }
void CInstrumentEditorDPCM::OnCbnSelchangePitch() { CComboBox *m_pPitchBox = reinterpret_cast<CComboBox*>(GetDlgItem(IDC_PITCH)); if (m_iSelectedKey == -1) return; int Pitch = m_pPitchBox->GetCurSel(); if (IsDlgButtonChecked(IDC_LOOP)) Pitch |= 0x80; m_pInstrument->SetSamplePitch(m_iOctave, m_iSelectedKey, Pitch); UpdateKey(m_iSelectedKey); }
void Input::Update() { UpdateMouse(); for(auto& key : m_keys) { const bool pressed = glfwGetKey(&m_window, key.key) == GLFW_PRESS; UpdateKey(pressed, key.state); const bool keyDown = key.continuous ? IsKeyDownContinous(key.state) : IsKeyDown(key.state); if(keyDown && key.onKeyFn != nullptr) { key.onKeyFn(); } } }
void KeyboardState::UpdateEvent(double /* elapsed */) { for (auto& keyStatePair : *this) { auto& keyState = keyStatePair.second; // NOTE(Wuxiang): The event polling has not polled anything reflecting // position changes. So the position is not changed. We have to reset // position difference. if (!keyState.mKeyChanged) { UpdateKey(keyState, keyState.mPressed, keyState.mPressed, GameTimer::GetMilliseconds()); } else { // Reset change flag if there has been changes during this frame. keyState.mKeyChanged = false; } } }
void CInstrumentEditorDPCM::BuildKeyList() { for (int i = 0; i < 12; ++i) { UpdateKey(i); } }
bool MyInput::Update(){ //キーボード, パッド, マウスの入力状態を更新 return UpdateKey() && UpdatePad() && UpdateMouse(); }
int ks_zjvcc_cardtype::RestoreFactorySettings() { char sCardPhyID[17]= {0}; byte ucCardPhyID[9]= {0}; byte ucMainKey[17]= {0}; byte ucDiverKey[17]= {0}; string sCmd; int nRet=0; if(!m_CardKeys.bLoad) { SetLastErrMsg("密钥未装载"); return -1; } nRet=RequestCard(); if(nRet) { return nRet; } nRet=SelectADF(); // 选择 DF03 if(nRet) { return nRet; } if(strlen(m_szCardUID)==8) strcat(m_szCardUID,"80000000"); if(strlen(m_szCardUID)!=16) { SET_ERR("卡物理ID["<<m_szCardUID<<"]长度错误"); return -1; } int i=0; int iLen=0; unsigned char ucCCK[17]= {0}; hex2dec(m_szCardUID,16,ucCardPhyID,iLen); #if UPDATE_DACK==1 PbocDiverKey(ucCardPhyID,m_CardKeys.DACK,ucMainKey);//应用主控密钥 #else memcpy(ucMainKey,INIT_CCK,16); //出厂密钥 #endif nRet=ExecExtAuthCmd8(ucMainKey); if(nRet) { return nRet; } byte ucData[256] = {0}; //初始化0x15 nRet=UpdateBinaryFile(0x15,0,56,ucData); if(nRet) { return nRet; } //初始化0x16 nRet=UpdateBinaryFile(0x16,0,112,ucData); if(nRet) { return nRet; } //初始化0x12 nRet=UpdateBinaryFile(0x12,0,16,ucData); if(nRet) { return nRet; } //初始化0x19 nRet=UpdateBinaryFile(0x19,0,16,ucData); if(nRet) { return nRet; } memcpy(ucDiverKey,INIT_CCK,16); //出厂密钥 //修改维护密钥1 nRet=UpdateKey(ucMainKey,0x00,0x36,ucDiverKey); if(nRet) { return nRet; } //修改维护密钥2 nRet=UpdateKey(ucMainKey,0x01,0x36,ucDiverKey); if(nRet) { return nRet; } //修改消费密钥1 nRet=UpdateKey(ucMainKey,0x01,0x3E,ucDiverKey); if(nRet) { return nRet; } //修改消费密钥2 nRet=UpdateKey(ucMainKey,0x02,0x3E,ucDiverKey); if(nRet) { return nRet; } //修改充值密钥1 nRet=UpdateKey(ucMainKey,0x01,0x3F,ucDiverKey); if(nRet) { return nRet; } //修改充值密钥2 nRet=UpdateKey(ucMainKey,0x02,0x3F,ucDiverKey); if(nRet) { return nRet; } //修改TAC密钥 nRet=UpdateKey(ucMainKey,0x00,0x34,ucDiverKey); if(nRet) { return nRet; } //修改PIN解锁密钥 nRet=UpdateKey(ucMainKey,0x00,0x37,ucDiverKey); if(nRet) { return nRet; } //修改PIN重装密钥 nRet=UpdateKey(ucMainKey,0x00,0x38,ucDiverKey); if(nRet) { return nRet; } //修改外部认证密钥1 nRet=UpdateKey(ucMainKey,0x01,0x39,ucDiverKey); if(nRet) { return nRet; } //修改外部认证密钥2 nRet=UpdateKey(ucMainKey,0x02,0x39,ucDiverKey); if(nRet) { return nRet; } #if UPDATE_DACK==1 //修改主控密钥 nRet=UpdateKey(ucMainKey,0x00,0x39,ucDiverKey); if(nRet) { return nRet; } #endif return SelectADF(); }
int ks_zjvcc_cardtype::InitUserCard(const char *sShowCardNo) { int nRet=0; int iLen=0; char sCardPhyID[17]= {0}; byte ucCardPhyID[9]= {0}; if(!m_CardKeys.bLoad) { SetLastErrMsg("密钥未装载"); return -1; } //寻卡 nRet=RequestCard(); if(nRet) { return nRet; } if(strlen(m_szCardUID)==8) strcat(m_szCardUID,"80000000"); if(strlen(m_szCardUID)!=16) { SET_ERR("卡物理ID["<<m_szCardUID<<"]长度错误"); return -1; } hex2dec(m_szCardUID,16,ucCardPhyID,iLen); nRet=SelectADF(); if(nRet) { return nRet; } byte ucData[256] = {0}; /* // 判断卡是否已经初始化 memset(ucData,0,sizeof ucData); nRet=ReadBinaryFile(0x15,0x00,30,ucData); if(nRet) { return nRet; } if(0x02==ucData[9]) { SET_ERR("该卡已经初始化"); return -1; } */ // 应用外部认证 nRet = ExecExtAuthCmd8(INIT_CCK); if(nRet) { return nRet; } byte ucRes[256]= {0}; byte ucRespLen = 0; byte ucMainKey[16]= {0}; byte ucDiverKey[16]= {0}; memcpy(ucMainKey,INIT_CCK,16); //出厂密钥 //修改维护密钥1 PbocDiverKey(ucCardPhyID,m_CardKeys.DAMK,ucDiverKey); nRet=UpdateKey(ucMainKey,0x00,0x36,ucDiverKey); if(nRet) { return nRet; } //修改维护密钥2 PbocDiverKey(ucCardPhyID,m_CardKeys.DAMK,ucDiverKey); nRet=UpdateKey(ucMainKey,0x01,0x36,ucDiverKey); if(nRet) { return nRet; } //修改消费密钥1 PbocDiverKey(ucCardPhyID,m_CardKeys.DPK1,ucDiverKey); nRet=UpdateKey(ucMainKey,0x01,0x3E,ucDiverKey); if(nRet) { return nRet; } //修改消费密钥2 PbocDiverKey(ucCardPhyID,m_CardKeys.DPK2,ucDiverKey); nRet=UpdateKey(ucMainKey,0x02,0x3E,ucDiverKey); if(nRet) { return nRet; } //修改充值密钥1 PbocDiverKey(ucCardPhyID,m_CardKeys.DLK1,ucDiverKey); nRet=UpdateKey(ucMainKey,0x01,0x3F,ucDiverKey); if(nRet) { return nRet; } //修改充值密钥2 PbocDiverKey(ucCardPhyID,m_CardKeys.DLK2,ucDiverKey); nRet=UpdateKey(ucMainKey,0x02,0x3F,ucDiverKey); if(nRet) { return nRet; } //修改TAC密钥 PbocDiverKey(ucCardPhyID,m_CardKeys.DTAC,ucDiverKey); nRet=UpdateKey(ucMainKey,0x00,0x34,ucDiverKey); if(nRet) { return nRet; } //修改PIN解锁密钥 PbocDiverKey(ucCardPhyID,m_CardKeys.DUK,ucDiverKey); nRet=UpdateKey(ucMainKey,0x00,0x37,ucDiverKey); if(nRet) { return nRet; } //修改PIN重装密钥 PbocDiverKey(ucCardPhyID,m_CardKeys.DRPK,ucDiverKey); nRet=UpdateKey(ucMainKey,0x00,0x38,ucDiverKey); if(nRet) { return nRet; } //修改外部认证密钥1 PbocDiverKey(ucCardPhyID,m_CardKeys.DACK1,ucDiverKey); nRet=UpdateKey(ucMainKey,0x01,0x39,ucDiverKey); if(nRet) { return nRet; } //修改外部认证密钥2 PbocDiverKey(ucCardPhyID,m_CardKeys.DACK2,ucDiverKey); nRet=UpdateKey(ucMainKey,0x02,0x39,ucDiverKey); if(nRet) { return nRet; } memset(ucData,0,sizeof(ucData)); //初始化0x15 // 显示卡号 strncpy((char*)&ucData[10], sShowCardNo, 10); //初始化0x15 nRet=UpdateBinaryFile(0x15,0,56,ucData); if(nRet) { return nRet; } memset(ucData,0,sizeof(ucData)); //初始化0x16 nRet=UpdateBinaryFile(0x16,0,112,ucData); if(nRet) { return nRet; } //初始化0x12 nRet=UpdateBinaryFile(0x12,0,16,ucData); if(nRet) { return nRet; } //初始化0x19 nRet=UpdateBinaryFile(0x19,0,16,ucData); if(nRet) { return nRet; } #if UPDATE_DACK==1 //修改主控密钥 PbocDiverKey(ucCardPhyID,m_CardKeys.DACK,ucDiverKey); nRet=UpdateKey(ucMainKey,0x00,0x39,ucDiverKey); if(nRet) { return nRet; } #endif return SelectADF(); }