Changeset 26 for trunk/Classes/intro.cpp
- Timestamp:
- 2010-05-28 07:39:52 (2 years ago)
- File:
-
- 1 edited
-
trunk/Classes/intro.cpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Classes/intro.cpp
r15 r26 34 34 #define LOG_NG LOG_STREAM(info, engine) 35 35 36 extern bool gRedraw; 37 36 38 namespace { 37 39 void scan_deprecation_messages(const config& cfg) … … 51 53 52 54 static bool show_intro_part(display &disp, const vconfig& part, 53 const std::string& scenario );55 const std::string& scenario, bool redrawOnly=false); 54 56 55 57 void show_intro(display &disp, const vconfig& data, const config& level) … … 101 103 102 104 bool show_intro_part(display &disp, const vconfig& part, 103 const std::string& scenario )105 const std::string& scenario, bool redrawOnly) 104 106 { 105 107 LOG_NG << "showing intro part\n"; … … 110 112 111 113 // Play music if available 112 if( music_file != "") {114 if(!redrawOnly && music_file != "") { 113 115 sound::play_music_repeatedly(music_file); 114 116 } 115 117 116 118 CKey key; 117 118 gui::button next_button(video,_("Next") + std::string(" >>>"));119 #ifdef __IPAD__ 120 gui::button next_button(video,_("Next") + std::string(" >>>")); 119 121 gui::button skip_button(video,_("Skip")); 122 #else 123 gui::button next_button(video,_("Next") + std::string(">>>"), gui::button::TYPE_PRESS, "button"); 124 gui::button skip_button(video,_("Skip"), gui::button::TYPE_PRESS, "button"); 125 #endif 120 126 121 127 // draw_solid_tinted_rectangle(0,0,video.getx(),video.gety(), … … 162 168 if(images.empty()) 163 169 dstrect.y -= 75/2; 170 #endif 171 172 #ifdef __IPAD__ 173 if(images.empty()) 174 dstrect.y -= 75; 164 175 #endif 165 176 … … 188 199 ybuttons = video.gety() - 40; 189 200 190 next_button.set_location(xbuttons,ybuttons- 30);201 next_button.set_location(xbuttons,ybuttons-50); 191 202 skip_button.set_location(xbuttons,ybuttons); 192 203 #endif … … 223 234 224 235 const int delay = lexical_cast_default<int>((*i)["delay"], 0); 225 const int x = static_cast<int>(atoi((*i)["x"].c_str())*scale); 226 const int y = static_cast<int>(atoi((*i)["y"].c_str())*scale); 236 int x = static_cast<int>(atoi((*i)["x"].c_str())*scale); 237 int y = static_cast<int>(atoi((*i)["y"].c_str())*scale); 238 239 #ifndef __IPAD__ 240 // KP: fix progress images 241 double xs = 427.0f/1024.0f; //480.0f/1024.0f; 242 double ys = 320.0f/768.0f; 243 x = x * xs; 244 y = y * ys; 245 #endif 227 246 228 247 if (utils::string_bool((*i)["scaled"])){ … … 280 299 } 281 300 } 301 302 if (redrawOnly) 303 return true; 304 282 305 try { 283 306 return show_intro_part_helper( … … 452 475 if(!skip || itor == utils::utf8_iterator::end(story)) 453 476 disp.delay(20); 477 478 if (gRedraw == true) 479 { 480 gRedraw = false; 481 482 itor = utils::utf8_iterator::begin(story); 483 #ifdef USE_TINY_GUI 484 xpos = textx; 485 ypos = texty + 10; 486 #else 487 xpos = textx; 488 ypos = texty + 20; 489 #endif 490 491 // mid-story flip support 492 show_intro_part(disp, part, "", true); 493 494 if(story.empty() != true) 495 { 496 // this should kill the tiniest flickering caused 497 // by the buttons being hidden and unhidden in this scope. 498 update_locker locker(disp.video()); 499 500 const SDL_Rect total_size = font::draw_text(NULL, screen_area(), font::SIZE_PLUS, 501 font::NORMAL_COLOUR, story, 0, 0); 502 503 next_button.hide(); 504 skip_button.hide(); 505 506 if (texty + 20 + total_size.h > screen_area().h) { 507 texty = screen_area().h > total_size.h + 1 ? screen_area().h - total_size.h - 21 : 0; 508 } 509 510 update_y = texty; 511 update_h = screen_area().h-texty; 512 blur_helper(disp.video(), update_y, update_h); 513 514 //draw_solid_tinted_rectangle( 515 // 0, texty, screen_area().w, screen_area().h - texty, 516 // 0, 0, 0, 1.0, video.getSurface() 517 //); 518 SDL_Rect tintRect = {0, texty, screen_area().w, screen_area().h - texty}; 519 SDL_SetRenderDrawColor(0, 0, 0, 0xff); 520 SDL_RenderFill(&tintRect); 521 522 // Draw a nice border 523 if(has_background) { 524 // FIXME: perhaps hard-coding the image path isn't a really 525 // good idea - it must not be forgotten if someone decides to switch 526 // the image directories around. 527 surface top_border = image::get_image("dialogs/translucent54-border-top.png"); 528 top_border = scale_surface_blended(top_border, screen_area().w, top_border->h); 529 update_y = texty - top_border->h; 530 update_h += top_border->h; 531 blur_helper(disp.video(), update_y, top_border->h); 532 blit_surface(0, texty - top_border->h, top_border); 533 } 534 535 // Make buttons aware of the changes in the background 536 next_button.set_location(next_button.location()); 537 next_button.hide(false); 538 skip_button.set_location(skip_button.location()); 539 skip_button.hide(false); 540 } 541 542 543 } 454 544 } 455 545
Note: See TracChangeset
for help on using the changeset viewer.