D3D Menu Design

Posts 115 of 15 · Page 1 of 1
D3D Menu Design
I am looking for a bit of advice with D3D Menus.

I coded a little bit of D3D from the ground up, but D3D Menus are a little confusing because they are injected into an already running game. I thought about creating a new D3DDEVICE, but wouldn't that just completely override the games screen? So what would I need to do? Find the pointer to the D3D device in the games code, etc? Please help :P
DirectDraw for menu's = epic
but decrapitated and doesnt work too well on nvidia cards ;(

I think using 2 D3D devices will conflict due to them both wanting to have focus.

edit: Windows 7 has Direct2D as replacement for DirectDraw.
You dont need to create another device for a basic d3d menu. All you need to hook is endscene in most games.
Quote Originally Posted by zhaoyun333 View Post
You dont need to create another device for a basic d3d menu. All you need to hook is endscene in most games.
Hmmmm... good idea thanks ;P

Thanks for the tips.
Code:
void DrawString(int x, int y, DWORD color, LPD3DXFONT g_pFont, const char *fmt, ...)
{
	if(g_pFont == NULL) { return; }

	RECT FontPos = { x, y, x + 120, y + 16 };
	char buf[1024] = {'\0'};
	va_list va_alist;

	va_start(va_alist, fmt);
	vsprintf_s(buf, fmt, va_alist);
	va_end(va_alist);

	g_pFont->DrawText(NULL, (LPCWSTR)buf, -1, &FontPos, DT_NOCLIP, color);
}
For drawing text.

Would be,
Code:
DrawString(Menu.x,Menu.y,D3DCOLOR_ARGB(255,255,255,255),g_pFont,Menu.title); //only reason its menu.x, menu.y, and menu.title, Is bc i declared them in a struct earlier. ;P


Code:
void DrawRect( int x, int y, int w, int h, D3DCOLOR color,LPDIRECT3DDEVICE9 pDevice)
{
	if(pDevice == NULL) { return; }

	D3DRECT BarRect = { x, y, x + w, y + h }; 
	pDevice->Clear(1, &BarRect, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, color, 0,  0); 
}
For drawing a rectangle.

Code:
DrawRect(Menu.x - 5,Menu.y - 5,180,270,D3DCOLOR_ARGB(200,216,216,216),pDevice);
Some D3DColors:
Code:
GenerateTexture(Device_Interface, &texGreen , D3DCOLOR_ARGB(255,0,255,0));
GenerateTexture(Device_Interface, &texRed , D3DCOLOR_ARGB(255,255,0,0));
GenerateTexture(Device_Interface, &texBlue , D3DCOLOR_ARGB(255,0,0,255));
GenerateTexture(Device_Interface, &texOrange , D3DCOLOR_ARGB(255,255,165,0));
GenerateTexture(Device_Interface, &texYellow , D3DCOLOR_ARGB(255,255,255,0));
GenerateTexture(Device_Interface, &texPink , D3DCOLOR_ARGB(255,255,192,203));
GenerateTexture(Device_Interface, &texCyan , D3DCOLOR_ARGB(255,0,255,255));
GenerateTexture(Device_Interface, &texPurple , D3DCOLOR_ARGB(255,160,32,240));
GenerateTexture(Device_Interface, &texBlack , D3DCOLOR_ARGB(255,0,0,0));
GenerateTexture(Device_Interface, &texWhite , D3DCOLOR_ARGB(255,255,255,255));
GenerateTexture(Device_Interface, &texSteelBlue , D3DCOLOR_ARGB(255,33,104,140));
GenerateTexture(Device_Interface, &texLightSteelBlue, D3DCOLOR_ARGB(255,201,255,255));
GenerateTexture(Device_Interface, &texLightBlue , D3DCOLOR_ARGB(255,26,140,306));
GenerateTexture(Device_Interface, &texSalmon , D3DCOLOR_ARGB(255,196,112,112));
GenerateTexture(Device_Interface, &texBrown , D3DCOLOR_ARGB(255,168,99,20));
GenerateTexture(Device_Interface, &texTeal , D3DCOLOR_ARGB(255,38,140,140));
GenerateTexture(Device_Interface, &texLime , D3DCOLOR_ARGB(255,50,205,50));
GenerateTexture(Device_Interface, &texElectricLime , D3DCOLOR_ARGB(255,204,255,0));
GenerateTexture(Device_Interface, &texGold , D3DCOLOR_ARGB(255,255, 215, 0));
GenerateTexture(Device_Interface, &texOrangeRed , D3DCOLOR_ARGB(255,255,69,0));
GenerateTexture(Device_Interface, &texGreenYellow , D3DCOLOR_ARGB(255,173,255,47));
GenerateTexture(Device_Interface, &texAquaMarine , D3DCOLOR_ARGB(255,127,255,212));
GenerateTexture(Device_Interface, &texSkyBlue , D3DCOLOR_ARGB(255,0,191,255));
GenerateTexture(Device_Interface, &texSlateBlue , D3DCOLOR_ARGB(255,132, 112, 255));
GenerateTexture(Device_Interface, &texCrimson , D3DCOLOR_ARGB(255,220,20,60));
GenerateTexture(Device_Interface, &texDarkOliveGreen, D3DCOLOR_ARGB(255,188,238,104 ));
GenerateTexture(Device_Interface, &texPaleGreen , D3DCOLOR_ARGB(255,154,255, 154));
GenerateTexture(Device_Interface, &texDarkGoldenRod , D3DCOLOR_ARGB(255,255, 185, 15 ));
GenerateTexture(Device_Interface, &texFireBrick , D3DCOLOR_ARGB(255,255,48,48));
GenerateTexture(Device_Interface, &texDarkBlue , D3DCOLOR_ARGB(255,0,0,204));
GenerateTexture(Device_Interface, &texDarkerBlue , D3DCOLOR_ARGB(255,0,0,153));
GenerateTexture(Device_Interface, &texDarkYellow , D3DCOLOR_ARGB(255,255,204,0));
GenerateTexture(Device_Interface, &texLightYellow , D3DCOLOR_ARGB(255,255,255,153));
http://www.colorpicker.com/
For more ARGB's. Hope I helped.

EDIT:
Beginning of the rendering menu:
Code:
void RenderMenu(LPDIRECT3DDEVICE9 pDevice, LPD3DXFONT g_pFont)
{
	if(pDevice == NULL || g_pFont == NULL) { return; }

	if (GetAsyncKeyState(VK_INSERT)&1){ CH_Menu = !CH_Menu; }

	if (CH_Menu)
	{
		// How Many Hacks //
		SetHighlights(Menu.maxitems);
Hey Thanks for the colors. That should help out a lot
I think the hard part is form a working method to handle the selected menu item. Also, the on and off control.

Other than that, the rest is fairly simple.
Code:
//for setting highlights
void SetHighlights(int menusize)
{
	if(GetAsyncKeyState(VK_UP)&1)
	{
		for(int i=0; i < menusize+1; i++)
		{
			if (highlight[i] == 1)
			{
				int a = i-1;

				if(a < 0)
					break;

				else
				{
					highlight[a]=1;
					highlight[i]=0;
					break;
				}
			}
		}
	}

	if(GetAsyncKeyState(VK_DOWN)&1)
	{
		for(int i=0; i < menusize+2; i++)
		{
			if (highlight[i] == 1)
			{
				int a = i+1;

				if(a > menusize)
					break;

				else
				{
					highlight[a]=1;
					highlight[i]=0;
					break;
				}
			}
		}
	}
}
Hey all I'm back after a long time being away

anyway Hans211's menu is a good example of a proper functional menu
I assume u know what it does but just an example
in endscene, the class is instantiated in which your menus are drawn and switch states are reset
inside the menu sources u can easily change or add new colors and functions to it provided u know where to look

a simpler way would just be to use coordinates to place your test and options but I know u would want to make a smexy looking menu
good luck why06 on your menu
Quote Originally Posted by falzarex View Post
Hey all I'm back after a long time being away

anyway Hans211's menu is a good example of a proper functional menu
I assume u know what it does but just an example
in endscene, the class is instantiated in which your menus are drawn and switch states are reset
inside the menu sources u can easily change or add new colors and functions to it provided u know where to look

a simpler way would just be to use coordinates to place your test and options but I know u would want to make a smexy looking menu
good luck why06 on your menu
Good to see you back falvarex!

I am trying to get the Design of the submenu right now and working on acquiring the device pointer. Also David is helping too, in fact he's done more work then me on it, guess he's a little shy.

I am looking at a bunch of other menu's now, which is taking a while since there's 0 documentation and hardly any comments in the code, The way it looks I might end up relying heavily on Azorbix's detour class at first, unless I could implement my own detour.
Just asking but what kind of menu do u plan on making?
pure keyboard menu with off,on options and folders?
Or mouse menus with checkboxes and stuff
just an idea but it would be cool to implement a slider control fully drawn in the menu

actually poking around with the menu codes and trying each of them out with your own hook can allow you to understand how it works better and it's internal functions and stuff

anyway i would like to see the endproduct and it's versatility in the sense that more custom controls could be easily implemented
Design each component speratly, I.e make a control class, buttons should inherit control class, and windows should inherit a panel class which inherit a control class.

Sorry for the crappy reply, just trying to boost post count.
Right now it will be a text base menu navigatable by the keyboard. I always liked those better anyhow. However there are menus like this already, so the real point is to understand the design of my menu very well so that I can upgrade it to use pictures, boxes and other things. And be able to use it on a variety of games. Basically Im trying to develop a D3DMenu that I can build on and use throughout my hacking career. Right now I just need it to make pubs, but the reason IM creating this instead of using someone else's is that when I need to create a VIP hack or so forth, I will have a good solid understanding to work with for more advanced menu designs. So its a long term project.
x, 1, x
3, 2, 3
x, 1, x

Make every x a seperate picture. that way you can stretch 1,2,1(top to bottom) on the X axis for wider window(without raping proportions) and stretch 3,2,3 on the Y axis for a higher window.

Thats how I used to do it.
@why06
ahh text based menus was what I started off with first
mine used to be the one where your selected option is highlighted and I placed my options via coordinates

@HD
drawing a canvas on screen?
Posts 115 of 15 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?