|
From: Yoda-JM <yo...@us...> - 2007-06-15 21:33:16
|
Update of /cvsroot/ultrastar-ng/UltraStar-ng/src In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv22845/src Modified Files: theme.cpp screen_configuration.cpp Log Message: Used theme Added configuration theme Index: screen_configuration.cpp =================================================================== RCS file: /cvsroot/ultrastar-ng/UltraStar-ng/src/screen_configuration.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** screen_configuration.cpp 5 Jun 2007 11:31:09 -0000 1.3 --- screen_configuration.cpp 15 Jun 2007 21:33:10 -0000 1.4 *************** *** 6,9 **** --- 6,10 ---- configuration.push_back(new CConfigurationFullscreen()); configuration.push_back(new CConfigurationDifficulty()); + configuration.push_back(new CConfigurationAudioVolume()); selected=0; } *************** *** 17,24 **** --- 18,29 ---- void CScreenConfiguration::enter( void ) { + CScreenManager * sm = CScreenManager::getSingletonPtr(); + theme = new CThemeConfiguration(); + bg_texture = sm->getVideoDriver()->initSurface(theme->bg->getSDLSurface()); } void CScreenConfiguration::exit( void ) { + delete theme; } *************** *** 36,42 **** CScreenManager::getSingletonPtr()->activateScreen("Intro"); } else if( keypressed == SDLK_LEFT ) { ! configuration[selected]->setPrevious(); } else if( keypressed == SDLK_RIGHT ) { ! configuration[selected]->setNext(); } else if( keypressed == SDLK_UP ) { if( selected > 0 ) --- 41,49 ---- CScreenManager::getSingletonPtr()->activateScreen("Intro"); } else if( keypressed == SDLK_LEFT ) { ! if( !configuration[selected]->isFirst() ) ! configuration[selected]->setPrevious(); } else if( keypressed == SDLK_RIGHT ) { ! if( !configuration[selected]->isLast() ) ! configuration[selected]->setNext(); } else if( keypressed == SDLK_UP ) { if( selected > 0 ) *************** *** 51,53 **** --- 58,79 ---- void CScreenConfiguration::draw( void ) { + CScreenManager * sm = CScreenManager::getSingletonPtr(); + theme->theme->clear(); + cairo_text_extents_t extents; + + // Draw the "Order by" text + { + theme->item.text = configuration[selected]->getDescription(); + extents = theme->theme->GetTextExtents(theme->item); + theme->item.x = (theme->item.svg_width - extents.width)/2; + theme->theme->PrintText(&theme->item); + + theme->value.text = configuration[selected]->getValue(); + extents = theme->theme->GetTextExtents(theme->value); + theme->value.x = (theme->value.svg_width - extents.width)/2; + theme->theme->PrintText(&theme->value); + } + + sm->getVideoDriver()->drawSurface(bg_texture); + sm->getVideoDriver()->drawSurface(theme->theme->getCurrent()); } Index: theme.cpp =================================================================== RCS file: /cvsroot/ultrastar-ng/UltraStar-ng/src/theme.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** theme.cpp 10 Jun 2007 13:16:33 -0000 1.21 --- theme.cpp 15 Jun 2007 21:33:10 -0000 1.22 *************** *** 458,459 **** --- 458,480 ---- delete theme; } + + CThemeConfiguration::CThemeConfiguration() { + char * theme_path = new char[1024]; + CScreenManager * sm = CScreenManager::getSingletonPtr(); + + sm->getThemePathFile(theme_path,"configuration_bg.svg"); + bg = new CairoSVG(theme_path, sm->getWidth(), sm->getHeight()); + + theme = new CTheme(sm->getWidth(), sm->getHeight()); + sm->getThemePathFile(theme_path,"configuration_item.svg"); + theme->ParseSVGForText(theme_path, &item); + + sm->getThemePathFile(theme_path,"configuration_value.svg"); + theme->ParseSVGForText(theme_path, &value); + + delete[] theme_path; + } + CThemeConfiguration::~CThemeConfiguration() { + delete bg; + delete theme; + } |