Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Bill Rogers

Pages: [1]
1
Graphics / Highlight text while cursor over it
« on: November 11, 2022, 06:01:05 am »
I'd like to implement a feature where text is highlighted when the mouse is positioned over it. However the only way I can think to do it is to set the color when the cursor is inside the box then reset the color when not.

Text text;
text.setString("Test");
//do text setting stuff

while (window.isOpen)
{
     if (cursor positioned in text box) text.setFillColor(Color::Red);
     else text.setFillColor(Color::White);

//draw stuff
}
 

This works but now is setting the text color every frame. Is there a more efficient way to do this or is the performance hit small enough to where it doesn't matter?

Pages: [1]