If you use my source, please give me credits for making it.
P.S: this is my first Mouse D3D I ever made.
Mine has more Features in it.
Code:
/*
Project Name : Mouse GUI
Author : Str1k3r21
Date : 26-03-09
Credits : Enigma.h4x
Information : This Menu was made for any D3D8 Games, but can easily be changed to D3D9.
Call Menu(pDevice); in your EndScene/BeginScene for this to work.
*/
bool bMenu=false; // Declare globally.
tagPOINT Pos; // Declare globally.
// Lets create some int variables so we can set our GUI position
int MenuPosX = 15; // GUI Position X on the screen
int MenuPosY = 30; // GUI Position Y on the screen
void DrawOption (int PosX, int PosY, char Text,bool bOption, IDirect3DDevice8* pDevice) // Lets define out params.
{
DrawText(Text, PosX, PosY, D3DCOLOR_ARGB(255, 255, 255, 255));
DrawRect(pDevice, PosX - 21, PosY + 1, 12, 12, D3DCOLOR_ARGB(255, 255, 255, 255));
if (bOption) // If our selected bool is turned on
{
DrawRect(pDevice, PosX - 20, PosY + 2, 10, 10, D3DCOLOR_ARGB(255, 0, 255, 0)); // If turned on it will turn green
}
else
{
DrawRect(pDevice, PosX - 20, PosY + 2, 10, 10, D3DCOLOR_ARGB(255, 255, 0, 0)); // If off then turn red. So you know when its on/off.
}
}
void DrawMouse (IDirect3DDevice8* pDevice, int PosX, int PosY)
{
DrawRect(pDevice, PosX, PosY, 10, 10, D3DCOLOR_ARGB(255, 255, 255, 0));
}
void DrawBox (IDirect3DDevice8* pDevice,int PosX, int PosY, int Width, int Height) // Lets define out params. Param 1. Defines Postion X on our screen, Param 2. Defines Position Y on our screen. Param 3. Defines the Width of the box, Param 4. Defines the Height of the box.
{
DrawRect(pDevice, PosX, PosY, Width, Height, D3DCOLOR_ARGB(255, 69, 139, 116)); // Lets draw our main box.
// Lets draw a border shall we? :)
DrawRect(pDevice, PosX, PosY, Width, 1, D3DCOLOR_ARGB(255, 120, 120, 120)); // Line on the left side of the box
DrawRect(pDevice, PosX, PosY, 1, Height, D3DCOLOR_ARGB(255, 120, 120, 120)); // Line on the top box
DrawRect(pDevice, PosX + Width, PosY, 1, Height, D3DCOLOR_ARGB(255, 120, 120, 120)); // Line on the right side of the box
DrawRect(pDevice, PosX, PosY + Height, Width, 1, D3DCOLOR_ARGB(255, 120, 120, 120)); // Line on the bottom of the box
}
void Menu ( IDirect3DDevice8* pDevice )
{
int PosX, PosY;
GetCursorPos( &Pos );
PosX = Pos.x;
PosY = Pos.y;
if ( GetAsyncKeyState(VK_INSERT) &1 ) // If we press Insert it will turn on. When pressed again it will turn off
bMenu = !bMenu;
if ( !bMenu )
return;
// Lets write out math equation for our checkboxes to allow input :|
if ( GetAsyncKeyState(VK_LBUTTON) &1 ) // If Left Moues button is clicked bool is on again and its off.
{
if ( (Pos.x > MenuPosX + 10 ) && (Pos.x < MenuPosX + 30) && (Pos.y > MenuPosY + 10) && (Pos.y < MenuPosY + 30) )
{
CH_Hack = !CH_Hack;
}
}
DrawBox(pDevice,MenuPosX, MenuPosY, 100, 300); // Lets call our Box function as our main GUI function.
DrawBox(pDevice,MenuPosX, MenuPosY - 22, 100, 20); // Lets draw a title bar :p.
DrawText("iNoob Hook", MenuPosX + 20, MenuPosY - 20, D3DCOLOR_ARGB(255, 255, 255, 255)); // Lets draw some text on our title bar.
DrawOption(MenuPosX + 30, MenuPosY + 10, "Hack", CH_Hack, pDevice); // Lets call some bools in our GUI so we can turn them on/off.
DrawText("[*By Str1k3r21*]", MenuPosX + 9, MenuPosY + 285, D3DCOLOR_ARGB(255,255,255,255));
DrawMouse(pDevice, PosX, PosY); // Draws the mouse by fetching the X and Y of the mouse .
Sleep(2); // Reduces lagg
}
// Draw Rect Function for those who don't have it //
void DrawRect(IDirect3DDevice8* Unidade, int baseX, int baseY, int baseW, int baseH, D3DCOLOR Cor)
{
D3DRECT BarRect = { baseX, baseY, baseX + baseW, baseY + baseH };
Unidade->Clear(1, &BarRect, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, Cor, 0, 0);
}