diff --git a/frontend/device/dummy/device.lua b/frontend/device/dummy/device.lua new file mode 100644 index 000000000..a10397d00 --- /dev/null +++ b/frontend/device/dummy/device.lua @@ -0,0 +1,26 @@ +local Generic = require("device/generic/device") +local logger = require("logger") + +local function yes() return true end +local function no() return false end + +local Device = Generic:new{ + model = "dummy", + hasKeyboard = no, + hasKeys = no, + isTouchDevice = no, + needsScreenRefreshAfterResume = no, + hasColorScreen = yes, + hasEinkScreen = no, +} + +function Device:init() + self.screen = require("ffi/framebuffer_SDL2_0"):new{ + dummy = true, + device = self, + debug = logger.dbg, + } + Generic.init(self) +end + +return Device diff --git a/frontend/runtimectl.lua b/frontend/runtimectl.lua index 718d76691..088d2927a 100644 --- a/frontend/runtimectl.lua +++ b/frontend/runtimectl.lua @@ -6,7 +6,20 @@ local Runtimectl = { is_bgr = false, } -function Runtimectl:setDevice(device) +--[[ +Initialize runtimectl with settings from device. + +The following key is required for a device object: + +* hasBGRFrameBuffer: function() -> boolean +* screen: object with following methods: + * getWidth() -> int + * getHeight() -> int + * getDPI() -> int + * getSize() -> Rect + * scaleBySize(int) -> int +]]-- +function Runtimectl:init(device) self.screen = device.screen self.isAndroid = device.isAndroid self.isKindle = device.isKindle diff --git a/reader.lua b/reader.lua index 4164824df..9a4eeb9b8 100755 --- a/reader.lua +++ b/reader.lua @@ -37,7 +37,7 @@ end -- setup various runtime control local Runtimectl = require("runtimectl") local Device = require("device") -Runtimectl:setDevice(Device) +Runtimectl:init(Device) local Font = require("ui/font") Font:setScreen(Device.screen)