Overview
Comment: | Implement clicking on the move list to rewind/replay, and display the move number when hovering the move list |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
6aab82917fd6f83d6a0fd4f6a62692a2 |
User & Date: | user on 2021-01-06 22:07:32 |
Other Links: | manifest | tags |
Context
2021-01-06
| ||
22:33 | Write more about the WinLevel instruction check-in: 44aa200a8a user: user tags: trunk | |
22:07 | Implement clicking on the move list to rewind/replay, and display the move number when hovering the move list check-in: 6aab82917f user: user tags: trunk | |
07:31 | Add instructions for checking types of values check-in: ef4096f816 user: user tags: trunk | |
Changes
Modified game.c from [8e4e41abe4] to [6379500623].
︙ | ︙ | |||
169 170 171 172 173 174 175 | } static void show_mouse_xy(SDL_Event*ev) { char buf[32]; int x,y; x=(ev->motion.x-left_margin)/picture_size+1; y=ev->motion.y/picture_size+1; | | > > > > > > > > > > > > | | > | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | } static void show_mouse_xy(SDL_Event*ev) { char buf[32]; int x,y; x=(ev->motion.x-left_margin)/picture_size+1; y=ev->motion.y/picture_size+1; if(ev->motion.x<left_margin) { if(ev->button.y<48) { strcpy(buf," "); } else if(side_mode) { // Inventory x=(ev->button.y-52)/picture_size; if(x<0 || x>=ninventory) strcpy(buf," "); else snprintf(buf,8,"%7d",inventory[x].value); } else { // Move list x=replay_pos+(ev->button.y+4)/16-(screen->h-68)/32-4; if(x<0 || x>replay_count) strcpy(buf," "); else snprintf(buf,8,"=%6d",x); } } else { if(x>0 && y>0 && x<=pfwidth && y<=pfheight) snprintf(buf,8,"(%2d,%2d)",x,y); else strcpy(buf," "); } SDL_LockSurface(screen); draw_text(0,40,buf,0xF0,0xF1); SDL_UnlockSurface(screen); SDL_Flip(screen); } static void begin_level(int id) { |
︙ | ︙ | |||
577 578 579 580 581 582 583 | break; case SDL_USEREVENT: if(!gameover && !quiz_text) continue_animation(); timerflag=0; break; case SDL_MOUSEBUTTONDOWN: if(ev.button.x<left_margin) { | > > > | > > > > > > > | 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | break; case SDL_USEREVENT: if(!gameover && !quiz_text) continue_animation(); timerflag=0; break; case SDL_MOUSEBUTTONDOWN: if(ev.button.x<left_margin) { if(ev.button.y<48) break; if(side_mode) { // Inventory } else { // Move list i=(ev.button.y+4)/16-(screen->h-68)/32-4; if(i<0) game_command(0,'- ',-i,0,0,0); else if(i>0) game_command(0,'+ ',i,0,0,0); goto replay; } break; } else { i=exec_key_binding(&ev,0,(ev.button.x-left_margin)/picture_size+1,ev.button.y/picture_size+1,game_command,0); goto command; } case SDL_KEYDOWN: i=exec_key_binding(&ev,0,0,0,game_command,0); command: if(i==-1) exit(0); if(i==-2) { main_options['e']=1; SDL_SetTimer(0,0); return; } replay: if(inputs_count) { //TODO: Check for solution replay for(i=0;i<inputs_count && !gameover;i++) if(inputs[i]) input_move(inputs[i]); inputs_count=0; } redraw_game(); timerflag=0; // ensure we have not missed a timer event |
︙ | ︙ |