This event doesn't exist, but you can add it yourself using the following code:
Code:
import "Turbine.UI";
-- Add the Turbine.UI.Display.SizeChanged event.
displaySizeListener = Turbine.UI.Window();
displaySizeListener:SetVisible(true);
displaySizeListener:SetStretchMode(0);
displaySizeListener:SetSize(1, 1);
displaySizeListener:SetStretchMode(1);
displaySizeListener:SetSize(2, 2);
displaySizeListener.ignoreSizeChangedEvents = 2;
function displaySizeListener:SizeChanged()
if (self.ignoreSizeChangedEvents > 0) then
self.ignoreSizeChangedEvents = self.ignoreSizeChangedEvents - 1;
return;
end
self:SetSize(2, 2);
self.ignoreSizeChangedEvents = 1;
-- Need to wait until the next Update() cycle before reporting.
self:SetWantsUpdates(true);
end
function displaySizeListener:Update()
self:SetWantsUpdates(false);
local sizeChangedFunc = Turbine.UI.Display.SizeChanged;
if (type(sizeChangedFunc) == "function") then
sizeChangedFunc(Turbine.UI.Display);
elseif (type(sizeChangedFunc) == "table") then
for f = 1, #sizeChangedFunc, 1 do
sizeChangedFunc[f](Turbine.UI.Display);
end
end
end
This exploits a bug in the undocumented SetStretchMode() feature, wherein the size of a "stretched" window reverts to the "unstretched" size when you change the size of the display. Serendipitously, this change also emits a SizeChanged event from said window. This implementation uses a small invisible stretched window to receive such notifications and pass them along to whatever you have assigned for Turbine.UI.Display.SizeChanged ().
This fix is useful in cases where you are using the stretching feature and need to reapply the desired stretching each time the display size changes. Or more generally, any time you need to resize or reposition something according to the display size.
Edit: Of course, you could instead continuously poll the display size in an Update() function, but that is inefficient.