Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Perfect World > PW Hacks, Bots, Cheats, Exploits
You last visited: Today at 13:24

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Someone understand something about ''D3D'' in Pascal ?

Discussion on Someone understand something about ''D3D'' in Pascal ? within the PW Hacks, Bots, Cheats, Exploits forum part of the Perfect World category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jun 2016
Posts: 38
Received Thanks: 0
Someone understand something about ''D3D'' in Pascal ?

So I want to create a menu in Perfect World windows , but I do not know where to start , I saw somethings about D3D but , I don't found noone teach well...

Someone could explain me a things about it ? Firstly , I wanted to know how insert in -Uses- it ''Direct3D9'' And ''D3DX9'' , When I pick up the code ready , Happened this error


[Fatal Error] Project2.dpr(15): File not found: 'D3DX9.dcu'
[Fatal Error] Project2.dpr(15): File not found: 'Direct3D9.dcu'
[Fatal Error] Project2.dpr(15): File not found: 'DXTypes.dcu

Here is the code

So I want to create a menu in Perfect World windows , but I do not know where to start , I saw somethings about D3D but , I don't found noone teach well...

Someone could explain me a things about it ? Firstly , I wanted to know how insert in -Uses- it ''Direct3D9'' And ''D3DX9'' , When I pick up the code ready , Happened this error


[Fatal Error] Project2.dpr(15): File not found: 'D3DX9.dcu'
[Fatal Error] Project2.dpr(15): File not found: 'Direct3D9.dcu'
[Fatal Error] Project2.dpr(15): File not found: 'DXTypes.dcu

Here is the code

--------------------------------------------------------------------------------------------------------------------------------------

nit 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 @Rectangle, 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_ALPHABLENDENAB LE,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, @Rectangle, 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, @Rectangle1, D3DCLEAR_TARGET, XHairColor, 0, 0);
Direct3DDevice.Clear(1, @Rectangle2, 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.

----------------------------------------------------------------------------------------------------------------



THX Peoples... o/
derleyvolt is offline  
Old 08/30/2016, 23:22   #2
 
Sᴡoosh's Avatar
 
elite*gold: 20
Join Date: May 2009
Posts: 1,290
Received Thanks: 326
You have a long way to go. Try not just copy pasting **** you find, and actually investing some time to learn, and not leech.
Sᴡoosh is offline  
Thanks
1 User
Old 09/01/2016, 15:32   #3
 
elite*gold: 0
Join Date: Jun 2016
Posts: 38
Received Thanks: 0
Yes, unfortunately , only time will kill my frustrations...

Thx Swoooosh o/
derleyvolt is offline  
Reply

Tags
d3d


Similar Threads Similar Threads
[Question] Pascal
09/29/2015 - Seafight - 5 Replies
yoo, I'm no longer playing seafight but still had a question and since some people in this section know some basic shit about pascal(scar) I thought let's ask it here;-) I'd like to know how to do a certain action: My script should click on some buttons and after X time it should click on another button(click on it once in 5-10 minutes) anyone here knows how to put this into a code? (just started studying pascal) greetz, edwin.
NEED HELP, PASCAL
03/13/2015 - General Coding - 3 Replies
Hello, is here someone who can help me with programming in Pascal? I need to help with programme which have to do system of linear equations via Gauss or Gauss Jordan elimination method. Thank you.
Pascal
10/06/2009 - General Coding - 12 Replies
Ja etwas spät sry Ich muss morgen ein Vortrag über ein Pascal Skript halten blos Irgendwie kann ich das Skript nicht ausführen ich mache es in notepad++ Speicher es als .pas ab aber er startet es dann nicht das Skript ist das. program Hallo; begin writeln('Hallo Welt'); end.



All times are GMT +1. The time now is 13:24.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.