This function creates an array of frame numbers and corresponding strings for displaying subtitles
| 1990 | |
| 1991 | //This function creates an array of frame numbers and corresponding strings for displaying subtitles |
| 1992 | void LoadSubtitles(MovieData &moviedata) |
| 1993 | { |
| 1994 | subtitleFrames.resize(0); |
| 1995 | subtitleMessages.resize(0); |
| 1996 | extern std::vector<string> subtitles; |
| 1997 | for(uint32 i=0; i < moviedata.subtitles.size() ; i++) |
| 1998 | { |
| 1999 | std::string& subtitle = moviedata.subtitles[i]; |
| 2000 | size_t splitat = subtitle.find_first_of(' '); |
| 2001 | std::string key, value; |
| 2002 | |
| 2003 | //If we can't split them, then don't process this one |
| 2004 | if(splitat == std::string::npos) |
| 2005 | { |
| 2006 | } |
| 2007 | //Else split the subtitle into the int and string arrays |
| 2008 | else |
| 2009 | { |
| 2010 | key = subtitle.substr(0,splitat); |
| 2011 | value = subtitle.substr(splitat+1); |
| 2012 | subtitleFrames.push_back(atoi(key.c_str())); |
| 2013 | subtitleMessages.push_back(value); |
| 2014 | } |
| 2015 | } |
| 2016 | |
| 2017 | } |
| 2018 | |
| 2019 | //Every frame, this will be called to determine if a subtitle should be displayed, which one, and then to display it |
| 2020 | void ProcessSubtitles(void) |
no test coverage detected