Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › C++/C Programming › D3D GUI Interface

D3D GUI Interface

Posts 1–15 of 16 · Page 1 of 2
radnomguywfq3
radnomguywfq3
D3D GUI Interface
Currently, I'm developing a GUI editor in C++ using DirectX, and I've created a couple of classes some people may find useful. Soon, I will be releasing the whole project, but at the moment, you may find these objects I've created useful. I'm not going to bother explaining it until I've completed the GUI editor, when I do finish it though, there will be an indepth description of all the methods and how to use the GUIEditer to compile GUIs and how to use the GUIReader library(which I will be creating) that you can use to read and display the GUIs created with the GUIEditor. Please note the below code isn't finished nor cleaned up. There are some parts were I was really lazzy and defined variabled that are constant over and over in the Render methods.

Form.h
[highlight=cpp]#pragma once

#include "stdafx.h"
#include <windows.h>
#include "d3d9.h"
#include "d3dx9.h"
#include "Button.h"
class Form {
private:
LPDIRECT3DSURFACE9 surface;
LPD3DXFONT d3dFont;
char caption[100];
int buttonCount;
bool visible;
D3DCOLOR bgrColor;
D3DCOLOR capColor;
RECT destRect;
RECT capBounds;

public:
Button* childButtons[100]; //You sure as hell shouldn't ever need more then 100 buttons..
Form(LPDIRECT3DDEVICE9 d3dDev, D3DCOLOR srcBgrColor, D3DCOLOR srcCapColor, RECT srcDestRect, char *srcCaption, bool vis);
void AddButton(Button *btn);
bool isVisible();
int Save(char* path);
void Render(LPDIRECT3DDEVICE9 d3dDev, LPDIRECT3DSURFACE9 destSurface);
void SetVisible(bool vis);

};[/highlight]Form.cpp
[highlight=cpp]
#include "stdafx.h"
#include "Form.h"
Form::Form(LPDIRECT3DDEVICE9 d3dDev, D3DCOLOR srcBgrColor, D3DCOLOR srcCapColor, RECT srcDestRect, char* srcCaption, bool vis)
{
strcpy(caption, srcCaption);
visible = vis;
buttonCount = 0;

destRect = RECT(srcDestRect);
capBounds = RECT(destRect);
capBounds.left = 0;
capBounds.top = 0;
capBounds.bottom = 20;

//REWRITE BELOW METHOD


D3DXCreateFont( d3dDev, 12, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH | FF_DONTCARE, TEXT("Arial"), &d3dFont );

d3dDev->CreateOffscreenPlainSurface(srcDestRect.right - srcDestRect.left, srcDestRect.bottom - srcDestRect.top,
D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &surface, NULL);

bgrColor = srcBgrColor;
capColor = srcCapColor;
}
void Form::AddButton(Button *btn) {
childButtons[buttonCount] = btn;
buttonCount++;
}
bool Form::isVisible()
{
return visible;
}
int Form::Save(char* path) {
//This is gunna be a hell of a method :X
return 1;
}

void Form::Render(LPDIRECT3DDEVICE9 d3dDev, LPDIRECT3DSURFACE9 d3dSurface) {
if(!visible)
return;

RECT capRendLoc = RECT(capBounds);
capRendLoc.left += destRect.left + 20;
capRendLoc.top += destRect.top + 3;
capRendLoc.right = capRendLoc.left + (10 * strlen(caption));
capRendLoc.bottom = capRendLoc.top + 10;

d3dDev->ColorFill(surface, NULL, bgrColor);
d3dDev->ColorFill(surface, &capBounds, capColor);

for(int i = 0; i < buttonCount; i++)
childButtons[i]->Render(d3dDev, surface, destRect);

d3dDev->StretchRect(surface, NULL, d3dSurface, &destRect, D3DTEXF_NONE);
d3dFont->DrawTextA(NULL, caption, -1, &capRendLoc, 0, D3DCOLOR_XRGB(0,0,0));


}

void Form::SetVisible(bool vis) {
visible = vis;
}
[/highlight]Button.h
[highlight=cpp]
#pragma once
#include "stdafx.h"
#include "d3d9.h"
#include "d3dx9.h"
#include "windows.h"


class Button {
private:
void (*methodToExecute)();
char caption[100]; //You shouldn't have a captions larger then 100 characters, but if you do Feel free to change this.
bool visible;
RECT destRect;
LPD3DXFONT d3dFont;
LPDIRECT3DSURFACE9 surface;
public:
Button(LPDIRECT3DDEVICE9 d3dDev, void *srcMethodToExecute, char* caption, int x, int y, bool vis);
void Button::SetCaption(char* srcCaption);
bool isVisible();
void SetVisible(bool vis);
void SetRect(RECT &newRect);
void Render(LPDIRECT3DDEVICE9 d3dDev, LPDIRECT3DSURFACE9 d3dSurface, RECT frmRect);
};
[/highlight]
button.cpp

[highlight=cpp]
#include "stdafx.h"
#include "Button.h"
#include "rectTools.h"
#include <windows.h>
#define _CRT_SECURE_NO_WARNINGS
Button::Button(LPDIRECT3DDEVICE9 d3dDev, void *srcMethodToExecute, char* srcCaption, int x, int y, bool vis) {

strncpy(caption, srcCaption, sizeof(caption));
this->visible = vis;
destRect.top = y;
destRect.left = x;
destRect.right = destRect.left + strlen(caption) * 10;
destRect.bottom = destRect.top + 20;



D3DXCreateFont( d3dDev, 12, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH | FF_DONTCARE, TEXT("Arial"), &d3dFont );

HRESULT res = d3dDev->CreateOffscreenPlainSurface(destRect.right, destRect.bottom, D3DFMT_X8R8G8B8,
D3DPOOL_DEFAULT, &surface, NULL);

methodToExecute = (void (__cdecl *)())srcMethodToExecute;
}

void Button::SetRect(RECT &newRect) {
destRect = RECT(newRect);
}

void Button::SetVisible(bool vis) {
visible = vis;
}

void Button::Render(LPDIRECT3DDEVICE9 d3dDev, LPDIRECT3DSURFACE9 d3dSurface, RECT frmRect) {
if(!isVisible())
return;

POINT mPos;
D3DCOLOR btnColor = D3DCOLOR_XRGB(200,200,200);
GetCursorPos(&mPos);

RECT posTestRect(destRect);
posTestRect.left += frmRect.left;
posTestRect.top += frmRect.top;
posTestRect.right += frmRect.left;
posTestRect.bottom += frmRect.top;
if(isInRect(mPos, posTestRect)) {
btnColor = D3DCOLOR_XRGB(100,100,200);
if(GetAsyncKeyState(VK_LBUTTON) & 0x8000)
methodToExecute();
}


RECT btnRect = RECT(destRect);
btnRect.left += 2;
btnRect.right -= 2;
btnRect.top += 2;
btnRect.bottom -= 2;
d3dDev->ColorFill(d3dSurface, &destRect, D3DCOLOR_XRGB(0,0,0));
d3dDev->ColorFill(d3dSurface, &btnRect, btnColor);
}
bool Button::isVisible(){
return visible;
}
void Button::SetCaption(char* srcCaption) {
strncpy(caption, srcCaption, sizeof(caption));
}
[/highlight]
#1 · edited 15y ago · 17y ago
JE
jeremy6996
Thanks jetamay, I hope other people actually read this fucking thread.
#2 · 17y ago
SY
Synns
Quote Originally Posted by jeremy6996 View Post
Thanks jetamay, I hope other people actually read this fucking thread.
Posting in your own thread?

Come on .
#3 · 17y ago
Obama
Obama
Quote Originally Posted by Longevity View Post
Posting in your own thread?

Come on .
There the same people lol?
#4 · 17y ago
apezwijn
apezwijn
Is this like a menu?
#5 · 17y ago
NatureSkillz
NatureSkillz
u know, i always wanted to make a D3d GUI ^^
#6 · 17y ago
[D]evliin
[D]evliin
cheers helped alot
#7 · 17y ago
UL
ultimate-tester
Can you tell me where I can find the rectTools.h file or class?
#8 · 17y ago
NatureSkillz
NatureSkillz
google, or use search at your pc
#9 · 17y ago
SY
Synns
I need 101 buttons .
#10 · 17y ago
UL
ultimate-tester
Just gimme the recttools file! I used google, but my google seems to fail! The file is NOT included in the directX sdk as far as I know. And he uses " instead of < and > to include it, so it must be a custom file! Please post it here!! i really need this
#11 · 17y ago
radnomguywfq3
radnomguywfq3
Quote Originally Posted by ultimate-tester View Post
Just gimme the recttools file! I used google, but my google seems to fail! The file is NOT included in the directX sdk as far as I know. And he uses " instead of < and > to include it, so it must be a custom file! Please post it here!! i really need this
<> means it's from the compiler's directives, "" means it from the project directive. Anyway, I updated this for my game engine, so I'll be posting that instead sometime next week. The rectTools is a source file I programmed myself. To be honest, this class wasn't really 100% completed, it will be next week and I'll post the whole thing.
#12 · edited 17y ago · 17y ago
UL
ultimate-tester
Well yes, I know c++ That's why I asked you the file! LOOK:

#include "rectTools.h"

(between " and not <>
#13 · 17y ago
breeze
breeze
could of been written better, but this is a nice share xD

going to work on a gui class with this one
#14 · 17y ago
breeze
breeze
Quote Originally Posted by ultimate-tester View Post
Just gimme the recttools file! I used google, but my google seems to fail! The file is NOT included in the directX sdk as far as I know. And he uses " instead of < and > to include it, so it must be a custom file! Please post it here!! i really need this
Try this

[php]

#ifndef MYRECTTOOLS_H
#define MYRECTTOOLS_H
#ifndef MAC_PLATFORM
#include "PIHeaders.h"
#endif

/**
* Function for Activation of Sign Tool
*/
extern ACCB1 void ACCB2 ActivateSignTool (void *clientData);

/**
* Function for Activation of SignExpert Tool
*/
//extern ACCB1 void ACCB2 ActivateSignExpertTool (void *clientData);

/**
* Sets up the Tool for SignMode
*/
extern void SetUpSignTool(void);


#endif /* MYRECTTOOLS_H */[/php]
#15 · 17y ago
Posts 1–15 of 16 · Page 1 of 2

Post a Reply

Similar Threads

  • [Help] D3DBy SpiderByte in WarRock - International Hacks
    7Last post 20y ago
  • New D3D Hack has been released!By Dave84311 in Hack/Release News
    23Last post 17y ago
  • Loading Interface... Problems =(By doratehexploda in Gunz General
    13Last post 20y ago
  • WR D3D Hook - =o - 03/22/07By Dave84311 in Hack/Release News
    14Last post 18y ago
  • D3D Hack (Old)By PBFUCKER in WarRock - International Hacks
    10Last post 19y ago

Tags for this Thread

#d3d#gui#interface