Shark.h
branchv_0
changeset 5 ee4ba9f5a053
parent 3 48dc4ae894b0
child 7 e6065118326f
equal deleted inserted replaced
4:9aba96f0b001 5:ee4ba9f5a053
    33 #include "opengl.h"
    33 #include "opengl.h"
    34 #include "EPoll.h"
    34 #include "EPoll.h"
    35 #include "Logger.h"
    35 #include "Logger.h"
    36 #include "MappedFile.h"
    36 #include "MappedFile.h"
    37 #include "ImageLoader.h"
    37 #include "ImageLoader.h"
       
    38 #include "Shader.h"
       
    39 #include "Program.h"
    38 
    40 
    39 class Shark {
    41 class Shark {
    40 private:
    42 private:
    41 
    43 
    42 	struct {
    44 	struct {
   165 
   167 
   166 		GLfloat getRatio() const {
   168 		GLfloat getRatio() const {
   167 			return (GLfloat) width / (GLfloat) height;
   169 			return (GLfloat) width / (GLfloat) height;
   168 		}
   170 		}
   169 	};
   171 	};
       
   172 
       
   173 	Display* dpy;
       
   174 	Window win;
       
   175 	XVisualInfo* vi;
       
   176 	GLXContext glc;
   170 	
   177 	
   171 	ImageLoader imageLoader;
   178 	ImageLoader imageLoader;
   172 	
   179 	std::vector<std::shared_ptr<Shader>> shaders;
   173 	GLuint shaderProgram;
   180 	std::shared_ptr<Program> shaderProgram;
   174 	std::vector<Texture> textures;
   181 	std::vector<Texture> textures;
   175 
   182 
   176 	Configuration cfg;
   183 	Configuration cfg;
   177 	std::ostream& logOutput = std::cerr;
   184 	std::ostream& logOutput = std::cerr;
   178 
   185 
   182 	void log(LogLevel level, std::string message);
   189 	void log(LogLevel level, std::string message);
   183 	int setNonBlocking(int fd);
   190 	int setNonBlocking(int fd);
   184 	void loadVertices();
   191 	void loadVertices();
   185 	Texture loadTexture(const std::string& fileName);
   192 	Texture loadTexture(const std::string& fileName);
   186 	void loadTextures();
   193 	void loadTextures();
   187 	GLuint loadShaders();
   194 	std::shared_ptr<Program> loadShaders();
   188 public:
   195 public:
   189 	Shark(const Configuration& cfg);
   196 	Shark(const Configuration& cfg);
   190 	virtual ~Shark();
   197 	virtual ~Shark();
   191 	Shark(const Shark&) = delete;
   198 	Shark(const Shark&) = delete;
   192 	Shark& operator=(const Shark&) = delete;
   199 	Shark& operator=(const Shark&) = delete;