本文整理汇总了C++中scanKeys函数的典型用法代码示例。如果您正苦于以下问题:C++ scanKeys函数的具体用法?C++ scanKeys怎么用?C++ scanKeys使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了scanKeys函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: device_io
void device_io()
{
if ( render_audio() && --scanDC == 0 )
{
scanDC = bufsPerScan; // reload downcounter to next scan
/* scan keys */
if ( curKey >= 0 )
{
if ( ! readKey( curKey ) )
{
console.postKeyUp( curKey, 0 );
scanKeys();
}
}
else
scanKeys();
/* scan buttons */
for ( byte i = 0; i < NumButs; i++ )
scanBut(i);
/* read next pot */
readPot( nextPot );
if ( ++nextPot >= NumPots )
nextPot = 0;
}
}
开发者ID:maltman23,项目名称:ArduTouch,代码行数:31,代码来源:System.cpp
示例2: main
int main(void)
{
videoSetMode(MODE_5_2D);
consoleDemoInit();
scanKeys();
int c = keysHeld();
Sfondo();
CreaPG();
while(true)
{
swiWaitForVBlank();
if(c!=0)
{
KeysPress(c);
//iprintf("-key:%i\n",c);
c = 0;
}
else
{//Nessun tasto premuto
scanKeys();
c = keysHeld();
}
}
return 0;
}
开发者ID:GiocoNDS,项目名称:Gioco-per-DS,代码行数:25,代码来源:main.cpp
示例3: main
int main(void) {
consoleDemoInit();
Keyboard *kbd = keyboardDemoInit();
kbd->OnKeyPressed = OnKeyPressed;
while(1) {
char myName[256];
iprintf("What is your name?\n");
scanf("%s", myName);
iprintf("\nHello %s", myName);
scanKeys();
while(!keysDown())scanKeys();
swiWaitForVBlank();
consoleClear();
}
return 0;
}
开发者ID:anitha2012,项目名称:evandrix.github.com,代码行数:26,代码来源:keymain.c
示例4: waitfor
void waitfor(int keys)
{
scanKeys();
while((keysDown() & keys) == 0)
{
swiWaitForVBlank();
scanKeys();
}
}
开发者ID:0265727207,项目名称:evandrix.github.com,代码行数:9,代码来源:main.c
示例5: while
void Menu::NX(int sock)
{
int volume = 77;
while(1) {
consoleClear();
iprintf("\n netxmms-nds\n ___________\n\n"
" A - PLAY\n"
" B - PAUSE\n"
" Y - STOP\n"
" R - NEXT\n"
" L - PREVIOUS\n"
" < - VOLUME-\n"
" > - VOLUME+\n\n"
" VOLUME: %d%%", volume);
while(1) {
swiWaitForVBlank();
scanKeys();
int pressed = keysDown();
int held = keysHeld();
if(pressed & KEY_A) NX::Play(sock);
if(pressed & KEY_B) NX::Pause(sock);
if(pressed & KEY_Y) NX::Stop(sock);
if(pressed & KEY_R) NX::Next(sock);
if(pressed & KEY_L) NX::Previous(sock);
if(pressed & KEY_LID) {
int s = REG_POWERCNT;
REG_POWERCNT = 0;
while(1) {
scanKeys();
if(keysUp() & KEY_LID) {
REG_POWERCNT = s;
break;
}
}
}
if(held & KEY_LEFT && volume > 0) {
volume--;
NX::Volume(sock, volume);
break;
}
else if(held & KEY_RIGHT && volume < 100) {
volume++;
NX::Volume(sock, volume);
break;
}
}
}
}
开发者ID:blahblahson,项目名称:netxmms,代码行数:55,代码来源:menu.cpp
示例6: Update
void Update()
{
//@NOTE: scanKeys() and keysDown() must only be called once per frame, never more
scanKeys();
gKeysPressed = gRawKeysPressed = keysDown();
gKeysHeld = keysHeld();
if (gKeysPressed & PauseKey)
{
gIsPaused = !gIsPaused;
}
gUnpauseOneFrame = false;
if (gKeysPressed & UnpauseOneFrameKey)
{
gUnpauseOneFrame = true;
}
// Pause key only queryable via IsPaused()
gKeysPressed &= (~PauseKey & ~UnpauseOneFrameKey);
// When paused, for debugging purposes, it's useful to consider
// held keys as pressed keys
if (gIsPaused)
{
gKeysPressed |= gKeysHeld;
}
}
开发者ID:amaiorano,项目名称:ZeldaDS,代码行数:30,代码来源:InputManager.cpp
示例7: input
void input(){ //Fonction de test des touches
touchPosition touchXY;
do{
scanKeys();
if(keysHeld() & KEY_A)
iprintf("\x1b[4;0HAppui A"); //Bouton A
else if(keysHeld() & KEY_B)
iprintf("\x1b[5;0HAppui B"); //Bouton B
else if(keysHeld() & KEY_X)
iprintf("\x1b[6;0HAppui X"); //Bouton X
else if(keysHeld() & KEY_Y)
iprintf("\x1b[7;0HAppui Y"); //Bouton Y
else if(keysHeld() & KEY_L)
iprintf("\x1b[8;0HAppui L"); //Bouton L
else if(keysHeld() & KEY_R)
iprintf("\x1b[9;0HAppui R"); //Bouton R
else if(keysHeld() & KEY_START)
iprintf("\x1b[10;0HAppui START"); //Bouton START
else if(keysHeld() & KEY_SELECT)
iprintf("\x1b[11;0HAppui SELECT"); //Bouton SELECT
else{
int i; //Effaçage zone
for(i=4;i<=11;i++){
iprintf("\x1b[%u;0H ",i);
}
}
touchRead(&touchXY);
}while((touchXY.px>=0x00)&&(touchXY.py>=0x00)&&(touchXY.py<0xB4)&&(touchXY.py<0xFF));
}
开发者ID:Allex0295,项目名称:ExposeConsole,代码行数:29,代码来源:MainConsole.cpp
示例8: updateInput
void updateInput(touchPosition * touch) {
// Update the key registers with current values.
scanKeys();
// Update the touch screen values.
touchRead(touch);
}
开发者ID:Patater,项目名称:manual,代码行数:7,代码来源:main.cpp
示例9: consoleClear
void Menu::Main()
{
consoleClear();
printf("\n netxmms-nds\n ___________\n\n"
" A - CONNECT\n"
" B - CONFIGURE\n\n"
" START - INFORMATION");
while(1) {
swiWaitForVBlank();
scanKeys();
u32 entry = keysDown();
if(entry & KEY_A) {
Menu::ConnectWifi();
return;
}
else if(entry & KEY_B) {
Menu::Configuration();
return;
}
else if(entry & KEY_START) {
Menu::Information();
return;
}
}
}
开发者ID:blahblahson,项目名称:netxmms,代码行数:28,代码来源:menu.cpp
示例10: draw
LevelId LevelSelector::select_level() {
touchPosition stylus;
level.set_current_level(level.get_level(selected_button).id);
level.load();
draw();
while (true) {
scanKeys();
touchRead(&stylus);
if (button_ok.update(stylus) == BUTTON_CLICKED) {
return level.get_level(selected_button).id;
}
for (u8 current_button = 0; current_button < num_buttons; current_button++) {
if (buttons[current_button]->update(stylus) == BUTTON_CLICKED) {
u8 last_selected_button = selected_button;
set_selected_level(level.get_level(current_button).id);
buttons[last_selected_button]->draw();
buttons[selected_button]->draw();
level.set_current_level(level.get_level(selected_button).id);
level.load();
level.draw(LEVEL_X, LEVEL_Y);
}
}
swiWaitForVBlank();
}
}
开发者ID:yjerem,项目名称:rodents-revenge-ds,代码行数:33,代码来源:levelselector.cpp
示例11: NDS_PumpEvents
void NDS_PumpEvents(_THIS)
{
scanKeys();
int i;
SDL_keysym keysym;
keysym.mod=KMOD_NONE;
for(i=0;i<NDS_NUMKEYS;i++)
{
keysym.scancode=i;
keysym.sym=keymap[i];
if(keysHeld()&(1<<i) && !keymem[i])
{
keymem[i]=1;
//printf("key released %d\n",i);
SDL_PrivateKeyboard(SDL_RELEASED, &keysym);
}
if(!(keysHeld()&(1<<i)) && keymem[i])
{
keymem[i]=0;
//printf("key pressed %d\n",i);
SDL_PrivateKeyboard(SDL_PRESSED, &keysym);
}
}
//touchPosition touch;
//touch=touchReadXY();
//if (touch.px!=0 || touch.py!=0)
// SDL_PrivateMouseMotion(SDL_PRESSED, 0, touch.px, touch.py);
}
开发者ID:ahpho,项目名称:wowmapviewer,代码行数:28,代码来源:SDL_ndsevents.c
示例12: processInput
//-----------------------------------------------------------------
// process input
//-----------------------------------------------------------------
void processInput( void )
//-----------------------------------------------------------------
{
scanKeys();
int keysh = keysHeld();
// process user input
if( keysh & KEY_UP ) // check if UP is pressed
{
if ( g_ball.y == c_platform_level )
g_ball.yvel = -y_tweak;
else if ( (g_ball.yvel < 0) && (g_ball.y < 4 + c_platform_level) )
g_ball.yvel -= y_tweak/14;
}
if( keysh & KEY_DOWN ) // check if DOWN is pressed
{
// tweak y velocity of ball
g_ball.yvel += y_tweak;
}
if( keysh & KEY_LEFT ) // check if LEFT is pressed
{
// tweak x velocity
g_ball.xvel -= x_tweak;
}
if( keysh & KEY_RIGHT ) // check if RIGHT is pressed
{
// tweak y velocity
g_ball.xvel += x_tweak;
}
}
开发者ID:Pazaak,项目名称:NDSScrolling,代码行数:35,代码来源:main.c
示例13: DS_VBlank_IRQ
/*
DS_VBlank_IRQ
Vertical blank interrupt callback.
*/
LOCALPROC DS_VBlank_IRQ(void)
{
scanKeys();
KeysHeld = keysHeld();
if (++VBlankCounter == 60) {
VBlankCounter = 0;
}
/*
TODO:
Rewrite this at some point, I'm not sure I like it.
*/
if (0 != (KeysHeld & KEY_LEFT)) {
--CursorX;
} else if (0 != (KeysHeld & KEY_RIGHT)) {
++CursorX;
}
if (0 != (KeysHeld & KEY_UP)) {
--CursorY;
} else if (0 != (KeysHeld & KEY_DOWN)) {
++CursorY;
}
CursorX = CursorX < 0 ? 0 : CursorX;
CursorX = CursorX > vMacScreenWidth ? vMacScreenWidth : CursorX;
CursorY = CursorY < 0 ? 0 : CursorY;
CursorY = CursorY > vMacScreenHeight ? vMacScreenHeight : CursorY;
DS_ScrollBackground();
bgUpdate();
}
开发者ID:libretro,项目名称:libretro-minivmac,代码行数:40,代码来源:OSGLUNDS.c
示例14: main
//---------------------------------------------------------------------------------
int main(void) {
//---------------------------------------------------------------------------------
consoleDemoInit(); //setup the sub screen for printing
keyboardDemoInit();
keyboardShow();
while(1) {
int key = keyboardUpdate();
if(key > 0)
iprintf("%c", key);
swiWaitForVBlank();
scanKeys();
int pressed = keysDown();
if(pressed & KEY_START) break;
}
return 0;
}
开发者ID:devkitPro,项目名称:nds-examples,代码行数:26,代码来源:template.c
示例15: connect_ap
/* Try to connect to given AP and get an IP via DHCP */
int connect_ap(Wifi_AccessPoint * ap)
{
int ret;
int status = ASSOCSTATUS_DISCONNECTED;
clear_main();
/* Ask for DHCP */
Wifi_SetIP(0, 0, 0, 0, 0);
ret = Wifi_ConnectAP(ap, WEPMODE_NONE, 0, NULL);
if (ret) {
print_to_debug("error connecting");
return ASSOCSTATUS_CANNOTCONNECT;
}
while (status != ASSOCSTATUS_ASSOCIATED &&
status != ASSOCSTATUS_CANNOTCONNECT) {
int oldStatus = status;
status = Wifi_AssocStatus();
if (oldStatus != status)
printf_to_main("\n%s",
(char *)ASSOCSTATUS_STRINGS[status]);
else
printf_to_main(".");
scanKeys();
if (keysDown() & KEY_B)
break;
swiWaitForVBlank();
}
return status;
}
开发者ID:Lexus89,项目名称:wifi-arsenal,代码行数:35,代码来源:main.c
示例16: waitButtonA
//---------------------------------------------------------------------------------
void waitButtonA() {
//---------------------------------------------------------------------------------
while(1) {
scanKeys();
swiWaitForVBlank();
if (keysDown() & KEY_A) break;
}
}
开发者ID:fagensden,项目名称:dslink,代码行数:9,代码来源:main.c
示例17: main
int main() {
// Setup the Main screen for 3D
videoSetMode(MODE_0_3D);
// initialize the geometry engine
glInit();
// enable antialiasing
glEnable(GL_ANTIALIAS);
// setup the rear plane
glClearColor(0,0,0,31); // BG must be opaque for AA to work
glClearPolyID(63); // BG must have a unique polygon ID for AA to work
glClearDepth(0x7FFF);
// Set our viewport to be the same size as the screen
glViewport(0,0,255,191);
// setup the view
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(70, 256.0 / 192.0, 0.1, 100);
//ds specific, several attributes can be set here
glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE);
while (1)
{
// Set the current matrix to be the model matrix
glMatrixMode(GL_MODELVIEW);
glColor3f(1, 1, 1); // Set the color..not in nehe source...ds gl default will be black
//Push our original Matrix onto the stack (save state)
glPushMatrix();
DrawGLScene();
// Pop our Matrix from the stack (restore state)
glPopMatrix(1);
//a handy little built in function to wait for a screen refresh
swiWaitForVBlank();
// flush to screen
glFlush(0);
scanKeys();
int pressed = keysDown();
if(pressed & KEY_START) break;
}
return 0;
}
开发者ID:devkitPro,项目名称:nds-examples,代码行数:58,代码来源:nehe1.cpp
示例18: main
int main()
{
// REG_WAITCNT = 0x46d6; // lets set some cool waitstates...
REG_WAITCNT = 0x46da; // lets set some cool waitstates...
irqInit();
irqEnable(IRQ_VBLANK);
consoleInit(0, 4, 0, NULL, 0, 15);
BG_COLORS[0] = RGB5(0, 0, 0);
BG_COLORS[241] = RGB5(31, 31, 31);
REG_DISPCNT = MODE_0 | BG0_ON;
gbfs_init(1);
pimp_sample_bank sb;
FILE *fp = fopen("dxn-oopk.xm", "rb");
if (!fp)
{
fprintf(stderr, "file not found\n");
return 1;
}
pimp_module *mod = load_module_xm(fp, &sb);
fclose(fp);
fp = NULL;
if (NULL == mod)
{
fprintf(stderr, "failed to load module\n");
return 1;
}
pimp_gba_init(mod, sb.data);
pimp_gba_set_callback(callback);
irqSet(IRQ_TIMER3, timer3);
irqEnable(IRQ_TIMER3);
REG_TM3CNT_L = 0;
REG_TM3CNT_H = TIMER_START | TIMER_IRQ | 2;
irqSet(IRQ_VBLANK, vblank);
irqEnable(IRQ_VBLANK);
while (1)
{
VBlankIntrWait();
scanKeys();
int keys = keysDown();
if (keys & KEY_UP) pimp_gba_set_pos(0, pimp_gba_get_order() - 1);
if (keys & KEY_DOWN) pimp_gba_set_pos(0, pimp_gba_get_order() + 1);
if (keys & KEY_RIGHT) pimp_gba_set_pos(pimp_gba_get_row() + 8, pimp_gba_get_order());
if (keys & KEY_LEFT) pimp_gba_set_pos(pimp_gba_get_row() - 8, pimp_gba_get_order());
iprintf("%d %d\n", pimp_gba_get_order(), pimp_gba_get_row());
}
pimp_gba_close();
return 0;
}
开发者ID:imclab,项目名称:pimpmobile,代码行数:58,代码来源:example2.cpp
示例19: update
void update(){
scanKeys();
touchRead(&stylus);
keyDown = keysDownRepeat();
//Play::get_state()->run();
swiWaitForVBlank();
}
开发者ID:nevilc,项目名称:YomiDS,代码行数:9,代码来源:update.cpp
示例20: scanKeys
void EventHandler::Update()
{
scanKeys();
touchRead(&m_touchPos);
m_held = keysHeld();
m_pressed = keysDown();
}
开发者ID:TheProjecter,项目名称:nintendo-ds-homebrew-framework,代码行数:9,代码来源:EventHandler.cpp
注:本文中的scanKeys函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论