static void tip_feel_exit( Dialog* d, int mouse ) { int status; if ( mouse && !press_button( d ) ) return; dialog_done = 1; }
static void feel_about(Dialog *d, int mouse) { if(mouse) if(!(press_button(d))) return; dialog_done=1; restore_under_dialog(); about(); }
static void tip_feel_previous_tip( Dialog* d, int mouse ) { int status; if ( mouse && !press_button( d ) ) return; assert( theTipButton ); theTipButton->previousTip(); }
void hexbright::init_hardware() { // These next 8 commands are for reference and cost nothing, // as we are initializing the values to their default state. pinModeFast(DPIN_PWR, OUTPUT); digitalWriteFast(DPIN_PWR, LOW); pinModeFast(DPIN_RLED_SW, INPUT); pinModeFast(DPIN_GLED, OUTPUT); pinModeFast(DPIN_DRV_MODE, OUTPUT); pinModeFast(DPIN_DRV_EN, OUTPUT); digitalWriteFast(DPIN_DRV_MODE, LOW); digitalWriteFast(DPIN_DRV_EN, LOW); #if (DEBUG!=DEBUG_OFF) // Initialize serial busses Serial.begin(9600); Wire.begin(); Serial.println("DEBUG MODE ON"); #endif #if (DEBUG!=DEBUG_OFF && DEBUG!=DEBUG_PRINT) if(DEBUG==DEBUG_LIGHT) { // do a full light range sweep, (printing all light intensity info) set_light(0,1000,update_delay*1002); } else if (DEBUG==DEBUG_TEMP) { set_light(0, MAX_LEVEL, NOW); } else if (DEBUG==DEBUG_LOOP) { // note the use of TIME_MS/update_delay. set_light(0, MAX_LEVEL, 2500/update_delay); } #ifdef FREE_RAM Serial.print("Ram available: "); Serial.print(freeRam()); Serial.println("/1024 bytes"); #endif #ifdef FLASH_CHECKSUM Serial.print("Flash checksum: "); Serial.println(flash_checksum()); #endif #endif // DEBUG!=DEBUG_OFF #ifdef ACCELEROMETER enable_accelerometer(); #endif // was this power on from battery? if so, it was a button press, even if it was too fast to register. read_charge_state(); if(get_charge_state()==BATTERY) press_button(); continue_time = micros(); }
void display_brightness() { if (settings.button_disp) switch (FLAG_GUI_MODE) { case GUIMODE_OFF: send_to_intercom(IC_SET_LCD_BRIGHTNESS, 1); press_button(IC_BUTTON_DISP); break; case GUIMODE_OLC: if (DPData.lcd_brightness < 7) send_to_intercom(IC_SET_LCD_BRIGHTNESS, 1 + DPData.lcd_brightness); else press_button(IC_BUTTON_DISP); break; default: press_button(IC_BUTTON_DISP); break; } else press_button(IC_BUTTON_DISP); }
int shutter_release() { wait_for_camera(); lock_sutter (); int result = press_button(IC_BUTTON_FULL_SHUTTER); if (DPData.drive == DRIVE_MODE_TIMER) SleepTask(SELF_TIMER_MS); wait_for_shutter(); return result; }
void autoiso_enable() { if (DPData.ae == AE_MODE_M && DPData.tv_val == TV_VAL_BULB) return; press_button(IC_BUTTON_SET); if (!settings.autoiso_enable) { settings.autoiso_enable = TRUE; enqueue_action(settings_write); } print_icu_info(); beep(); }
/* the main ftn */ int main(void) { int buttons[N] = {0}; /* to save up to seven buttons */ int i/*for loop*/, flag/*chek for elevator is still or moving */, floor/*the variable for representing the floor*/; char yn; /* for yes or no */ print_info(); /* call print information ftn */ first_floor(buttons, &floor); /* the initial state is the first floor. */ while(1){ flag = 0; /* the initial value is that the elevator is still */ press_button(buttons); /* call press button ftn */ move_ele(buttons, &floor); /* call elevator movement ftn */ /* check if buttons are pressed */ for(i = 0 ; i < N ; ++i){ if(buttons[i] == 1) flag = 1; } /* when buttons are pressed */ if(flag){ printf("The elevator keeps going...\n"); continue; /* skip things under this */ } /* when buttons are not pressed */ while(!flag){ printf("The elevator is still...\n"); /* ask if the program will be finished */ printf("Do you want to quit this(y/n)? "); scanf("\n%c", &yn); /* when the progam is finished */ if(yn == 'y' || yn == 'Y'){ printf("\nGoodbye!\n"); system("pause"); exit(0); } /* when the program is not finished */ else if(yn =='n' || yn == 'N') break; /* when the input is wrong */ else printf("the input is wrong!\n"); } } return 0; }
int shutter_release_bulb(int time) { static int first = true; int button; long delay; int shutter_lag, mirror_lag; if (first) { first = false; shutter_lag = SHUTTER_LAG_1ST; mirror_lag = MIRROR_LAG_1ST; } else { shutter_lag = SHUTTER_LAG_2ND; mirror_lag = MIRROR_LAG_2ND; } if (DPData.drive == DRIVE_MODE_TIMER) { button = IC_BUTTON_FULL_SHUTTER; delay = time + shutter_lag + mirror_lag; } else { button = IC_BUTTON_HALF_SHUTTER; delay = time + shutter_lag; } wait_for_camera(); lock_sutter (); press_button(button); SleepTask (delay); press_button(button); wait_for_shutter(); return 0; }
static void feel_palette(Dialog *d, int mouse) { char buff[128]; char extenders[11][4] = { "VGP", "PAL", "", "", "", "", "", "", "", "", "", }; char drive[XF_MAX_DRIVE]; char dir[XF_MAX_DIR]; char fname[XF_MAX_FNAME]; char ext[XF_MAX_EXT]; if(mouse) if(!(press_button(d))) return; dialog_done=1; restore_under_dialog(); for(;;) { if (mtl_palpath[strlen(mtl_palpath)-1]=='\\') mtl_palpath[strlen(mtl_palpath)-1]=0; gfx_file_selector("VanGogh Palette File", mtl_palpath, mtl_palname, extenders, buff); if (!*buff) return; if (access(buff,0) != 0) { gfx_continu_line("Palette file doesn't exist"); } else break; } _splitpath(buff,drive,dir,fname,ext); strcpy(mtl_palpath,drive); strcat(mtl_palpath,dir); strcpy(mtl_palname,fname); strcat(mtl_palname,ext); }
void main(int argc, char *argv[]) { if(argc < 2) { printf("Usage : ssignal [KEY_X]\n"); printf("To see available keys use : -h\n"); return; } if(strncmp(argv[1],"-h",2)==0) { list_keys(); return; } press_button(atoi(argv[1])); }
void hexbright::init_hardware() { // These next 8 commands are for reference and cost nothing, // as we are initializing the values to their default state. pinModeFast(DPIN_PWR, OUTPUT); digitalWriteFast(DPIN_PWR, LOW); pinModeFast(DPIN_RLED_SW, INPUT); pinModeFast(DPIN_GLED, OUTPUT); pinModeFast(DPIN_DRV_MODE, OUTPUT); pinModeFast(DPIN_DRV_EN, OUTPUT); digitalWriteFast(DPIN_DRV_MODE, LOW); digitalWriteFast(DPIN_DRV_EN, LOW); #if (DEBUG!=DEBUG_OFF) // Initialize serial busses Serial.begin(9600); Wire.begin(); Serial.println("DEBUG MODE ON"); #endif #if (DEBUG!=DEBUG_OFF && DEBUG!=DEBUG_PRINT) #ifdef FREE_RAM Serial.print("Ram available: "); Serial.print(freeRam()); Serial.println("/1024 bytes"); #endif #ifdef FLASH_CHECKSUM Serial.print("Flash checksum: "); Serial.println(flash_checksum()); #endif #endif //(DEBUG!=DEBUG_OFF && DEBUG!=DEBUG_PRINT) #ifdef ACCELEROMETER enable_accelerometer(); #endif // was this power on from battery? if so, it was a button press, even if it was too fast to register. read_charge_state(); if(get_charge_state()==BATTERY) press_button(); continue_time = micros(); }
void menu_close() { /* GUI_Lock(); GUI_PalleteInit(); DeleteDialogBox(menu_handler); menu_destroy(); menu_finish(); GUI_StartMode(GUIMODE_OLC); CreateDialogBox_OlMain(); GUIMode = GUIMODE_OLC; GUI_UnLock(); GUI_PalleteUnInit(); */ press_button(IC_BUTTON_DISP); menu_destroy(); menu_finish(NULL); //TODO:FixMe }
void get_events(int16_t *mouse_x, int16_t *mouse_y) { SDL_Event event; while (SDL_PollEvent(&event)) { /** Get user events. **/ switch(event.type) { case SDL_QUIT: /** User press the cross to close the application. **/ quit_game=true ; set_loop(false) ; break; case SDL_KEYDOWN : if (event.key.keysym.scancode == SDL_SCANCODE_ESCAPE) { /** The user fallback to the previous screen. **/ set_loop(false) ; break ; } case SDL_MOUSEMOTION : *mouse_x = event.motion.x ; /** We keep the mouse position at everytime in the game. **/ *mouse_y = event.motion.y ; /** We keep the mouse position at everytime in the game. **/ if ( ! game_control->is_animation_running && game_control->GAME_STATUS != DRAG_CARD_ON && game_control->GAME_STATUS != GAME_START ) { if ( mouse_over_card(event.motion.x,event.motion.y) != -1 && ! game_control->is_animation_running ) { /** The mouse is over an card. **/ if ( game_control->cursor_type != SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND) ) { /** We set the cursor to an hand cursor to notify the user that he can return or drag-and-drop the card. **/ game_control->cursor_type = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND) ; SDL_SetCursor(game_control->cursor_type) ; game_control->mouse_over_card=true ; } } else { if ( game_control->cursor_type != SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW) && ! game_control->is_animation_running && ! is_mouse_in_buttons_bboxes(event.motion.x) ) { /** We reset the cursor to default. **/ game_control->cursor_type = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW) ; SDL_SetCursor(game_control->cursor_type) ; game_control->mouse_over_card=false ; } } } if ( ! game_control->is_animation_running ) { /** The mouse is over an button. **/ mouse_over_button(event.motion.x,event.motion.y) ; break ; } break ; case SDL_MOUSEBUTTONDOWN : if (event.button.button == SDL_BUTTON_LEFT && event.button.state == SDL_PRESSED) { int8_t ret ; if ( ! game_control->is_animation_running && ((ret=mouse_over_card(event.button.x,event.button.y)) != -1) ) { if (game_control->player[ret].is_back_faced) { /** We process an card returning aniation. **/ current_card = &game_control->player[ret] ; game_control->GAME_STATUS = RETURN_A_CARD ; break ; } else if (! game_control->player[ret].is_back_faced && game_control->GAME_STATUS != DRAG_CARD_ON) { /** The user can drag an card. **/ dragging_card->card = &game_control->player[ret] ; dragging_card->x = event.button.x - game_control->player[ret].x ; dragging_card->y = event.button.y - game_control->player[ret].y ; game_control->player[ret].is_moving = true ; game_control->GAME_STATUS = DRAG_CARD_ON ; game_control->cursor_type = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEALL) ; SDL_SetCursor(game_control->cursor_type) ; break ; } } else if ( ! game_control->is_animation_running && (ret = press_button(event.button.x,event.button.y)) != -1 ) { /** The user press an button which is allowed. **/ do_change_game_status(ret) ; break ; } } case SDL_MOUSEBUTTONUP : if ( game_control->GAME_STATUS == DRAG_CARD_ON) { /** The user release an card he is dragging, so we process. **/ game_control->GAME_STATUS = DRAG_CARD_OFF ; game_control->cursor_type = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW) ; SDL_SetCursor(game_control->cursor_type) ; } break ; } } return ; }
void main() { UBYTE key1, key2, i, j, pos_x, pos_y, ch_pos; UBYTE non_flick = OFF; UWORD on_time, off_time; char str[MAX_DTMF]; char str_ms[10]; /* default dialling time setting */ on_time = DTMF_ON; off_time = DTMF_OFF; disable_interrupts(); SPRITES_8x8; /* sprites are 8x8 */ init_dial(); init_bkg(); init_key(); init_cursor(); disp(TITLE); SHOW_BKG; SHOW_SPRITES; DISPLAY_ON; enable_interrupts(); i = j = 0; ch_pos = 0; while(1) { wait_vbl_done(); key1 = joypad(); if(key1 != key2){ pos_x = i * KEY_STEP + START_CURSOR_X; pos_y = j * KEY_STEP + START_CURSOR_Y; move_cursor(pos_x, pos_y); } if(key2 & J_A){ if(key1 & J_A){ /* value set for each sound reg only numeric key pad*/ if(i <= 3 && j <= 3){ /* frequncy register set up for DTMF */ NR13_REG = row[i]; NR23_REG = col[j]; NR24_REG = 0x87U; /* sound output on */ NR51_REG = 0x33U; } /* '?' button */ /* appear the title during press A button */ if(i == 5 && j == 0 && !non_flick){ disp(TITLE); non_flick = ON; } /* incremental button */ /* decremental button */ /* appear the delay during press A button */ if(i == 5 && (j == 1 || j == 2) && !non_flick){ sprintf(str_ms, "%lu MS", on_time); disp(str_ms); non_flick = ON; } } else{ /* sound output off */ NR51_REG = 0x00U; break_button(i, j); /* '?' button */ /* incremental button */ /* decremental button */ /* return to normal display at release the A button */ if(i == 5 && (j == 0 || j == 1 || j == 2)){ non_flick = OFF; if(ch_pos == 0) clr_disp(); else disp(str); } } } else{ if(key1 & J_A){ /* button display handle */ press_button(i, j); /* numeric key pad handling */ if(i <= 3 && j <= 3){ /* string length check */ if(ch_pos < MAX_DTMF-1){ str[ch_pos] = pad[j][i]; ch_pos++; str[ch_pos] = 0x00; disp(str); } } /* ',' button */ if(i == 4 && j == 2){ /* string length check */ if(ch_pos < MAX_DTMF-1){ str[ch_pos] = pad[j][i]; ch_pos++; str[ch_pos] = 0x00; disp(str); } } /* all clear button */ if(i == 4 && j == 0){ ch_pos = 0x00; strcpy(str,""); clr_disp(); } /* delete button */ if(i == 4 && j == 1){ if(ch_pos > 0){ ch_pos--; str[ch_pos] = 0x00; if(ch_pos == 0) clr_disp(); else disp(str); } } /* incremental button */ if(i == 5 && j == 1){ if(on_time >= DTMF_ON / 2){ on_time = on_time - 10; off_time = off_time - 10; } } /* decremental button */ if(i == 5 && j == 2){ if(on_time <= DTMF_ON * 2){ on_time = on_time + 10; off_time = off_time + 10; } } /* dialing button */ if((i==4 || i==5) && j==3){ dialtone(on_time, off_time, str); } } } if(!(key1 & J_A)){ if((key1 & J_UP) && !(key2 & J_UP) && j > 0) j--; else if((key1 & J_DOWN) && !(key2 & J_DOWN) && j < 3) j++; if((key1 & J_LEFT) && !(key2 & J_LEFT) && i > 0) i--; else if((key1 & J_RIGHT) && !(key2 & J_RIGHT) && i < 5) i++; } key2 = key1; } }