EMO Style ForumPro - Hos Geldiniz
Delphi D3D9 Menu class Uyeols10

Join the forum, it's quick and easy

EMO Style ForumPro - Hos Geldiniz
Delphi D3D9 Menu class Uyeols10
EMO Style ForumPro - Hos Geldiniz
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Giriş yap

Şifremi unuttum

Istatistikler
Toplam 203 kayıtlı kullanıcımız var
Son kaydolan kullanıcımız: crayzboy76

Kullanıcılarımız toplam 1186 mesaj attılar bunda 862 konu
Tarıyıcı
 Kapı
 Indeks
 Üye Listesi
 Profil
 SSS
 Arama
Arama
 
 

Sonuç :
 


Rechercher çıkıntı araştırma

RSS akısı


Yahoo! 
MSN 
AOL 
Netvibes 
Bloglines 


Anahtar-kelime

pointer  kutu  loot  

Kimler hatta?
Toplam 1 kullanıcı online :: 0 Kayıtlı, 0 Gizli ve 1 Misafir

Yok

[ Bütün listeye bak ]


Sitede bugüne kadar en çok 217 kişi C.tesi Tem. 29, 2017 1:46 am tarihinde online oldu.
En son konular
» İnternetten Para Kazandıran Oyun ! Ödeme Alt Limiti Yok ! DEV KONU
Delphi D3D9 Menu class I_icon_minitimeCuma Ağus. 29, 2014 8:33 am tarafından Hello EMO

» goldenchase.net maden yaparak para kazanma
Delphi D3D9 Menu class I_icon_minitimeCuma Ağus. 29, 2014 8:18 am tarafından Hello EMO

» etichal hacker görsel egitim seti
Delphi D3D9 Menu class I_icon_minitimeÇarş. Ağus. 06, 2014 4:57 am tarafından Hello EMO

» KO TBL Source C#
Delphi D3D9 Menu class I_icon_minitimePtsi Ara. 09, 2013 6:36 am tarafından Hello EMO

» x86 Registers
Delphi D3D9 Menu class I_icon_minitimeC.tesi Ağus. 24, 2013 5:02 am tarafından Hello EMO

» [Tutorial] Pegando Address, Pointers de WYD
Delphi D3D9 Menu class I_icon_minitimeÇarş. Tem. 10, 2013 7:25 am tarafından Hello EMO

» [Tutorial] Pegando Address, Pointers de CS Metodo²
Delphi D3D9 Menu class I_icon_minitimeÇarş. Tem. 10, 2013 7:23 am tarafından Hello EMO

» [Tutorial] Aprendendo basico deASM OLLYDBG
Delphi D3D9 Menu class I_icon_minitimeÇarş. Tem. 10, 2013 7:22 am tarafından Hello EMO

» Basic C# DLL injector
Delphi D3D9 Menu class I_icon_minitimePtsi Tem. 08, 2013 7:48 am tarafından Hello EMO

Reklam

Delphi D3D9 Menu class

Aşağa gitmek

Delphi D3D9 Menu class Empty Delphi D3D9 Menu class

Mesaj tarafından EMO Çarş. Haz. 01, 2011 9:02 am

This is a class with many options and very configurable, But should be easy to use..

Code:
(****************************
Unit : clsMenuEngine
Author : Departure
Url : ic0de.org
****************************)

unit clsMenuEngine;

interface

uses Windows, SysUtils, Variants, D3DX9, Direct3D9, DXTypes;

type
TItems = packed record
strName: PAnsiChar;
bOn : Boolean;
bShowCheck: Boolean;
end;

Type
TMenuEngine = Class
Private
pD3Ddev: Direct3D9.IDirect3DDevice9;
fMenuFont: D3DX9.ID3DXFont;

bVisable: Boolean;
iMenuX, iMenuY, iMenuW, iMenuH, iMenuItems: Integer;
dwMenuBgColor, dwMenuBorderColor, dwCrossHairColor, dwTextColor: Dword;

