I did a light system some weeks ago, and it worked, now that i changed my pc, game closes when i try to draw a surface, it doesn't even give a error log
im drawing only the visible part, but is it possible to create a surface of the size of the view and change its "x and y"?That's most likely because a surface that large is too big to handle for most average PCs. It's sort of overkill even when you have a high-end PC.
I suggest making the surface smaller and only drawing the region that is actually visible to it.
Ohh, i understand now, i didn't get it because im not good at englishDrawing is not the problem, it's keeping the oversized surface in memory. The PC this is crashing on probably has less video memory available than the surface requires, or it may not even support such a large surface size.
What you're asking about is indeed possible. With a surface as big as the room, you are currently drawing to it at room coordinates and then drawing the visible portion at view coordinates. If you change the surface's size to match the visible region, switch this around. When drawing to the surface, subtract the view coordinates from the draw coordinates to "change its x and y" to be relative to the cutout (as opposed to adding them to the coordinates you draw the cutout at). You will no longer need to cut out the visible part, so just draw the full surface at view coordinates.