Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

graphic.hpp

Go to the documentation of this file.
00001 // PTF - Psychological Test Framework 00002 // http://ptf.sourceforge.net 00003 // 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 2 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU Library General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 00018 #ifndef __GRAPHIC__ 00019 #define __GRAPHIC__ 00020 00021 #include <ptf/core/singleton.hpp> 00022 #include <SDL.h> 00023 #ifdef MAC 00024 #include <OpenGL/gl.h> 00025 #include <OpenGL/glu.h> 00026 #else 00027 #include <GL/gl.h> 00028 #include <GL/glu.h> 00029 #endif 00030 #include <vector> 00031 00032 // Brings things we use into scope 00033 using std::vector; 00034 00040 typedef struct { 00041 int x, y; 00042 } Point; 00043 00051 typedef struct { 00052 int x, y; 00053 float u, v; 00054 } PointTex; 00055 00059 class Graphic : public Singleton<Graphic> { 00060 public: 00061 Graphic(); 00062 ~Graphic(); 00063 bool createWindow(int, int, bool); 00064 void setBGColor(float, float, float); 00065 void setFGColor(float, float, float); 00066 void drawFixationCross(); 00067 void drawFixationCross(int, int); 00068 void drawLine(Point, Point); 00069 void drawTriangle(Point, Point, Point); 00070 void drawRectangle(Point, Point, Point, Point); 00071 void drawUnfilledCircle(Point, float); 00072 void drawCircle(Point, float); 00073 void clear(); 00074 void swap(); 00075 int addTexture(char*); 00076 void drawTexturedRectangle(PointTex, PointTex, PointTex, PointTex, int); 00077 private: 00078 int width, height, bpp; 00079 bool windowOpen; 00080 vector<GLuint> textures; 00081 SDL_Surface *display; 00082 void initOpenGL(); 00083 }; 00084 00085 #endif

Generated on Fri Dec 17 14:54:23 2004 for Psychological Test Framework by doxygen 1.3.8