00001 00008 /* 00009 This file is part of Teapot Colony Wars. 00010 00011 Teapot Colony Wars is free software: you can redistribute it and/or modify 00012 it under the terms of the GNU General Public License as published by 00013 the Free Software Foundation, either version 2 of the License, or 00014 (at your option) any later version. 00015 00016 Teapot Colony Wars is distributed in the hope that it will be useful, 00017 but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 GNU General Public License for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with Teapot Colony Wars. If not, see <http://www.gnu.org/licenses/>. 00023 */ 00024 00025 #ifndef DISPLAY_H 00026 #define DISPLAY_H 00027 00028 #include <GL/glut.h> 00029 00030 #include "World.h" 00031 00035 class Display 00036 { 00037 protected: 00038 00040 static Display* _instance; 00041 00043 GLfloat _camera_x; 00045 GLfloat _camera_y; 00047 GLfloat _camera_z; 00049 GLfloat _center_x; 00051 GLfloat _center_y; 00053 GLfloat _center_z; 00055 GLfloat _near; 00057 GLfloat _far; 00059 GLfloat _fovy; 00060 00062 World _world; 00063 00065 bool _timer; 00066 00070 Display(); 00071 00078 GLfloat focal_distance(); 00079 00086 void translate_camera(GLfloat inc_x, GLfloat inc_z); 00087 00093 void move_camera(GLfloat inc_y); 00094 00101 void zoom_camera(GLfloat inc); 00102 00108 void rotate_camera(GLfloat inc); 00109 00110 public: 00111 00115 virtual ~Display(); 00116 00122 static Display* instance(); 00123 00127 static void destroy(); 00128 00132 void init(); 00133 00137 void quit(); 00138 00144 void timer(int value); 00145 00149 void draw(); 00150 00157 void reshape(int width, int height); 00158 00166 void inputKey(unsigned char key, int x, int y); 00167 00176 void inputMouse(int button, int state, int x, int y); 00177 }; 00178 00179 #endif // DISPLAY_H