Attempt at making a UI Library
Hi there, I am making a UI Library as I had some free timeI've added a button which functions
Then I tried to add a Text Box, for which I needed to add a blinking cursor
The cursor animates properly but the problem is that the position of the cursor is not correct
I have not changed the Size, Font, Alignment or anything of the text but still the cursor renders far ahead of where it's supposed to
This is the code to render the cursor
line(x + textWidth(val), y + 2, x + textWidth(val), y + textAscent() + 2);
I've heard somewhere that padding is already included in the textWidth function... due to which i have not added +2 to the x and w value, val is a string that's updated everytime the user presses a key on the keyboard
The y values work ok for now... There are no error messages too
I've tried looking online but none of the solutions work for me