OSDN Git Service

first
[psychlops/cpp.git] / psychlops / extension / devices / psychlops_devices_crs_bits.h
1 /*\r
2  *  psychlops_devices_crs_bits.h\r
3  *  Psychlops Standard Library (Universal)\r
4  *\r
5  *  Last Modified 2009/07/30 by Kenchi HOSOKAWA\r
6  *  (C) 2009 Kenchi HOSOKAWA, Kazushi MARUYA, Takao SATO\r
7  */\r
8 \r
9 #ifndef HEADER_PSYCHLOPS_DEVICES_CRS_BITS\r
10 #define HEADER_PSYCHLOPS_DEVICES_CRS_BITS\r
11 \r
12 #include "../../core/graphic/psychlops_graphic.h"\r
13 #include "../../core/devices/psychlops_io_analog.h"\r
14 #include "../../core/devices/psychlops_io_clock.h"\r
15 #include "../../extension/standard/shader/psychlops_g_shader.h"\r
16 #include "../../platform/gl/extension/psychlops_g_shader_gl.h"\r
17 \r
18 \r
19 namespace Psychlops {\r
20 namespace Devices {\r
21 \r
22 \r
23         struct BitsTlock\r
24         {\r
25                 static const unsigned char COMMAND_R[8];// = { 69,40,19,119,52,233,41,183 };\r
26                 static const unsigned char COMMAND_G[8];// = { 33,230,190,84,12,108,201,124 };\r
27                 static const unsigned char COMMAND_B[8];// = { 56,208,102,207,192,172,80,221};\r
28                 static const unsigned char PALLETE_R[8];// = { 69,40,19,119,52,233,41,183 };\r
29                 static const unsigned char PALLETE_G[8];// = { 33,230,190,84,12,108,201,124 };\r
30                 static const unsigned char PALLETE_B[8];// = { 56,208,102,207,192,172,80,221};\r
31         };\r
32 \r
33 \r
34         struct BitsTimer\r
35         {\r
36         };\r
37 \r
38 \r
39         struct BitsPallete\r
40         {\r
41                 Image tlock;\r
42                 bool is_initialized;\r
43                 void initialize();\r
44 \r
45                 BitsPallete();\r
46                 void set(double *val);\r
47         };\r
48 \r
49 \r
50         struct BitsTrigger\r
51         {\r
52                 Image tlock;\r
53                 bool is_initialized;\r
54                 void initialize();\r
55 \r
56                 BitsTrigger();\r
57                 void set(double val);\r
58                 void out();\r
59         };\r
60 \r
61 \r
62 /*\r
63         struct BitsResponseBox\r
64         {\r
65                 struct Key {\r
66                         const int code;\r
67                         Key(const int code_);\r
68                         bool pressed() const;\r
69                         bool pushed() const;\r
70                         bool released() const;\r
71                         bool get(KeyState state) const;\r
72                 };\r
73 \r
74                 CBBOXRECORD C;\r
75                 Image tlock;\r
76                 bool is_initialized;\r
77                 void initialize();\r
78 \r
79                 BitsResponseBox();\r
80                 BitsResponseBox(unsigned long BoxType);\r
81                 ~BitsResponseBox();\r
82                 void open(unsigned long BoxType = 8);\r
83                 void close();\r
84 \r
85                 void reset();\r
86                 void buzzer(unsigned long Period, unsigned long Frequency);\r
87                 void sendback();\r
88                 void check();\r
89                 void flush();\r
90         };\r
91 */\r
92 \r
93 \r
94 \r
95 \r
96         class CanvasBits : public Canvas\r
97         {\r
98                 protected:\r
99                 ShaderAPI shader;\r
100                 /*\r
101                 virtual void initAPIprop();\r
102                 virtual void initAPIattributes();\r
103                 void popMatrixes();\r
104                 void loadOrthoProjection();\r
105                 */\r
106                 inline void setStrokeState(const Stroke& strk);\r
107 \r
108                 public:\r
109                 CanvasBits();\r
110                 CanvasBits(CanvasMode mode);\r
111                 CanvasBits(int d_width, int d_height, int d_colordepth, double d_refreshrate, CanvasMode mode);\r
112                 virtual ~CanvasBits(void);\r
113 \r
114                 virtual void initAPIprop();\r
115                 virtual void initAPIattributes();\r
116                 //virtual void popAPIattributes();\r
117 \r
118                 public:\r
119                 virtual CanvasBits& clear(const Color &col);\r
120                 /*\r
121                 virtual Drawable& pix(const double x, const double y, const Color &col) = 0;\r
122 \r
123 \r
124                 virtual Drawable& line(const Line &drawee, const Color &col) = 0;\r
125                 virtual Drawable& line(const Line &drawee, const Stroke &strk) = 0;\r
126                 */\r
127                 virtual CanvasBits& rect(const Rectangle &drawee, const Color &col);\r
128                 virtual CanvasBits& rect(const Rectangle &drawee, const Stroke &strk);\r
129                 /*\r
130                 //virtual Drawable& rect(const Rectangle[] drawee, const Color &col) = 0;\r
131                 //virtual Drawable& rect(const Rectangle[] drawee, const Stroke &strk) = 0;\r
132                 virtual Drawable& ellipse(const Ellipse &drawee, const Color &col) = 0;\r
133                 virtual Drawable& ellipse(const Ellipse &drawee, const Stroke &strk) = 0;\r
134                 virtual Drawable& polygon(const Polygon &drawee) = 0;\r
135                 virtual Drawable& polygon(const Polygon &drawee, const Color &col) = 0;\r
136                 virtual Drawable& polygon(const Polygon &drawee, const Stroke &strk) = 0;\r
137                 virtual Drawable& polyline(const PolyLine &drawee) = 0;\r
138                 virtual Drawable& polyline(const PolyLine &drawee, const Color &col) = 0;\r
139                 virtual Drawable& polyline(const PolyLine &drawee, const Stroke &strk) = 0;\r
140                 virtual Drawable& figures(const Group &drawee) = 0;\r
141                 */\r
142                 virtual CanvasBits& image(const Image &img);\r
143 //              virtual CanvasBits& image(Image &img, const Rectangle &target_area, const Rectangle &source_rect);\r
144                 virtual CanvasBits& image(const Image &img, const double x, const double y);\r
145                 /*      virtual Drawable& image(const Image &img, const double alpha) = 0;\r
146                 //virtual Drawable& cacheImage(Image &img, bool on_off) = 0;\r
147                 virtual Drawable& letters(Letters &let, const Color &col) = 0;\r
148                 */\r
149                 //virtual void flip(int and_wait_N_vsyncs=1);\r
150 \r
151 \r
152                 virtual void cacheImageBody(Image &img);
153                 void drawImage(const Image &img, const double left, const double top);
154 //              void drawImage(Image &img, const Rectangle &target_area);\r
155         };\r
156 \r
157 \r
158 }\r
159 \r
160 }       /*      <- namespace Psycholops         */\r
161 \r
162 \r
163 \r
164 #endif\r