Sign in to follow this  

GUI Issues

This topic is 4075 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm having trouble with my GUI. I'm trying to make it so when I click a button different controls show up. But the controls from the last options are wiped off the GUI (hence if the button is pushed, for example AimF, the AimF controls are to be displayed, but any other controls are turned to false, wiping them off). However, I'm having the issue that if I click a button the controls don't show. And I don't know what happened, it used to be that if I clicked a button, the old controls wouldn't be wipped off at all. And the new controls would just overlap it and make it look reallllyyy bad. Can someone please help me with this?! Here is the code I'm trying to use:
static TCHAR Text[256];
static TCHAR Label1[256];
static TCHAR Label2[256];
static TCHAR Label3[256];
static TCHAR Label4[256];

bool WeaponF = false;
bool AimbotF = false;
bool RadarF = false;
bool RadarFV = false;
bool VisualsF = false;
bool MiscF = false;

POINT pCursor;

void DrawMenu (UCanvas* Canvas, float PosX, float PosY)
{
	static bool bPressed = 0;
	//PosX = 300; PosY = 300;
	GetCursorPos ( &pCursor );


			if ( ( (pCursor.x >= PosX + 10) && (pCursor.x < ((PosX + 10) + 70)) && //(pCursor.x <= PosX + 79) && (pCursor.x > (PosX + 79)) &&
						(pCursor.y >= PosY + 10) && (pCursor.y < (PosY + 10) ) ) && ( GetAsyncKeyState ( VK_LBUTTON ) && bMouse ) ) 
			{
				WeaponF = true;
				AimF = false;
				RadarF = false;
				RadarFV = false;
				VisualsF = false;
				MiscF = false;
			}
			if ( ( (pCursor.x >= PosX + 80) && (pCursor.x < ((PosX + 80) + 70)) && //(pCursor.x <= PosX + 149) && (pCursor.x > (PosX + 149) ) && 
						(pCursor.y >= PosY + 10) && (pCursor.y < (PosY + 10)) && ( GetAsyncKeyState ( VK_LBUTTON ) && bMouse ) ) ) 
			{

				WeaponF = false;
				AimF = true;
				RadarF = false;
				RadarFV = false;
				VisualsF = false;
				MiscF = false;
			}
			if ( (pCursor.x >= PosX + 150) && (pCursor.x < ((PosX + 150) + 70)) && //(pCursor.x <= PosX + 219) && (pCursor.x > (PosX + 219) && 
						(pCursor.y >= PosY + 10) && (pCursor.y < (PosY + 10)) && ( GetAsyncKeyState ( VK_LBUTTON ) && bMouse ) )
			{
				WeaponF = false;
				AimF = false;
				RadarF = false;
				RadarFV = true;
				VisualsF = false;
				MiscF = false;
			}
			if ( (pCursor.x >= PosX + 220) && (pCursor.x < ((PosX + 220) + 70)) && //(pCursor.x <= PosX + 289) && (pCursor.x > (PosX + 289) && 
						(pCursor.y >= PosY + 10) && (pCursor.y < (PosY + 10)) && ( GetAsyncKeyState ( VK_LBUTTON ) && bMouse ) )
			{
				WeaponF = false;
				AimF = false;
				RadarF = true;
				RadarFV = false;
				VisualsF = false;
				MiscF = false;
			}
			if ( (pCursor.x >= PosX + 290) && (pCursor.x < ((PosX + 290) + 70)) && //(pCursor.x <= PosX + 359) && (pCursor.x > (PosX + 359)) && 
						(pCursor.y >= PosY + 10) && (pCursor.y < (PosY + 10)) && ( GetAsyncKeyState ( VK_LBUTTON ) && bMouse ) )
			{
				WeaponF = false;
				AimF = false;
				RadarF = false;
				RadarFV = false;
				VisualsF = true;
				MiscF = false;
			}
			if ( (pCursor.x >= PosX + 360) && (pCursor.x < ((PosX + 360) + 70)) && //(pCursor.x <= PosX + 429) && (pCursor.x > (PosX + 429) && 
					(pCursor.y >= PosY + 10) && (pCursor.y < (PosY + 10)) && ( GetAsyncKeyState ( VK_LBUTTON ) && bMouse ) )
			{
				WeaponF = false;
				AimF = false;
				RadarF = false;
				RadarFV = false;
				VisualsF = false;
				MiscF = true;
			}

	if(Canvas != NULL && Controller != NULL)
	{
		DrawGUI(Canvas, PosX, PosY, 440, 380,TEXT("T2x Hack"),false,FColor(255,255,255,255));
		AddButton(Canvas, PosX + 10, PosY + 10, 70, 15, WeaponF, TEXT("   Weapon"), ColorBlack);
		AddButton(Canvas, PosX + 80, PosY + 10, 70, 15, AimF, TEXT("   Aim"), ColorBlack);
		AddButton(Canvas, PosX + 150, PosY + 10, 70, 15, RadarFV, TEXT("  3D Radar"), ColorBlack);
		AddButton(Canvas, PosX + 220, PosY + 10, 70, 15, RadarF, TEXT("  2D Radar"), ColorBlack);
		AddButton(Canvas, PosX + 290, PosY + 10, 70, 15, VisualsF, TEXT("  Visuals"), ColorBlack);
		AddButton(Canvas, PosX + 360, PosY + 10, 70, 15, MiscF, TEXT("    Misc"), ColorBlack);
		if ( WeaponF )
		{
			appSprintf(Text, TEXT(" Weapon"));
			appSprintf(Label1, TEXT("Weapon Accuracy"));
			appSprintf(Label2, TEXT("Firing Mods"));
			appSprintf(Label3, TEXT("Sight Mods"));
			appSprintf(Label4, TEXT("Misc"));
			Canvas->pCanvasUtil->DrawString( PosX + 25, PosY + 30, Text, BoxFont, ColorBlack );
			Canvas->pCanvasUtil->DrawString( PosX + 40, PosY + 50, Label1, BoxFont, ColorBlack );
			DrawHorizLines(Canvas, PosX + 30, PosY + 60, 130);
			Canvas->pCanvasUtil->DrawString( PosX + 40, PosY + 130, Label2, BoxFont, ColorBlack );
			DrawHorizLines(Canvas, PosX + 30, PosY + 140, 130);
			Canvas->pCanvasUtil->DrawString( PosX + 40, PosY + 200, Label3, BoxFont, ColorBlack );
			DrawHorizLines(Canvas, PosX + 30, PosY + 210, 130);
			Canvas->pCanvasUtil->DrawString( PosX + 270, PosY + 50, Label4, BoxFont, ColorBlack );
			DrawHorizLines(Canvas, PosX + 260, PosY + 60, 130);
			//Weapon Accuracy
			DrawCheckBox(Canvas, PosX + 40, PosY + 80, bPerfectAccuracy, TEXT("Perfect Accuracy"));
			//Firing Mods
			DrawCheckBox(Canvas, PosX + 40, PosY + 170, bNoMuzzleFlash, TEXT("No Muzzle Flash"));
			DrawCheckBox(Canvas, PosX + 40, PosY + 150, bWeaponFireAnyState, TEXT("Weapon Fire In Any State"));
			//Sight Mods
			DrawCheckBox(Canvas, PosX + 40, PosY + 260, bSuperZoom, TEXT("Super Zoom"));
			DrawCheckBox(Canvas, PosX + 40, PosY + 240, bCanUse3DSights, TEXT("Can Use 3D Sights"));
			DrawCheckBox(Canvas, PosX + 40, PosY + 220, bNoZoomAnimation, TEXT("No Zoom Animation"));
			//Misc
			DrawCheckBox(Canvas, PosX + 270, PosY + 140, bNoWeaponWeight, TEXT("No Weapon Weight"));
			DrawCheckBox(Canvas, PosX + 270, PosY + 120, bWeaponCanSupport, TEXT("Weapon Can Support"));
			DrawCheckBox(Canvas, PosX + 270, PosY + 100, bNoReloadAnimation, TEXT("No Reload Animation"));
			DrawCheckBox(Canvas, PosX + 270, PosY + 80, bNoLimitations, TEXT("No Limitations"));
		}
		if ( AimF )
		{
			appSprintf(Text, TEXT(" Aim"));
			appSprintf(Label1, TEXT("Aim Options"));
			appSprintf(Label2, TEXT("Firing"));
			Canvas->pCanvasUtil->DrawString( PosX + 25, PosY + 30, Text, BoxFont, ColorBlack );
			Canvas->pCanvasUtil->DrawString( PosX + 40, PosY + 50, Label1, BoxFont, ColorBlack );
			DrawHorizLines(Canvas, PosX + 30, PosY + 60, 130);
			Canvas->pCanvasUtil->DrawString( PosX + 40, PosY + 130, Label2, BoxFont, ColorBlack );
			DrawHorizLines(Canvas, PosX + 30, PosY + 140, 130);
			DrawCheckBox(Canvas, PosX + 40, PosY + 70, bAutoAim, TEXT("Auto Aim"));
		}
		if ( RadarFV )
		{
			appSprintf(Text, TEXT("3D Radar"));
			appSprintf(Label1, TEXT("ESP's"));
			appSprintf(Label2, TEXT("Extra"));
			Canvas->pCanvasUtil->DrawString( PosX + 25, PosY + 30, Text, BoxFont, ColorBlack );
			Canvas->pCanvasUtil->DrawString( PosX + 40, PosY + 50, Label1, BoxFont, ColorBlack );
			DrawHorizLines(Canvas, PosX + 30, PosY + 60, 130);
			Canvas->pCanvasUtil->DrawString( PosX + 40, PosY + 230, Label2, BoxFont, ColorBlack );
			DrawHorizLines(Canvas, PosX + 30, PosY + 240, 130);
			//ESP's
			DrawCheckBox(Canvas, PosX + 40, PosY + 70, bPlayerNameESP, TEXT("Player Name"));
			DrawCheckBox(Canvas, PosX + 40, PosY + 90, bPlayerDistance, TEXT("Player Distance"));
			DrawCheckBox(Canvas, PosX + 40, PosY + 110, bWeaponNameESP, TEXT("Weapon Name"));
			DrawCheckBox(Canvas, PosX + 40, PosY + 130, bPlayerHealthESP, TEXT("Player Health"));
			DrawCheckBox(Canvas, PosX + 40, PosY + 150, bBleedHealthESP, TEXT("Bleed Health"));
			DrawCheckBox(Canvas, PosX + 40, PosY + 170, bPlayerStatesESP, TEXT("Player States"));
			DrawCheckBox(Canvas, PosX + 40, PosY + 270, bWeaponFireAnyState, TEXT("Weapon Fire In Any State"));
		}
		if ( RadarF )
		{
			appSprintf(Text, TEXT("2D Radar"));
			appSprintf(Label1, TEXT("Showings"));
			//---------------------------------------------
			Canvas->pCanvasUtil->DrawString( PosX + 25, PosY + 30, Text, BoxFont, ColorBlack );
			Canvas->pCanvasUtil->DrawString( PosX + 40, PosY + 50, Label1, BoxFont, ColorBlack );
			DrawHorizLines(Canvas, PosX + 30, PosY + 60, 130);
			//----------------------------------------------
			//Showings
			DrawCheckBox(Canvas, PosX + 40, PosY + 70, bEnemyOnRadar, TEXT("Show Enemy On Radar"));
			DrawCheckBox(Canvas, PosX + 40, PosY + 90, bAlliesOnRadar, TEXT("Show Allies On Radar"));
		}
		if ( VisualsF )
		{
			appSprintf(Text, TEXT("Visuals"));
			Canvas->pCanvasUtil->DrawString( PosX + 25, PosY + 30, Text, BoxFont, ColorBlack );
			//All
			DrawCheckBox(Canvas, PosX + 40, PosY + 80, bClearVision, TEXT("Clear Vision"));
			DrawCheckBox(Canvas, PosX + 40, PosY + 100, bNoFlash, TEXT("No Flash"));
			DrawCheckBox(Canvas, PosX + 40, PosY + 120, bWallHack, TEXT("Wall Hack"));
		}
		if ( MiscF )
		{
			appSprintf(Text, TEXT("  Misc"));

			Canvas->pCanvasUtil->DrawString( PosX + 25, PosY + 30, Text, BoxFont, ColorBlack );
			//All
			DrawCheckBox(Canvas, PosX + 40, PosY + 80, bPerfectAccuracy, TEXT("Fast ROF"));
			DrawCheckBox(Canvas, PosX + 40, PosY + 100, bNoMuzzleFlash, TEXT("Normal ROF"));
			DrawCheckBox(Canvas, PosX + 40, PosY + 120, bWeaponFireAnyState, TEXT("Auto Reload"));
			DrawCheckBox(Canvas, PosX + 40, PosY + 140, bWeaponFireAnyState, TEXT("No Weapon Jams"));
		}
		
		if( GetAsyncKeyState( VK_HOME ) &1 )
		{ 
			bMouse = !bMouse;
		}
		if ( bMouse )
		{
			ConsoleCommand(Controller, TEXT("Setsensitivity 0"));
			DrawCursor(Canvas, pCursor.x, pCursor.y);
		}
		else if ( !bMouse )
		{
			ConsoleCommand(Controller, TEXT("Setsensitivity 3"));
		}
		if ( bMouse && bDrag && ( GetAsyncKeyState ( VK_RBUTTON ) ) )
		{
			PosX = pCursor.x;
			PosY = pCursor.y;
		}
	}
}


[Edited by - Xore on October 22, 2006 10:59:52 PM]

Share this post


Link to post
Share on other sites
This also might help you all.


void DrawCheckBox (UCanvas* Canvas, int PosX, int PosY, bool &bOption, const TCHAR* Text)

void AddButton( UCanvas* Canvas, int PosX, int PosY, int Width, int Height, bool bFace, FString Text, FColor Color )




But yeah, I can't get the button clicking to work anymore :-(

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Classes are your FRIEND.

Wrap everything up into one class per control and a parent class that draws everything. I promise you, it will be INCREDIBLY helpful. Trying to create a GUI without a class hierarchy is like trying to go fishing without a fishing rod - it can be done, but why bother when you can do it more easily?

Share this post


Link to post
Share on other sites

This topic is 4075 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this