├── .gitattributes ├── .gitignore ├── DX9OverlayWrapper.sln ├── DX9OverlayWrapper ├── Box.cs ├── DX9Overlay.cs ├── DX9OverlayAPIWrapper.csproj ├── Image.cs ├── LatestRealease │ └── DX9OverlayAPIWrapper.dll ├── Line.cs ├── Overlay.cs ├── Properties │ └── AssemblyInfo.cs └── TextLabel.cs └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Build results 10 | 11 | [Dd]ebug/ 12 | [Rr]elease/ 13 | x64/ 14 | build/ 15 | [Bb]in/ 16 | [Oo]bj/ 17 | 18 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 19 | !packages/*/build/ 20 | 21 | # MSTest test Results 22 | [Tt]est[Rr]esult*/ 23 | [Bb]uild[Ll]og.* 24 | 25 | *_i.c 26 | *_p.c 27 | *.ilk 28 | *.meta 29 | *.obj 30 | *.pch 31 | *.pdb 32 | *.pgc 33 | *.pgd 34 | *.rsp 35 | *.sbr 36 | *.tlb 37 | *.tli 38 | *.tlh 39 | *.tmp 40 | *.tmp_proj 41 | *.log 42 | *.vspscc 43 | *.vssscc 44 | .builds 45 | *.pidb 46 | *.log 47 | *.scc 48 | 49 | # Visual C++ cache files 50 | ipch/ 51 | *.aps 52 | *.ncb 53 | *.opensdf 54 | *.sdf 55 | *.cachefile 56 | 57 | # Visual Studio profiler 58 | *.psess 59 | *.vsp 60 | *.vspx 61 | 62 | # Guidance Automation Toolkit 63 | *.gpState 64 | 65 | # ReSharper is a .NET coding add-in 66 | _ReSharper*/ 67 | *.[Rr]e[Ss]harper 68 | 69 | # TeamCity is a build add-in 70 | _TeamCity* 71 | 72 | # DotCover is a Code Coverage Tool 73 | *.dotCover 74 | 75 | # NCrunch 76 | *.ncrunch* 77 | .*crunch*.local.xml 78 | 79 | # Installshield output folder 80 | [Ee]xpress/ 81 | 82 | # DocProject is a documentation generator add-in 83 | DocProject/buildhelp/ 84 | DocProject/Help/*.HxT 85 | DocProject/Help/*.HxC 86 | DocProject/Help/*.hhc 87 | DocProject/Help/*.hhk 88 | DocProject/Help/*.hhp 89 | DocProject/Help/Html2 90 | DocProject/Help/html 91 | 92 | # Click-Once directory 93 | publish/ 94 | 95 | # Publish Web Output 96 | *.Publish.xml 97 | 98 | # NuGet Packages Directory 99 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 100 | #packages/ 101 | 102 | # Windows Azure Build Output 103 | csx 104 | *.build.csdef 105 | 106 | # Windows Store app package directory 107 | AppPackages/ 108 | 109 | # Others 110 | sql/ 111 | *.Cache 112 | ClientBin/ 113 | [Ss]tyle[Cc]op.* 114 | ~$* 115 | *~ 116 | *.dbmdl 117 | *.[Pp]ublish.xml 118 | *.pfx 119 | *.publishsettings 120 | 121 | # RIA/Silverlight projects 122 | Generated_Code/ 123 | 124 | # Backup & report files from converting an old project file to a newer 125 | # Visual Studio version. Backup files are not needed, because we have git ;-) 126 | _UpgradeReport_Files/ 127 | Backup*/ 128 | UpgradeLog*.XML 129 | UpgradeLog*.htm 130 | 131 | # SQL Server files 132 | App_Data/*.mdf 133 | App_Data/*.ldf 134 | 135 | 136 | #LightSwitch generated files 137 | GeneratedArtifacts/ 138 | _Pvt_Extensions/ 139 | ModelManifest.xml 140 | 141 | # ========================= 142 | # Windows detritus 143 | # ========================= 144 | 145 | # Windows image file caches 146 | Thumbs.db 147 | ehthumbs.db 148 | 149 | # Folder config file 150 | Desktop.ini 151 | 152 | # Recycle Bin used on file shares 153 | $RECYCLE.BIN/ 154 | 155 | # Mac desktop service store files 156 | .DS_Store 157 | -------------------------------------------------------------------------------- /DX9OverlayWrapper.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.30324.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DX9OverlayAPIWrapper", "DX9OverlayWrapper\DX9OverlayAPIWrapper.csproj", "{AC439097-82E5-46CF-A0F7-C787D57F2225}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {AC439097-82E5-46CF-A0F7-C787D57F2225}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {AC439097-82E5-46CF-A0F7-C787D57F2225}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {AC439097-82E5-46CF-A0F7-C787D57F2225}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {AC439097-82E5-46CF-A0F7-C787D57F2225}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /DX9OverlayWrapper/Box.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Drawing; 7 | 8 | namespace DX9OverlayAPIWrapper 9 | { 10 | public class Box : Overlay 11 | { 12 | public override bool Visible 13 | { 14 | get 15 | { 16 | return base.Visible; 17 | } 18 | set 19 | { 20 | DX9Overlay.BoxSetShown(Id, value); 21 | base.Visible = value; 22 | } 23 | } 24 | 25 | private Color _color; 26 | public Color Color 27 | { 28 | get 29 | { 30 | return _color; 31 | } 32 | set 33 | { 34 | DX9Overlay.BoxSetColor(Id, (uint)value.ToArgb()); 35 | _color = value; 36 | } 37 | } 38 | 39 | private Rectangle _rectangle; 40 | public Rectangle Rectangle 41 | { 42 | get 43 | { 44 | return _rectangle; 45 | } 46 | set 47 | { 48 | DX9Overlay.BoxSetPos(Id, value.X, value.Y); 49 | DX9Overlay.BoxSetWidth(Id, value.Width); 50 | DX9Overlay.BoxSetHeight(Id, value.Height); 51 | _rectangle = value; 52 | } 53 | } 54 | 55 | private bool _borderShown; 56 | public bool BorderShown 57 | { 58 | get 59 | { 60 | return _borderShown; 61 | } 62 | set 63 | { 64 | DX9Overlay.BoxSetBorder(Id, _borderHeight, value); 65 | _borderShown = value; 66 | } 67 | } 68 | 69 | private int _borderHeight; 70 | public int BorderHeight 71 | { 72 | get 73 | { 74 | return _borderHeight; 75 | } 76 | set 77 | { 78 | DX9Overlay.BoxSetBorder(Id, value, _borderShown); 79 | _borderHeight = value; 80 | } 81 | } 82 | 83 | private Color _borderColor; 84 | public Color BorderColor 85 | { 86 | get 87 | { 88 | return _borderColor; 89 | } 90 | set 91 | { 92 | DX9Overlay.BoxSetBorderColor(Id, (uint)value.ToArgb()); 93 | _borderColor = value; 94 | } 95 | } 96 | 97 | public Box(Rectangle rectangle, Color color, bool show, bool borderShown = false, int borderHeight = 0, Color borderColor = default(Color)) 98 | { 99 | Id = DX9Overlay.BoxCreate(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, (uint)color.ToArgb(), show); 100 | if (borderHeight != 0) 101 | { 102 | DX9Overlay.BoxSetBorder(Id, borderHeight, borderShown); 103 | _borderHeight = borderHeight; 104 | _borderShown = borderShown; 105 | } 106 | if (borderColor != default(Color)) 107 | { 108 | DX9Overlay.BoxSetBorderColor(Id, (uint)borderColor.ToArgb()); 109 | _borderColor = borderColor; 110 | } 111 | _rectangle = rectangle; 112 | base.Visible = show; 113 | _color = color; 114 | } 115 | 116 | public override void Destroy() 117 | { 118 | DX9Overlay.BoxDestroy(Id); 119 | base.Destroy(); 120 | } 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /DX9OverlayWrapper/DX9Overlay.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Drawing; 7 | using System.Runtime.InteropServices; 8 | 9 | namespace DX9OverlayAPIWrapper 10 | { 11 | /// 12 | /// Class providing all necessary Functions for the API 13 | /// 14 | public static class DX9Overlay 15 | { 16 | private const String PATH = "dx9_overlay.dll"; 17 | 18 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 19 | public static extern int TextCreate(string font, int fontSize, bool bBold, bool bItalic, int x, int y, uint color, string text, bool bShadow, bool bShow); 20 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 21 | public static extern int TextDestroy(int id); 22 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 23 | public static extern int TextSetShadow(int id, bool b); 24 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 25 | public static extern int TextSetShown(int id, bool b); 26 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 27 | public static extern int TextSetColor(int id, uint color); 28 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 29 | public static extern int TextSetPos(int id, int x, int y); 30 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 31 | public static extern int TextSetString(int id, string str); 32 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 33 | public static extern int TextUpdate(int id, string font, int fontSize, bool bBold, bool bItalic); 34 | 35 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 36 | public static extern int BoxCreate(int x, int y, int w, int h, uint dwColor, bool bShow); 37 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 38 | public static extern int BoxDestroy(int id); 39 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 40 | public static extern int BoxSetShown(int id, bool bShown); 41 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 42 | public static extern int BoxSetBorder(int id, int height, bool bShown); 43 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 44 | public static extern int BoxSetBorderColor(int id, uint dwColor); 45 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 46 | public static extern int BoxSetColor(int id, uint dwColor); 47 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 48 | public static extern int BoxSetHeight(int id, int height); 49 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 50 | public static extern int BoxSetPos(int id, int x, int y); 51 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 52 | public static extern int BoxSetWidth(int id, int width); 53 | 54 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 55 | public static extern int LineCreate(int x1, int y1, int x2, int y2, int width, uint color, bool bShow); 56 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 57 | public static extern int LineDestroy(int id); 58 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 59 | public static extern int LineSetShown(int id, bool bShown); 60 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 61 | public static extern int LineSetColor(int id, uint color); 62 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 63 | public static extern int LineSetWidth(int id, int width); 64 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 65 | public static extern int LineSetPos(int id, int x1, int y1, int x2, int y2); 66 | 67 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 68 | public static extern int ImageCreate(string path, int x, int y, int rotation, int align, bool bShow); 69 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 70 | public static extern int ImageDestroy(int id); 71 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 72 | public static extern int ImageSetShown(int id, bool bShown); 73 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 74 | public static extern int ImageSetAlign(int id, int align); 75 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 76 | public static extern int ImageSetPos(int id, int x, int y); 77 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 78 | public static extern int ImageSetRotation(int id, int rotation); 79 | 80 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 81 | public static extern int DestroyAllVisual(); 82 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 83 | public static extern int ShowAllVisual(); 84 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 85 | public static extern int HideAllVisual(); 86 | 87 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 88 | public static extern int GetFrameRate(); 89 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 90 | public static extern int GetScreenSpecs(out int width, out int height); 91 | 92 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 93 | public static extern int Init(); 94 | [DllImport(PATH, CallingConvention = CallingConvention.Cdecl)] 95 | public static extern void SetParam(string _szParamName, string _szParamValue); 96 | 97 | public static string ToHexValueRGB(Color color) 98 | { 99 | return $"{color.R.ToString("X2")}{color.G.ToString("X2")}{color.B.ToString("X2")}"; 100 | } 101 | 102 | public static string ToHexValueARGB(Color color) 103 | { 104 | return $"{color.A.ToString("X2")}{color.R.ToString("X2")}{color.G.ToString("X2")}{color.B.ToString("X2")}"; 105 | } 106 | 107 | public static Point GetScreenSpecs() 108 | { 109 | GetScreenSpecs(out int x, out int y); 110 | return new Point(x, y); 111 | } 112 | } 113 | 114 | [Flags] 115 | public enum Align 116 | { 117 | CENTER = 1, 118 | LEFT = 0 119 | } 120 | 121 | [Flags] 122 | public enum TypeFace 123 | { 124 | ITALIC = 1, 125 | BOLD = 2, 126 | NONE = 4 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /DX9OverlayWrapper/DX9OverlayAPIWrapper.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {AC439097-82E5-46CF-A0F7-C787D57F2225} 8 | Library 9 | Properties 10 | DX9OverlayAPIWrapper 11 | DX9OverlayAPIWrapper 12 | v4.0 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | LatestRealease\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 58 | -------------------------------------------------------------------------------- /DX9OverlayWrapper/Image.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Drawing; 7 | 8 | namespace DX9OverlayAPIWrapper 9 | { 10 | public class Image : Overlay 11 | { 12 | public override bool Visible 13 | { 14 | get 15 | { 16 | return base.Visible; 17 | } 18 | set 19 | { 20 | DX9Overlay.ImageSetShown(Id, value); 21 | base.Visible = value; 22 | } 23 | } 24 | 25 | private int _rotation; 26 | public int Rotation 27 | { 28 | get 29 | { 30 | return _rotation; 31 | } 32 | set 33 | { 34 | DX9Overlay.ImageSetRotation(Id, value); 35 | _rotation = value; 36 | } 37 | } 38 | 39 | private Point _position; 40 | public Point Position 41 | { 42 | get 43 | { 44 | return _position; 45 | } 46 | set 47 | { 48 | DX9Overlay.ImageSetPos(Id, value.X, value.Y); 49 | _position = value; 50 | } 51 | } 52 | 53 | private Align _align; 54 | public Align Align 55 | { 56 | get 57 | { 58 | return _align; 59 | } 60 | set 61 | { 62 | DX9Overlay.ImageSetAlign(Id, (int)value); 63 | _align = value; 64 | } 65 | } 66 | 67 | public Image(string path, Point position, int rotation, Align align, bool show) 68 | { 69 | Id = DX9Overlay.ImageCreate(path, position.X, position.Y, rotation, (int)align, show); 70 | _position = position; 71 | _rotation = rotation; 72 | _align = align; 73 | base.Visible = show; 74 | } 75 | 76 | public override void Destroy() 77 | { 78 | DX9Overlay.ImageDestroy(Id); 79 | base.Destroy(); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /DX9OverlayWrapper/LatestRealease/DX9OverlayAPIWrapper.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JohnnyCrazy/DX9-Overlay-API-Wrapper/cfd148da478beb7031da3992fe9ffd3aa69c4c8a/DX9OverlayWrapper/LatestRealease/DX9OverlayAPIWrapper.dll -------------------------------------------------------------------------------- /DX9OverlayWrapper/Line.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Drawing; 7 | 8 | namespace DX9OverlayAPIWrapper 9 | { 10 | public class Line : Overlay 11 | { 12 | public override bool Visible 13 | { 14 | get 15 | { 16 | return base.Visible; 17 | } 18 | set 19 | { 20 | DX9Overlay.LineSetShown(Id, value); 21 | base.Visible = value; 22 | } 23 | } 24 | 25 | private Color _color; 26 | public Color Color 27 | { 28 | get 29 | { 30 | return _color; 31 | } 32 | set 33 | { 34 | DX9Overlay.LineSetColor(Id, (uint)value.ToArgb()); 35 | _color = value; 36 | } 37 | } 38 | 39 | private int _width; 40 | public int Width 41 | { 42 | get 43 | { 44 | return _width; 45 | } 46 | set 47 | { 48 | DX9Overlay.LineSetWidth(Id, value); 49 | _width = value; 50 | } 51 | } 52 | 53 | private Point _startPosition; 54 | public Point StartPosition 55 | { 56 | get 57 | { 58 | return _startPosition; 59 | } 60 | set 61 | { 62 | DX9Overlay.LineSetPos(Id, value.X, value.Y, _endPosition.X, _endPosition.Y); 63 | _startPosition = value; 64 | } 65 | } 66 | 67 | private Point _endPosition; 68 | public Point EndPosition 69 | { 70 | get 71 | { 72 | return _endPosition; 73 | } 74 | set 75 | { 76 | DX9Overlay.LineSetPos(Id, _startPosition.X, _startPosition.Y, value.X, value.Y); 77 | _endPosition = value; 78 | } 79 | } 80 | 81 | public Line(Point startPosition, Point endPosition, int width, Color color, bool show) 82 | { 83 | Id = DX9Overlay.LineCreate(startPosition.X, startPosition.Y, endPosition.X, endPosition.Y, width, (uint)color.ToArgb(), show); 84 | _startPosition = startPosition; 85 | _endPosition = endPosition; 86 | _width = width; 87 | _color = color; 88 | base.Visible = show; 89 | } 90 | 91 | public override void Destroy() 92 | { 93 | DX9Overlay.LineDestroy(Id); 94 | base.Destroy(); 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /DX9OverlayWrapper/Overlay.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace DX9OverlayAPIWrapper 8 | { 9 | public abstract class Overlay 10 | { 11 | private int _id = -1; 12 | public int Id 13 | { 14 | get 15 | { 16 | return _id; 17 | } 18 | protected set 19 | { 20 | _id = value; 21 | } 22 | } 23 | 24 | private bool _visible; 25 | public virtual bool Visible 26 | { 27 | get 28 | { 29 | return _visible; 30 | } 31 | set 32 | { 33 | _visible = value; 34 | } 35 | } 36 | 37 | public virtual void Destroy() 38 | { 39 | _id = -1; 40 | } 41 | 42 | public override string ToString() 43 | { 44 | return $"{GetType().Name} {Id}"; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /DX9OverlayWrapper/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // Allgemeine Informationen über eine Assembly werden über die folgenden 6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, 7 | // die mit einer Assembly verknüpft sind. 8 | [assembly: AssemblyTitle("DX9OverlayAPIWrapper")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("DX9OverlayAPIWrapper")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar 18 | // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von 19 | // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. 20 | [assembly: ComVisible(false)] 21 | 22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird 23 | [assembly: Guid("ca5ffb88-6112-4da2-8d46-111bb48c531b")] 24 | 25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: 26 | // 27 | // Hauptversion 28 | // Nebenversion 29 | // Buildnummer 30 | // Revision 31 | // 32 | // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern 33 | // übernehmen, indem Sie "*" eingeben: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /DX9OverlayWrapper/TextLabel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Drawing; 7 | 8 | namespace DX9OverlayAPIWrapper 9 | { 10 | public class TextLabel : Overlay 11 | { 12 | public override bool Visible 13 | { 14 | get 15 | { 16 | return base.Visible; 17 | } 18 | set 19 | { 20 | DX9Overlay.TextSetShown(Id, value); 21 | base.Visible = value; 22 | } 23 | } 24 | 25 | private string _text; 26 | public string Text 27 | { 28 | get 29 | { 30 | return _text; 31 | } 32 | set 33 | { 34 | DX9Overlay.TextSetString(Id, value); 35 | _text = value; 36 | } 37 | } 38 | 39 | private bool _shadow; 40 | public bool Shadow 41 | { 42 | get 43 | { 44 | return _shadow; 45 | } 46 | set 47 | { 48 | DX9Overlay.TextSetShadow(Id, value); 49 | _shadow = value; 50 | } 51 | } 52 | 53 | private Color _color; 54 | public Color Color 55 | { 56 | get 57 | { 58 | return _color; 59 | } 60 | set 61 | { 62 | DX9Overlay.TextSetColor(Id, (uint)value.ToArgb()); 63 | _color = value; 64 | } 65 | } 66 | 67 | private Point _position; 68 | public Point Position 69 | { 70 | get 71 | { 72 | return _position; 73 | } 74 | set 75 | { 76 | DX9Overlay.TextSetPos(Id, value.X, value.Y); 77 | _position = value; 78 | } 79 | } 80 | 81 | public TextLabel(string font, int size, TypeFace type, Point position, Color color, string text, bool shadow, bool show) 82 | { 83 | Id = DX9Overlay.TextCreate(font, size, type.HasFlag(TypeFace.BOLD), type.HasFlag(TypeFace.ITALIC), position.X, position.Y, (uint)color.ToArgb(), text, shadow, show); 84 | _text = text; 85 | _shadow = shadow; 86 | base.Visible = show; 87 | _color = color; 88 | _position = position; 89 | } 90 | 91 | public override void Destroy() 92 | { 93 | DX9Overlay.TextDestroy(Id); 94 | base.Destroy(); 95 | } 96 | 97 | public void TextUpdate(String font, int size, Boolean bold, Boolean italic) 98 | { 99 | DX9Overlay.TextUpdate(Id, font, size, bold, italic); 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | DX9-Overlay-API-Wrapper 2 | ======================= 3 | 4 | A .NET Wrapper for the [DX9-Overlay-API](https://github.com/agrippa1994/DX9-Overlay-API) 5 | 6 | 7 | #####Usage Example (Add the Wrapper DLL as reference): 8 | 9 | ```C# 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Linq; 13 | using System.Text; 14 | using System.Threading.Tasks; 15 | using System.Drawing; 16 | using System.Threading; 17 | using DX9OverlayAPIWrapper; 18 | 19 | namespace DX9OverlayWrapperTest 20 | { 21 | class Program 22 | { 23 | static void Main(string[] args) 24 | { 25 | DX9Overlay.SetParam("process", "GFXTest.exe"); 26 | DX9Overlay.DestroyAllVisual(); 27 | TextLabel text = new TextLabel("Arial", 20, TypeFace.NONE, new Point(5, 5), Color.Red, "Test123", true, true); 28 | Thread.Sleep(5000); 29 | text.Text = "Text2"; //Text updaten 30 | Thread.Sleep(5000); 31 | text.Color = Color.Cyan; //Color updaten 32 | Thread.Sleep(5000); 33 | text.Destroy(); //Text entfernen 34 | } 35 | } 36 | } 37 | 38 | ``` 39 | 40 | For all types, look at the source Files 41 | --------------------------------------------------------------------------------