Skip to content

Instantly share code, notes, and snippets.

@Jerakin
Created November 14, 2017 10:09
Show Gist options
  • Save Jerakin/4b031707f4d973cf66d2c2e83068809d to your computer and use it in GitHub Desktop.
Save Jerakin/4b031707f4d973cf66d2c2e83068809d to your computer and use it in GitHub Desktop.
Defold screen helper
-- Initiate it in your game.render_script by adding this to its init()
-- screeninfo.init(render.get_window_width(), render.get_window_height())
local M = {}
local window_width
local window_height
local project_widht
local project_height
function M.init(initial_window_width, initial_window_height)
window_width = initial_window_width
window_height = initial_window_height
project_widht = sys.get_config("display.width")
project_height = sys.get_config("display.height")
end
function M.get_window_width()
return window_width
end
function M.get_window_height()
return window_height
end
function M.get_project_width()
return project_widht
end
function M.get_project_height()
return project_height
end
return M
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment