Community Forum

overlay image limits ?

Forum Overview >> Scripting

CategoryScripting
Created12.08.2021 08:48


@ Squity (Squity) 12.08.2021 08:48
Hi, is there a limit to the number of overlays images that can be created/drawn at the same time?

I'm having a strange behavior with my script, i use Overlay:new() to create 8 panels with the same image.png file, on myScript:update() i use a for loop to render each created overlay, all this works fine!

The problem comes when i try to replace one of the overlay with a new image, i have a function for onHover that create a new overlay when the mouse is over one of the panels with the image_hovered.png, this function makes some of my overlay panels disappear.. i'm trying also with the setImage function of Overlay table but it doesn't work at all, i also try to use Overlay:delete() to delete and empty the memory from the default overlay image.
With .dds files i get the same results.

Any suggestion? I'm doing something wrong?

@ Squity (Squity) 13.08.2021 07:59
I've found the problem!
First i use
local MyModScript_mt = Class(MyModScript);
addModEventListener(MyModScript);
to create a class for my mod and then attached the update function to render my overlay on screen.
function MyModScript:update()
renderMyOverlay() -- BAD MISTAKE.
end

You should NEVER use MyModScript:update() callback to render stuff on screen! use MyModScript:draw() instead.
function MyModScript:draw()
renderMyOverlay() -- WORKING
end


Note: Log in to post. Create a new account here.