2-column open source credits

This commit is contained in:
2024-11-19 14:13:12 -06:00
parent 17e297ea32
commit bf91f41675
9 changed files with 85 additions and 32 deletions

View File

@@ -1,5 +1,6 @@
Confirmed: Confirmed:
- The Almighty Doer of Stuff - The Almighty
Doer of Stuff
- Mistb0rn - Mistb0rn
- Celtic Minstrel - Celtic Minstrel
- Kelyar-Ihrno - Kelyar-Ihrno

View File

@@ -1,2 +1,3 @@
Confirmed: Confirmed:
- The Almighty Doer of Stuff - The Almighty
Doer of Stuff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

View File

@@ -19,7 +19,9 @@ def get_confirmed_names(filename):
# After the confirmed names, there may be Not Confirmed: names. # After the confirmed names, there may be Not Confirmed: names.
if 'Not Confirmed:' in lines: if 'Not Confirmed:' in lines:
lines = lines[0:lines.index('Not Confirmed:')] lines = lines[0:lines.index('Not Confirmed:')]
return [line.replace('- ', '') for line in lines if len(line) > 0]
# Lines should either start with "- " or " " if continuing the previous name, wrapped and indented:
return [line[2:] for line in lines if len(line) > 0]
def main(): def main():
# Generate about-boe.xml from about-boe-template.xml: # Generate about-boe.xml from about-boe-template.xml:
@@ -83,19 +85,59 @@ def main():
output_file.write(content) output_file.write(content)
# Generate startanim.png using ImageMagick # Generate startanim.png using ImageMagick
image_lines = ['* OPEN SOURCE CREDITS *', ' ', ' ']
image_lines_col1 = []
image_lines_col2 = []
# Note: blank lines need to have a space in them for some reason
def add_heading(heading): def add_heading(heading):
image_lines.append(f'- {heading.upper()} -') image_lines_col1.append(f'- {heading.upper()} -')
image_lines.extend(" ") image_lines_col1.append(' ')
image_lines.extend(name_dict[heading]) image_lines_col2.extend([' ', ' '])
image_lines.extend(" ")
# (Complicated)
# Split the names into two columns, still vertically alphabetized,
# while keeping multi-line names on the same column!
names = name_dict[heading]
left_column = True
idx = 0
while idx < len(names):
current_column = image_lines_col1 if left_column else image_lines_col2
current_column.append(names[idx])
multiline_idx = idx + 1
while multiline_idx < len(names) and names[multiline_idx].startswith(' '):
current_column.append(names[multiline_idx])
multiline_idx += 1
idx += 1
left_column = len(image_lines_col1) <= len(image_lines_col2)
idx += 1
while len(image_lines_col1) != len(image_lines_col2):
current_column = image_lines_col1 if left_column else image_lines_col2
current_column.append(' ')
image_lines_col1.append(' ')
image_lines_col2.append(' ')
add_heading('Programming') add_heading('Programming')
add_heading('Graphics') add_heading('Graphics')
add_heading('Testing') add_heading('Testing')
add_heading('Funding') add_heading('Funding')
run(['bash', 'pkg/generate-startanim.sh'], input='\n'.join(image_lines), encoding='ascii') # when one column starts with blank lines, ImageMagick doesn't offset the top correctly.
# So we pass the number of lines to y-offset the right column image
col2_blank_lines_start = 0
for line in image_lines_col2:
if line == ' ':
col2_blank_lines_start += 1
else:
break
run(['bash', 'pkg/generate-startanim-col.sh', '1', '0'], input='\n'.join(image_lines_col1), encoding='ascii')
# print(col2_blank_lines_start)
run(['bash', 'pkg/generate-startanim-col.sh', '2', str(col2_blank_lines_start)], input='\n'.join(image_lines_col2), encoding='ascii')
run(['bash', 'pkg/generate-startanim.sh'])
if __name__ == "__main__": if __name__ == "__main__":
main() main()

16
pkg/generate-startanim-col.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
text="$(cat)"
line_count=$(echo "$text" | wc -l)
font_size=8
spacing=5
actual_line_size=$((font_size + spacing))
top_offset_lines=$2
first_line_offset=$((font_size + 2 + actual_line_size * top_offset_lines))
height=$((actual_line_size * line_count))
magick -size 140x$height xc:transparent \
-stroke black -pointsize $font_size -interline-spacing $spacing \
-font 'pkg/credits/font-8.bdf' -annotate +7+$first_line_offset "$text" \
pkg/credits/startanim-col-$1.png

View File

@@ -1,17 +1,7 @@
#!/bin/bash #!/bin/bash
text="$(cat)" magick convert +append pkg/credits/startanim-col-*.png pkg/credits/startanim-pt-2.png
line_count=$(echo "$text" | wc -l) magick convert -append pkg/credits/startanim-pt-*.png rsrc/graphics/startanim.png
# Clean up:
font_size=8 rm pkg/credits/startanim-col-*.png
spacing=5 rm pkg/credits/startanim-pt-2.png
actual_line_size=$((font_size + spacing))
first_line_offset=$((font_size + 2))
height=$((actual_line_size * line_count))
magick -size 280x$height xc:transparent \
-stroke black -pointsize $font_size -interline-spacing $spacing \
-font 'pkg/credits/font-8.bdf' -annotate +7+$first_line_offset "$text" \
pkg/credits/startanim-pt-2.png
magick convert -append pkg/credits/startanim-pt-*.png rsrc/graphics/startanim.png

View File

@@ -18,11 +18,11 @@
<!-- The height of this text needs to be 10 times the number of lines. --> <!-- The height of this text needs to be 10 times the number of lines. -->
<text top='52' left='50' width='400' height='240'> <text top='52' left='50' width='400' height='240'>
ORIGINAL GAME: <br/><br/><br/><br/><br/><br/> ORIGINAL GAME: <br/><br/><br/><br/><br/><br/>
OPEN SOURCE CREDITS: <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> OPEN SOURCE CREDITS: <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
SCENARIO FIXES AND UPDATES: <br/><br/> SCENARIO FIXES AND UPDATES: <br/><br/>
</text> </text>
<!-- This text is right-aligned and fills out the above text with sub-headings --> <!-- This text is right-aligned and fills out the above text with sub-headings -->
<text top='52' left='50' width='180' height='620' align='right'> <text top='52' left='50' width='180' height='650' align='right'>
<br/> <br/>
Concept, Design, Programming: <br/> Concept, Design, Programming: <br/>
Graphics: <br/> Graphics: <br/>
@@ -30,14 +30,14 @@
Title/Splash Screens: <br/> Title/Splash Screens: <br/>
<br/> <br/>
<br/> <br/>
Programming: <br/><br/><br/><br/><br/><br/><br/><br/><br/> Programming: <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
Graphics: <br/><br/><br/><br/><br/> Graphics: <br/><br/><br/><br/><br/><br/>
Testing and Troubleshooting: <br/> Testing and Troubleshooting: <br/><br/>
Funding: <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> Funding: <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<br/><br/> <br/><br/>
Bandit Busywork: <br/> Bandit Busywork: <br/>
</text> </text>
<text top='52' left='250' width='230' height='620'> <text top='52' left='250' width='230' height='650'>
<!-- ORIGINAL GAME --><br/> <!-- ORIGINAL GAME --><br/>
<!-- Concept, Design, Programming -->Jeff Vogel <br/> <!-- Concept, Design, Programming -->Jeff Vogel <br/>
<!-- Graphics -->Andrew Hunter <br/> <!-- Graphics -->Andrew Hunter <br/>
@@ -53,12 +53,15 @@
xq <br/> xq <br/>
Daerogami <br/> Daerogami <br/>
NQNStudios <br/> NQNStudios <br/>
<!-- Graphics -->The Almighty Doer of Stuff <br/> Sei Satzparad <br/>
<!-- Graphics -->The Almighty <br/>
Doer of Stuff <br/>
Mistb0rn <br/> Mistb0rn <br/>
Celtic Minstrel <br/> Celtic Minstrel <br/>
Kelyar-Ihrno <br/> Kelyar-Ihrno <br/>
Jewels <br/> Jewels <br/>
<!-- Testing and Troubleshooting -->The Almighty Doer of Stuff <br/> <!-- Testing and Troubleshooting -->The Almighty <br/>
Doer of Stuff <br/>
<!-- Funding -->Alan Elkins <br/> <!-- Funding -->Alan Elkins <br/>
Alan Monroe <br/> Alan Monroe <br/>
Amanda Klecker <br/> Amanda Klecker <br/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB