Skip to content

Commit 98d3cc8

Browse files
authored
Init
0 parents  commit 98d3cc8

File tree

5 files changed

+123
-0
lines changed

5 files changed

+123
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"folders": [
3+
{
4+
"name": "Custom Lua UI",
5+
"path": "."
6+
}
7+
],
8+
"settings": {}
9+
}

Custom Lua UI/Poppins-SemiBold.ttf

148 KB
Binary file not shown.

Custom Lua UI/editIcon.png

1.2 KB
Loading

Custom Lua UI/main.lua

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
2+
--UI Libs
3+
4+
--Adds fonts
5+
function love.load()
6+
poppins = love.graphics.newFont("Poppins-SemiBold.ttf", 27)
7+
poppinsSmall = love.graphics.newFont("Poppins-SemiBold.ttf", 17)
8+
editIcon = love.graphics.newImage("editIcon.png")
9+
end
10+
11+
-- Button Styles
12+
-- Button Style One
13+
14+
function ButtonStyleOne(x, y)
15+
love.graphics.setFont(poppins)
16+
love.graphics.setColor(love.math.colorFromBytes(35, 35, 35))
17+
love.graphics.rectangle("fill",x,y,155,60)
18+
19+
love.graphics.setColor(255, 255, 255)
20+
love.graphics.printf("Button", x, y+(60/5), 155, "center")
21+
end
22+
23+
-- Button Style Two
24+
function ButtonStyleTwo(x1, y1)
25+
love.graphics.setFont(poppins)
26+
love.graphics.setColor(love.math.colorFromBytes(35, 35, 35))
27+
love.graphics.rectangle("fill",x1,y1,155, 155)
28+
love.graphics.setColor(love.math.colorFromBytes(188, 134, 235))
29+
love.graphics.draw(editIcon, x1+(97.52/2), y1+30)
30+
love.graphics.printf("Example", x1, y1+(155-(155/3)), 155, "center")
31+
end
32+
33+
-- Text Entry Box
34+
function TextEntryBox(x, y, placeholder)
35+
love.graphics.setFont(poppins)
36+
love.graphics.setColor(love.math.colorFromBytes(35, 35, 35))
37+
love.graphics.rectangle("fill", x, y, 440, 60)
38+
love.graphics.setColor(love.math.colorFromBytes(255, 255, 255))
39+
love.graphics.print(placeholder, x+10, y+10)
40+
end
41+
42+
43+
-- Toggle Button
44+
function ToggleButton(x, y, title, descirption, defaultState)
45+
local state = defaultState or false
46+
47+
love.graphics.setColor(love.math.colorFromBytes(35, 35, 35))
48+
love.graphics.rectangle("fill", x, y, 440, 80)
49+
50+
love.graphics.setColor(255, 255, 255)
51+
love.graphics.setFont(poppins)
52+
love.graphics.printf(title, x+10, y, 440, "left")
53+
love.graphics.setColor(love.math.colorFromBytes(132, 132, 132))
54+
love.graphics.setFont(poppinsSmall)
55+
love.graphics.printf(descirption, x+10, y+35, 440, "left")
56+
57+
if state == true then
58+
love.graphics.setColor(love.math.colorFromBytes(117, 205, 103))
59+
love.graphics.rectangle("fill", x+340, y+45/2, 90, 35)
60+
love.graphics.setColor(love.math.colorFromBytes(80, 80, 80))
61+
love.graphics.rectangle("fill", x+395, y+45/2, 35, 35)
62+
end
63+
if state == false then
64+
love.graphics.setColor(love.math.colorFromBytes(244, 105, 105))
65+
love.graphics.rectangle("fill", x+340, y+45/2, 90, 35)
66+
love.graphics.setColor(love.math.colorFromBytes(80, 80, 80))
67+
love.graphics.rectangle("fill", x+395, y+45/2, 35, 35)
68+
end
69+
end
70+
71+
72+
-- Sets Window Title
73+
function windowTitle(title)
74+
love.window.setTitle(title)
75+
end
76+
77+
78+
-- Sets Window Size
79+
function windwoSize(width, height)
80+
love.window.setMode(width, height)
81+
end
82+
83+
84+
-- Sets Background Color
85+
function backgroundColor(r, g, b)
86+
love.graphics.setBackgroundColor(love.math.colorFromBytes(r, g, b))
87+
end
88+
89+
-- Gets Clipboard
90+
function getClipboardText()
91+
return love.system.getClipboardText()
92+
end
93+
94+
95+
-- Sets the Window Icon
96+
function windowIcon(Icon)
97+
love.window.setIcon(imagedata)
98+
end
99+
--Rendering
100+
101+
function love.draw()
102+
ButtonStyleTwo(10, 10)
103+
ButtonStyleTwo(10, 175)
104+
105+
ButtonStyleOne(10, 350)
106+
107+
TextEntryBox(10, 420, "Example")
108+
109+
ToggleButton(10, 500, "Example", "Example", false)
110+
end
111+
112+
function love.update()
113+
windowTitle("Example LuaUI")
114+
end

Custom Lua UI/ui.lua

Whitespace-only changes.

0 commit comments

Comments
 (0)