CVSROOT: /cvsroot/wesnoth Module name: wesnoth Branch: Changes by: Yann Dirson <[EMAIL PROTECTED]> 05/03/24 21:35:53
Modified files: src : about.cpp about.hpp display.cpp display.hpp filechooser.cpp font.cpp game.cpp help.cpp intro.cpp intro.hpp multiplayer.cpp playlevel.cpp preferences.cpp show_dialog.cpp titlescreen.cpp video.cpp video.hpp Log message: moved the overlay-related part of CVideo::flip() up to display; this causes intro and about to require again a display, but that does not harm much compared to this cleanup in video deps CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/about.cpp.diff?tr1=1.106&tr2=1.107&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/about.hpp.diff?tr1=1.14&tr2=1.15&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.cpp.diff?tr1=1.309&tr2=1.310&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/display.hpp.diff?tr1=1.100&tr2=1.101&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/filechooser.cpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/font.cpp.diff?tr1=1.124&tr2=1.125&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game.cpp.diff?tr1=1.212&tr2=1.213&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/help.cpp.diff?tr1=1.81&tr2=1.82&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/intro.cpp.diff?tr1=1.73&tr2=1.74&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/intro.hpp.diff?tr1=1.20&tr2=1.21&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer.cpp.diff?tr1=1.151&tr2=1.152&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playlevel.cpp.diff?tr1=1.193&tr2=1.194&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/preferences.cpp.diff?tr1=1.144&tr2=1.145&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/show_dialog.cpp.diff?tr1=1.118&tr2=1.119&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/titlescreen.cpp.diff?tr1=1.37&tr2=1.38&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/video.cpp.diff?tr1=1.61&tr2=1.62&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/video.hpp.diff?tr1=1.33&tr2=1.34&r1=text&r2=text Patches: Index: wesnoth/src/about.cpp diff -u wesnoth/src/about.cpp:1.106 wesnoth/src/about.cpp:1.107 --- wesnoth/src/about.cpp:1.106 Wed Mar 23 21:30:46 2005 +++ wesnoth/src/about.cpp Thu Mar 24 21:35:50 2005 @@ -1,4 +1,4 @@ -/* $Id: about.cpp,v 1.106 2005/03/23 21:30:46 ydirson Exp $ */ +/* $Id: about.cpp,v 1.107 2005/03/24 21:35:50 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -316,8 +316,9 @@ return res; } -void show_about(CVideo &video) +void show_about(display &disp) { + CVideo &video = disp.video(); std::vector<std::string> text = get_text(); SDL_Rect rect = {0, 0, video.getx(), video.gety()}; @@ -419,7 +420,7 @@ // update screen and wait, so the text does not scroll too fast update_rect(map_rect); - video.flip(); + disp.flip(); SDL_Delay(20); } while(!close.pressed()); Index: wesnoth/src/about.hpp diff -u wesnoth/src/about.hpp:1.14 wesnoth/src/about.hpp:1.15 --- wesnoth/src/about.hpp:1.14 Fri Mar 18 21:21:48 2005 +++ wesnoth/src/about.hpp Thu Mar 24 21:35:50 2005 @@ -1,4 +1,4 @@ -/* $Id: about.hpp,v 1.14 2005/03/18 21:21:48 ydirson Exp $ */ +/* $Id: about.hpp,v 1.15 2005/03/24 21:35:50 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -14,7 +14,7 @@ #ifndef ABOUT_H_INCLUDED #define ABOUT_H_INCLUDED -class CVideo; +class display; #include <vector> #include <string> @@ -22,7 +22,7 @@ namespace about { -void show_about(CVideo &video); +void show_about(display &disp); std::vector<std::string> get_text(); } Index: wesnoth/src/display.cpp diff -u wesnoth/src/display.cpp:1.309 wesnoth/src/display.cpp:1.310 --- wesnoth/src/display.cpp:1.309 Thu Mar 24 21:18:26 2005 +++ wesnoth/src/display.cpp Thu Mar 24 21:35:50 2005 @@ -1,4 +1,4 @@ -/* $Id: display.cpp,v 1.309 2005/03/24 21:18:26 silene Exp $ */ +/* $Id: display.cpp,v 1.310 2005/03/24 21:35:50 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -14,6 +14,7 @@ #include "global.hpp" #include "actions.hpp" +#include "cursor.hpp" #include "display.hpp" #include "events.hpp" #include "font.hpp" @@ -573,6 +574,26 @@ draw(true,true); } +void display::flip() +{ + if(video().faked()) + return; + + const surface frameBuffer = get_video_surface(); + + halo::render(); + font::draw_floating_labels(frameBuffer); + events::raise_volatile_draw_event(); + cursor::draw(frameBuffer); + + video().flip(); + + cursor::undraw(frameBuffer); + events::raise_volatile_undraw_event(); + font::undraw_floating_labels(frameBuffer); + halo::unrender(); +} + namespace { void draw_panel(CVideo& video, const theme::panel& panel, std::vector<gui::button>& buttons) @@ -743,7 +764,7 @@ fps_handle_ = 0; } - screen_.flip(); + flip(); } void display::draw_sidebar() Index: wesnoth/src/display.hpp diff -u wesnoth/src/display.hpp:1.100 wesnoth/src/display.hpp:1.101 --- wesnoth/src/display.hpp:1.100 Thu Mar 24 21:18:26 2005 +++ wesnoth/src/display.hpp Thu Mar 24 21:35:50 2005 @@ -1,4 +1,4 @@ -/* $Id: display.hpp,v 1.100 2005/03/24 21:18:26 silene Exp $ */ +/* $Id: display.hpp,v 1.101 2005/03/24 21:35:50 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -107,6 +107,8 @@ //invalidates entire screen, including all tiles and sidebar. void redraw_everything(); + void flip(); + //draws invalidated items. If update is true, will also copy the //display to the frame buffer. If force is true, will not skip frames, //even if running behind. Index: wesnoth/src/filechooser.cpp diff -u wesnoth/src/filechooser.cpp:1.7 wesnoth/src/filechooser.cpp:1.8 --- wesnoth/src/filechooser.cpp:1.7 Fri Mar 18 21:21:48 2005 +++ wesnoth/src/filechooser.cpp Thu Mar 24 21:35:50 2005 @@ -49,7 +49,7 @@ fc.set_dirty(true); events::raise_draw_event(); - screen.flip(); + disp.flip(); disp.invalidate_all(); CKey key; @@ -73,7 +73,7 @@ return button_it - buttons_ptr.begin(); } } - screen.flip(); + disp.flip(); SDL_Delay(10); } } Index: wesnoth/src/font.cpp diff -u wesnoth/src/font.cpp:1.124 wesnoth/src/font.cpp:1.125 --- wesnoth/src/font.cpp:1.124 Wed Mar 23 20:46:58 2005 +++ wesnoth/src/font.cpp Thu Mar 24 21:35:50 2005 @@ -1,4 +1,4 @@ -/* $Id: font.cpp,v 1.124 2005/03/23 20:46:58 ydirson Exp $ */ +/* $Id: font.cpp,v 1.125 2005/03/24 21:35:50 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -34,6 +34,7 @@ #include <iostream> #include <list> #include <map> +#include <set> #include <sstream> #include <stack> #include <string> @@ -540,7 +541,7 @@ //function which will parse the markup tags at the front of a string std::string::const_iterator parse_markup(std::string::const_iterator i1, std::string::const_iterator i2, - int* font_size, SDL_Color* colour, int* style) + int* font_size, SDL_Color* colour, int* style) { if(font_size == NULL || colour == NULL) { return i1; Index: wesnoth/src/game.cpp diff -u wesnoth/src/game.cpp:1.212 wesnoth/src/game.cpp:1.213 --- wesnoth/src/game.cpp:1.212 Tue Mar 22 23:42:36 2005 +++ wesnoth/src/game.cpp Thu Mar 24 21:35:50 2005 @@ -1,4 +1,4 @@ -/* $Id: game.cpp,v 1.212 2005/03/22 23:42:36 ydirson Exp $ */ +/* $Id: game.cpp,v 1.213 2005/03/24 21:35:50 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -1434,8 +1434,8 @@ try { const LEVEL_RESULT result = ::play_game(disp(),state_,game_config_,units_data_,video_); if(result == VICTORY) { - the_end(disp().video()); - about::show_about(disp().video()); + the_end(disp()); + about::show_about(disp()); } } catch(game::load_game_exception& e) { @@ -1677,7 +1677,7 @@ game.disp().redraw_everything(); continue; } else if(res == gui::SHOW_ABOUT) { - about::show_about(game.disp().video()); + about::show_about(game.disp()); continue; } Index: wesnoth/src/help.cpp diff -u wesnoth/src/help.cpp:1.81 wesnoth/src/help.cpp:1.82 --- wesnoth/src/help.cpp:1.81 Wed Mar 23 21:30:46 2005 +++ wesnoth/src/help.cpp Thu Mar 24 21:35:52 2005 @@ -2608,7 +2608,7 @@ } hb.set_dirty(true); events::raise_draw_event(); - screen.flip(); + disp.flip(); disp.invalidate_all(); CKey key; for (;;) { @@ -2626,7 +2626,7 @@ return; } } - screen.flip(); + disp.flip(); SDL_Delay(10); } } Index: wesnoth/src/intro.cpp diff -u wesnoth/src/intro.cpp:1.73 wesnoth/src/intro.cpp:1.74 --- wesnoth/src/intro.cpp:1.73 Wed Mar 23 21:30:46 2005 +++ wesnoth/src/intro.cpp Thu Mar 24 21:35:52 2005 @@ -1,4 +1,4 @@ -/* $Id: intro.cpp,v 1.73 2005/03/23 21:30:46 ydirson Exp $ */ +/* $Id: intro.cpp,v 1.74 2005/03/24 21:35:52 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -13,6 +13,7 @@ #include "global.hpp" +#include "display.hpp" #include "events.hpp" #include "font.hpp" #include "game_config.hpp" @@ -35,10 +36,10 @@ const int min_room_at_bottom = 150; } -bool show_intro_part(CVideo &video, const config& part, +bool show_intro_part(display &disp, const config& part, const std::string& scenario); -void show_intro(CVideo &video, const config& data, const config& level) +void show_intro(display &disp, const config& data, const config& level) { std::cerr << "showing intro sequence...\n"; @@ -55,7 +56,7 @@ std::pair<const std::string*, const config*> item = *i; if(*item.first == "part") { - showing = show_intro_part(video, (*item.second), scenario); + showing = show_intro_part(disp, (*item.second), scenario); } else if(*item.first == "if") { const std::string type = game_events::conditional_passed( NULL, *item.second) ? "then":"else"; @@ -65,18 +66,19 @@ return; } const config& selection = *thens; - show_intro(video, selection, level); + show_intro(disp, selection, level); } } std::cerr << "intro sequence finished...\n"; } -bool show_intro_part(CVideo &video, const config& part, +bool show_intro_part(display &disp, const config& part, const std::string& scenario) { std::cerr << "showing intro part\n"; + CVideo &video = disp.video(); const std::string& music_file = part["music"]; //play music if available @@ -144,7 +146,7 @@ } update_whole_screen(); - video.flip(); + disp.flip(); if(!background.null()) { //draw images @@ -202,7 +204,7 @@ continue; } - video.flip(); + disp.flip(); } } @@ -290,7 +292,7 @@ events::pump(); events::raise_process_event(); events::raise_draw_event(); - video.flip(); + disp.flip(); if(!skip || itor == utils::utf8_iterator::end(story)) SDL_Delay(20); @@ -302,13 +304,14 @@ return true; } -void the_end(CVideo& video) +void the_end(display &disp) { SDL_Rect area = screen_area(); + CVideo &video = disp.video(); SDL_FillRect(video.getSurface(),&area,0); update_whole_screen(); - video.flip(); + disp.flip(); const std::string text = _("The End"); const size_t font_size = font::SIZE_XLARGE; @@ -321,7 +324,7 @@ const SDL_Color col = {n,n,n,n}; font::draw_text(&video,area,font_size,col,text,area.x,area.y); update_rect(area); - video.flip(); + disp.flip(); SDL_FillRect(video.getSurface(),&area,0); Index: wesnoth/src/intro.hpp diff -u wesnoth/src/intro.hpp:1.20 wesnoth/src/intro.hpp:1.21 --- wesnoth/src/intro.hpp:1.20 Sun Mar 20 16:27:44 2005 +++ wesnoth/src/intro.hpp Thu Mar 24 21:35:52 2005 @@ -1,4 +1,4 @@ -/* $Id: intro.hpp,v 1.20 2005/03/20 16:27:44 ydirson Exp $ */ +/* $Id: intro.hpp,v 1.21 2005/03/24 21:35:52 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -14,7 +14,7 @@ #define INTRO_HPP_INCLUDED class config; -class CVideo; +class display; #include "SDL.h" #include <string> @@ -31,8 +31,8 @@ // //each part of the sequence will be displayed in turn, with the //user able to go to the next part, or skip it entirely. -void show_intro(CVideo &video, const config& data, const config& level); +void show_intro(display &disp, const config& data, const config& level); -void the_end(CVideo& screen); +void the_end(display &disp); #endif Index: wesnoth/src/multiplayer.cpp diff -u wesnoth/src/multiplayer.cpp:1.151 wesnoth/src/multiplayer.cpp:1.152 --- wesnoth/src/multiplayer.cpp:1.151 Wed Mar 23 19:41:09 2005 +++ wesnoth/src/multiplayer.cpp Thu Mar 24 21:35:52 2005 @@ -1,4 +1,4 @@ -/* $Id: multiplayer.cpp,v 1.151 2005/03/23 19:41:09 j_daniel Exp $ */ +/* $Id: multiplayer.cpp,v 1.152 2005/03/24 21:35:52 ydirson Exp $ */ /* Copyright (C) Part of the Battle for Wesnoth Project http://www.wesnoth.org @@ -70,7 +70,7 @@ ui.process_network(); - disp.video().flip(); + disp.flip(); SDL_Delay(20); } } Index: wesnoth/src/playlevel.cpp diff -u wesnoth/src/playlevel.cpp:1.193 wesnoth/src/playlevel.cpp:1.194 --- wesnoth/src/playlevel.cpp:1.193 Thu Mar 24 00:11:36 2005 +++ wesnoth/src/playlevel.cpp Thu Mar 24 21:35:52 2005 @@ -1,4 +1,4 @@ -/* $Id: playlevel.cpp,v 1.193 2005/03/24 00:11:36 j_daniel Exp $ */ +/* $Id: playlevel.cpp,v 1.194 2005/03/24 21:35:52 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -412,7 +412,8 @@ if(recorder.skipping() == false) { for(std::vector<config*>::const_iterator story_i = story.begin(); story_i != story.end(); ++story_i) { - show_intro(gui.video(),**story_i, *level); + + show_intro(gui,**story_i, *level); } } Index: wesnoth/src/preferences.cpp diff -u wesnoth/src/preferences.cpp:1.144 wesnoth/src/preferences.cpp:1.145 --- wesnoth/src/preferences.cpp:1.144 Fri Mar 18 21:21:48 2005 +++ wesnoth/src/preferences.cpp Thu Mar 24 21:35:52 2005 @@ -1,4 +1,4 @@ -/* $Id: preferences.cpp,v 1.144 2005/03/18 21:21:48 ydirson Exp $ */ +/* $Id: preferences.cpp,v 1.145 2005/03/24 21:35:52 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -1210,7 +1210,7 @@ mod=event.key.keysym.mod; }; SDL_PollEvent(&event); - disp.video().flip(); + disp.flip(); SDL_Delay(10); } while (event.type!=SDL_KEYUP); restorer.restore(); Index: wesnoth/src/show_dialog.cpp diff -u wesnoth/src/show_dialog.cpp:1.118 wesnoth/src/show_dialog.cpp:1.119 --- wesnoth/src/show_dialog.cpp:1.118 Wed Mar 23 21:30:46 2005 +++ wesnoth/src/show_dialog.cpp Thu Mar 24 21:35:52 2005 @@ -1,4 +1,4 @@ -/* $Id: show_dialog.cpp,v 1.118 2005/03/23 21:30:46 ydirson Exp $ */ +/* $Id: show_dialog.cpp,v 1.119 2005/03/24 21:35:52 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -659,7 +659,7 @@ } } - screen.flip(); + disp.flip(); CKey key; @@ -815,7 +815,7 @@ } } - screen.flip(); + disp.flip(); SDL_Delay(10); if(action != NULL) { Index: wesnoth/src/titlescreen.cpp diff -u wesnoth/src/titlescreen.cpp:1.37 wesnoth/src/titlescreen.cpp:1.38 --- wesnoth/src/titlescreen.cpp:1.37 Fri Mar 18 21:21:48 2005 +++ wesnoth/src/titlescreen.cpp Thu Mar 24 21:35:52 2005 @@ -291,7 +291,7 @@ events::raise_process_event(); events::raise_draw_event(); - screen.video().flip(); + screen.flip(); if(!last_escape && key[SDLK_ESCAPE]) return QUIT_GAME; Index: wesnoth/src/video.cpp diff -u wesnoth/src/video.cpp:1.61 wesnoth/src/video.cpp:1.62 --- wesnoth/src/video.cpp:1.61 Wed Mar 16 21:49:37 2005 +++ wesnoth/src/video.cpp Thu Mar 24 21:35:52 2005 @@ -1,4 +1,4 @@ -/* $Id: video.cpp,v 1.61 2005/03/16 21:49:37 ydirson Exp $ */ +/* $Id: video.cpp,v 1.62 2005/03/24 21:35:52 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -17,10 +17,7 @@ #include <iostream> #include <vector> -#include "cursor.hpp" -#include "events.hpp" #include "font.hpp" -#include "halo.hpp" #include "image.hpp" #include "log.hpp" #include "video.hpp" @@ -334,10 +331,6 @@ if(fake_screen) return; - halo::render(); - font::draw_floating_labels(frameBuffer); - events::raise_volatile_draw_event(); - cursor::draw(frameBuffer); if(update_all) { ::SDL_Flip(frameBuffer); } else if(update_rects.empty() == false) { @@ -345,11 +338,6 @@ } clear_updates(); - - cursor::undraw(frameBuffer); - events::raise_volatile_undraw_event(); - font::undraw_floating_labels(frameBuffer); - halo::unrender(); } void CVideo::lock_updates(bool value) Index: wesnoth/src/video.hpp diff -u wesnoth/src/video.hpp:1.33 wesnoth/src/video.hpp:1.34 --- wesnoth/src/video.hpp:1.33 Wed Mar 16 21:49:37 2005 +++ wesnoth/src/video.hpp Thu Mar 24 21:35:52 2005 @@ -1,4 +1,4 @@ -/* $Id: video.hpp,v 1.33 2005/03/16 21:49:37 ydirson Exp $ */ +/* $Id: video.hpp,v 1.34 2005/03/24 21:35:52 ydirson Exp $ */ /* Copyright (C) 2003 by David White <[EMAIL PROTECTED]> Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net @@ -77,6 +77,7 @@ int getBpp(); void make_fake(); + bool faked() { return fake_screen; } //functions to set and clear 'help strings'. A 'help string' is like a tooltip, but it appears //at the bottom of the screen, so as to not be intrusive. Setting a help string sets what