-
Notifications
You must be signed in to change notification settings - Fork 2
/
BcmHost.lua
44 lines (28 loc) · 812 Bytes
/
BcmHost.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
local ffi = require "ffi"
local host = require "bcm_host"
local bcm_host_lib = ffi.load("bcm_host");
--[[
The bcm_host_init() function must be called
before any other functions in the library can be
utilized. This will be done automatically
if the developer does:
require "bcm_host"
--]]
bcm_host_lib.bcm_host_init();
local GetDisplaySize = function(display_number)
display_number = display_number or 0
local pWidth = ffi.new("uint32_t[1]");
local pHeight = ffi.new("uint32_t[1]");
local err = lib.graphics_get_display_size(display_number, pWidth, pHeight);
-- Return immediately if there was an error
if err ~= 0 then
return false, err
end
return pWidth[0], pHeight[0];
end
return {
-- Libraries
Lib = lib,
bcm_host_lib = bcm_host_lib,
GetDisplaySize = GetDisplaySize,
}