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 › Getting started with D3D9

Getting started with D3D9

Posts 1–5 of 5 · Page 1 of 1
K^2
K^2
Getting started with D3D9
Hey guys.

Can anyone recommend some good and thorough tutorials on programming some Direct X 9 stuff (in c++). I've searched around the internet and can't find any decent ones that are tutorials on drawing stuff over a game.

I would like to start by drawing text over a game. Literally "Hello world!" in the top right corner of the screen when in game or something.

I would be using GTA: San Andreas which used Direct X 9.

Thanks guys!
#1 · 11y ago
lvous
lvous
just look at other menu sources or something, this should work:

drawing text:
Code:
//top of your project:
LPD3DXFONT Directx_Font;

VOID DrawText(LPDIRECT3DDEVICE9 Device, INT x, INT y, DWORD color, CHAR *text)
{
	RECT rect;
	SetRect(&rect, x, y, x + 100, y);
	Directx_Font->DrawText(NULL, text, -1, &rect, DT_CENTER | DT_NOCLIP, color);
}

//in endscene:
if (Directx_Font == NULL)
D3DXCreateFontA(Device, 14, 0, FW_BOLD, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &Directx_Font);

if (Directx_Font)
DrawText(Device, 10, 10, D3DCOLOR_ARGB(255, 255, 255, 249), "Hello world!");


//in reset:
if (Directx_Font)
Directx_Font->OnLostDevice();

HRESULT iReturnValue = OrigReset(Device, Params);

if (iReturnValue == D3D_OK)
{
	if (Directx_Font)
	Directx_Font->OnResetDevice();
}
drawing sprites:
Code:
bool SpriteCreated0 = NULL;
LPDIRECT3DTEXTURE9 IMAGE0;
LPD3DXSPRITE SPRITE0;
D3DXVECTOR3 ImagePos0;

//in endscene:
if (SpriteCreated0 == FALSE)
{
	D3DXCreateTextureFromFile(Device, "yourpng.png", &IMAGE0); //place png in game dir
	SpriteCreated0 = TRUE;
}
	D3DXCreateSprite(Device, &SPRITE0);

	ImagePos0.x = 100; //(int)ModelInfo[i]->Position2D.x;
	ImagePos0.y = 100 //(int)ModelInfo[i]->Position2D.y;
	ImagePos0.z = 0.0f;

	SPRITE0->Begin(D3DXSPRITE_ALPHABLEND);
	SPRITE0->Draw(IMAGE0, NULL, NULL, &ImagePos0, 0xFFFFFFFF);
	SPRITE0->End();
	if (SPRITE0 != NULL){SPRITE0->Release();}SPRITE0 = NULL ;
#2 · edited 11y ago · 11y ago
K^2
K^2
Thanks for your reply Ivous. The reason I wanted tutorials was because I'm not familiar with Direct X 9 code; I don't know how to get the device of the game or anything.

When I followed your code I understood that I need I possiblly need to hook the endscene and reset functions (Which I assumed because of "in endscene:" etc and I can do that) but I'm getting errors on the device pointer here:

Code:
//in endscene:
if (Directx_Font == NULL)
D3DXCreateFontA(Device, 14, 0, FW_BOLD, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &Directx_Font);

	if (Directx_Font)
	DrawText(Device, 10, 10, D3DCOLOR_ARGB(255, 255, 255, 249), "Hello world!");
and here:

Code:
HRESULT iReturnValue = Reset(Device, Params);
Because I don't know how to get the device in the first place then I can't point to it and as for the params parameter in:

Code:
Reset(Device, Params);
I have no idea what to pass it.

Thanks again.
#3 · edited 11y ago · 11y ago
lvous
lvous
can't give you a tutorial but you can use findpattern to find the d3d device, there is a d3d hook example in my signature
Code:
hD3D = (DWORD)GetModuleHandleA("d3d9.dll");
..
FindPattern(hD3D, 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx");
..
#4 · 11y ago
K^2
K^2
Thanks again Ivous but I think I'm going to just step away from D3D all together, what's the point if I don't understand any of it, I didn't have a clue what to do after using the snippet you posted last.

I really don't understand why there isn't a tutorial for what I'm wanting to learn. All the tutorials I've seen have been about creating a windows form and displaying graphics in that not about hooking a game and displaying text over it and what not.

Ugh the internet is a weird place. You get people thata waltz on in and ask for everything to be done for them and they get told to RTFM and then you get the people who actually want to learn but can't find any good, thorough tutorials on what they want to learn.

Thanks again.
#5 · 11y ago
Posts 1–5 of 5 · Page 1 of 1

Post a Reply

Similar Threads

  • Getting Started With Visual C++/CLIBy Hassan in Programming Tutorials
    44Last post 5y ago
  • [Tutorial] Getting Started With a On Screen KeyBoardBy CoderNever in Visual Basic Programming
    11Last post 16y ago
  • Getting started with Mw 2 MPGHBy lolbie in Call of Duty Modern Warfare 2 Private Servers
    27Last post 16y ago
  • Getting started with Uniform Spatial Subdivision.By bubblesppf in C++/C Programming
    0Last post 15y ago
  • Getting Started With C++ [Solved]By Cehk! in C++/C Programming
    6Last post 14y ago

Tags for this Thread

#c++#direct3d#draw#drawing#game#process