void AFFICHEUR_OPTION::change_type_obj(int t) { if (type_edition==OBJ) curent_OBJ->type=(_type_objets)t; switch (curent_OBJ->type) { case OR : _or->setEnabled(true); break; case OBJ_QUETTE: quette->setValue(1); _or->setEnabled(false); break; default : _or->setEnabled(false); quette->setValue(0); break; } if (curent_OBJ->type <=PIEGE) { change_direction(t); // sprite_courant.SetSubRect(subRect); strcpy(curent_OBJ->dossier,"./resources/image"); strcpy(curent_OBJ->nom,"allItems.png"); } };
void update_state() { sample_buttons(); update_game_state(); if(has_button_changed(OPT1_BTN_INDEX) && is_button_pressed(OPT1_BTN_INDEX)) { toggle_pause_game(); } if(has_button_changed(DOWN_BUTTON_INDEX) && is_button_pressed(DOWN_BUTTON_INDEX)) { change_direction(DOWN); } if(has_button_changed(UP_BUTTON_INDEX) && is_button_pressed(UP_BUTTON_INDEX)) { change_direction(UP); } if(has_button_changed(LEFT_BUTTON_INDEX) && is_button_pressed(LEFT_BUTTON_INDEX)) { change_direction(LEFT); } if(has_button_changed(RIGHT_BUTTON_INDEX) && is_button_pressed(RIGHT_BUTTON_INDEX)) { change_direction(RIGHT); } }
/* *********************************************************************** TIM Channel 7 interrupt service routine Initialized for 1.00 ms interrupt rate Increment (3-digit) BCD variable "react" by one *********************************************************************** */ interrupt 15 void TIM_ISR(void) { // clear TIM CH 7 interrupt flag TFLG1 = TFLG1 | 0x80; //if(flag == 1) { //Sampling Speed For Enable atdia++; //Increment atdi if(atdia == 2000) { atdia = 0; //reset if(atdca <= 1760) { change_direction(atdc); } else if(atdca > 1800) { PTT_PTT0 = 0; PTT_PTT1 = 0; PTT_PTT2 = 0; PTT_PTT3 = 0; } atdca=0; //reset atdca } if(PORTAD0_PTAD4 == 1) { atdca++; } //Increments atdc to change the direction atdi++; //Increment atdi if(atdi == 2000) { atdi = 0; //reset atdi counter atdc = 0; //reset atdc counter } if(PORTAD0_PTAD5 == 1) { atdc++; } // } }
bool AI::go_up() { switch (m_direction) { case Input::UP: break; //nothing to change case Input::DOWN: //facing the wrong way! return false; case Input::LEFT: case Input::RIGHT: change_direction(Input::UP); break; default: assert(false); } return true; }
void move_head(uint8_t new_dir) { if (new_dir) { //Copy head to new position head = get_next_node(head); //increment head corners[head].x = corners[get_previous_node(head)].x; corners[head].y = corners[get_previous_node(head)].y; change_direction(); //change direction } //Have we left the game board? if ((corners[head].x == 0) && (dirX == -1)) { game_over(); return; } if ((corners[head].y == 0) && (dirY == -1)) { game_over(); return; } if ((corners[head].x == GAMEBOARD_X-1) && (dirX == 1)) { game_over(); return; } if ((corners[head].y == GAMEBOARD_Y-1) && (dirY == 1)) { game_over(); return; } corners[head].x += dirX; corners[head].y += dirY; ++snake_length_current; }
/* * Function run_train * ------------------ * Get all contacts information * Config 1: contact[2]=1 contact[8]=1 * Config 2: contact[2]=1 contact[8]=1 * Config 3: contact[5]=1 contact[11]=1 * Config 4: contact[5]=1 contact[16]=1 */ void run_train() { int i; wprintf(train_wnd, "Checking contacts"); /* Get contact id */ contacts[8] = get_contact_status(8); contacts[11] = get_contact_status(11); contacts[16] = get_contact_status(16); if (contacts[8] == 1) { wprintf(train_wnd, "Configuration 1,2\n"); /* Process configuration 1&2 */ wprintf(train_wnd, "Try trap Zamboni"); /* Following code try to trap zamboni */ change_switch(4, 'G'); change_switch(5, 'G'); change_switch(8, 'R'); change_switch(9, 'R'); change_switch(1, 'R'); change_switch(2, 'R'); change_switch(7, 'R'); for (i = 0; i < check_ticks; i++) { /* Looking for Zamboni*/ wprintf(train_wnd, "."); if (get_contact_status(15) == 1) { wprintf(train_wnd, "Found Zamboni!\n"); zamboni = 1; break; } } /* Using same strategy regardless of Zamobni */ wprintf(train_wnd, "\n"); change_switch(3, 'G'); change_switch(4, 'R'); change_switch(5, 'R'); change_switch(6, 'R'); change_speed('T', 4); while (get_contact_status(1) != 1) ; change_speed('T', 0); change_direction('T'); change_speed('T', 4); while (get_contact_status(8) != 1) ; change_speed('T', 0); } else if (contacts[11] == 1) { /* Configuration 3 */ wprintf(train_wnd, "Configuration 3\n"); /* Process configuration 1&2 */ change_switch(4, 'G'); /* Try trap Zamboni */ change_switch(5, 'G'); change_switch(8, 'G'); change_switch(9, 'R'); change_switch(1, 'G'); for (i = 0; i < check_ticks; i++) { if (get_contact_status(6) == 1) { wprintf(train_wnd, "Found Zamboni!\n"); zamboni = 1; break; } } if (zamboni == 0) { wprintf(train_wnd, "Configuration 3 without zamboni\n"); change_switch(3, 'R'); change_switch(4, 'R'); change_switch(5, 'R'); change_switch(6, 'G'); change_switch(7, 'G'); change_speed('T', 4); while (get_contact_status(12) != 1) ; change_speed('T', 0); change_direction('T'); change_switch(7, 'R'); change_switch(8, 'R'); change_speed('T', 4); while (get_contact_status(13) != 1) ; change_speed('T', 0); change_direction('T'); change_switch(8, 'G'); change_switch(5, 'G'); change_speed('T', 4); while (get_contact_status(5) != 1) ; change_speed('T', 0); } else { wprintf(train_wnd, "Configuration 3 with zamboni\n"); change_switch(3, 'R'); change_switch(4, 'R'); change_speed('T', 5); while (get_contact_status(10) != 1) ; change_switch(5, 'R'); change_switch(6, 'G'); while (get_contact_status(12) != 1) ; change_speed('T', 0); change_switch(5, 'G'); change_switch(7, 'R'); change_direction('T'); while (get_contact_status(3) != 1) ; /* Wait for zamboni to pass */ change_switch(1, 'R'); change_switch(2, 'G'); change_speed('T', 5); while (get_contact_status(1) != 1) ; change_speed('T', 0); change_switch(1, 'R'); change_switch(2, 'R'); change_switch(7, 'R'); while (get_contact_status(12) != 1) ; change_speed('T', 4); while (get_contact_status(6) != 1) ; change_speed('T', 0); change_direction('T'); change_switch(3, 'R'); change_switch(4, 'R'); change_speed('T', 4); while (get_contact_status(5) != 1) ; change_speed('T', 0); } } else if (contacts[16] == 1) { /* Configuration 4 */ change_switch(4, 'G'); change_switch(8, 'R'); for (i = 0; i < check_ticks; i++) { if (get_contact_status(12) == 1) { wprintf(train_wnd, "Found Zamboni!\n"); zamboni = 1; break; } } if (zamboni == 1) { wprintf(train_wnd, "Configuration 4 with Zamboni!\n"); change_switch(3, 'R'); change_switch(4, 'R'); change_speed('T', 4); while (get_contact_status(6) != 1) ; change_speed('T', 0); change_direction('T'); change_switch(4, 'G'); change_switch(1, 'G'); change_switch(9, 'R'); change_speed('T', 4); while (get_contact_status(3) != 1) ; change_speed('T', 0); while (get_contact_status(14) != 1) ; change_switch(8, 'G'); while (get_contact_status(10) != 1) ; change_switch(8, 'R'); change_speed('T', 5); while (get_contact_status(12) != 1) ; change_speed('T', 0); change_switch(8, 'G'); while (get_contact_status(14) != 1) ; change_switch(9, 'G'); while (get_contact_status(10) != 1) ; change_speed('T', 5); while (get_contact_status(14) != 1) ; change_speed('T', 0); change_direction('T'); change_speed('T', 5); while (get_contact_status(14) != 0) ; change_speed('T', 4); change_speed('T', 3); change_speed('T', 2); change_speed('T', 1); change_speed('T', 0); change_direction('T'); wprintf(train_wnd, "Got the cargo, hopefully\n"); change_switch(8, 'R'); wprintf(train_wnd, "Try trap Zamboni\n"); while (get_contact_status(12) != 1) ; wprintf(train_wnd, "Zamboni trapped\n"); while (get_contact_status(14) != 1) ; change_switch(8, 'G'); wprintf(train_wnd, "Zamboni is out of the loop!\n"); while (get_contact_status(6) != 1) ; change_speed('T', 5); while (get_contact_status(10) != 1) ; wprintf(train_wnd, "Start train with cargo\n"); change_speed('T', 4); change_switch(8, 'R'); while (get_contact_status(7) != 1) ; change_switch(4, 'R'); change_switch(3, 'R'); change_speed('T', 4); while (get_contact_status(5) != 1) ; change_speed('T', 0); } else { wprintf(train_wnd, "Configuration 4 without zamboni\n"); change_switch(3, 'R'); change_switch(4, 'R'); change_speed('T', 4); while (get_contact_status(6) != 1) ; change_speed('T', 0); change_direction('T'); change_switch(4, 'G'); change_switch(1, 'G'); change_switch(9, 'R'); change_speed('T', 4); while (get_contact_status(14) != 1) ; change_speed('T', 0); change_direction('T'); change_switch(9, 'G'); change_speed('T', 5); while (get_contact_status(14) != 0) ; change_speed('T', 3); // sleep(20); Wait(20); change_speed('T', 0); change_direction('T'); change_switch(9, 'G'); change_switch(8, 'G'); change_switch(5, 'G'); change_switch(4, 'R'); change_switch(3, 'R'); change_speed('T', 4); while (get_contact_status(5) != 1) ; change_speed('T', 0); } } }
static int vector_bfgs3_iterate(void *vstate, gsl_multimin_function_fdf * fdf, gsl_vector * x, double *f, gsl_vector * gradient, gsl_vector * dx) { vector_bfgs3_state_t *state = (vector_bfgs3_state_t *) vstate; double alpha = 0.0, alpha1; gsl_vector *x0 = state->x0; gsl_vector *g0 = state->g0; gsl_vector *p = state->p; double g0norm = state->g0norm; double pnorm = state->pnorm; double delta_f = state->delta_f; double pg, dir; int status; double f0 = *f; if (pnorm == 0.0 || g0norm == 0.0 || state->fp0 == 0) { gsl_vector_set_zero(dx); return GSL_ENOPROG; } if (delta_f < 0) { double del = GSL_MAX_DBL(-delta_f, 10 * GSL_DBL_EPSILON * fabs(f0)); alpha1 = GSL_MIN_DBL(1.0, 2.0 * del / (-state->fp0)); } else { alpha1 = fabs(state->step); } /* * line minimisation, with cubic interpolation (order = 3) */ if (debug) printf("...call minimize()\n"); status = minimize(&state->wrap.fdf_linear, state->rho, state->sigma, state->tau1, state->tau2, state->tau3, state->order, alpha1, &alpha); if (debug) printf("...end minimize()\n"); if (status != GSL_SUCCESS) { update_position(&(state->wrap), alpha, x, f, gradient); /* YES! hrue */ return status; } update_position(&(state->wrap), alpha, x, f, gradient); state->delta_f = *f - f0; /* * Choose a new direction for the next step */ { /* * This is the BFGS update: */ /* * p' = g1 - A dx - B dg */ /* * A = - (1+ dg.dg/dx.dg) B + dg.g/dx.dg */ /* * B = dx.g/dx.dg */ gsl_vector *dx0 = state->dx0; gsl_vector *dg0 = state->dg0; double dxg, dgg, dxdg, dgnorm, A, B; /* * dx0 = x - x0 */ gsl_vector_memcpy(dx0, x); gsl_blas_daxpy(-1.0, x0, dx0); gsl_vector_memcpy(dx, dx0); /* keep a copy */ /* * dg0 = g - g0 */ gsl_vector_memcpy(dg0, gradient); gsl_blas_daxpy(-1.0, g0, dg0); gsl_blas_ddot(dx0, gradient, &dxg); gsl_blas_ddot(dg0, gradient, &dgg); gsl_blas_ddot(dx0, dg0, &dxdg); dgnorm = gsl_blas_dnrm2(dg0); if (dxdg != 0) { B = dxg / dxdg; A = -(1.0 + dgnorm * dgnorm / dxdg) * B + dgg / dxdg; } else { B = 0; A = 0; } gsl_vector_memcpy(p, gradient); gsl_blas_daxpy(-A, dx0, p); gsl_blas_daxpy(-B, dg0, p); } gsl_vector_memcpy(g0, gradient); gsl_vector_memcpy(x0, x); state->g0norm = gsl_blas_dnrm2(g0); state->pnorm = gsl_blas_dnrm2(p); /* * update direction and fp0 */ gsl_blas_ddot(p, gradient, &pg); dir = (pg >= 0.0) ? -1.0 : +1.0; gsl_blas_dscal(dir / state->pnorm, p); state->pnorm = gsl_blas_dnrm2(p); gsl_blas_ddot(p, g0, &state->fp0); change_direction(&state->wrap); return GSL_SUCCESS; }
void Behavior::update() { // No need to change position if we can't move if(movement == Movement::None) return; // Update pony position (so it won't jump when we change desktops or something else unexpected happens) // Under X11 the current desktop is (0,0)x(width,height). The desktop on the left is (-width,0)x(0,0), // the desktop to the right is (width,0)x(width*2,height), etc parent->x_pos = parent->x() + x_center; parent->y_pos = parent->y() + y_center; QRect screen = QApplication::desktop()->availableGeometry(parent); // If we are moving to a destanation point, calculate direction and move there if(state == State::Following || state == State::MovingToPoint) { // Check if we are close enough to destanation point if((std::abs(destanation_point.x() - parent->x_pos) < 1.5f) && (std::abs(destanation_point.y() - parent->y_pos) < 1.5f)) { moving = false; change_direction(direction_h==Direction::Right,false); return; // We arrived at destanation, don't move anymore // TODO: if the centers for stopped and moving are not the same, then // maybe we must move the window to the center of follow_stopped_behavior? } if(destanation_point.x() == 0 && destanation_point.y() == 0){ qWarning() << parent->name << "behavior" << name << "is following, but has no target!"; return; } float dir_x = destanation_point.x() - parent->x_pos; float dir_y = destanation_point.y() - parent->y_pos; // Normalize direction vector float vec_len = std::sqrt(dir_x*dir_x + dir_y*dir_y); dir_x /= vec_len; dir_y /= vec_len; // TODO: avoidance areas: // for each avoidance area: // check if we are inside // if yes, do not change direction, just go, we will leave it eventually // check if we are too close // abs(x - area.left) < min_dist // if we are too close, and we are // // going in the direction of the area (left,right,up,down) // // then flip direction // change_direction left, etc // Check if we are facing the right irection if(dir_x < 0 && direction_h != Direction::Left) { moving = true; change_direction(false, true); }else if(dir_x > 0 && direction_h != Direction::Right) { moving = true; change_direction(true, true); }else if(moving == false) { // We were stopped, but are moving now, update the animation moving = true; change_direction(direction_h==Direction::Right,true); } // Move only if we are within the screen boundaries // Else we may go offscreen when two ponies are following each other if((parent->x() >= screen.left()) && (dir_x < 0)) { parent->x_pos += dir_x * speed; } if((parent->x() <= screen.right() - width) && (dir_x > 0)) { parent->x_pos += dir_x * speed; } if((parent->y() >= screen.top()) && (dir_y < 0)){ parent->y_pos += dir_y * speed; } if((parent->y() <= screen.bottom() - height) && (dir_y > 0)){ parent->y_pos += dir_y * speed; } parent->move(parent->x_pos-x_center,parent->y_pos-y_center); return; } // Normal movement // If we are at the screen edge or beyond then reverse the direction of movement if we are not already going in the right direction if((parent->x() <= screen.left()) && (direction_h != Direction::Right)) { change_direction(true); if(movement == Movement::Diagonal) choose_angle(); } if((parent->x() >= screen.right() - width) && (direction_h != Direction::Left)) { change_direction(false); if(movement == Movement::Diagonal) choose_angle(); } if((parent->y() <= screen.top()) && (direction_v != Direction::Down)){ direction_v = Direction::Down; if(movement == Movement::Diagonal) choose_angle(); } if((parent->y() >= screen.bottom() - height) && (direction_v != Direction::Up)){ direction_v = Direction::Up; if(movement == Movement::Diagonal) choose_angle(); } // Calculate the velocity float vel_x = direction_h * speed; float vel_y = direction_v * speed; // Update posiotion depending on movement type if(movement == Movement::Horizontal){ parent->x_pos += vel_x; } if(movement == Movement::Vertical){ parent->y_pos += vel_y; } if(movement == Movement::Diagonal){ vel_x = std::sqrt(speed*speed*2) * std::cos(angle); vel_y = -std::sqrt(speed*speed*2) * std::sin(angle); parent->x_pos += vel_x; parent->y_pos += vel_y; } parent->move(parent->x_pos-x_center,parent->y_pos-y_center); }
LRESULT CALLBACK MainDlg(HWND hwnd,UINT message,WPARAM wparam,LPARAM lparam) { PAINTSTRUCT ps; BITMAPINFO bmi; char str[255]; static int timer=FALSE; static int xpos=0,ypos=0,LMB=FALSE,dx=0,dy=0; static HWND hview=0; static HGLRC hglrc=0; static HDC hdc=0; int i; #ifdef _DEBUG // if(message!=0x200&&message!=0x84&&message!=0x20&&message!=WM_ENTERIDLE) // debug_printf("message=%08X wparam=%08X lparam=%08X\n",message,wparam,lparam); #endif switch(message) { case WM_INITDIALOG: bufA=malloc(bwidth*bheight*bdepth); bufB=malloc(bwidth*bheight*bdepth); if(bufA==0 || bufB==0) MessageBox(hwnd,"malloc failed","error",MB_OK); else{ memset(bufB,0,bwidth*bheight*bdepth); rand_fill(bufA,bwidth,bheight,bdepth); } create_grippy(hwnd); BringWindowToTop(hwnd); BringWindowToTop(hwnd); update_title(hwnd); SendMessage(hwnd,WM_KEYDOWN,VK_TAB,0); SendMessage(hwnd,WM_LBUTTONDOWN,0,0); create_view_windows(hwnd,&hview); init_ogl(hview,&hglrc,&hdc); resize_view(hwnd,hview); break; case WM_SIZE: { int w,h; w=LOWORD(lparam); h=HIWORD(lparam); grippy_move(hwnd); resize_view(hwnd,hview); reshape(w,h); } break; case WM_TIMER: if(LMB) handle_click(xpos,ypos); display_view1(hview,hglrc); break; case WM_COMMAND: switch(LOWORD(wparam)) { case IDC_ONTOP: SetWindowPos(hwnd,IsDlgButtonChecked(hwnd,LOWORD(wparam))? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE ); break; case WM_DESTROY: #ifndef _DEBUG if(MessageBox(hwnd,"Sure you want to quit?","QUIT",MB_OKCANCEL)!=IDOK) break; #endif PostQuitMessage(0); break; } break; case WM_PAINT: /* hdc=BeginPaint(hwnd,&ps); memset(&bmi,0,sizeof(BITMAPINFO)); bmi.bmiHeader.biBitCount=24; bmi.bmiHeader.biWidth=BUF_WIDTH; bmi.bmiHeader.biHeight=BUF_HEIGHT; bmi.bmiHeader.biPlanes=1; bmi.bmiHeader.biSize=40; if(stretch) StretchDIBits(hdc,0,0,client_rect.right,client_rect.bottom,0,0,BUF_WIDTH,BUF_HEIGHT,buffer,&bmi,DIB_RGB_COLORS,SRCCOPY); else SetDIBitsToDevice(hdc,0,0,BUF_WIDTH,BUF_HEIGHT,0,0,0,BUF_WIDTH,buffer,&bmi,DIB_RGB_COLORS); screen_updated=TRUE; EndPaint(hwnd,&ps); */ break; case WM_CLOSE: case WM_QUIT: PostQuitMessage(0); break; case WM_DROPFILES: break; case WM_RBUTTONDOWN: case WM_LBUTTONDOWN: case WM_MBUTTONDOWN: xpos=LOWORD(lparam); ypos=HIWORD(lparam); break; case WM_MOUSEMOVE: { int x,y; int key=wparam; x=LOWORD(lparam); y=HIWORD(lparam); if(key&MK_LBUTTON){ x=xpos-x; ry=x; y=ypos-y; rx=y; printf("rz=%.1f ry=%.1f\n",rx,ry); } if(key&MK_RBUTTON){ x=xpos-x; rz=-x; printf("z=%.1f\n",rz); } update_title(hwnd); } break; case WM_MOUSEWHEEL: if(wparam&0x80000000) SendMessage(hwnd,WM_KEYDOWN,VK_NEXT,0); else SendMessage(hwnd,WM_KEYDOWN,VK_PRIOR,0); break; case WM_KEYUP: break; case WM_KEYDOWN: { int ctrl=GetKeyState(VK_CONTROL)&0x8000; int shift=GetKeyState(VK_SHIFT)&0x8000; #ifdef _DEBUG // debug_printf("message=%08X wparam=%08X lparam=%08X\n",message,wparam,lparam); #endif switch(wparam) { case VK_INSERT: clear_screen(); break; case 0xBD: case 0xBB: break; case 'Q': rx=ry=rz=0; printf("angles reset\n"); break; case 'W': break; case 0xC0: rand_fill(swap?bufB:bufA,bwidth,bheight,bdepth); break; case 'K': set_offsety(1); break; case 'L': set_offsety(-1); break; case 'X': if(shift) scale+=10; else scale++; printf("scale=%i\n",scale); break; case 'Z': if(shift) scale-=10; else scale--; printf("scale=%i\n",scale); break; //case 0xC0: change_direction(0); rx=ry=rz=0; break; case '0': case '1': //tube(); frame_step=1; break; case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': change_direction(wparam-'0'); break; case VK_SPACE: break; case VK_TAB: if(timer) KillTimer(hwnd,1); else SetTimer(hwnd,1,60,NULL); timer=!timer; break; case VK_F1: display_help(hwnd); break; /* case VK_F2: i=CreateDialog(ghInstance,MAKEINTRESOURCE(IDD_DIALOG2),hwnd,request_value); ShowWindow(i,SW_SHOWNORMAL); debug_printf("return =%i\r\n",i); break;*/ case VK_F5: break; case VK_F9: stretch=!stretch; break; case 0xDEADBEEF: break; case VK_DOWN: if(GetKeyState(VK_CONTROL)&0x8000) move_center(3); else if(GetKeyState(VK_SHIFT)&0x8000) change_direction(12); else change_direction(2); break; case VK_UP: if(GetKeyState(VK_CONTROL)&0x8000) move_center(4); else if(GetKeyState(VK_SHIFT)&0x8000) change_direction(11); else change_direction(1); break; case VK_LEFT: if(GetKeyState(VK_CONTROL)&0x8000) move_center(1); else if(GetKeyState(VK_SHIFT)&0x8000) change_direction(14); else change_direction(4); break; case VK_RIGHT: if(GetKeyState(VK_CONTROL)&0x8000) move_center(2); else if(GetKeyState(VK_SHIFT)&0x8000) change_direction(13); else change_direction(3); break; case VK_ADD: break; case VK_SUBTRACT: break; case VK_NEXT: //page key if(GetKeyState(VK_CONTROL)&0x8000) ; else if(GetKeyState(VK_SHIFT)&0x8000) ; change_direction(100); break; case VK_PRIOR: //page key if(GetKeyState(VK_CONTROL)&0x8000) ; else if(GetKeyState(VK_SHIFT)&0x8000) ; change_direction(100); break; case VK_HOME: change_direction(5); break; case VK_END: ; break; case ZOOM_IN_KEY: //[ if(GetKeyState(VK_SHIFT)&0x8000){ if(GetKeyState(VK_CONTROL)&0x8000) ; else ; } else ; break; case ZOOM_OUT_KEY: //] if(GetKeyState(VK_SHIFT)&0x8000){ if(GetKeyState(VK_CONTROL)&0x8000) ; else ; } else ; break; case 0xBE: //> if(GetKeyState(VK_SHIFT)&0x8000){ if(GetKeyState(VK_CONTROL)&0x8000) ; else ; } else ; break; case 0xBC: //< if(GetKeyState(VK_SHIFT)&0x8000){ if(GetKeyState(VK_CONTROL)&0x8000) ; else ; } else ; break; case 'V': if(GetKeyState(VK_CONTROL)&0x8000){ if(OpenClipboard(NULL)){ char *p=GetClipboardData(CF_TEXT); if(p!=0){ strncpy(str,p,sizeof(str)); SetDlgItemText(hwnd,IDC_EDIT1,str); } CloseClipboard(); } } break; case VK_ESCAPE: if(MessageBox(hwnd,"Sure you want to quit?","QUIT",MB_OKCANCEL)==IDOK) PostQuitMessage(0); break; } update_title(hwnd); } break; } return 0; }
void AI::go_safest_turn_direction() { change_direction(find_safest_turn_direction()); }