Function GetDevice():IDirect3DDevice9;
function GetFont(): ID3DXFont;
procedure DrawRectangle(iXleft, iYtop, iWidth, iHight: Integer; Color: Dword);
procedure DrawRectangleAlpha(iXleft, iYtop, iWidth, iHight: Integer; Color: Dword);
procedure DrawBorder();
procedure DrawBorderAlpha();
procedure DrawCheck( Color: Dword; x, y: Integer);
procedure DrawDash( Color: Dword; x, y: Integer);
procedure DrawPlus(Color: Dword; x, y: Integer);
procedure DrawBox();
procedure DrawBoxAlpha();
procedure DrawText(const iLeft, iTop: Integer; szText: PAnsiChar);

Public
aItems: Array of TItems;
Constructor Create( Left, Top, Width, Hight, Items: Integer; BGColor, BDColor, TXTColor: Dword);
Destructor Destroy(); Override;
Procedure Render();
Procedure Reset(Const pDevice: IDirect3DDevice9);
procedure DrawXhair();
procedure MenuItemAdd( iIndex: Integer; szText: PAnsiChar; bOnOff: Boolean; bShowOnOff: Boolean = True);

Property Direct3DDevice: Direct3D9.IDirect3DDevice9 read pD3Ddev write pD3Ddev;



Property MenuLeft: Integer read iMenuX write iMenuX;
Property MenuTop: Integer read iMenuY write iMenuY;
Property MenuWidth: Integer read iMenuW write iMenuW;
Property MenuHight: Integer read iMenuH write iMenuH;
Property MenuItems: Integer read iMenuItems write iMenuItems;

Property BackGroundColor: Dword read dwMenuBgColor write dwMenuBgColor;
Property BorderColor: Dword read dwMenuBorderColor write dwMenuBorderColor;
Property TextColor: Dword read dwTextColor write dwTextColor;

Property XHairColor: Dword read dwCrossHairColor write dwCrossHairColor;

Property Menuvisable: Boolean read bVisable write bVisable;

end;

implementation

{ TMenuEngine }

constructor TMenuEngine.Create( Left, Top,
Width, Hight, Items: Integer; BGColor, BDColor, TXTColor: Dword);
begin
MenuLeft:= Left; MenuTop:= Top; MenuWidth:= Width; MenuHight:= Hight;
BackGroundColor:= BGColor; BorderColor:= BDColor; TextColor:= TXTColor;
MenuItems:= Items;
SetLength(aItems,MenuItems);
end;

destructor TMenuEngine.Destroy;
var
i: Integer;
begin
inherited Destroy();
pD3Ddev:= Nil;
fMenuFont:= Nil;
end;

procedure TMenuEngine.DrawBorder;
begin
DrawRectangle(iMenuX, (iMenuY + iMenuH - 1), iMenuW, 1, dwMenuBorderColor);
DrawRectangle(iMenuX, iMenuY, 1, iMenuH, dwMenuBorderColor);
DrawRectangle(iMenuX, iMenuY, iMenuW, 1, dwMenuBorderColor);
DrawRectangle((iMenuX + iMenuW - 1), iMenuY, 1, iMenuH, dwMenuBorderColor);
end;

procedure TMenuEngine.DrawBorderAlpha;
begin
DrawRectangleAlpha(iMenuX, (iMenuY + iMenuH - 1), iMenuW, 1, dwMenuBorderColor);
DrawRectangleAlpha(iMenuX, iMenuY, 1, iMenuH, dwMenuBorderColor);
DrawRectangleAlpha(iMenuX, iMenuY, iMenuW, 1, dwMenuBorderColor);
DrawRectangleAlpha((iMenuX + iMenuW - 1), iMenuY, 1, iMenuH, dwMenuBorderColor);
end;

procedure TMenuEngine.DrawBox;
begin
DrawRectangle(iMenuX, iMenuY, iMenuW, iMenuH, dwMenuBgColor);
DrawBorder;
end;

procedure TMenuEngine.DrawBoxAlpha;
begin
DrawRectangleAlpha(iMenuX, iMenuY, iMenuW, iMenuH, dwMenuBgColor);
DrawBorderAlpha;
end;

procedure TMenuEngine.DrawCheck(Color: Dword; x, y: Integer);
begin
DrawRectangle( x, y, 1, 3, Color );
DrawRectangle( x + 1, y + 1, 1, 3, Color );
DrawRectangle( x + 2, y + 2, 1, 3, Color );
DrawRectangle( x + 3, y + 1, 1, 3, Color );
DrawRectangle( x + 4, y, 1, 3, Color );
DrawRectangle( x + 5, y - 1, 1, 3, Color );
DrawRectangle( x + 6, y - 2, 1, 3, Color );
DrawRectangle( x + 7, y - 3, 1, 3, Color );
end;

