Facebook
From Czapla, 7 Years ago, written in C++.
Embed
Download Paste or View Raw
Hits: 356
  1. void start( RenderWindow & okno)
  2. {
  3.         short  roz_x = 1280, roz_y =720 ;
  4.         bool full = 0;
  5.         bool frame = 0;
  6.        
  7.         konsola.log("uruchamianie programu");
  8.        
  9.        
  10.        
  11.         string Text;
  12.         TiXmlDocument doc("opcje.xml");
  13.        
  14.         //wczytywanie z opcje.xml
  15.         if (doc.LoadFile())
  16.         {
  17.                
  18.                 TiXmlHandle hDoc(&doc);
  19.                 TiXmlElement* pElem;
  20.  
  21.                
  22.  
  23.                 //pelen ekran
  24.                 pElem = hDoc.FirstChild("ustawienia").Child("okno", 0).Child("pelen_ekran",0).ToElement();
  25.                 if (pElem)
  26.                 {
  27.                         Text = pElem->GetText();
  28.                         if (Text == "true" || Text == "True")
  29.                         {
  30.                                 full = 1;
  31.                         }
  32.                         else
  33.                         {
  34.                                
  35.                                 pElem = hDoc.FirstChild("ustawienia").Child("okno", 0).Child("ramki", 0).ToElement();
  36.                                 Text = pElem->GetText();
  37.                                 if (Text == "true" || Text == "True")
  38.                                 {
  39.                                         frame = 1;
  40.                                 }
  41.                        
  42.                         }
  43.  
  44.                        
  45.  
  46.                
  47.                 }
  48.                 else { konsola.log("nie znaleziono elementu pelen ekran"); }
  49.  
  50.  
  51.  
  52.  
  53.                 //wczytywanie szerokosci
  54.                 pElem = hDoc.FirstChild("ustawienia").Child("okno", 0).Child("szerokosc", 0).ToElement();
  55.                 if (pElem)
  56.                 {
  57.                         Text = pElem->GetText();
  58.                        
  59.                         string::size_type sz;
  60.  
  61.                         int dimension =stoi(Text, &sz);
  62.                         if (dimension <= 1920 && dimension >= 0)
  63.                         {
  64.                         roz_x = dimension;
  65.                         }
  66.                
  67.                 }
  68.                 else { konsola.log("nie znaleziono elementu szerokosc"); }
  69.        
  70.                
  71.                
  72.                
  73.                 //wczytywanie dlugosci
  74.                 pElem = hDoc.FirstChild("ustawienia").Child("okno", 0).Child("wysokosc", 0).ToElement();
  75.                 if (pElem)
  76.                 {
  77.                         Text = pElem->GetText();
  78.                
  79.                        
  80.                         string::size_type sz;
  81.  
  82.                         int dimension = stoi(Text, &sz);
  83.                         if (dimension >= 0 && dimension <=1080)
  84.                         {
  85.                                 roz_y = dimension;
  86.                         }
  87.                        
  88.        
  89.                 }
  90.                 else { konsola.log("nie znaleziono elementu dlugosc"); }
  91.  
  92.         } else konsola.log("nie wczytano pliku opcje.xml");
  93.        
  94.        
  95.        
  96.         //tworzy okno
  97.        
  98.         if (full)
  99.         {
  100.                 okno.create(VideoMode(roz_x, roz_y), "SFML_Buldier", Style::Fullscreen);
  101.         }
  102.         else
  103.         {
  104.        
  105.                 if (frame) { okno.create(VideoMode(roz_x, roz_y), "SFML_Buldier", Style::Titlebar | Style::Close); }
  106.                 else{ okno.create(VideoMode(roz_x, roz_y), "SFML_Buldier", Style::None);               
  107.                 }
  108.        
  109.         }
  110.  
  111.  
  112.  
  113.  
  114. }