Results 1 to 7 of 7

Threaded View

  1. #1
    |-|3|_][({}PT3R12's Avatar
    Join Date
    Nov 2008
    Gender
    male
    Location
    UnkwOwnS
    Posts
    449
    Reputation
    12
    Thanks
    472
    My Mood
    Twisted

    Angry Font Controller?



    With the problem being one of those that is always reoccurring, I was hoping someone would explain a new method or old method to me..

    I've done this plenty of ways, one being just a simple creation method (In Present or EndScene)
    Code:
    if(MyFont == NULL || !MyFont)
    {
        if(!IsBadReadPtr((void*)MyFont, sizeof(MyFont))
             MyFont->Release();
    
        Created = false;
    }
    if(!Created)
    {
        D3DXCreateFont(....&MyFont);
        Created = true;
    }
    I have also looked around the forum and talked to some friends and they said to use something that I believe originated from Gellin (Didn't work either)

    With pDeviceFontBuffer being defined as: LPDIRECT3DDEVICE9 pDeviceFontBuffer;
    Code:
    if(pFont == NULL || TabFont == NULL)
    	{
    		D3DXCreateFontA(.......&pFont);
    		D3DXCreateFontA(.......&TabFont);
    	}
    	else
    	{
    		if(pDeviceFontBuffer != pDevice)
    		{
    			pDeviceFontBuffer = pDevice;
    
    			try
    			{
    				if(pFont != 0 || TabFont != 0){ pFont->Release(); TabFont->Release(); }
    
    			} catch (...) {}
    
    			pFont = 0, TabFont = 0;
    			D3DXCreateFontA(......&pFont);
    			D3DXCreateFontA(......&TabFont);
    		}
    	}
    After going through these and a few more things I put together off the top of my head, I thought of something that made sense, but still failed. Maybe my logic is wrong here, but I figured that since my text worked perfectly until I joined a game, there was a problem with my Device. Maybe my device changed or was lost somehow (and yes I have Reset hooked). So I figured if I save what ever pDevice is returned in my Reset, i could make a new font from it and it should produce visible text. For some reason it didn't work, maybe me logic is flawed... But give it a look:

    Reset: (Setting "Buff" to the reset pDevice, so i can make a font off it)
    Code:
    HRESULT WINAPI nReset( LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* PresentationParameters )
    {
    	__asm pushad;
    	pFont->OnLostDevice();
    	TabFont->OnLostDevice();
    
    	HRESULT rCSetRet = oReset(pDevice, PresentationParameters);
    
    	if(SUCCEEDED(rCSetRet)) pFont->OnResetDevice(), TabFont->OnLostDevice(), Buff = pDevice;
    	__asm popad;
        return rCSetRet;
    }
    EndScene:
    Code:
    if(pFont)
    	{
    		pFont->Release();
    		TabFont->Release();
    		pFont = 0;
    		TabFont = 0;
    		font = false;
    	}
    	if(!font)
    	{
    		if(Buff){
    			D3DXCreateFont(Buff...... &TabFont);
    			D3DXCreateFont(Buff.......&pFont); 
    		}else{
    			D3DXCreateFont(pDevice.......&TabFont);
    			D3DXCreateFont(pDevice.......&pFont); 
    		}
    		font = true;
    	}
    It seems like its not my font going bad, its some other issue that wont show my text... I'v also tried just using a hot-key to re-create the font ingame, but it still refused to show!

    Any help or additions would be appreciated! Thank you in advanced.
    Last edited by |-|3|_][({}PT3R12; 01-06-2013 at 07:09 PM.

Similar Threads

  1. [TUT] How to add Oriental/Korean Fonts
    By W$t$5TA34TYTHSETH5Y5 in forum WarRock Korea Hacks
    Replies: 2
    Last Post: 05-06-2007, 11:08 AM
  2. Download fonts to where?
    By acepwnage in forum Art & Graphic Design
    Replies: 3
    Last Post: 07-13-2006, 01:55 AM
  3. [TUTORIAL]How to control an airplane :p and ofcourse insert it
    By System79 in forum WarRock - International Hacks
    Replies: 8
    Last Post: 07-09-2006, 03:44 PM
  4. how do you add fonts in PS
    By darkone1149 in forum Art & Graphic Design
    Replies: 2
    Last Post: 02-06-2006, 05:32 PM
  5. CBS Controls StarTrek
    By Dave84311 in forum SCI-FI
    Replies: 5
    Last Post: 01-22-2006, 11:18 PM