Announcement

Collapse
No announcement yet.

Get Click Event When Clicking On AHUD::DrawTextureSimple Texture On Screen

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Get Click Event When Clicking On AHUD::DrawTextureSimple Texture On Screen

    Do I have to use hitboxes here (aka layer a hitbox over the texture on screen) or does the Texture Simple have the ability to get a click event?

    Thanks!

    #2
    You will need to place a hitbox if you want to receive clicks. None of the Draw elements provide them implicitly.

    Comment


      #3
      Thank you, Marc. What I'm doing now is putting down a simple texture then taking it's position info and trying to put a hitbox over top of it. Does this look about right?
      Code:
      void AInventoryHUD::DrawInventoryItem(int32 Offset, UTexture* Thumbnail)
      {
      
      	float XCoord = (float)Offset * 100;
      
      	float ThumbX = XCoord;
      	float ThumbY = 1.f;
      
      	float ThumbWidth = Thumbnail->GetSurfaceWidth();
      	float ThumbHeight = Thumbnail->GetSurfaceHeight();
      
      	AHUD::DrawTextureSimple(Thumbnail, ThumbX, ThumbY);
      
      	FVector2D HBPosition;
      	HBPosition.X = ThumbX;
      	HBPosition.Y = ThumbY;
      	FVector2D HBSize;
      	HBSize.X = ThumbWidth;
      	HBSize.Y = ThumbHeight;
      	FName HBName = FName(TEXT("HB"));
      	AHUD::AddHitBox(HBPosition, HBSize, HBName, false);
      
      }
      It compiles and plays, but since the hitbox is invisible, I don't know if it's actually showing.

      Edit:

      Actually, per an old answer of yours at https://answers.unrealengine.com/que...e-in-game.html, I was able to turn on hitbox debugging and this does seem to be working. Is this the correct workflow?

      Thanks!
      Last edited by AllenGingrich; 10-24-2014, 11:34 AM.

      Comment


        #4
        That does look correct.

        For debugging, you should be able to type "showdebug hitbox" on the console to visualize where the hitboxes are.

        Comment

        Working...
        X