2 * psychlops_devices_crs_bits.h
\r
3 * Psychlops Standard Library (Universal)
\r
5 * Last Modified 2009/07/30 by Kenchi HOSOKAWA
\r
6 * (C) 2009 Kenchi HOSOKAWA, Kazushi MARUYA, Takao SATO
\r
9 #ifndef HEADER_PSYCHLOPS_DEVICES_CRS_BITS
\r
10 #define HEADER_PSYCHLOPS_DEVICES_CRS_BITS
\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
19 namespace Psychlops {
\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
42 bool is_initialized;
\r
46 void set(double *val);
\r
53 bool is_initialized;
\r
57 void set(double val);
\r
63 struct BitsResponseBox
\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
76 bool is_initialized;
\r
80 BitsResponseBox(unsigned long BoxType);
\r
82 void open(unsigned long BoxType = 8);
\r
86 void buzzer(unsigned long Period, unsigned long Frequency);
\r
96 class CanvasBits : public Canvas
\r
101 virtual void initAPIprop();
\r
102 virtual void initAPIattributes();
\r
103 void popMatrixes();
\r
104 void loadOrthoProjection();
\r
106 inline void setStrokeState(const Stroke& strk);
\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
114 virtual void initAPIprop();
\r
115 virtual void initAPIattributes();
\r
116 //virtual void popAPIattributes();
\r
119 virtual CanvasBits& clear(const Color &col);
\r
121 virtual Drawable& pix(const double x, const double y, const Color &col) = 0;
\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
127 virtual CanvasBits& rect(const Rectangle &drawee, const Color &col);
\r
128 virtual CanvasBits& rect(const Rectangle &drawee, const Stroke &strk);
\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
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
149 //virtual void flip(int and_wait_N_vsyncs=1);
\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
160 } /* <- namespace Psycholops */
\r