Add love.themechanged() event.

Called when the system theme is changed (e.g. switching from light theme to dark and vice versa).
This commit is contained in:
Miku AuahDark
2025-11-25 15:41:42 +08:00
parent c4d30081f4
commit 6eb7329a06
2 changed files with 6 additions and 0 deletions
+3
View File
@@ -573,6 +573,9 @@ Message *Event::convert(const SDL_Event &e)
case SDL_EVENT_LOCALE_CHANGED:
msg = new Message("localechanged");
break;
case SDL_EVENT_SYSTEM_THEME_CHANGED:
msg = new Message("themechanged");
break;
case SDL_EVENT_SENSOR_UPDATE:
sensorInstance = Module::getInstance<sensor::Sensor>(M_SENSOR);
if (sensorInstance)
+3
View File
@@ -150,6 +150,9 @@ function love.createhandlers()
sensorupdated = function (sensorType, x, y, z)
if love.sensorupdated then return love.sensorupdated(sensorType, x, y, z) end
end,
themechanged = function ()
if love.themechanged then return love.themechanged() end
end,
}, {
__index = function(self, name)
error("Unknown event: " .. name)