Display is now updated as labels are scrolling.
2 using System.Collections.Generic;
5 using System.Threading.Tasks;
7 using System.Runtime.InteropServices;
10 namespace SharpDisplayManager
18 iDevice = IntPtr.Zero;
24 if (iDevice == IntPtr.Zero)
26 iDevice = MiniDisplayOpen();
28 return iDevice != IntPtr.Zero;
33 MiniDisplayClose(iDevice);
34 iDevice = IntPtr.Zero;
39 return iDevice != IntPtr.Zero;
44 MiniDisplayClear(iDevice);
49 MiniDisplayFill(iDevice);
52 public void SwapBuffers()
54 MiniDisplaySwapBuffers(iDevice);
57 public int MaxBrightness()
59 return MiniDisplayMaxBrightness(iDevice);
62 public int MinBrightness()
64 return MiniDisplayMinBrightness(iDevice);
67 public void SetBrightness(int aBrightness)
69 if (!IsOpen()) return;
71 MiniDisplaySetBrightness(iDevice, aBrightness);
74 public int WidthInPixels()
76 return MiniDisplayWidthInPixels(iDevice);
79 public int HeightInPixels()
81 return MiniDisplayHeightInPixels(iDevice);
84 public void SetPixel(int aX, int aY, int aValue)
86 MiniDisplaySetPixel(iDevice,aX,aY,aValue);
91 //Our display device handle
94 [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
95 public static extern IntPtr MiniDisplayOpen();
97 [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
98 public static extern void MiniDisplayClose(IntPtr aDevice);
100 [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
101 public static extern void MiniDisplayClear(IntPtr aDevice);
103 [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
104 public static extern void MiniDisplayFill(IntPtr aDevice);
106 [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
107 public static extern void MiniDisplaySwapBuffers(IntPtr aDevice);
109 [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
110 public static extern void MiniDisplaySetBrightness(IntPtr aDevice, int aBrightness);
112 [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
113 public static extern int MiniDisplayMinBrightness(IntPtr aDevice);
115 [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
116 public static extern int MiniDisplayMaxBrightness(IntPtr aDevice);
118 [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
119 public static extern int MiniDisplayWidthInPixels(IntPtr aDevice);
121 [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
122 public static extern int MiniDisplayHeightInPixels(IntPtr aDevice);
124 [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
125 public static extern int MiniDisplaySetPixel(IntPtr aDevice, int aX, int aY, int aValue);