procedure TMenuEngine.DrawDash(Color: Dword; x, y: Integer);
begin
DrawRectangle( x , y , 8, 3, Color );
end;

procedure TMenuEngine.DrawPlus(Color: Dword; x, y: Integer);
begin
DrawRectangle( x , y , 7, 1, Color );
DrawRectangle( x + 3 , y - 3 , 1, 7, Color );
end;

procedure TMenuEngine.DrawRectangle(iXleft, iYtop, iWidth, iHight: Integer; Color: Dword);
var
d3dRectangle : D3DRECT;
begin

d3dRectangle.x1:= iXleft;
d3dRectangle.y1:= iYtop;
d3dRectangle.x2:= iXleft + iWidth;
d3dRectangle.y2:= iYtop + iHight;

Direct3DDevice.Clear(1,@d3dRectangle, D3DCLEAR_TARGET or D3DCLEAR_ZBUFFER, Color, 0, 0);
end;

procedure TMenuEngine.DrawRectangleAlpha(iXleft, iYtop, iWidth, iHight: Integer; Color: Dword);
type
tStruct = packed record
x, y, z, rhw: Single;
Color: dWord;
end;
procedure AssignVertex(var Vertex: tStruct; x, y, z, rhw: Single; Color: Dword);
begin
Vertex.x:= x; Vertex.y:= y; Vertex.z:= z;
Vertex.Color:= Color;
end;
var
qV: array[0..3] of tStruct;
begin

AssignVertex(qV[0], iXLeft, iYtop + iHight, 0.0, 0.0, Color);
AssignVertex(qV[1], iXLeft, iYtop, 0.0, 0.0, Color);
AssignVertex(qV[2], iXLeft + iWidth, iYtop + iHight, 0.0, 0.0, Color);
AssignVertex(qV[3], iXLeft + iWidth, iYtop, 0.0, 0.0, Color);

Direct3DDevice.SetRenderState(D3DRS_ALPHABLENDENABLE,1);
Direct3DDevice.SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
Direct3DDevice.SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
Direct3DDevice.SetRenderState(D3DRS_FOGENABLE, 0);

Direct3DDevice.SetFVF(D3DFVF_XYZRHW or D3DFVF_DIFFUSE);
Direct3DDevice.SetTexture(0, Nil);
Direct3DDevice.DrawPrimitiveUP(D3DPT_TRIANGLESTRIP,2,qV,SizeOf(tStruct));

end;

procedure TMenuEngine.DrawText(const iLeft, iTop: Integer;
szText: PAnsiChar);
var
d3dRectangle : D3DRECT;
begin
d3dRectangle.x1:= ileft;
d3dRectangle.y1:= itop;
d3dRectangle.x2:= ileft + 130;
d3dRectangle.y2:= itop + 10;

fMenuFont.DrawTextA(nil, szText, -1, @d3dRectangle, 0{( DT_CALCRECT or DT_NOCLIP )}, dwTextColor);

end;

procedure TMenuEngine.DrawXhair;
var
viewP: D3DVIEWPORT9;
ScreenCenterX,ScreenCenterY: DWORD;
d3dRectangle1,d3dRectangle2: D3DRECT;
begin
// Get screen
Direct3DDevice.GetViewport(viewP);
ScreenCenterX:= ((viewP.Width div 2) - 1);
ScreenCenterY:= ((viewP.Height div 2) - 1);
//Set xhair params
d3dRectangle1.x1:= ScreenCenterX-10;
d3dRectangle1.y1:= ScreenCenterY;
d3dRectangle1.x2:= ScreenCenterX+ 10;
d3dRectangle1.y2:= ScreenCenterY+1;
d3dRectangle2.x1:= ScreenCenterX;
d3dRectangle2.y1:= ScreenCenterY-10;
d3dRectangle2.x2:= ScreenCenterX+ 1;
d3dRectangle2.y2:= ScreenCenterY+10;
//Draw crosshair
Direct3DDevice.Clear(1, @d3dRectangle1, D3DCLEAR_TARGET, XHairColor, 0, 0);
Direct3DDevice.Clear(1, @d3dRectangle2, D3DCLEAR_TARGET, XHairColor, 0, 0);
end;

