forked from MLJWare/Opcode-LD42
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_display.lua
More file actions
46 lines (34 loc) · 1.08 KB
/
setup_display.lua
File metadata and controls
46 lines (34 loc) · 1.08 KB
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
45
46
local Global = require "app.Global"
local width, height, flags = love.window.getMode()
--local desktop_width, desktop_height = love.window.getDesktopDimensions(flags.display or 1)
local Images = require "app.Images"
local board_image = Images.get("code-editor/Board")
local board_w, board_h = board_image:getDimensions()
Global.CENTER_X = math.floor(board_w/2)
Global.CENTER_Y = math.floor(board_h/2)
Global.SCALE = 4
love.window.setMode(board_w*Global.SCALE, board_h*Global.SCALE, {
fullscreen = false;
fullscreentype = "desktop";
vsync = true;
--msaa = 0;
stencil = true;
depth = 0;
resizable = true;
borderless = false;
centered = true;
display = 2;
minwidth = board_w;
minheight = board_h;
--highdpi = false;
x = nil;
y = nil;
})
function love.resize(screen_w, screen_h)
local scale_w = math.floor(screen_w/board_w)
local scale_h = math.floor(screen_h/board_h)
local scale = math.min(scale_w, scale_h)
Global.SCALE = scale
Global.OFFSET_X = math.floor((screen_w - board_w*scale)/2)
Global.OFFSET_Y = math.floor((screen_h - board_h*scale)/2)
end