Skip to content

Commit 0cdfa04

Browse files
committed
refactor(gui): Start work on the gui textures
1 parent 22b4818 commit 0cdfa04

7 files changed

Lines changed: 1028 additions & 233 deletions

File tree

scripts/generate_amoled_gui.py

Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,232 @@
1+
"""
2+
Generate an AMOLED-themed GUI texture for the Research Table.
3+
Pure black background with dark accents for in-game layout testing.
4+
5+
Layout (470x260):
6+
Top: Upper Panel with 3 view modes (LIST/TREE/PROGRESS)
7+
- Controls bar: Search + Tree/List buttons
8+
- Content area
9+
- Progress bar (at bottom of upper panel)
10+
Bottom: Machine Panel (left, horizontal) + Player Inventory (right)
11+
"""
12+
13+
from PIL import Image, ImageDraw
14+
import os
15+
16+
# ══════════════════════════════════════════════════════════════
17+
# GUI Dimensions
18+
# ══════════════════════════════════════════════════════════════
19+
WIDTH = 470
20+
HEIGHT = 260
21+
22+
# ══════════════════════════════════════════════════════════════
23+
# Upper Panel (top) - contains list/tree/progress views
24+
# ══════════════════════════════════════════════════════════════
25+
UPPER_PANEL_X, UPPER_PANEL_Y = 8, 4
26+
UPPER_PANEL_W, UPPER_PANEL_H = 454, 140
27+
28+
SEARCH_X, SEARCH_Y = 16, 10
29+
SEARCH_W, SEARCH_H = 340, 14
30+
31+
TREE_BTN_X, TREE_BTN_Y = 364, 8
32+
TREE_BTN_W, TREE_BTN_H = 46, 16
33+
34+
LIST_BTN_X, LIST_BTN_Y = 414, 8
35+
LIST_BTN_W, LIST_BTN_H = 40, 16
36+
37+
# Content area (for list or tree or progress info)
38+
CONTENT_X, CONTENT_Y = 16, 28
39+
CONTENT_W = 438
40+
CONTENT_H = 88 # LIST: list + detail; TREE/PROGRESS: full area
41+
42+
# Progress bar (at bottom of upper panel)
43+
PROGRESS_BAR_X, PROGRESS_BAR_Y = 16, 120
44+
PROGRESS_BAR_W, PROGRESS_BAR_H = 438, 12
45+
46+
# ══════════════════════════════════════════════════════════════
47+
# Machine Panel (bottom left) - HORIZONTAL layout
48+
# ══════════════════════════════════════════════════════════════
49+
MACHINE_PANEL_X, MACHINE_PANEL_Y = 12, 148
50+
MACHINE_PANEL_W = 200
51+
52+
LABEL_Y = 156
53+
SLOT_ROW_1_Y = 168
54+
SLOT_ROW_2_Y = 186
55+
56+
# Drive/Cube/Idea - horizontal
57+
DRIVE_X, DRIVE_Y = 20, 168
58+
CUBE_X, CUBE_Y = 40, 168
59+
IDEA_CHIP_X, IDEA_CHIP_Y = 60, 168
60+
61+
# Cost grid (3x2)
62+
COST_X, COST_Y = 96, 168
63+
64+
# Fluid gauge + Buckets
65+
FLUID_GAUGE_X, FLUID_GAUGE_Y = 168, 168
66+
FLUID_GAUGE_W, FLUID_GAUGE_H = 18, 36
67+
68+
BUCKET_IN_X, BUCKET_IN_Y = 190, 168
69+
BUCKET_OUT_X, BUCKET_OUT_Y = 190, 186
70+
71+
# Buttons (single row, moved up from old layout)
72+
BUTTON_Y = 210
73+
BUTTON_W, BUTTON_H = 42, 14
74+
START_BTN_X = 20
75+
STOP_BTN_X = 66
76+
WIPE_BTN_X = 112
77+
78+
# ══════════════════════════════════════════════════════════════
79+
# Player Inventory (bottom right)
80+
# ══════════════════════════════════════════════════════════════
81+
PLAYER_INV_X, PLAYER_INV_Y = 229, 168
82+
HOTBAR_X, HOTBAR_Y = 229, 230
83+
84+
# ══════════════════════════════════════════════════════════════
85+
# AMOLED Colors
86+
# ══════════════════════════════════════════════════════════════
87+
COLORS = {
88+
'background': (0, 0, 0), # Pure black
89+
'panel_bg': (12, 12, 12), # Slightly lighter black for panels
90+
'panel_border': (40, 40, 40), # Dark gray border
91+
'slot_bg': (30, 30, 30), # Dark slot background
92+
'slot_border_dark': (20, 20, 20), # Slot inner shadow
93+
'slot_border_light': (55, 55, 55), # Slot outer highlight
94+
'input_bg': (18, 18, 18), # Input field background
95+
'input_border': (50, 50, 50), # Input field border
96+
'button_bg': (25, 25, 25), # Button background
97+
'button_border': (60, 60, 60), # Button border
98+
'progress_bg': (20, 20, 20), # Progress bar background
99+
'progress_border': (45, 45, 45), # Progress bar border
100+
'gauge_bg': (15, 15, 15), # Fluid gauge background
101+
'gauge_border': (50, 50, 50), # Fluid gauge border
102+
'accent': (80, 80, 80), # Accent color for highlights
103+
}
104+
105+
106+
def draw_slot(draw, x, y):
107+
"""Draw a Minecraft-style slot with 3D effect."""
108+
# Outer highlight (bottom-right)
109+
draw.rectangle([x-1, y-1, x+16, y+16], fill=COLORS['slot_border_light'])
110+
# Inner shadow (top-left)
111+
draw.rectangle([x-1, y-1, x+15, y+15], fill=COLORS['slot_border_dark'])
112+
# Slot background
113+
draw.rectangle([x, y, x+15, y+15], fill=COLORS['slot_bg'])
114+
115+
116+
def draw_panel(draw, x, y, w, h):
117+
"""Draw a panel with subtle border."""
118+
draw.rectangle([x, y, x+w-1, y+h-1], fill=COLORS['panel_bg'])
119+
draw.rectangle([x, y, x+w-1, y+h-1], outline=COLORS['panel_border'])
120+
121+
122+
def draw_input(draw, x, y, w, h):
123+
"""Draw an input field / text area."""
124+
draw.rectangle([x, y, x+w-1, y+h-1], fill=COLORS['input_bg'])
125+
draw.rectangle([x, y, x+w-1, y+h-1], outline=COLORS['input_border'])
126+
127+
128+
def draw_button(draw, x, y, w, h):
129+
"""Draw a button with subtle 3D effect."""
130+
# Bottom-right shadow
131+
draw.rectangle([x+1, y+1, x+w-1, y+h-1], fill=COLORS['slot_border_dark'])
132+
# Main button
133+
draw.rectangle([x, y, x+w-2, y+h-2], fill=COLORS['button_bg'])
134+
draw.rectangle([x, y, x+w-2, y+h-2], outline=COLORS['button_border'])
135+
136+
137+
def draw_gauge(draw, x, y, w, h):
138+
"""Draw a fluid gauge area."""
139+
draw.rectangle([x, y, x+w-1, y+h-1], fill=COLORS['gauge_bg'])
140+
draw.rectangle([x, y, x+w-1, y+h-1], outline=COLORS['gauge_border'])
141+
142+
143+
def draw_progress_bar(draw, x, y, w, h):
144+
"""Draw a progress bar background."""
145+
draw.rectangle([x, y, x+w-1, y+h-1], fill=COLORS['progress_bg'])
146+
draw.rectangle([x, y, x+w-1, y+h-1], outline=COLORS['progress_border'])
147+
148+
149+
def main():
150+
img = Image.new('RGB', (WIDTH, HEIGHT), COLORS['background'])
151+
draw = ImageDraw.Draw(img)
152+
153+
# ═══════════════════════════════════════════════════════════════
154+
# UPPER PANEL (for list/tree/progress views)
155+
# ═══════════════════════════════════════════════════════════════
156+
draw_panel(draw, UPPER_PANEL_X, UPPER_PANEL_Y, UPPER_PANEL_W, UPPER_PANEL_H)
157+
158+
# Search box
159+
draw_input(draw, SEARCH_X, SEARCH_Y, SEARCH_W, SEARCH_H)
160+
161+
# Tree button
162+
draw_button(draw, TREE_BTN_X, TREE_BTN_Y, TREE_BTN_W, TREE_BTN_H)
163+
164+
# List button
165+
draw_button(draw, LIST_BTN_X, LIST_BTN_Y, LIST_BTN_W, LIST_BTN_H)
166+
167+
# Content area (list rows / detail pane)
168+
draw_input(draw, CONTENT_X, CONTENT_Y, CONTENT_W, CONTENT_H)
169+
170+
# Progress bar background
171+
draw_progress_bar(draw, PROGRESS_BAR_X, PROGRESS_BAR_Y, PROGRESS_BAR_W, PROGRESS_BAR_H)
172+
173+
# ═══════════════════════════════════════════════════════════════
174+
# MACHINE PANEL (bottom left)
175+
# ═══════════════════════════════════════════════════════════════
176+
panel_height = BUTTON_Y + BUTTON_H - MACHINE_PANEL_Y + 8
177+
draw_panel(draw, MACHINE_PANEL_X, MACHINE_PANEL_Y, MACHINE_PANEL_W, panel_height)
178+
179+
# Drive/Cube/Idea slots
180+
draw_slot(draw, DRIVE_X, DRIVE_Y)
181+
draw_slot(draw, CUBE_X, CUBE_Y)
182+
draw_slot(draw, IDEA_CHIP_X, IDEA_CHIP_Y)
183+
184+
# Cost Grid (3x2)
185+
for row in range(2):
186+
for col in range(3):
187+
sx = COST_X + col * 18
188+
sy = COST_Y + row * 18
189+
draw_slot(draw, sx, sy)
190+
191+
# Fluid Gauge
192+
draw_gauge(draw, FLUID_GAUGE_X, FLUID_GAUGE_Y, FLUID_GAUGE_W, FLUID_GAUGE_H)
193+
194+
# Bucket I/O
195+
draw_slot(draw, BUCKET_IN_X, BUCKET_IN_Y)
196+
draw_slot(draw, BUCKET_OUT_X, BUCKET_OUT_Y)
197+
198+
# Buttons
199+
draw_button(draw, START_BTN_X, BUTTON_Y, BUTTON_W, BUTTON_H)
200+
draw_button(draw, STOP_BTN_X, BUTTON_Y, BUTTON_W, BUTTON_H)
201+
draw_button(draw, WIPE_BTN_X, BUTTON_Y, BUTTON_W, BUTTON_H)
202+
203+
# ═══════════════════════════════════════════════════════════════
204+
# PLAYER INVENTORY (bottom right)
205+
# ═══════════════════════════════════════════════════════════════
206+
inv_panel_height = HOTBAR_Y + 18 - MACHINE_PANEL_Y + 8
207+
draw_panel(draw, PLAYER_INV_X - 8, MACHINE_PANEL_Y, 178, inv_panel_height)
208+
209+
# Main inventory (9x3)
210+
for row in range(3):
211+
for col in range(9):
212+
sx = PLAYER_INV_X + col * 18
213+
sy = PLAYER_INV_Y + row * 18
214+
draw_slot(draw, sx, sy)
215+
216+
# Hotbar
217+
for col in range(9):
218+
sx = HOTBAR_X + col * 18
219+
draw_slot(draw, sx, HOTBAR_Y)
220+
221+
# Save
222+
script_dir = os.path.dirname(os.path.abspath(__file__))
223+
output_path = os.path.join(
224+
script_dir, "..", "src", "main", "resources", "assets",
225+
"researchcube", "textures", "gui", "research_table.png"
226+
)
227+
img.save(output_path, "PNG")
228+
print(f"AMOLED GUI texture saved to: {output_path}")
229+
230+
231+
if __name__ == "__main__":
232+
main()

0 commit comments

Comments
 (0)