basically the same way my old universal d3d menu does it. was one of the first menus i ever made, and it's bad ass XD works on any game that's d3d9-d3d11
This is the way i set up fonts in CA with a present hook...
also i'm not gonna be explaining hooks, drawing function's or how its set up =p so don't ask me at least.
Font.h
DllMain.cppCode:class cFont { public: LPD3DXFONT g_pFont; void FontManager (LPDIRECT3DDEVICE9 pDevice) { if (g_pFont) { g_pFont->Release(); g_pFont = NULL; } D3DXCreateFont( pDevice, 14, 0, FW_BOLD, 1, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &g_pFont ); } }Font;
Now just call them in you're present hook and youre good to go lolCode:void cooperativeStatus(LPDIRECT3DDEVICE9 pDevice) { HRESULT cooperativeStat = pDevice->TestCooperativeLevel(); switch (cooperativeStat) { case D3DERR_DEVICELOST: Sleep(1000); Font.g_pFont->OnLostDevice(); break; case D3DERR_DEVICENOTRESET: Font.g_pFont->OnResetDevice(); break; case D3DERR_DRIVERINTERNALERROR: break; case D3D_OK: //Do youre drawings here if (MenuShow) { RenderMenu(pDevice); } break; } }
Hope this helps some of youCode:HRESULT APIENTRY MyPresent ( LPDIRECT3DDEVICE9 pDevice, const RECT *pSourceRect, const RECT *pDestRect, HWND hDestWindowOverride, const RGNDATA *pDirtyRegion ) { _asm pushad; Font.FontManager(pDevice); cooperativeStatus(pDevice); _asm popad; return RealPresent(pDevice,pSourceRect,pDestRect,hDestWindowOverride,pDirtyRegion); }
if any of you code junkies think something is rong let me know lmao
basically the same way my old universal d3d menu does it. was one of the first menus i ever made, and it's bad ass XD works on any game that's d3d9-d3d11
commando: You're probably the best non-coder coder I know LOL
I can see that you try, but the I wouldnt use this on my base. The purpose of reset is to reset only when device is new or different, but in the implementation you have there, tho on track with some things which are not required. You see both functions u use can reset a font but in the first function 'FontManager' it is creating a new font every frame, which would be a very hard hit on performance. In the second frame, u have a sleep for a second in a rendering frame, i understand what you are trying to achieve here, but the implementation of it is somewhat out of place.
But it is a nice try, good work either way.
I just like programming, that is all.
Current Stuff:
- GPU Programmer (Cuda)
- Client/Server (Cloud Server)
- Mobile App Development
ieatyourlvllol (12-12-2013)
hahaha thanks i understand, ill fix that for myself you know...the only thing i thought about that could be wrong with this is the way i was recreating that font in fontmgr and you nailed it lmao xD and about that sleep func idk...something about wasteing data without it....idk i read to much random stuffs from google xD
Sleep is used to put a thread on somewhat of a pause or yield to another thread. Sleeping or other thread waiting method in a Rendering/GUI is not recommended where it is "ballz to the wallz" to get everything done in 16ms(1000ms / 60 : the refresh rate of a 60Hz monitor). Sleeping for anytime can dramatically affect the time it have to do this.
With that lesson learnt there is also no reason to sleep before lost device
I just like programming, that is all.
Current Stuff:
- GPU Programmer (Cuda)
- Client/Server (Cloud Server)
- Mobile App Development