]> git.treefish.org Git - phys/latlib.git/blob - culooks.h
76f0919ce2dbdf3b8ddf29be7269dbbd05fc6fb4
[phys/latlib.git] / culooks.h
1 #ifndef CULOOKS_H
2 #define CULOOKS_H
3
4 #include <pthread.h>
5 #include <vector>
6 #include <GL/glut.h>
7 #include <GL/glx.h>
8 #include <GL/gl.h>
9 #include <X11/Xlib.h>
10 #include <X11/Xutil.h>
11 #include <string>
12
13 using namespace std;
14
15 class culooks
16 {
17  public:
18   
19   culooks (const char* name, const int& xcubes, const int& ycubes, const int& l, int *argc, char **argv);
20
21  private:
22   
23   class cube {
24   public:
25     cube(int l);
26     void draw();
27     int id;
28     float az, alt;
29     float zoom;
30   private:
31     void drawAll();
32     void drawBox();
33     static int allid;
34     float *plaq;
35     float *link;
36     int l;
37   };
38   
39   struct window {
40     int layout[2];
41     double aspect;
42     vector<cube> cubes;
43     int w, h;
44     int gwinid;
45     bool initialized;
46     string name;
47   };
48
49   class drawing 
50   {
51   private:
52     static int rotcube[3];
53     static culooks::window* getWin();
54     static int getCubeFromPos(int x, int y);
55     static void motionFunc(int x, int y);
56     static void mouseFunc(int button, int state, int x, int y);
57     static void reshapeFunc(int w, int h);
58     static void displayFunc();
59     static void initWindow(int winid);
60     static void idleFunc_master();
61   public:
62     static void* glutThread(void *leer);
63   };
64   
65   static vector< pair<int,window*> > Windows;
66   static pthread_t glThreadId;
67   static int windowid;
68   int mywid;
69 };
70
71 #endif