Results 1 to 7 of 7
  1. #1
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty

    DPrint Source Code


    Print
    DPrint Source Code v.1.0


    Created By: why06 For: MPGH.net


    My hope is for this Project to be open source. So I've included the code below. This way people can contribute code as well as take away code for their own use.

    Code:
    	//********************************************************************************
    	//funtion:	DPrint()
    	//purpose:	Contructs new Dprint object
    	/////////////////////////////PARAMETERS///////////////////////////////////////////////
    	//startx:	The beginning x screen coordinate for Println
    	//starty:	The beginning y screen coordinate for Println
    	//vertical_spacing:	The vertical spacing between each subsequent line using Println
    	//pdevice:	The D3D Device
    	//********************************************************************************
    	DPrint(int startx, int starty, int vertical_spacing, LPDIRECT3DDEVICE9 pdevice);
    	/*Creates with autoFilter Settings*/
    	//autoFilter:	Turn auto filter on or off
    	//filterTime:	the frequency of auto filtration
    	DPrint(int startx, int starty, int vertical_spacing, LPDIRECT3DDEVICE9 pdevice, bool autoFilter, UINT filterTime=10000);
    	
    	//********************************************************************
    	//function: TestPrint
    	//purpose:	Tests boundaries of a line of text, preparing to be written.
    	//returns:	An array of RECTs holding the calculated size of each character 
    	//			block in the text and the whole length of the text.
    	/////////////////////////////PARAMETERS///////////////////////////////////////////////
    	//Rectarr:	An array of RECT that one must past to the function which will 
    	//			be filled with the location, width and height of each character printed
    	//pFormat:	A reference to the Format which holds one's font preferences
    	//str:		The string to test.
    	//********************************************************************
    	void TestPrintln(RECT* Rectarr, LPFFORMAT pFormat, char* str);
    
    	//*******************************************************************************************
    	//function:	CalcConcat
    	//purpose:	will return the least amount of letters that must be erased for a string in order
    	//			for that string to be concatenated with a new string and still fit in the pixel
    	//			limitations supplied.
    	/////////////////////////////PARAMETERS///////////////////////////////////////////////
    	//Rectarr:	An array of RECT that one must past to the function which will 
    	//			be filled with the location, width and height of each character printed.
    	//bufout:	bufin will be concatenated to this string.
    	//bufin:	The initial string to be concatenated.
    	//maxpixwidth:	The concatenated string will not be longer then maxpixwidth, if it is the string 
    	//				will be shortened until it fits within the horizontal limitations of maxpixwidth.
    	//pFormat:	Naturally different fonts take up different amounts of screen realistate, so one must
    	//			specify which font is to be made to fit in maxpixwidth.
    	//*******************************************************************************************
    	int CalcConcat(RECT* RectArr, char* bufout, char* bufin, int maxpixwidth, LPFFORMAT pFormat);
    
    	//*********************************************************************
    	//funtion: Println
    	//purpose: Will print a new line of text to screen 
    	//returns: A reactangle holding the size of the text drawn in Rectptr
    	//remarks: Starts at the locations specified by startx and starty. On each call
    	//		   the cursor moves down vertically vspacing pixels until ResetCursor is
    	//		   called which resets the cursor.
    	//
    	/////////////////////////////PARAMETERS///////////////////////////////////////////////
    	//Rectarr:	An array of RECT that one must past to the function which will 
    	//			be filled with the location, width and height of each character printed.
    	//fontColor:The color for the text to be printed.
    	//pFormat:	The Format for the text to be printed
    	//str:		The text to be printed.
    	//*********************************************************************
    	void Println(RECT* Rectptr, D3DCOLOR fontColor, LPFFORMAT pFormat, char* str);
    
    	//*********************************************************************
    	//funtion: Print
    	//purpose: Will print text to the size of the RECT provided
    	/////////////////////////////PARAMETERS///////////////////////////////////////////////
    	//rbox:		A reference to a RECT. Holds coordinates for text to be printed
    	//fontColor:The color for the text to be printed.
    	//pFormat:	The Format for the text to be printed.
    	//str:		The text to be printed.
    	//*********************************************************************
    	void Print(RECT* rbox, D3DCOLOR fontColor, LPFFORMAT pFormat, char* str);
    	
    	//*******************************************************
    	// function: DrawBox
    	// purpose: Will draw a box based on dimensions and color specified.
    	// NOTE: Not mine. Leeched code.
    	//*******************************************************
    	void DrawBox(int x, int y, int w, int h, D3DCOLOR col);
    
    	//********************************************************
    	// function: TextBox
    	// purpose: Will try to draw text in the given RECT
    	/////////////////////////////PARAMETERS///////////////////////////////////////////////
    	//Rectarr:		An array of RECT that one must past to the function which will 
    	//				be filled with the location, width and height of each character printed.
    	//FormatRect:	A reference to a RECT. Holds coordinates for text to be printed.
    	//text:			Text to be printed.
    	//pFormat:		The Format for the text to be printed.
    	//inside:		Color of inside of textbox.
    	//border:		Color of border of textbox.
    	//textcol:		Color of text to be printed in box.
    	// *******************************************************
    	void TextBox(RECT* Rectptr, RECT* FormatRect, string text, LPFFORMAT pFormat,  D3DCOLOR inside, D3DCOLOR border, D3DCOLOR textcol);
    
    
    //Font Functions
    	void Filter();											//manual filter
    	void SetFilter(bool autoFilter, UINT cycletime = 10000);//automatic filter settings
    
    //Set Functions
    	void SetCursor(int newx, int newy);	//Set X and Y coords for text printing
    	void ResetCursor();					//sets Println cursor back to starty and startx.
    	void Setvspc(int vertical_spacing); //change vertical spacing.
    
    //Get Functions
    	int getx();//startx
    	int gety();//starty
    	int getvspc();// get vertical spacing
    
    //Resets Font Pointers
    	void PreReset();	//OnLostDevice
    	void PostReset();	//OnResetDevice
    
    //RECT HELPERS
    	static RECT* rectcpy(RECT* out, RECT* in); 
    	static int rectw(RECT* in);	//width
    	static int recth(RECT* in);	//height
    
    //TEXT HELPERS
    	// a bit misleading. Does not tick all the way through only to end of text. Does not loop.
    	static int TickerText(char* strin, char* strout, unsigned int constraint, int wait, int time);

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  2. The Following 7 Users Say Thank You to why06 For This Useful Post:

    maxrio (01-17-2014),mohercliff (04-12-2013),pDevice (05-04-2012),rghmodz (03-18-2013),Varphone (11-25-2013),xCyberxx (10-22-2013),___guilherme___ (11-09-2011)

  3. #2
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Moved to DirectX and Stickied


     


     


     



    The Most complete application MPGH will ever offer - 68%




  4. The Following User Says Thank You to NextGen1 For This Useful Post:

    why06 (01-12-2011)

  5. #3
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    Thanks Next.

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  6. The Following User Says Thank You to why06 For This Useful Post:

    NextGen1 (01-12-2011)

  7. #4
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Not a problem, I am always for long term projects that are open source and have potential.

    Maybe we should make our own Open Source Project Site for MPGH


     


     


     



    The Most complete application MPGH will ever offer - 68%




  8. #5
    pDevice's Avatar
    Join Date
    Feb 2012
    Gender
    male
    Location
    d3d9.h
    Posts
    1,306
    Reputation
    15
    Thanks
    420
    My Mood
    Stressed
    very thanks !



  9. #6
    why06's Avatar
    Join Date
    Jul 2009
    Gender
    male
    Location
    IBM
    Posts
    4,304
    Reputation
    170
    Thanks
    2,203
    My Mood
    Flirty
    Hmmm... just looked back at this after all these years. I used an atrocious ordinal system in the code to access each font by a unique number value. I could have just used a multi-dimensional array with the Font size, weight, color, etc. representing specific indexes in the array.

    "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."
    - Dwight D. Eisenhower

  10. #7
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by why06 View Post
    Hmmm... just looked back at this after all these years. I used an atrocious ordinal system in the code to access each font by a unique number value. I could have just used a multi-dimensional array with the Font size, weight, color, etc. representing specific indexes in the array.
    Sounds gay.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)