Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- -----------------------------------------
- * Game hacking QTS ( Quickie Tip Series )
- * no. 6 - Primitive shape drawing function
- -----------------------------------------
- * Author: SEGnosis - GHAnon.net
- * Thanks to:
- * bitterbanana - No known site
- * Drunken Cheetah - No known site
- * fatboy88 - No known site
- * Geek4Ever - No known site
- * learn_more - www.uc-forum.com
- * Novocaine - http://ilsken.net/blog/?page_id=64
- * Philly0494 - No known site
- * Roverturbo - www.uc-forum.com
- * SilentKarma - www.halocoders.com - offline
- * Strife - www.uc-forum.com
- * Wieter20 - No known site
- */
- #define PI 3.14159265
- enum ShapeSides
- {
- LINE = 2,
- TRIANGLE = 3,
- SQUARE = 4,
- PENTAGON = 5,
- HEXAGON = 6,
- HEPTAGON = 7,
- OCTAGON = 8,
- NONAGON = 9,
- DECAGON = 11
- };
- //----------------------------------//
- void DrawShape( long x, long y, float fDegrees, DWORD dwSides, DWORD dwSize, DWORD dwLineWidth, D3DCOLOR Color )
- {
- POINT* pt = new POINT[ dwSides + 1 ]; // allocate points
- fDegrees = ( fDegrees * PI ) / 180.0f; // Convert degrees to radians
- float k = 0.000000f;
- for( int i = 0; i < dwSides; i++, k += ( TWO_PI/dwSides ) )
- {
- float fDeg = k + fDegrees; // add degrees
- while( fDeg > TWO_PI )
- fDeg -= TWO_PI; // limit
- pt[ i ].x = ( cos( fDeg ) * dwSize ) + x; // set points
- pt[ i ].y = ( sin( fDeg ) * dwSize ) + y;
- }
- pt[ dwSides ].x = pt[ 0 ].x; // set last point to first
- pt[ dwSides ].y = pt[ 0 ].y;
- for( int i = 0; i < dwSides; i++ )
- CDraw.Line( pt[ i ].x, pt[ i ].y, pt[ i + 1 ].x, pt[ i + 1 ].y, dwLineWidth, Color ); // draw through all points
- delete[] pt; // release points allocated
- }
- //----------------------------------//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement