本文整理汇总了C++中ReadKey函数的典型用法代码示例。如果您正苦于以下问题:C++ ReadKey函数的具体用法?C++ ReadKey怎么用?C++ ReadKey使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ReadKey函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Key
void Key()
{
char keyvalue;
keyvalue=ReadKey();
if(keyvalue!=0x00)
{
keyvalue=ReadKey();
while(ReadKey()!=0x00){}
}
if(keyvalue!=0x00)
{
switch(keyvalue) //只处理单个键按下的情况,多个键按下不识别,当作没有键按下
{
case 0x01:KeyNum=1;break;
case 0x02:KeyNum=2;break;
case 0x04:KeyNum=3;break;
case 0x08:KeyNum=4;break;
case 0x10:KeyNum=5;break;
case 0x20:KeyNum=6;break;
case 0x40:KeyNum=7;break;
case 0x80:KeyNum=8;break;
default:KeyNum=0;break;
}
}
else KeyNum=0;
if(KeyNum==3) Count++;
else if(KeyNum==7) Count--;
else{}
}
示例2: ReadKey
void CSTMInput::ReadKeys()
{
ReadKey(KEY_JOYSTICK_SEL);
ReadKey(KEY_JOYSTICK_UP);
ReadKey(KEY_JOYSTICK_DOWN);
ReadKey(KEY_JOYSTICK_LEFT);
ReadKey(KEY_JOYSTICK_RIGHT);
}
示例3: Mass_Storage_Start
/*******************************************************************************
* Function Name : Mass_Storage_Start
* Description : Starts the mass storage demo.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void Mass_Storage_Start (void)
{
/* Disble the JoyStick interrupts */
IntExtOnOffConfig(DISABLE);
/* Clear the LCD screen */
LCD_Clear(White);
LCD_SetDisplayWindow(160, 223, 128, 128);
LCD_DrawBMP(0x00647C00);
/* Disable LCD Window mode */
LCD_WindowModeDisable();
/* Set the Back Color */
LCD_SetBackColor(Blue);
/* Set the Text Color */
LCD_SetTextColor(White);
if(MSD_Init() != 0x00)
{
LCD_DisplayStringLine(Line8, " No MSD Card Present");
LCD_DisplayStringLine(Line9, " To exit Press SEL ");
/* Loop until SEL key pressed */
while(ReadKey() != SEL)
{
}
}
else
{
Get_Medium_Characteristics();
/* Display the " Plug the USB " message */
LCD_DisplayStringLine(Line8, " Plug the USB Cable ");
LCD_DisplayStringLine(Line9, "Exit: Push JoyStick");
/* Intialize the USB cell */
USB_Init();
LCD_ClearLine(Line9);
/* Display the "To stop Press SEL" message */
LCD_DisplayStringLine(Line8, " To stop Press SEL ");
/* Loop until SEL key pressed */
while(ReadKey() != SEL)
{
}
PowerOff();
}
LCD_Clear(White);
DisplayMenu();
IntExtOnOffConfig(ENABLE);
/* Flush SPI1 Data Register */
SPI_I2S_ReceiveData(SPI1);
}
示例4: DHCPReadConfig
// read configuration either from INI file (if it exists) or from the registry
int DHCPReadConfig ( )
{
int Ark;
char szBuf[128];
memset (& sParamDHCP, 0, sizeof sParamDHCP);
sParamDHCP.nLease = DHCP_DEFAULT_LEASE_TIME;
for (Ark=0 ; Ark<SizeOfTab (tDHCPd32Entry) ; Ark++)
ReadKey ( TFTPD32_DHCP_KEY,
tDHCPd32Entry [Ark].szEntry,
tDHCPd32Entry [Ark].pValue,
tDHCPd32Entry [Ark].nBufSize,
tDHCPd32Entry [Ark].nType,
szTftpd32IniFile );
// custom items
for (Ark=0 ; Ark < SizeOfTab (sParamDHCP.t) ; Ark++)
{
wsprintf (szBuf, "%s%d", KEY_DHCP_USER_OPTION_NB, Ark+1);
ReadKey (TFTPD32_DHCP_KEY, szBuf, & sParamDHCP.t[Ark].nAddOption,
sizeof sParamDHCP.t[Ark].nAddOption, REG_DWORD, szTftpd32IniFile);
wsprintf (szBuf, "%s%d", KEY_DHCP_USER_OPTION_VALUE, Ark+1);
ReadKey (TFTPD32_DHCP_KEY, szBuf, sParamDHCP.t[Ark].szAddOption,
sizeof sParamDHCP.t[Ark].szAddOption, REG_SZ, szTftpd32IniFile);
}
if ( sParamDHCP.nPoolSize!=0 )
{
tFirstIP = malloc (sParamDHCP.nPoolSize * sizeof *tFirstIP[0]) ;
tMAC = malloc (sParamDHCP.nPoolSize * sizeof *tMAC[0]) ;
if (tFirstIP == NULL || tMAC == NULL )
{
SVC_ERROR ("Can not allocate memory");
return FALSE;
}
LoadLeases ();
}
if (sParamDHCP.nLease==0)
{
sParamDHCP.nLease=DHCP_DEFAULT_LEASE_TIME;
LOG (12, "%d, Lease time not specified, set to 2 days", GetCurrentThreadId ());
}
// compatability 3 -> 4
if (sParamDHCP.szWins[0]==0 && sParamDHCP.szDns1[0]!=0)
{
lstrcpy (sParamDHCP.szWins, sParamDHCP.szDns1);
LOG (0, "WINS server copied from DNS servers");
}
return TRUE;
} // DHCPReadConfig
示例5: Proc_TP_Adj
char Proc_TP_Adj(char *NC)
{
unsigned int temp[8] ;
Color = Green ;
Color_BK = Black ;
TP_Init() ;
Clear_LCD(Color_BK) ;
PutStringCN24(58,120,"触摸屏校正") ;
Color = Cyan ;
PutStringCN16(30,165,"请用触控笔点测试点中心") ;
for(;;)
{
Draw_Test_Point(20,20,Yellow) ;
for(;;)
{
if(Read_TP_Twice(&temp[0],&temp[1])) break ;
if(ReadKey()==Cancel) return 0x00 ;
}
DrawRectFill(0,0,40,40,Color_BK) ;
Wait_Pen_Up() ;
Draw_Test_Point(220,20,Yellow) ;
for(;;)
{
if(Read_TP_Twice(&temp[2],&temp[3])) break ;
if(ReadKey()==Cancel) return 0x00 ;
}
DrawRectFill(200,0,40,40,Color_BK) ;
Wait_Pen_Up() ;
Draw_Test_Point(20,300,Yellow) ;
for(;;)
{
if(Read_TP_Twice(&temp[4],&temp[5])) break ;
if(ReadKey()==Cancel) return 0x00 ;
}
DrawRectFill(0,280,40,40,Color_BK) ;
Wait_Pen_Up() ;
Draw_Test_Point(220,300,Yellow) ;
for(;;)
{
if(Read_TP_Twice(&temp[6],&temp[7])) break ;
if(ReadKey()==Cancel) return 0x00 ;
}
DrawRectFill(200,280,40,40,Color_BK) ;
Wait_Pen_Up() ;
if(TP_Adjust(temp)) break ;
}
return 0x00 ;
}
示例6: MASS_init
/*******************************************************************************
* Function Name : MASS_init
* Description : Mass Storage init routine.
* Input : None.
* Output : None.
* Return : None.
*******************************************************************************/
void MASS_init()
{
pInformation->Current_Configuration = 0;
/* Connect the device */
PowerOn();
/* USB interrupts initialization */
/* clear pending interrupts */
_SetISTR(0);
wInterrupt_Mask = IMR_MSK;
/* set interrupts mask */
_SetCNTR(wInterrupt_Mask);
pInformation->Current_Feature = MASS_ConfigDescriptor[7];
/* Wait until device is configured */
while (pInformation->Current_Configuration == 0)
{
NOP_Process();
if(ReadKey() != NOKEY)
{
return;
}
}
bDeviceState = CONFIGURED;
}
示例7: Tftpd32ReadSettings
/////////////////////////////////////////////////////////
// Read settings :
// Parse the settings table and call ReadKey
/////////////////////////////////////////////////////////
BOOL Tftpd32ReadSettings (void)
{
int Ark, Rc=TRUE;
char szCurDir[_MAX_PATH];
for (Ark=0 ; Ark< SizeOfTab (tTftpd32Entry) ; Ark++)
ReadKey ( TFTPD32_MAIN_KEY,
tTftpd32Entry[Ark].szEntry,
tTftpd32Entry[Ark].pValue,
tTftpd32Entry[Ark].nBufSize,
tTftpd32Entry[Ark].nType,
szTftpd32IniFile );
if (sSettings.uServices == TFTPD32_NONE) sSettings.uServices = TFTPD32_ALL_SERVICES;
// field WorkingDirectory :
// try env variable then szBaseDir and current dir
if ( GetEnvironmentVariable (TFTP_DIR, szCurDir, sizeof szCurDir) != 0
&& IsValidDirectory ( szCurDir ) )
GetFullPathName ( szCurDir,
sizeof sSettings.szWorkingDirectory,
sSettings.szWorkingDirectory,
NULL );
else if ( IsValidDirectory ( sSettings.szBaseDirectory ) )
GetFullPathName ( sSettings.szBaseDirectory,
sizeof sSettings.szWorkingDirectory,
sSettings.szWorkingDirectory,
NULL );
else GetCurrentDirectory ( sizeof sSettings.szWorkingDirectory,
sSettings.szWorkingDirectory );
// release for the Australian Department of defence
#ifdef BAE_SYSTEMS_LEN_WHITE
sSettings.uServices = TFTPD32_TFTP_SERVER;
#endif
return Rc;
} // Tftpd32ReadSettings
示例8: main
int main(int argc, char **argv)
{
FILE *f;
double atk,def;
int t=0;
InitSystem();
Bpp=4;
XRes=800+XR; YRes=400;
ScreenBuf=(unsigned char*)malloc(XRes*YRes*Bpp);
memset(ScreenBuf,0,XRes*YRes*Bpp);
InitSDL();
while (1)
{
int Ch=ReadKey();
if (Ch=='q') exit(0);
Iterate();
Survey(&atk,&def);
f=fopen("output.txt","a");
fprintf(f,"%d %.6g %.6g\n",t,atk,def);
fclose(f);
t++;
}
}
示例9: Alarm_Adjust
/*******************************************************************************
* Function Name : Alarm_Adjust
* Description : Adjusts an alarm event to occurs within the current day.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void Alarm_Adjust(void)
{
/* Disable the JoyStick interrupts */
IntExtOnOffConfig(DISABLE);
while(ReadKey() != NOKEY)
{
}
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);
/* Clear the LCD screen */
LCD_Clear(White);
LCD_SetDisplayWindow(160, 223, 128, 128);
LCD_NORDisplay(ALARM_ICON);
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);
/* Disable LCD Window mode */
LCD_WindowModeDisable();
Alarm_PreAdjust();
/* Clear the LCD */
LCD_Clear(White);
/* Display the menu */
DisplayMenu();
/* Enable the JoyStick interrupts */
IntExtOnOffConfig(ENABLE);
}
示例10: GetVisItInstallationDirectory
std::string
GetVisItInstallationDirectory(const char *version)
{
#if defined(_WIN32)
// Get the installation dir for the specified from the registry.
char *visitHome = 0;
std::string installDir("C:\\");
if(ReadKey(version, "VISITHOME", &visitHome) == 1)
{
installDir = visitHome;
}
else
{
// try the environment
const std::string idir = Environment::get("VISITHOME");
if (!idir.empty())
{
installDir = idir;
}
else
{
// get the path for this process
char tmpdir[MAX_PATH];
if (GetModuleFileName(NULL, tmpdir, MAX_PATH) != 0)
{
std::string visitpath(tmpdir);
size_t lastSlash = visitpath.rfind("\\");
if(lastSlash != std::string::npos)
installDir = visitpath.substr(0, lastSlash);
else
installDir = visitpath;
}
}
}
if (visitHome != 0)
free(visitHome);
return installDir;
#else
// Get the installation dir for the version that's running. They all use
// the same "visit" script so it's okay to do this.
std::string installDir("/usr/local/visit");
const std::string idir = Environment::get("VISITHOME");
if(!idir.empty())
{
if(isDevelopmentVersion)
installDir = idir;
else
{
// The directory often has a "/bin" on the end. Strip it off.
std::string home(idir);
int lastSlash = home.rfind("/");
if(lastSlash != -1)
installDir = home.substr(0, lastSlash);
else
installDir = idir;
}
}
return installDir;
#endif
}
示例11: GetDiscKey
bool CDVDSession::GetDiscKey()
{
if (m_session == DVD_END_ALL_SESSIONS) {
return false;
}
BYTE DiscKeys[2048];
if (!ReadKey(DvdDiskKey, DiscKeys)) {
return false;
}
for (int i = 0; i < g_nPlayerKeys; i++) {
for (int j = 1; j < 409; j++) {
BYTE DiscKey[6];
memcpy(DiscKey, &DiscKeys[j * 5], 5);
DiscKey[5] = 0;
CSSdisckey(DiscKey, g_PlayerKeys[i]);
BYTE Hash[6];
memcpy(Hash, &DiscKeys[0], 5);
Hash[5] = 0;
CSSdisckey(Hash, DiscKey);
if (!memcmp(Hash, DiscKey, 6)) {
memcpy(m_DiscKey, DiscKey, 6);
return true;
}
}
}
return false;
}
示例12: _QuerySaveState
STATIC int _QuerySaveState(void)
{
_UpdateInterfaceState();
while (KeyPressed())
{
if (ReadKey() == STOPKEY)
{
UnLockMouse();
DrawFunctionKey(1, "help");
if (QueryUserStop())
{
StopDefragmentationProcess(); /* Just sets a variable in
main\actions.c */
LockMouse(1, 1, 80, 25);
DrawFunctionKey(3, "stop");
return TRUE;
}
else
{
LockMouse(1, 1, 80, 25);
DrawFunctionKey(3, "stop");
return FALSE;
}
}
}
return FALSE;
}
示例13: ReadData
int Bitmaps::ReadData()
{
this->GetSquareSize();
int start = this->_squareSize / 2;
if (!ReadKey())
{
printf("invalid key\n");
return 0;
}
ReadOne();
int i = start*4;
int a;
int r;
int b;
int g;
r = b = g = -1;
for(a=0;a<this->_n_squares;a++)
{
r = this->_data[i+2];
g = this->_data[i+1];
b = this->_data[i];
//printf("Read data = R:%d G:%d B:%d\n",r,g,b);
i = i + this->_squareSize *4;
}
return a;
}
示例14: GTIFImport
int GTIFImport(GTIF *gtif, GTIFReadMethod scan,void *aux)
{
int status;
char message[1024];
if (!scan) scan = (GTIFReadMethod) &DefaultRead;
if (!aux) aux=stdin;
scan(message,aux);
if (strncmp(message,FMT_GEOTIFF,8)) return 0;
scan(message,aux);
if (!sscanf(message,FMT_VERSION,(short int*)>if->gt_version)) return 0;
scan(message,aux);
if (sscanf(message,FMT_REV,(short int*)>if->gt_rev_major,
(short int*)>if->gt_rev_minor) !=2) return 0;
scan(message,aux);
if (strncmp(message,FMT_TAGS,8)) return 0;
while ((status=ReadTag(gtif,scan,aux))>0);
if (status < 0) return 0;
scan(message,aux);
if (strncmp(message,FMT_KEYS,8)) return 0;
while ((status=ReadKey(gtif,scan,aux))>0);
return (status==0); /* success */
}
示例15: ManualClockCalibration
/**
* @brief Calibration of External crystal oscillator manually
* @param None
* @retval : None
*/
void ManualClockCalibration(void)
{
UpDownIntOnOffConfig(ENABLE);
RightLeftIntExtOnOffConfig(ENABLE);
SelIntExtOnOffConfig(DISABLE);
LCD_Clear(Blue2);
BKP_TamperPinCmd(DISABLE);
BKP_RTCOutputConfig(BKP_RTCOutputSource_CalibClock);
LCD_DisplayString(Line1,Column5,"Calibration");
LCD_DisplayString(Line3,Column0,"LSE/64 is available");
LCD_DisplayString(Line4,Column0,"on PC13.Measure the");
LCD_DisplayString(Line5,Column0,"the frequency and");
LCD_DisplayString(Line6,Column0,"press Sel to proceed");
while(ReadKey()!=SEL)
{
}
LCD_Clear(Blue2);
BKP_RTCOutputConfig(BKP_RTCOutputSource_None);
LCD_DisplayString(Line1,Column4,"Please enter");
LCD_DisplayString(Line2,Column2,"Calibration Value");
LCD_DisplayCount(Line4,Column6,1,ArrayTime[0]+0x30);
LCD_DisplayCount(Line4,Column7,0,ArrayTime[1]+0x30);
LCD_DisplayCount(Line4,Column8,0,ArrayTime[2]+0x30);
LCD_DisplayString(Line6,Column6,"(0-121)");
LCD_SetBackColor(Green);
SelIntExtOnOffConfig(ENABLE);
}