Skip to content

Latest commit

 

History

History
35 lines (22 loc) · 1 KB

refreshDpi.markdown

File metadata and controls

35 lines (22 loc) · 1 KB

device.refreshDpi()

 
Type function
Library device.*
Return value nil
Keywords refresh, dpi, xdpi, ydpi, orientation
See also Sample code, orientation, xdpi, ydpi

Overview

This function refreshes the xdpi and ydpi for the device, based on the orientation. Orientation changes may result in dpi changes if the display is stretched.

Syntax

device.refreshDpi()

Examples

local device = require 'plugin.device'

print(device.orientation, device.xdpi, device.ydpi)

local function onOrientationChanged(event)
	device.refreshDpi()
	print(device.orientation, device.xdpi, device.ydpi)
end

Runtime:addEventListener("orientation", onOrientationChanged)