rotation support

This commit is contained in:
Franzi 2020-12-18 22:05:10 +01:00
parent fe58b5a874
commit ab1f68a712
Signed by: kunsi
GPG key ID: 12E3D2136B818350
2 changed files with 15 additions and 0 deletions

View file

@ -41,5 +41,18 @@
"type": "string", "type": "string",
"default": "https://icinga2/api/v1/objects/services?filter=service.state!=ServiceOK", "default": "https://icinga2/api/v1/objects/services?filter=service.state!=ServiceOK",
"hint": "Full URL to the API endpoint which returns a list of monitored services. Keeping the filter is strongly recommended!" "hint": "Full URL to the API endpoint which returns a list of monitored services. Keeping the filter is strongly recommended!"
}, {
"title": "Screen Rotation",
"ui_width": 4,
"name": "rotate",
"type": "select",
"default": 0,
"hint": "Rotation of screen (clockwise)",
"options": [
[0, "0°"],
[90, "90°"],
[180, "180°"],
[270, "270°"]
]
}] }]
} }

View file

@ -23,6 +23,7 @@ c_text[2] = {1, 1, 1}
c_text[3] = {1, 1, 1} c_text[3] = {1, 1, 1}
gl.setup(NATIVE_WIDTH, NATIVE_HEIGHT) gl.setup(NATIVE_WIDTH, NATIVE_HEIGHT)
local transform = util.screen_transform(CONFIG.rotate)
util.file_watch("services.json", function(content) util.file_watch("services.json", function(content)
services = json.decode(content) services = json.decode(content)
@ -39,6 +40,7 @@ local white = resource.create_colored_texture(1,1,1,1)
local base_time = N.base_time or 0 local base_time = N.base_time or 0
function node.render() function node.render()
transform()
CONFIG.background_color.clear() CONFIG.background_color.clear()
CONFIG.font:write(NATIVE_WIDTH/2-time_width/2, 10, services.prettytime, 30, 1,1,1,1) CONFIG.font:write(NATIVE_WIDTH/2-time_width/2, 10, services.prettytime, 30, 1,1,1,1)