Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <istream>
- #include <iostream>
- #include <float.h>
- #include <string>
- #include <gl/glut.h>
- using namespace std;
- class screenRGB{
- public:
- void setScreenRed(float r){screenRed = r;}
- void setScreenGreen(float g){screenGreen = g;}
- void setScreenBlue(float b){screenBlue = b; }
- float getScreenRed(void){return screenRed;}
- float getScreenGreen(void){return screenGreen;}
- float getScreenBlue(void){return screenBlue;}
- private:
- float screenRed, screenGreen, screenBlue;
- };
- class Weather{
- int currentWeather;
- public:
- void setWeather(int x){currentWeather = x;}
- string getWeather(){return changeWeather();}
- string changeWeather()
- {
- screenRGB screenrgb;
- /*
- screenrgb.setScreenRed(0.0);
- screenrgb.setScreenGreen(1.0);
- screenrgb.setScreenBlue(0.0);
- */
- //Weather Options
- string sunny = "Sunny";
- float sunnyF;
- string raining = "Raining";
- string cloudy = "Cloudy";
- string overcast = "Overcast";
- string hail = "Hailing";
- string snowing = "Snowing";
- switch(currentWeather){
- case 1:
- cout << screenrgb.getScreenBlue() << endl;
- //cout << "Morning";
- screenrgb.setScreenBlue(1.0);
- return sunny;
- break;
- case 2:
- //cout << "Brunch";
- return raining;
- break;
- case 3:
- //cout << "Midday";
- return cloudy;
- break;
- case 4:
- //cout << "Dusk";
- return overcast;
- break;
- case 5:
- //cout << "Evening";
- return hail;
- break;
- case 6:
- //cout << "Evening";
- return snowing;
- break;
- default:
- //cout << "NightTime";
- return "Have a look outside....";
- break;
- }
- }
- };
- //OpenGL Functions
- void init(void)
- {
- screenRGB screenrgb;
- //Print Debug Settings
- printf( "OpenGL version: %s\n", (char*)glGetString(GL_VERSION));
- printf( "OpenGL renderer: %s\n", (char*)glGetString(GL_RENDERER));
- //Configure basic OpenGL settings
- cout << screenrgb.getScreenRed() << endl;
- glClearColor(screenrgb.getScreenRed(), screenrgb.getScreenGreen(), screenrgb.getScreenBlue(), 1.0);
- cout << screenrgb.getScreenRed() << endl;
- glShadeModel(GL_SMOOTH);
- glEnable(GL_BLEND);
- glEnable(GL_TEXTURE_2D);
- }
- void display( void )
- {
- //Clear the screen and set our initial view matrix
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- //TODO: Perform drawing here
- //We just drew to the back buffer. Now we need to swap that with the
- //front buffer to show it on screen.
- glutSwapBuffers();
- }
- int endProgram()
- {
- cout << endl;
- system("PAUSE");
- return 0;
- }
- int main(int argc,char** argv)
- {
- //Local variables
- int inputWeather;
- string returnWeather;
- cout << "Have a look outside...." << endl;
- Weather weather;
- cout << returnWeather;
- cin >> inputWeather;
- //Change the weather
- weather.setWeather(inputWeather);
- returnWeather = weather.getWeather();
- //weather.changeWeather
- cout << returnWeather << endl;
- //GLUT WindowCreation
- glutInit( &argc, argv );
- glutInitDisplayMode (GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB);
- glutInitWindowSize (800, 600);
- glutInitWindowPosition (100, 100);
- glutCreateWindow( "OpenGL Test" );
- glutDisplayFunc( display );
- init();
- glutMainLoop();
- endProgram();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement