Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "global.hpp"
00023
00024 #include "intro.hpp"
00025
00026 #include "display.hpp"
00027 #include "gettext.hpp"
00028 #include "log.hpp"
00029 #include "marked-up_text.hpp"
00030 #include "storyscreen/interface.hpp"
00031
00032 static lg::log_domain log_engine("engine");
00033 #define ERR_NG LOG_STREAM(err, log_engine)
00034 #define LOG_NG LOG_STREAM(info, log_engine)
00035
00036 static bool use_shadowm_storyscreen = false;
00037
00038 static void the_end_old(display &disp, std::string text, unsigned int duration)
00039 {
00040
00041
00042
00043 if(text.empty())
00044 text = _("The End");
00045 if(!duration)
00046 duration = 3500;
00047
00048 SDL_Rect area = screen_area();
00049 CVideo &video = disp.video();
00050 sdl_fill_rect(video.getSurface(),&area,0);
00051
00052 update_whole_screen();
00053 disp.flip();
00054
00055 const size_t font_size = font::SIZE_XLARGE;
00056
00057 area = font::text_area(text,font_size);
00058 area.x = screen_area().w/2 - area.w/2;
00059 area.y = screen_area().h/2 - area.h/2;
00060
00061 for(size_t n = 0; n < 255; n += 5) {
00062 if(n)
00063 sdl_fill_rect(video.getSurface(),&area,0);
00064
00065 const SDL_Color col = create_color(n, n, n, n);
00066 font::draw_text(&video,area,font_size,col,text,area.x,area.y);
00067 update_rect(area);
00068
00069 events::pump();
00070 events::raise_process_event();
00071 events::raise_draw_event();
00072 disp.flip();
00073 disp.delay(10);
00074 }
00075
00076
00077
00078
00079
00080 unsigned int count = duration/10;
00081 while(count) {
00082 events::pump();
00083 events::raise_process_event();
00084 events::raise_draw_event();
00085 disp.flip();
00086 disp.delay(10);
00087 --count;
00088 }
00089 }
00090
00091 void set_new_storyscreen(bool enabled)
00092 {
00093 use_shadowm_storyscreen = enabled;
00094 LOG_NG << "enabled experimental story/endscreen code\n";
00095 }
00096
00097 void the_end(display &disp, std::string text, unsigned int duration)
00098 {
00099 if(use_shadowm_storyscreen) {
00100 show_endscreen(disp, t_string(text) , duration);
00101 }
00102 else {
00103 the_end_old(disp,text,duration);
00104 }
00105 }
00106