| View previous topic :: View next topic |
| Author |
Message |
L0rd_Yoshi How do I cheat?
Reputation: 0
Joined: 24 May 2020 Posts: 2
|
Posted: Sun Jul 12, 2020 1:35 am Post subject: D3DHook_FontMap.changeFont Memory Leak |
|
|
Hi, I'm running CE 7.1, and I needed a way to update the font size of D3Dhook_TextContainer objects, so my initial idea was to update the font map every frame. Unfortunately, the only way to change the text size of font map objects is to adjust a font object and use D3DHook_FontMap.changeFont, which appears to have a nasty memory leak. I could just compare the window size to a stored variable and update it then, but I was wondering if there was an undocumented alternate way of changing the font size. Thanks.
The below code will consume about 400MB extra process memory.
| Code: | d3dobj = createD3DHook()
testfont = createFont()
testfontmap = d3dobj.createFontmap(testfont)
for i = 1, 10000 do
testfontmap.changeFont(testfont)
end |
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25839 Location: The netherlands
|
Posted: Sun Jul 12, 2020 2:22 am Post subject: |
|
|
You can have more than 1 fontmap
Create 4 to 5 fontmaps and then assign them to the textcontainer as needed. No need to create a new fontmap each time
And if that doesn't work then create 4 to 5 textcontainers each with their unique fontmap. Then when you wish to change the size hide the old one and make the others invisible
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
L0rd_Yoshi How do I cheat?
Reputation: 0
Joined: 24 May 2020 Posts: 2
|
Posted: Sun Jul 12, 2020 10:58 am Post subject: |
|
|
| I tried to D3DHook_FontMap.destroy() the previous font map and create a new font map, but D3DHOOK.createFontmap() also has memory leaks. D3Dhook_TextContainer.FontMap() does not have any leaks, so creating several text containers with different font sizes could work depending on how many different text profiles are needed. I will go with my solution of detecting a window size change and updating it then. Thanks.
|
|
| Back to top |
|
 |
|