ecere: gfx/gui: support P/NaCl platform. add new Pepper interface driver for targetin...
[sdk] / ecere / src / gfx / drivers / PepperDisplayDriver.ec
1 namespace gfx::drivers;
2
3 #ifdef BUILDING_ECERE_COM
4 import "instance"
5 import "Display"
6 #else
7 #ifdef ECERE_STATIC
8 public import static "ecere"
9 #else
10 public import "ecere"
11 #endif
12 #endif
13
14 import "PepperInterface"
15
16 #if !defined(ENABLE_PEPPER_DRIVER)
17 #define NO_PEPPER_DRIVER
18 #endif
19
20 #if (defined(__nacl__) || defined(__pnacl__)) // && !defined(NO_PEPPER_DRIVER)
21
22 #include <stdio.h>
23
24 // source file line number printf (sflnprintf)
25 #define sflnprintf(format,...) printf("%s:% 5d: " format, __FILE__, __LINE__, ##__VA_ARGS__)
26
27 class PepperDisplayDriver : DisplayDriver
28 {
29    class_property(name) = "Pepper";
30
31
32    // Constructor / Destructor
33
34    bool ::CreateDisplaySystem(DisplaySystem displaySystem)
35    {
36       sflnprintf("class(PepperDisplayDriver) ::CreateDisplaySystem [STUB!]\n");
37       return false;
38    }
39
40    void ::DestroyDisplaySystem(DisplaySystem displaySystem)
41    {
42       sflnprintf("class(PepperDisplayDriver) ::DestroyDisplaySystem [STUB!]\n");
43    }
44
45    bool ::CreateDisplay(Display display)
46    {
47       sflnprintf("class(PepperDisplayDriver) ::CreateDisplay [STUB!]\n");
48       return false;
49    }
50
51    void ::DestroyDisplay(Display display)
52    {
53       sflnprintf("class(PepperDisplayDriver) ::DestroyDisplay [STUB!]\n");
54    }
55
56
57    // Display Position and Size
58
59    bool ::DisplaySize(Display display, int width, int height)
60    {
61       sflnprintf("class(PepperDisplayDriver) ::DisplaySize [STUB!]\n");
62       return false;
63    }
64
65    void ::DisplayPosition(Display display, int x, int y)
66    {
67       sflnprintf("class(PepperDisplayDriver) ::DisplayPosition [STUB!]\n");
68    }
69
70
71    // Palettes
72
73    void ::SetPalette(Display display, ColorAlpha * palette, bool colorMatch)
74    {
75       sflnprintf("class(PepperDisplayDriver) ::SetPalette [STUB!]\n");
76    }
77
78    void ::RestorePalette(Display display)
79    {
80       sflnprintf("class(PepperDisplayDriver) ::RestorePalette [STUB!]\n");
81    }
82
83
84    // Display the back buffer content
85
86    void ::StartUpdate(Display display)
87    {
88       sflnprintf("class(PepperDisplayDriver) ::StartUpdate [STUB!]\n");
89    }
90
91    void ::EndUpdate(Display display)
92    {
93       sflnprintf("class(PepperDisplayDriver) ::EndUpdate [STUB!]\n");
94    }
95
96    void ::Scroll(Display display, Box scroll, int x, int y, Extent dirty)
97    {
98       sflnprintf("class(PepperDisplayDriver) ::Scroll [STUB!]\n");
99    }
100
101    void ::Update(Display display, Box updateBox)
102    {
103       sflnprintf("class(PepperDisplayDriver) ::Update [STUB!]\n");
104    }
105
106
107    // Allocate/free a bitmap
108
109    bool ::AllocateBitmap(DisplaySystem displaySystem, Bitmap bitmap, int width, int height, int stride, PixelFormat format, bool allocatePalette)
110    {
111       sflnprintf("class(PepperDisplayDriver) ::AllocateBitmap [STUB!]\n");
112       return false;
113    }
114
115    void ::FreeBitmap(DisplaySystem displaySystem, Bitmap bitmap)
116    {
117       sflnprintf("class(PepperDisplayDriver) ::FreeBitmap [STUB!]\n");
118    }
119
120
121    // Lock
122
123    bool ::LockSystem(DisplaySystem displaySystem)
124    {
125       sflnprintf("class(PepperDisplayDriver) ::LockSystem [STUB!]\n");
126       return false;
127    }
128
129    void ::UnlockSystem(DisplaySystem displaySystem)
130    {
131       sflnprintf("class(PepperDisplayDriver) ::UnlockSystem [STUB!]\n");
132    }
133
134    bool ::Lock(Display display)
135    {
136       sflnprintf("class(PepperDisplayDriver) ::Lock [STUB!]\n");
137       return false;
138    }
139
140    void ::Unlock(Display display)
141    {
142       sflnprintf("class(PepperDisplayDriver) ::Unlock [STUB!]\n");
143    }
144
145
146    // Get/release a surface
147
148    bool ::GetSurface(Display display, Surface surface, int x, int y, Box clip)
149    {
150       sflnprintf("class(PepperDisplayDriver) ::GetSurface [STUB!]\n");
151       return false;
152    }
153
154    bool ::GetBitmapSurface(DisplaySystem displaySystem, Surface surface, Bitmap bitmap, int x, int y, Box clip)
155    {
156       sflnprintf("class(PepperDisplayDriver) ::GetBitmapSurface [STUB!]\n");
157       return false;
158    }
159
160    void ::ReleaseSurface(Display display, Surface surface)
161    {
162       sflnprintf("class(PepperDisplayDriver) ::ReleaseSurface [STUB!]\n");
163    }
164
165
166    // Clip a surface
167
168    void ::Clip(Display display, Surface surface, Box clip)
169    {
170       sflnprintf("class(PepperDisplayDriver) ::Clip [STUB!]\n");
171    }
172
173
174    // Grab from the screen
175
176    bool ::GrabScreen(Display display, Bitmap bitmap, int x, int y, unsigned int w, unsigned int h)
177    {
178       sflnprintf("class(PepperDisplayDriver) ::GrabScreen [STUB!]\n");
179       return false;
180    }
181
182
183    // Converts a bitmap format
184
185    bool ::ConvertBitmap(DisplaySystem displaySystem, Bitmap src, PixelFormat format, ColorAlpha * palette)
186    {
187       sflnprintf("class(PepperDisplayDriver) ::ConvertBitmap [STUB!]\n");
188       return false;
189    }
190
191
192    // Converts an LFB bitmap into an offscreen bitmap for this device
193
194    bool ::MakeDDBitmap(DisplaySystem displaySystem, Bitmap bitmap, bool mipMaps)
195    {
196       sflnprintf("class(PepperDisplayDriver) ::MakeDDBitmap [STUB!]\n");
197       return false;
198    }
199
200
201    // Font loading
202
203    Font ::LoadFont(DisplaySystem displaySystem, const char * faceName, float size, FontFlags flags)
204    {
205       sflnprintf("class(PepperDisplayDriver) ::LoadFont [STUB!]\n");
206       return null;
207    }
208
209    void ::UnloadFont(DisplaySystem displaySystem, Font font)
210    {
211       sflnprintf("class(PepperDisplayDriver) ::UnloadFont [STUB!]\n");
212    }
213
214
215    // 2D Drawing
216
217    void ::SetForeground(Display display, Surface surface, ColorAlpha color)
218    {
219       sflnprintf("class(PepperDisplayDriver) ::SetForeground [STUB!]\n");
220    }
221
222    void ::SetBackground(Display display, Surface surface, ColorAlpha color)
223    {
224       sflnprintf("class(PepperDisplayDriver) ::SetBackground [STUB!]\n");
225    }
226
227    void ::LineStipple(Display display, Surface surface, uint stipple)
228    {
229       sflnprintf("class(PepperDisplayDriver) ::LineStipple [STUB!]\n");
230    }
231
232    ColorAlpha ::GetPixel(Display display, Surface surface, int x, int y)
233    {
234       sflnprintf("class(PepperDisplayDriver) ::GetPixel [STUB!]\n");
235       return 0;
236    }
237
238    void ::PutPixel(Display display, Surface surface, int x, int y)
239    {
240       sflnprintf("class(PepperDisplayDriver) ::PutPixel [STUB!]\n");
241    }
242
243    void ::DrawLine(Display display, Surface surface, int x1, int y1, int x2, int y2)
244    {
245       sflnprintf("class(PepperDisplayDriver) ::DrawLine [STUB!]\n");
246    }
247
248    void ::Rectangle(Display display, Surface surface, int x1, int y1, int x2, int y2)
249    {
250       sflnprintf("class(PepperDisplayDriver) ::Rectangle [STUB!]\n");
251    }
252
253    void ::Area(Display display, Surface surface, int x1, int y1, int x2, int y2)
254    {
255       sflnprintf("class(PepperDisplayDriver) ::Area [STUB!]\n");
256    }
257
258    void ::Clear(Display display, Surface surface, ClearType type)
259    {
260       sflnprintf("class(PepperDisplayDriver) ::Clear [STUB!]\n");
261    }
262
263    void ::Blit(Display display, Surface surface, Bitmap src, int dx, int dy, int sx, int sy, int w, int h)
264    {
265       sflnprintf("class(PepperDisplayDriver) ::Blit [STUB!]\n");
266    }
267
268    void ::SetBlitTint(Display display, Surface surface, ColorAlpha tint)
269    {
270       sflnprintf("class(PepperDisplayDriver) ::SetBlitTint [STUB!]\n");
271    }
272
273    void ::Stretch(Display display, Surface surface, Bitmap src, int dx, int dy, int sx, int sy, int w, int h, int sw, int sh)
274    {
275       sflnprintf("class(PepperDisplayDriver) ::Stretch [STUB!]\n");
276    }
277
278    void ::Filter(Display display, Surface surface, Bitmap src, int dx, int dy, int sx, int sy, int w, int h, int sw, int sh)
279    {
280       sflnprintf("class(PepperDisplayDriver) ::Filter [STUB!]\n");
281    }
282
283    void ::BlitDI(Display display, Surface surface, Bitmap src, int dx, int dy, int sx, int sy, int w, int h)
284    {
285       sflnprintf("class(PepperDisplayDriver) ::BlitDI [STUB!]\n");
286    }
287
288    void ::StretchDI(Display display, Surface surface, Bitmap src, int dx, int dy, int sx, int sy, int w, int h, int sw, int sh)
289    {
290       sflnprintf("class(PepperDisplayDriver) ::StretchDI [STUB!]\n");
291    }
292
293    void ::FilterDI(Display display, Surface surface, Bitmap src, int dx, int dy, int sx, int sy, int w, int h, int sw, int sh)
294    {
295       sflnprintf("class(PepperDisplayDriver) ::FilterDI [STUB!]\n");
296    }
297
298    void ::TextFont(Display display, Surface surface, Font font)
299    {
300       sflnprintf("class(PepperDisplayDriver) ::TextFont [STUB!]\n");
301    }
302
303    void ::TextOpacity(Display display, Surface surface, bool opaque)
304    {
305       sflnprintf("class(PepperDisplayDriver) ::TextOpacity [STUB!]\n");
306    }
307
308    void ::WriteText(Display display, Surface surface, int x, int y, const char * text, int len)
309    {
310       sflnprintf("class(PepperDisplayDriver) ::WriteText [STUB!]\n");
311    }
312
313    void ::TextExtent(Display display, Surface surface, const char * text, int len, int * width, int * height)
314    {
315       sflnprintf("class(PepperDisplayDriver) ::TextExtent [STUB!]\n");
316    }
317
318    void ::FontExtent(DisplaySystem displaySystem, Font font, const char * text, int len, int * width, int * height)
319    {
320       sflnprintf("class(PepperDisplayDriver) ::FontExtent [STUB!]\n");
321    }
322
323    void ::DrawingChar(Display display, Surface surface, char character)
324    {
325       sflnprintf("class(PepperDisplayDriver) ::DrawingChar [STUB!]\n");
326    }
327
328    void ::NextPage(Display display)
329    {
330       sflnprintf("class(PepperDisplayDriver) ::NextPage [STUB!]\n");
331    }
332
333    // 3D Graphics
334
335 #if !defined(ECERE_VANILLA) && !defined(ECERE_NO3D)
336    void ::SetRenderState(Display display, RenderState state, uint value)
337    {
338       sflnprintf("class(PepperDisplayDriver) ::SetRenderState [STUB!]\n");
339    }
340
341    void ::SetLight(Display display, int id, Light light)
342    {
343       sflnprintf("class(PepperDisplayDriver) ::SetLight [STUB!]\n");
344    }
345
346    void ::SetCamera(Display display, Surface surface, Camera camera)
347    {
348       sflnprintf("class(PepperDisplayDriver) ::SetCamera [STUB!]\n");
349    }
350
351    bool ::AllocateMesh(DisplaySystem displaySystem, Mesh mesh, MeshFeatures flags, int nVertices)
352    {
353       sflnprintf("class(PepperDisplayDriver) ::AllocateMesh [STUB!]\n");
354       return false;
355    }
356
357    void ::FreeMesh(DisplaySystem displaySystem, Mesh mesh)
358    {
359       sflnprintf("class(PepperDisplayDriver) ::FreeMesh [STUB!]\n");
360    }
361
362    bool ::LockMesh(DisplaySystem displaySystem, Mesh mesh, MeshFeatures flags)
363    {
364       sflnprintf("class(PepperDisplayDriver) ::LockMesh [STUB!]\n");
365       return false;
366    }
367
368    void ::UnlockMesh(DisplaySystem displaySystem, Mesh mesh, MeshFeatures flags)
369    {
370       sflnprintf("class(PepperDisplayDriver) ::UnlockMesh [STUB!]\n");
371    }
372
373    void * ::AllocateIndices(DisplaySystem displaySystem, int nIndices, bool indices32bit)
374    {
375       sflnprintf("class(PepperDisplayDriver) ::AllocateIndices [STUB!]\n");
376       return null;
377    }
378
379    void ::FreeIndices(DisplaySystem displaySystem, void * indices)
380    {
381       sflnprintf("class(PepperDisplayDriver) ::FreeIndices [STUB!]\n");
382    }
383
384    uint16 * ::LockIndices(DisplaySystem displaySystem, void * indices)
385    {
386       sflnprintf("class(PepperDisplayDriver) ::LockIndices [STUB!]\n");
387       return null;
388    }
389
390    void ::UnlockIndices(DisplaySystem displaySystem, void * indices, bool indices32bit, int nIndices)
391    {
392       sflnprintf("class(PepperDisplayDriver) ::UnlockIndices [STUB!]\n");
393    }
394
395    void ::SelectMesh(Display display, Mesh mesh)
396    {
397       sflnprintf("class(PepperDisplayDriver) ::SelectMesh [STUB!]\n");
398    }
399
400    void ::ApplyMaterial(Display display, Material material, Mesh mesh)
401    {
402       sflnprintf("class(PepperDisplayDriver) ::ApplyMaterial [STUB!]\n");
403    }
404
405    void ::DrawPrimitives(Display display, PrimitiveSingle * primitive, Mesh mesh)
406    {
407       sflnprintf("class(PepperDisplayDriver) ::DrawPrimitives [STUB!]\n");
408    }
409
410    void ::PushMatrix(Display display)
411    {
412       sflnprintf("class(PepperDisplayDriver) ::PushMatrix [STUB!]\n");
413    }
414
415    void ::PopMatrix(Display display, bool setMatrix)
416    {
417       sflnprintf("class(PepperDisplayDriver) ::PopMatrix [STUB!]\n");
418    }
419
420    void ::SetTransform(Display display, Matrix transMatrix, bool viewSpace, bool useCamera)
421    {
422       sflnprintf("class(PepperDisplayDriver) ::SetTransform [STUB!]\n");
423    }
424 #endif
425
426 }
427
428 #endif // !defined(NO_PEPPER_DRIVER)