Jump to content
Welcome, Guest
Existing user? Sign In

Sign In



Sign Up
The MatriX
  • Welcome To Ghbsys
  • CS GO Streaming Version is released. Have fun streaming while cheating!
  • Have a Payment Issue? Send us a Support ticket.
  • Make a thread if you need support or join our discord for live support.
  • Have Suggestions? Make a thread and you'll earn Ghbsys Points for implemented suggestions.
  • Join our discord to stay well connected! Don't forget to integrate your discord to the site
  • Welcome to [GHB] - GAmEhAcKbAsTaRdS Forum

    Welcome to [GHB] - GAmEhAcKbAsTaRdS Forum, like most online communities you must register to view or post in our community, but don't worry this is a simple free process that requires minimal information for you to signup. Be apart of [GHB] - GAmEhAcKbAsTaRdS Forum by signing in or creating an account.
    • Start new topics and reply to others
    • Subscribe to topics and forums to get email updates
    • Get your own profile page and make new friends
    • Send personal messages to other members.

    D3D9 Buttons


    sxtronic
     Share

    Recommended Posts

    Hey, I made D3D "Buttons" but I wanted to know whether it's possible to short it up.

    For every button i want to have I have to code this with other x's and y's..

     

      if (GetAsyncKeyState(VK_LBUTTON))
     {	  
      POINT m;
      GetCursorPos(&m);
      int x = m.x;
      int y = m.y;
    
      if (x > 50 && y > 50)
      {
    	  if (x < 200 && y < 200)
    	  {
    		  ExitProcess(1);
    	  }
      }
     }

     

    I know that it's possible but don't know how.

    Something like this:

    if(GetCurPos(2, 2, 50, 100){

    //Do

    }

    So I need a function to check if curosor is in an area.

    :)

    Thx

    Link to comment
    Share on other sites

    call GetCursorPos once a frame and check xywh like you did

     

    POINT mouse;
    bool IsInArea( int x, int y, int w, int h )
    {
    if( mouse.x >= x && mouse.x <= ( x + w ) )
    {
    	if( mouse.y >= y && mouse.y <= ( y + h ) )
    	{
    		return true;
    	}
    }
    return false;
    }
    

    Edited by ZeaS
    Link to comment
    Share on other sites

    Thanks :)

     

    For those who are interested, useage:

     

     

      GetCursorPos(&mouse);
     if(GetAsyncKeyState(VK_LBUTTON) && IsInArea(1, 1, 500, 500)){
      //DoSomething
      }

    Edited by sxtronic
    Link to comment
    Share on other sites

    Guest
    This topic is now closed to further replies.
     Share

    • Recently Browsing   0 members

      • No registered users viewing this page.
    ×
    ×
    • Create New...