function TMenuEngine.GetDevice: IDirect3DDevice9;
begin
Result:= Direct3DDevice;
end;

function TMenuEngine.GetFont: ID3DXFont;
begin
Result:= fMenuFont;
end;

procedure TMenuEngine.MenuItemAdd(iIndex: Integer; szText: PAnsiChar;
bOnOff: Boolean; bShowOnOff : Boolean = True);
begin
aItems[pred(iIndex)].strName:= szText;
aItems[pred(iIndex)].bOn:= bOnOff;
aItems[pred(iIndex)].bShowCheck:= bShowOnOff;
end;

procedure TMenuEngine.Render;
var
i: integer;
begin
if MenuVisable then
begin
if MenuHight = 0 then
MenuHight:= ((11 * MenuItems)+ 9);
DrawBoxAlpha;
for i:= 1 to MenuItems do
begin
If aItems[pred(i)].bShowCheck then
begin
TextColor:= $FF6746A3;
DrawText(MenuLeft + 5,(MenuTop + 5 + (i*11) - 11) , PChar(aItems[pred(i)].strName));
if i = 2 then
DrawPlus(XHairColor, (MenuLeft + MenuWidth) - 12 , (MenuTop + 5 + (i*11) - 11) + 2)
else
Case aItems[pred(i)].bOn of
True: DrawCheck($EE00FF00, (MenuLeft + MenuWidth) - 12 , (MenuTop + 5 + (i*11) - 11) + 2);
False: DrawDash($EEFF0000, (MenuLeft + MenuWidth) - 12 , (MenuTop + 5 + (i*11) - 11) + 2);
end;
end
else
begin
TextColor:= $FFCB7018;
DrawText(MenuLeft + 5,(MenuTop + 5 + (i*11) - 11) , PChar(aItems[pred(i)].strName));
end;
end;
end;
end;

procedure TMenuEngine.Reset(Const pDevice: IDirect3DDevice9);
begin
if Direct3DDevice <> pDevice then
begin
Direct3DDevice:= pDevice;
fMenuFont:= nil;
if fMenuFont = nil then
D3DXCreateFont(Direct3DDevice,10, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH or FF_DONTCARE, 'Terminal', fMenuFont);
end;
end;

end.


Usage:
Code:
MyMenu:= TMenuEngine.Create(20,20,100,18,1,$96000000,$FF000000,$FFCB7018);

Arguments: Create( Left, Top, Width, Hight, Items: Integer; BGColor, BDColor, TXTColor: Dword);

To add Items to your menu...

Code:
MyMenu.MenuItemAdd(1, 'Your Menu Item Text',True, False);

Arguments: MenuItemAdd( iIndex: Integer; szText: PAnsiChar; bOnOff: Boolean; bShowOnOff: Boolean = True);

To render your menu, just call it in a your hooked D3D9 function like this...

Code:
if MyMenu.Direct3DDevice <> Self then
MyMenu.Reset(Self);

if MyMenu.Menuvisable then
MyMenu.Render;

It has many nice features to make it easy to build multiple
menus and can auto size the hight of the menu depending on the amount
of items...

This is still work in progress, but will adding sprites and other cool stuff as I build it up..

Credits:
C++ snippets I have converted to delphi( 2 or 3 of them) not sure who
the original Authors of DrawTriangleAlpha and Tickbox but thanks..
EMO
EMO
EMO Team
EMO Team

Cinsiyet : Erkek
Burçlar : Yay
Yılan
Mesaj Sayısı : 184
Puan : 247393
Rep Puanı : 5
Doğum tarihi : 28/11/89
Kayıt tarihi : 18/05/11
Yaş : 34
Nerden : EMO world
İş/Hobiler : RCE Student / Game Hacking / Learn Beginner C#,C++,Delphi
Lakap : EMO

Sayfa başına dön Aşağa gitmek

Sayfa başına dön

- Similar topics

 
Bu forumun müsaadesi var:
Bu forumdaki mesajlara cevap veremezsiniz