-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththeme.lua
More file actions
234 lines (192 loc) · 7.1 KB
/
theme.lua
File metadata and controls
234 lines (192 loc) · 7.1 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
-- Theme configuration for Cybersafe Rogue
-- Vibrant cyberpunk color palette
local Theme = {}
-- Main colors
Theme.colors = {
-- Background
bgDark = {0.06, 0.04, 0.12},
bgMid = {0.1, 0.06, 0.18},
-- Primary accent (magenta/pink)
primary = {0.95, 0.3, 0.6},
primaryBright = {1, 0.4, 0.7},
primaryDark = {0.7, 0.15, 0.4},
-- Secondary accent (cyan)
secondary = {0.2, 0.9, 0.95},
secondaryBright = {0.4, 1, 1},
secondaryDark = {0.1, 0.6, 0.7},
-- Tertiary (lime/green)
tertiary = {0.5, 1, 0.3},
tertiaryBright = {0.6, 1, 0.5},
-- UI elements
panelBg = {0.12, 0.08, 0.2, 0.95},
panelBorder = {0.95, 0.3, 0.6, 0.8},
-- Text
textBright = {1, 1, 1},
textNormal = {0.9, 0.85, 0.95},
textMuted = {0.6, 0.5, 0.7},
-- Status
health = {0.3, 1, 0.5},
damage = {1, 0.4, 0.4},
warning = {1, 0.8, 0.2},
-- Hexagon grid
hexLine = {0.95, 0.3, 0.6, 0.08},
hexGlow = {0.95, 0.3, 0.6, 0.03},
}
-- Draw hexagonal background pattern
function Theme.drawHexBackground(w, h)
local hexSize = 40
local hexHeight = hexSize * math.sqrt(3)
local hexWidth = hexSize * 2
-- Background gradient
love.graphics.setColor(Theme.colors.bgDark)
love.graphics.rectangle('fill', 0, 0, w, h)
-- Subtle radial gradient overlay
local cx, cy = w/2, h/2
local maxDist = math.sqrt(cx*cx + cy*cy)
for i = 20, 1, -1 do
local t = i / 20
local radius = maxDist * t
local alpha = 0.08 * (1 - t)
love.graphics.setColor(0.95, 0.3, 0.6, alpha)
love.graphics.circle('fill', cx, cy, radius)
end
-- Hexagon grid
love.graphics.setLineWidth(1)
love.graphics.setColor(Theme.colors.hexLine)
local offsetX = -hexSize
local offsetY = -hexHeight/2
for row = -1, math.ceil(h / hexHeight) + 1 do
for col = -1, math.ceil(w / (hexWidth * 0.75)) + 1 do
local x = offsetX + col * hexWidth * 0.75
local y = offsetY + row * hexHeight
if col % 2 == 1 then
y = y + hexHeight / 2
end
Theme.drawHexagon(x, y, hexSize * 0.95)
end
end
end
function Theme.drawHexagon(cx, cy, size)
local points = {}
for i = 0, 5 do
local angle = math.pi / 3 * i + math.pi / 6
table.insert(points, cx + size * math.cos(angle))
table.insert(points, cy + size * math.sin(angle))
end
love.graphics.polygon('line', points)
end
-- Draw a styled panel/card
function Theme.drawPanel(x, y, w, h, options)
options = options or {}
local cornerRadius = options.cornerRadius or 16
local glowColor = options.glowColor or Theme.colors.primary
local bgColor = options.bgColor or Theme.colors.panelBg
-- Outer glow
love.graphics.setColor(glowColor[1], glowColor[2], glowColor[3], 0.15)
love.graphics.rectangle('fill', x - 4, y - 4, w + 8, h + 8, cornerRadius + 4, cornerRadius + 4)
-- Background
love.graphics.setColor(bgColor)
love.graphics.rectangle('fill', x, y, w, h, cornerRadius, cornerRadius)
-- Top highlight
love.graphics.setColor(1, 1, 1, 0.05)
love.graphics.rectangle('fill', x + 4, y + 4, w - 8, h * 0.3, cornerRadius - 2, cornerRadius - 2)
-- Border
love.graphics.setColor(glowColor[1], glowColor[2], glowColor[3], 0.7)
love.graphics.setLineWidth(2)
love.graphics.rectangle('line', x, y, w, h, cornerRadius, cornerRadius)
end
-- Draw a styled button
function Theme.drawButton(x, y, w, h, text, font, options)
options = options or {}
local isHovered = options.hovered or false
local accentColor = options.accent or Theme.colors.secondary
-- Background
if isHovered then
love.graphics.setColor(accentColor[1], accentColor[2], accentColor[3], 0.2)
else
love.graphics.setColor(0.15, 0.1, 0.25, 0.9)
end
love.graphics.rectangle('fill', x, y, w, h, 12, 12)
-- Border
love.graphics.setColor(accentColor[1], accentColor[2], accentColor[3], 0.8)
love.graphics.setLineWidth(2)
love.graphics.rectangle('line', x, y, w, h, 12, 12)
-- Text
love.graphics.setFont(font)
love.graphics.setColor(Theme.colors.textBright)
local tw = font:getWidth(text)
local th = font:getHeight()
love.graphics.print(text, x + (w - tw)/2, y + (h - th)/2)
end
-- Draw upgrade card
function Theme.drawUpgradeCard(x, y, w, h, title, description, icon, font, titleFont)
-- Glow effect
love.graphics.setColor(Theme.colors.secondary[1], Theme.colors.secondary[2], Theme.colors.secondary[3], 0.1)
love.graphics.rectangle('fill', x - 3, y - 3, w + 6, h + 6, 18, 18)
-- Background with gradient feel
love.graphics.setColor(0.1, 0.06, 0.2, 0.95)
love.graphics.rectangle('fill', x, y, w, h, 14, 14)
-- Top accent bar
love.graphics.setColor(Theme.colors.secondary[1], Theme.colors.secondary[2], Theme.colors.secondary[3], 0.4)
love.graphics.rectangle('fill', x, y, w, 4, 14, 14)
love.graphics.rectangle('fill', x, y, w, 40, 14, 14)
love.graphics.setColor(0.1, 0.06, 0.2, 0.7)
love.graphics.rectangle('fill', x + 2, y + 6, w - 4, 32, 10, 10)
-- Border
love.graphics.setColor(Theme.colors.secondary[1], Theme.colors.secondary[2], Theme.colors.secondary[3], 0.6)
love.graphics.setLineWidth(2)
love.graphics.rectangle('line', x, y, w, h, 14, 14)
-- Icon placeholder (colored circle)
local iconX = x + 20
local iconY = y + 20
love.graphics.setColor(Theme.colors.secondary)
love.graphics.circle('fill', iconX, iconY, 12)
love.graphics.setColor(Theme.colors.bgDark)
love.graphics.circle('fill', iconX, iconY, 6)
-- Title
love.graphics.setFont(titleFont or font)
love.graphics.setColor(Theme.colors.textBright)
love.graphics.print(title, iconX + 22, y + 12)
-- Description
love.graphics.setFont(font)
love.graphics.setColor(Theme.colors.textNormal)
love.graphics.printf(description, x + 16, y + 50, w - 32, 'left')
end
-- Draw HUD panel
function Theme.drawHUDPanel(x, y, w, h)
-- Semi-transparent background
love.graphics.setColor(0.08, 0.04, 0.15, 0.85)
love.graphics.rectangle('fill', x, y, w, h, 12, 12)
-- Accent border
love.graphics.setColor(Theme.colors.primary[1], Theme.colors.primary[2], Theme.colors.primary[3], 0.5)
love.graphics.setLineWidth(2)
love.graphics.rectangle('line', x, y, w, h, 12, 12)
-- Corner accents
local cornerSize = 8
love.graphics.setColor(Theme.colors.primary)
love.graphics.rectangle('fill', x, y, cornerSize, 2)
love.graphics.rectangle('fill', x, y, 2, cornerSize)
love.graphics.rectangle('fill', x + w - cornerSize, y, cornerSize, 2)
love.graphics.rectangle('fill', x + w - 2, y, 2, cornerSize)
end
-- Draw a progress bar (for HP, etc)
function Theme.drawProgressBar(x, y, w, h, value, maxValue, color)
local pct = math.max(0, math.min(1, value / maxValue))
color = color or Theme.colors.health
-- Background
love.graphics.setColor(0.1, 0.06, 0.15, 0.9)
love.graphics.rectangle('fill', x, y, w, h, 4, 4)
-- Fill
if pct > 0 then
love.graphics.setColor(color[1], color[2], color[3], 0.9)
love.graphics.rectangle('fill', x + 2, y + 2, (w - 4) * pct, h - 4, 2, 2)
-- Shine
love.graphics.setColor(1, 1, 1, 0.2)
love.graphics.rectangle('fill', x + 2, y + 2, (w - 4) * pct, (h - 4) * 0.4, 2, 2)
end
-- Border
love.graphics.setColor(color[1], color[2], color[3], 0.5)
love.graphics.setLineWidth(1)
love.graphics.rectangle('line', x, y, w, h, 4, 4)
end
return Theme