aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author1029chris <1029chris@gmail.com>2016-04-09 21:14:49 -0700
committer1029chris <1029chris@gmail.com>2016-04-09 21:14:49 -0700
commitf56dd94334559d026922cd1ef81e1a6a506d239a (patch)
treedba239e8a99cec84cd8f86e5350a00c11579644a
parentb6b0f050d75e22af5eb53d2c1d058a40e0ff1e6b (diff)
Added settings menu
Added option to change backgrounds
-rw-r--r--assets.lua22
-rw-r--r--assets/computer.pngbin0 -> 707 bytes
-rw-r--r--settings.lua61
-rw-r--r--window.lua4
4 files changed, 87 insertions, 0 deletions
diff --git a/assets.lua b/assets.lua
index b94ee31..3286a5f 100644
--- a/assets.lua
+++ b/assets.lua
@@ -25,6 +25,25 @@ function loadAssets()
flower = love.graphics.newImage("assets/bg_flower.jpg"),
city = love.graphics.newImage("assets/bg_city.jpg")
}
+ st = {}
+ st[1] = {}
+ st[1].title = "Default"
+ st[1].hl = false
+ st[2] = {}
+ st[2].title = "Hills"
+ st[2].hl = false
+ st[3] = {}
+ st[3].title = "Clouds"
+ st[3].hl = false
+ st[4] = {}
+ st[4].title = "City"
+ st[4].hl = false
+ st[5] = {}
+ st[5].title = "Flower"
+ st[5].hl = false
+ st[6] = {}
+ st[6].title = "Coast"
+ st[6].hl = false
music = {
battle1 = love.audio.newSource("assets/music/Thrills And Spills.ogg"),
battleNSA = love.audio.newSource("assets/music/Less Than Three.ogg"),
@@ -47,6 +66,9 @@ function loadAssets()
bar = love.graphics.newImage("assets/win_bar.png"),
barGrey = love.graphics.newImage("assets/win_bar_grey.png")
}
+ settings = {
+ comp = love.graphics.newImage("assets/computer.png")
+ }
chat = {
online = love.graphics.newImage("assets/chat_status_online.png"),
offline = love.graphics.newImage("assets/chat_status_offline.png"),
diff --git a/assets/computer.png b/assets/computer.png
new file mode 100644
index 0000000..3ac923f
--- /dev/null
+++ b/assets/computer.png
Binary files differ
diff --git a/settings.lua b/settings.lua
index b21b387..3633198 100644
--- a/settings.lua
+++ b/settings.lua
@@ -1,2 +1,63 @@
function drawSettings()
+ drawDownBox(8, 30, 384, 25, 2)
+ love.graphics.setColor(colors.font.dark)
+ love.graphics.print("Wallpaper", 14, 38)
+ love.graphics.setColor(255,255,255)
+ love.graphics.draw(settings.comp, 200-64, 36+32, 0, 2, 2, 60)
+ drawDownBox(262, 37+32, 122, 222, 2)
+ love.graphics.setColor(255,255,255)
+ love.graphics.rectangle("fill", 263, 38+32, 120, 220)
+ if st[1].hl == true then
+ desktop.bg.current = 0
+ elseif st[2].hl == true then
+ desktop.bg.current = desktop.bg.hills
+ elseif st[3].hl == true then
+ desktop.bg.current = desktop.bg.cloud
+ elseif st[4].hl == true then
+ desktop.bg.current = desktop.bg.city
+ elseif st[5].hl == true then
+ desktop.bg.current = desktop.bg.flower
+ elseif st[6].hl == true then
+ desktop.bg.current = desktop.bg.coast
+ end
+ love.graphics.stencil(stencilBg, "replace", 1)
+ love.graphics.setStencilTest("greater", 0)
+ if desktop.bg.current ~= 0 then
+ love.graphics.setColor(255,255,255)
+ love.graphics.draw(desktop.bg.current, 88-64, 44+32, 0, 0.1)
+ else
+ love.graphics.setColor(0,128,128)
+ love.graphics.rectangle("fill", 88-64, 44+32, 152, 120)
+ end
+ love.graphics.setStencilTest()
+ for i=1,6 do
+ drawBgSel(i)
+ end
+end
+function stencilBg()
+ love.graphics.rectangle("fill", 88-64, 44+32, 152, 120)
+end
+function drawBgSel(i)
+ if st[i].hl == false then
+ love.graphics.setColor(colors.font.dark)
+ love.graphics.print(st[i].title, 268, 78+(20*(i-1)))
+ elseif st[i].hl == true then
+ love.graphics.setColor(0,0,120)
+ love.graphics.rectangle("fill", 263, 70+(20*(i-1)), 120, 20)
+ love.graphics.setColor(colors.font.light)
+ love.graphics.print(st[i].title, 268, 78+(20*(i-1)))
+ end
+end
+function updateSettings()
+ for i=1,6 do
+ if (layer[1] == 6 and win[6].hover == true and sys.mouse.p.p == true and
+ sys.mouse.p.x >= win[6].x+263 and sys.mouse.p.x <= win[6].x+263+120 and
+ sys.mouse.p.y >= win[6].y+70+(20*(i-1)) and sys.mouse.y <= win[6].y+70+(20*(i-1))+20) then
+ for i=1,6 do
+ st[i].hl = false
+ end
+ st[i].hl = true
+ win[6].update = true
+ end
+ end
end
diff --git a/window.lua b/window.lua
index 4350b76..4e071e3 100644
--- a/window.lua
+++ b/window.lua
@@ -20,6 +20,8 @@ function drawWindow(id)
drawChat()
elseif id == 2 then
drawInternet()
+ elseif id == 6 then
+ drawSettings()
end
love.graphics.setCanvas()
win[id].update = false
@@ -125,6 +127,8 @@ function drawWindow(id)
updateChat()
elseif id == 2 then
updateInternet()
+ elseif id == 6 then
+ updateSettings()
end
if id == layer[1] and win[id].bar == "grey" then
win[id].bar = "active"