ecere: gfx/gui: support P/NaCl platform. add new Pepper interface driver for targetin...
[sdk] / ecere / src / gfx / drivers / PepperDisplayDriver.ec
diff --git a/ecere/src/gfx/drivers/PepperDisplayDriver.ec b/ecere/src/gfx/drivers/PepperDisplayDriver.ec
new file mode 100644 (file)
index 0000000..1e5c308
--- /dev/null
@@ -0,0 +1,428 @@
+namespace gfx::drivers;
+
+#ifdef BUILDING_ECERE_COM
+import "instance"
+import "Display"
+#else
+#ifdef ECERE_STATIC
+public import static "ecere"
+#else
+public import "ecere"
+#endif
+#endif
+
+import "PepperInterface"
+
+#if !defined(ENABLE_PEPPER_DRIVER)
+#define NO_PEPPER_DRIVER
+#endif
+
+#if (defined(__nacl__) || defined(__pnacl__)) // && !defined(NO_PEPPER_DRIVER)
+
+#include <stdio.h>
+
+// source file line number printf (sflnprintf)
+#define sflnprintf(format,...) printf("%s:% 5d: " format, __FILE__, __LINE__, ##__VA_ARGS__)
+
+class PepperDisplayDriver : DisplayDriver
+{
+   class_property(name) = "Pepper";
+
+
+   // Constructor / Destructor
+
+   bool ::CreateDisplaySystem(DisplaySystem displaySystem)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::CreateDisplaySystem [STUB!]\n");
+      return false;
+   }
+
+   void ::DestroyDisplaySystem(DisplaySystem displaySystem)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::DestroyDisplaySystem [STUB!]\n");
+   }
+
+   bool ::CreateDisplay(Display display)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::CreateDisplay [STUB!]\n");
+      return false;
+   }
+
+   void ::DestroyDisplay(Display display)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::DestroyDisplay [STUB!]\n");
+   }
+
+
+   // Display Position and Size
+
+   bool ::DisplaySize(Display display, int width, int height)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::DisplaySize [STUB!]\n");
+      return false;
+   }
+
+   void ::DisplayPosition(Display display, int x, int y)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::DisplayPosition [STUB!]\n");
+   }
+
+
+   // Palettes
+
+   void ::SetPalette(Display display, ColorAlpha * palette, bool colorMatch)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::SetPalette [STUB!]\n");
+   }
+
+   void ::RestorePalette(Display display)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::RestorePalette [STUB!]\n");
+   }
+
+
+   // Display the back buffer content
+
+   void ::StartUpdate(Display display)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::StartUpdate [STUB!]\n");
+   }
+
+   void ::EndUpdate(Display display)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::EndUpdate [STUB!]\n");
+   }
+
+   void ::Scroll(Display display, Box scroll, int x, int y, Extent dirty)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Scroll [STUB!]\n");
+   }
+
+   void ::Update(Display display, Box updateBox)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Update [STUB!]\n");
+   }
+
+
+   // Allocate/free a bitmap
+
+   bool ::AllocateBitmap(DisplaySystem displaySystem, Bitmap bitmap, int width, int height, int stride, PixelFormat format, bool allocatePalette)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::AllocateBitmap [STUB!]\n");
+      return false;
+   }
+
+   void ::FreeBitmap(DisplaySystem displaySystem, Bitmap bitmap)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::FreeBitmap [STUB!]\n");
+   }
+
+
+   // Lock
+
+   bool ::LockSystem(DisplaySystem displaySystem)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::LockSystem [STUB!]\n");
+      return false;
+   }
+
+   void ::UnlockSystem(DisplaySystem displaySystem)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::UnlockSystem [STUB!]\n");
+   }
+
+   bool ::Lock(Display display)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Lock [STUB!]\n");
+      return false;
+   }
+
+   void ::Unlock(Display display)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Unlock [STUB!]\n");
+   }
+
+
+   // Get/release a surface
+
+   bool ::GetSurface(Display display, Surface surface, int x, int y, Box clip)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::GetSurface [STUB!]\n");
+      return false;
+   }
+
+   bool ::GetBitmapSurface(DisplaySystem displaySystem, Surface surface, Bitmap bitmap, int x, int y, Box clip)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::GetBitmapSurface [STUB!]\n");
+      return false;
+   }
+
+   void ::ReleaseSurface(Display display, Surface surface)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::ReleaseSurface [STUB!]\n");
+   }
+
+
+   // Clip a surface
+
+   void ::Clip(Display display, Surface surface, Box clip)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Clip [STUB!]\n");
+   }
+
+
+   // Grab from the screen
+
+   bool ::GrabScreen(Display display, Bitmap bitmap, int x, int y, unsigned int w, unsigned int h)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::GrabScreen [STUB!]\n");
+      return false;
+   }
+
+
+   // Converts a bitmap format
+
+   bool ::ConvertBitmap(DisplaySystem displaySystem, Bitmap src, PixelFormat format, ColorAlpha * palette)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::ConvertBitmap [STUB!]\n");
+      return false;
+   }
+
+
+   // Converts an LFB bitmap into an offscreen bitmap for this device
+
+   bool ::MakeDDBitmap(DisplaySystem displaySystem, Bitmap bitmap, bool mipMaps)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::MakeDDBitmap [STUB!]\n");
+      return false;
+   }
+
+
+   // Font loading
+
+   Font ::LoadFont(DisplaySystem displaySystem, const char * faceName, float size, FontFlags flags)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::LoadFont [STUB!]\n");
+      return null;
+   }
+
+   void ::UnloadFont(DisplaySystem displaySystem, Font font)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::UnloadFont [STUB!]\n");
+   }
+
+
+   // 2D Drawing
+
+   void ::SetForeground(Display display, Surface surface, ColorAlpha color)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::SetForeground [STUB!]\n");
+   }
+
+   void ::SetBackground(Display display, Surface surface, ColorAlpha color)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::SetBackground [STUB!]\n");
+   }
+
+   void ::LineStipple(Display display, Surface surface, uint stipple)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::LineStipple [STUB!]\n");
+   }
+
+   ColorAlpha ::GetPixel(Display display, Surface surface, int x, int y)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::GetPixel [STUB!]\n");
+      return 0;
+   }
+
+   void ::PutPixel(Display display, Surface surface, int x, int y)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::PutPixel [STUB!]\n");
+   }
+
+   void ::DrawLine(Display display, Surface surface, int x1, int y1, int x2, int y2)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::DrawLine [STUB!]\n");
+   }
+
+   void ::Rectangle(Display display, Surface surface, int x1, int y1, int x2, int y2)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Rectangle [STUB!]\n");
+   }
+
+   void ::Area(Display display, Surface surface, int x1, int y1, int x2, int y2)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Area [STUB!]\n");
+   }
+
+   void ::Clear(Display display, Surface surface, ClearType type)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Clear [STUB!]\n");
+   }
+
+   void ::Blit(Display display, Surface surface, Bitmap src, int dx, int dy, int sx, int sy, int w, int h)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Blit [STUB!]\n");
+   }
+
+   void ::SetBlitTint(Display display, Surface surface, ColorAlpha tint)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::SetBlitTint [STUB!]\n");
+   }
+
+   void ::Stretch(Display display, Surface surface, Bitmap src, int dx, int dy, int sx, int sy, int w, int h, int sw, int sh)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Stretch [STUB!]\n");
+   }
+
+   void ::Filter(Display display, Surface surface, Bitmap src, int dx, int dy, int sx, int sy, int w, int h, int sw, int sh)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::Filter [STUB!]\n");
+   }
+
+   void ::BlitDI(Display display, Surface surface, Bitmap src, int dx, int dy, int sx, int sy, int w, int h)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::BlitDI [STUB!]\n");
+   }
+
+   void ::StretchDI(Display display, Surface surface, Bitmap src, int dx, int dy, int sx, int sy, int w, int h, int sw, int sh)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::StretchDI [STUB!]\n");
+   }
+
+   void ::FilterDI(Display display, Surface surface, Bitmap src, int dx, int dy, int sx, int sy, int w, int h, int sw, int sh)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::FilterDI [STUB!]\n");
+   }
+
+   void ::TextFont(Display display, Surface surface, Font font)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::TextFont [STUB!]\n");
+   }
+
+   void ::TextOpacity(Display display, Surface surface, bool opaque)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::TextOpacity [STUB!]\n");
+   }
+
+   void ::WriteText(Display display, Surface surface, int x, int y, const char * text, int len)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::WriteText [STUB!]\n");
+   }
+
+   void ::TextExtent(Display display, Surface surface, const char * text, int len, int * width, int * height)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::TextExtent [STUB!]\n");
+   }
+
+   void ::FontExtent(DisplaySystem displaySystem, Font font, const char * text, int len, int * width, int * height)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::FontExtent [STUB!]\n");
+   }
+
+   void ::DrawingChar(Display display, Surface surface, char character)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::DrawingChar [STUB!]\n");
+   }
+
+   void ::NextPage(Display display)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::NextPage [STUB!]\n");
+   }
+
+   // 3D Graphics
+
+#if !defined(ECERE_VANILLA) && !defined(ECERE_NO3D)
+   void ::SetRenderState(Display display, RenderState state, uint value)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::SetRenderState [STUB!]\n");
+   }
+
+   void ::SetLight(Display display, int id, Light light)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::SetLight [STUB!]\n");
+   }
+
+   void ::SetCamera(Display display, Surface surface, Camera camera)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::SetCamera [STUB!]\n");
+   }
+
+   bool ::AllocateMesh(DisplaySystem displaySystem, Mesh mesh, MeshFeatures flags, int nVertices)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::AllocateMesh [STUB!]\n");
+      return false;
+   }
+
+   void ::FreeMesh(DisplaySystem displaySystem, Mesh mesh)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::FreeMesh [STUB!]\n");
+   }
+
+   bool ::LockMesh(DisplaySystem displaySystem, Mesh mesh, MeshFeatures flags)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::LockMesh [STUB!]\n");
+      return false;
+   }
+
+   void ::UnlockMesh(DisplaySystem displaySystem, Mesh mesh, MeshFeatures flags)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::UnlockMesh [STUB!]\n");
+   }
+
+   void * ::AllocateIndices(DisplaySystem displaySystem, int nIndices, bool indices32bit)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::AllocateIndices [STUB!]\n");
+      return null;
+   }
+
+   void ::FreeIndices(DisplaySystem displaySystem, void * indices)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::FreeIndices [STUB!]\n");
+   }
+
+   uint16 * ::LockIndices(DisplaySystem displaySystem, void * indices)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::LockIndices [STUB!]\n");
+      return null;
+   }
+
+   void ::UnlockIndices(DisplaySystem displaySystem, void * indices, bool indices32bit, int nIndices)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::UnlockIndices [STUB!]\n");
+   }
+
+   void ::SelectMesh(Display display, Mesh mesh)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::SelectMesh [STUB!]\n");
+   }
+
+   void ::ApplyMaterial(Display display, Material material, Mesh mesh)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::ApplyMaterial [STUB!]\n");
+   }
+
+   void ::DrawPrimitives(Display display, PrimitiveSingle * primitive, Mesh mesh)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::DrawPrimitives [STUB!]\n");
+   }
+
+   void ::PushMatrix(Display display)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::PushMatrix [STUB!]\n");
+   }
+
+   void ::PopMatrix(Display display, bool setMatrix)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::PopMatrix [STUB!]\n");
+   }
+
+   void ::SetTransform(Display display, Matrix transMatrix, bool viewSpace, bool useCamera)
+   {
+      sflnprintf("class(PepperDisplayDriver) ::SetTransform [STUB!]\n");
+   }
+#endif
+
+}
+
+#endif // !defined(NO_PEPPER_DRIVER)