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