-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetres.lua
More file actions
92 lines (73 loc) · 2.48 KB
/
setres.lua
File metadata and controls
92 lines (73 loc) · 2.48 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
--[[
This software is released under the MIT License. See LICENSE.txt for details.
Also, on a non-legal note: I do not recommend reading my code, especially not for educative
purposes. It was written over like three years, and I often forgot how I implemented several
things over time. Also, I was mostly drunk and listening to the Katamari Damacy soundtrack.
So yeah.
]]
setResState = newState()
local dx = 30
local xposs1 = {100-dx, 250-dx, 400-dx, 560-dx}
local xposs2 = {100-dx, 260-dx, 390-dx}
local yposs = {100, 250, 400}
function setResState:load()
self.flagOptionsState = true
self.gfx = love.graphics.newImage("res/introfg.png")
self.butts = newButtList()
self.butts:add(newButt("go back",xposs1[1],yposs[1],function()
changeState(optionsState)
end))
--window
self.butts:add(newButt("800 x 480",xposs1[1],yposs[2],function()
setResolution(800,480,false)
end))
self.butts:add(newButt("800 x 600",xposs1[2],yposs[2],function()
setResolution(800,600,false)
end))
self.butts:add(newButt("1080 x 720",xposs1[3],yposs[2],function()
setResolution(1080,720,false)
end))
self.butts:add(newButt("1920 x 1080",xposs1[4],yposs[2],function()
setResolution(1920,1080,false)
end))
--fullscreen
self.butts:add(newButt("1280 x 720",xposs2[1],yposs[3],function()
setResolution(1280,720,true)
end))
self.butts:add(newButt("1920 x 1080",xposs2[2],yposs[3],function()
setResolution(1920,1080,true)
end))
self.butts:add(newButt("auto",xposs2[3],yposs[3],function()
local modes = love.graphics.getModes()
table.sort(modes, function(a, b) return a.width*a.height < b.width*b.height end)
for i=#modes,1,-1 do
local mode = modes[i]
local w = mode.width
local h = mode.height
if w >= 800 and w <= 1920 and h >= 480 and h <=1080 then
setResolution(w,h,true)
return
end
end
exit_prompt = newpopup("your screen is strange :<", {{"ok",function()
exit_prompt = nil
end}})
end))
self.butts.flagLolCoords = true
end
function setResState:draw()
love.graphics.setColor(0,40,0)
love.graphics.rectangle("fill",0,0,width,height)
love.graphics.setColor(255,255,255,40)
love.graphics.draw(self.gfx, width - 400*2, height - 512*2 + 50,0,2,2)
love.graphics.setColor(255,255,255)
love.graphics.push()
love.graphics.translate(centerx - x_corr, centery - y_corr)
self.butts:draw()
love.graphics.print("window:",10,yposs[2]-70)
love.graphics.print("fullscreen:",10,yposs[3]-70)
love.graphics.pop()
end
function setResState:mousepressed()
self.butts:click()
end