Hello Savaikun,
I believe I have a better way to draw the inventory(That doesn’t include 5 hotbar highlight settings and up to 50+ inventory ones (Not sure if this is how you handle your inventory as well).
When drawing my inventory (Can be done with the hotbars as well) I utilize a single texture as the backdrop (If I ever consider doing an increasing inventory size/Window resizing - I will probably give the base item a texture draw that will expand the inventory as it gets bigger dynamically). I then draw the first inventory slots hitbox(index 0), once that is drawn I save the hitboxes position into a 2d vector array(Index 0 of the hitbox position array now matches up with index 0 of my inventory hitbox).
From there I do a mouse over event check to find which box is hovered over, save the bool that its being hovered over, and do a branch check and only draw the material if its true. Please see my pictures below.
Drawing of the hitbox and saving of that hitboxes position
Once that information has been drawn I receive the draw call to draw my hitboxes as the mouse overs happen and utilize the below to detect which hitbox to highlight.
And my bool settings and saving for hitbox name.
Also is a video of it in use.
://www.youtube.com/=pQA57JOQpsk
EDIT: Yes, my inventory system looks like a mess currently. This is due to it still being built upon and I haven’t taken the time to truly clean things up.

