ItsRobinson
Active member
- Joined
- Nov 16, 2017
- Messages
- 105
- Reaction score
- 20
PHP:
:drawIcon
0470: 4@ = $PLAYER_ACTOR
format 20@ "cleo\HDhud\resources\%d.png" 4@
0B71: render 6@ = load_texture_from_file 20@
0@ = 1578
1@ = 91
0@ += 6
0B73: render draw_texture 6@ pos 0@ 1@ size 75 75 rotation 0 color 0xFFFFFFFF
return
I've got a gosub to the function above, which should get the players weapon in hand and then grab the weapons icon from the resources folder (inside the resources the folder I have the weapons ID's as the name, hence the %d.png)
The issue with this is that it'll work for a few seconds and then my FPS drops from around 150 to 70 and then a few seconds later from 70 to 15. I'm not exactly sure why that's happening but I know it's something to do with this because I deleted the gosub and that didn't happen.
I've been converting my lua script into a cleo and my lua script works like this:
PHP:
function drawWeapon(posX, posY, sizeX, sizeY, wep)
weptext = renderLoadTextureFromFile(string.format("moonloader/resource/icons/%d.png", wep))
renderDrawTexture(weptext, posX, posY, sizeX, sizeY, 0, 0xFFFFFFFF)
renderReleaseTexture(weptext)
end
So I've tried in the CLEO releasing the texture after drawing it, but that then just doesn't make the icon appear.
So I'm stuck for what to do, any ideas?