Advertisement
Guest User

Untitled

a guest
Jul 15th, 2013
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.36 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <fstream>
  4. #include <istream>
  5. #include <iostream>
  6. #include <float.h>
  7. #include <string>
  8. #include <gl/glut.h>
  9.  
  10. using namespace std;
  11.  
  12. class screenRGB{
  13.  
  14. public:
  15.     void setScreenRed(float r){screenRed = r;}
  16.     void setScreenGreen(float g){screenGreen = g;}
  17.     void setScreenBlue(float b){screenBlue = b; }
  18.  
  19.  
  20.     float getScreenRed(void){return screenRed;}
  21.     float getScreenGreen(void){return screenGreen;}
  22.     float getScreenBlue(void){return screenBlue;}
  23. private:
  24.     float screenRed, screenGreen, screenBlue;
  25. };
  26.  
  27. class Weather{
  28.     int currentWeather;
  29. public:
  30.     void setWeather(int x){currentWeather = x;}
  31.     string getWeather(){return changeWeather();}
  32.     string changeWeather()
  33.     {
  34.         screenRGB screenrgb;
  35.  
  36.         /*
  37.         screenrgb.setScreenRed(0.0);
  38.         screenrgb.setScreenGreen(1.0);
  39.         screenrgb.setScreenBlue(0.0);
  40.         */
  41.  
  42.         //Weather Options
  43.         string sunny = "Sunny";
  44.         float sunnyF;
  45.         string raining = "Raining";
  46.         string cloudy = "Cloudy";
  47.         string overcast = "Overcast";
  48.         string hail = "Hailing";
  49.         string snowing = "Snowing";
  50.  
  51.         switch(currentWeather){
  52.         case 1:
  53.             cout << screenrgb.getScreenBlue() << endl;
  54.             //cout << "Morning";
  55.             screenrgb.setScreenBlue(1.0);
  56.             return sunny;
  57.             break;
  58.         case 2:
  59.             //cout << "Brunch";
  60.             return raining;
  61.             break;
  62.         case 3:
  63.             //cout << "Midday";
  64.             return cloudy;
  65.             break;
  66.         case 4:
  67.             //cout << "Dusk";
  68.             return overcast;
  69.             break;
  70.         case 5:
  71.             //cout << "Evening";
  72.             return hail;
  73.             break;
  74.         case 6:
  75.             //cout << "Evening";
  76.             return snowing;
  77.             break;
  78.         default:
  79.            
  80.            
  81.            
  82.             //cout << "NightTime";
  83.             return "Have a look outside....";
  84.             break;
  85.         }
  86.     }
  87. };
  88.  
  89.  
  90. //OpenGL Functions
  91. void init(void)
  92. {
  93.     screenRGB screenrgb;
  94.    
  95.     //Print Debug Settings
  96.     printf( "OpenGL version: %s\n", (char*)glGetString(GL_VERSION));
  97.     printf( "OpenGL renderer: %s\n", (char*)glGetString(GL_RENDERER));
  98.  
  99.     //Configure basic OpenGL settings
  100.  
  101.     cout << screenrgb.getScreenRed() << endl;
  102.  
  103.     glClearColor(screenrgb.getScreenRed(), screenrgb.getScreenGreen(), screenrgb.getScreenBlue(), 1.0);
  104.     cout << screenrgb.getScreenRed() << endl;
  105.  
  106.     glShadeModel(GL_SMOOTH);
  107.     glEnable(GL_BLEND);
  108.     glEnable(GL_TEXTURE_2D);
  109. }
  110.  
  111. void display( void )
  112. {
  113.     //Clear the screen and set our initial view matrix
  114.     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
  115.     glMatrixMode(GL_MODELVIEW);
  116.     glLoadIdentity();
  117.  
  118.     //TODO: Perform drawing here
  119.  
  120.     //We just drew to the back buffer. Now we need to swap that with the
  121.     //front buffer to show it on screen.
  122.     glutSwapBuffers();
  123. }
  124.  
  125.  
  126.  
  127.  
  128. int endProgram()
  129. {
  130.     cout << endl;
  131.     system("PAUSE");
  132.     return 0;
  133. }
  134.  
  135. int main(int argc,char** argv)
  136. {
  137.  
  138.  
  139.  
  140.     //Local variables
  141.     int inputWeather;
  142.     string returnWeather;
  143.  
  144.     cout << "Have a look outside...." << endl;
  145.  
  146.     Weather weather;
  147.    
  148.     cout << returnWeather;
  149.     cin >> inputWeather;
  150.  
  151.     //Change the weather
  152.     weather.setWeather(inputWeather);
  153.     returnWeather = weather.getWeather();
  154.  
  155.  
  156.  
  157.     //weather.changeWeather
  158.     cout << returnWeather << endl;
  159.  
  160.     //GLUT WindowCreation
  161.     glutInit( &argc, argv );
  162.     glutInitDisplayMode (GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB);
  163.     glutInitWindowSize (800, 600);
  164.     glutInitWindowPosition (100, 100);
  165.     glutCreateWindow( "OpenGL Test" );
  166.     glutDisplayFunc( display );
  167.  
  168.     init();
  169.  
  170.     glutMainLoop();
  171.  
  172.    
  173.  
  174.     endProgram();
  175. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement