Directx Menu (Help Fixing The Code Please)

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

programmer

Jr.Coder
Full Member
Nobleman
Jul 15, 2012
46
422
2
C++:
#include "Hacks.h"


int MenuIndex = 0;

D3DCOLOR fontRed = D3DCOLOR_ARGB(255, 255, 0, 0);
D3DCOLOR fontGreen = D3DCOLOR_ARGB(255, 0, 255, 0);
D3DCOLOR fontBlue = D3DCOLOR_ARGB(255, 0, 0, 255);
D3DCOLOR fontWhite = D3DCOLOR_ARGB(255, 255, 255, 255);
D3DCOLOR fontBlack = D3DCOLOR_ARGB(255, 0, 0, 0);

void Hacks::CreateFont(IDirect3DDevice9 *d3dDevice, std::string choiceFont)
{
	D3DXCreateFont(d3dDevice, 20, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET,
		      OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
				  choiceFont.c_str(), &Font);
}

void Hacks::InitializeMenuItems()
{
	hack[WALLHACK].name = " WallHack And Chams ";
	hack[CUSTOM_CROSSHAIR].name = " Show custom crosshair ";
	hack[NO_RECOIL].name = " No Recoil ";
	hack[UNLIMITED_AMMO].name = " UNLIMITED AMMO ";
	hack[AUTO_FIRE].name = " All Guns Automatic ";
	hack[HIDE_MENU].name = " Hide hacks[INSERT] ";
	hack[HIDE_MENU].on = false;


}

void Hacks::Draw_Text(LPCSTR TextToDraw, int x, int y, D3DCOLOR Color)
{
	RECT rct = {x - 120, y, x + 120, y + 15};
	Font->DrawTextA(NULL, TextToDraw, -1, &rct, DT_NOCLIP, Color);
}

void Hacks::DrawMenu(IDirect3DDevice9 *d3dDevice)
{
	if(!hack[HIDE_MENU].on)
	{
		DrawFilledRectangln(55, 20, 200, 50, fontBlue, d3dDevice);
		DrawBorderBox(55, 20, 200, 50, 4, fontBlack, d3dDevice);
		Draw_Text("GAME NAME HERE", 190, 30, fontWhite);

		DrawFilledRectangln(30, 55, 250, (62*MAX_MENU_ITEMS), fontBlue, d3dDevice);
		DrawBorderBox(30, 55, 250, (62*MAX_MENU_ITEMS), 6, fontBlack, d3dDevice);

		int y = 40;
		for(int i = 0; i < MAX_MENU_ITEMS; i ++)
		{
		DrawFilledRectangln(45, 30+y, 220, 40, hack[i].on ? fontGreen : fontRed, d3dDevice);
		DrawBorderBox(45, 30+y, 220, 40, 4, fontBlack, d3dDevice);

		if(MenuIndex == i)
		{
			DrawBorderBox(41, 26+y, 228, 48, 4, fontWhite, d3dDevice );
		}

		Draw_Text(hack[i].name.c_str(), 170, 39+y, fontBlack);
		y+=50;
		}
		Draw_Text("Select using arrow keys", 170, ((62*MAX_MENU_ITEMS)+7), fontWhite);
		Draw_Text("Turn ON/OFF [END] key", 170, ((62*MAX_MENU_ITEMS)+27), fontWhite);
	}



}

void Hacks::DrawFilledRectangln(int x, int y, int w, int h, D3DCOLOR color, IDirect3DDevice9* d3dDevice)
{
	D3DRECT rct = {x, y, x + w, y + h};
	d3dDevice->Clear(1, &rct, D3DCLEAR_TARGET | D3DCLEAR_TARGET, color, 0, 0);
}

void Hacks::DrawBorderBox( int x, int y, int w, int h, int thickness, D3DCOLOR color, IDirect3DDevice9 *d3dDevice)
{
	DrawFilledRectangln(x, y, w, thickness, color, d3dDevice);

	DrawFilledRectangln(x, y, thickness, h, color, d3dDevice);

	DrawFilledRectangln(x+w, y, thickness, h, color, d3dDevice);

	DrawFilledRectangln(x, y+h, w+thickness, thickness, color, d3dDevice);


}

void Hacks::KeyboardInput()
{
	if(GetAsyncKeyState(VK_UP)&1)
	{
		if(MenuIndex > 0)
		{
		MenuIndex--;
		}
	}
	if(GetAsyncKeyState(VK_DOWN)&1)
	{
		if(MenuIndex > MAX_MENU_ITEMS-1)
		{
		MenuIndex++;
		}
	}
	if(GetAsyncKeyState(VK_END)&1)
	{
		hack[MenuIndex].on = !hack[MenuIndex].on;
	}
	if(GetAsyncKeyState(VK_INSERT)&1)
	{
		hack[HIDE_MENU].on = !hack[HIDE_MENU].on;
	}
}
 

Crazywink

Hacker
Meme Tier VIP
Dank Tier Donator
Jul 18, 2012
626
4,613
17
if you can do code brackets around your code you posted it would help a lot for us to read. :) I'm looking at it now..
 

programmer

Jr.Coder
Full Member
Nobleman
Jul 15, 2012
46
422
2
The Problem That When I Inject It , It Shows Me Blue Board Without Any Texts And Buttons .

But It Says 1 success 0 Fails .
 

Crazywink

Hacker
Meme Tier VIP
Dank Tier Donator
Jul 18, 2012
626
4,613
17
Hmm.. I don't see anything wrong initially.. Can you include your header source too please?
 

programmer

Jr.Coder
Full Member
Nobleman
Jul 15, 2012
46
422
2
Header source :

C++:
#pragma once


#include <Windows.h>
#include "d3d9.h"
#include <ctime>
#include <iostream>

#define D3DHOOK_TEXTURES
#define MAX_MENU_ITEMS 6

#define WALLHACK 0
#define CUSTOM_CROSSHAIR 1
#define NO_RECOIL 2
#define UNLIMITED_AMMO 3
#define AUTO_FIRE 4
#define HIDE_MENU 5


class Hacks
{
public:
	int m_stride;
	void Hacks::CreateFont(IDirect3DDevice9 *d3dDevice, std::string choiceFont);
	void Hacks::InitializeMenuItems();
	void Hacks::Draw_Text(LPCSTR TextToDraw, int x, int y, D3DCOLOR Color);
	void Hacks::DrawMenu(IDirect3DDevice9 *d3dDevice);
	void Hacks::DrawFilledRectangln(int x, int y, int w, int h, D3DCOLOR color, IDirect3DDevice9* d3dDevice);
	void Hacks::DrawBorderBox( int x, int y, int w, int h, int thickness, D3DCOLOR Color, IDirect3DDevice9 *d3dDevice);
	void Hacks::KeyboardInput();

	LPDIRECT3DTEXTURE9 textRed;
	LPDIRECT3DTEXTURE9 textGreen;

	LPDIRECT3DTEXTURE9 textBlue;
	LPDIRECT3DTEXTURE9 textWhite;

	D3DVIEWPORT9 ViewPort;

	LPD3DXFONT Font;

	struct d3dMenuHack
	{
		bool on;
		std::string name;
	};

	d3dMenuHack hack[MAX_MENU_ITEMS];
};

Please start using the Source button(#) when pasting code
 

Crazywink

Hacker
Meme Tier VIP
Dank Tier Donator
Jul 18, 2012
626
4,613
17
This is really strange, I can't see a single thing wrong.. What are you injecting this into?
 

programmer

Jr.Coder
Full Member
Nobleman
Jul 15, 2012
46
422
2
Call Of Duty 4 Modern Warfare
And Also I Tried To Combat Arms Europe
 

programmer

Jr.Coder
Full Member
Nobleman
Jul 15, 2012
46
422
2
I fixed it :
I added the wall hack source and it worked very good and the second thing was i wrote texRed ->textRed & texBlue -> textBlue & texGreen->textGreen....
(text* is wrong)
 

Departure

Newbie
Full Member
Jun 24, 2012
21
272
1
Where you resetting? Font.OnLostDevice, Font.OnResetDevice, normally hooking the DirectX function Reset is good place to do this without getting detected(depending on AntiCheat Engine)
 

justintcs

Newbie
Full Member
Jul 13, 2012
30
302
0
programmer said:
The Problem That When I Inject It , It Shows Me Blue Board Without Any Texts And Buttons .

But It Says 1 success 0 Fails .
What blue board, can you upload the screen shot?
 

m0v

Jr.Coder
Full Member
Nobleman
Jun 11, 2012
54
402
0
I think the problem was draw_text he didn't note that fleep changed it to drawtext maybe that's the reason why it didn't draw the text because the function wasn't called correct

Edit:

Sry my fault seems like everything is ok about the function
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods League of Legends Accounts