mirror of
https://github.com/freedoom/freedoom.git
synced 2025-09-02 07:25:45 -04:00
graphics: Generate HELP screens programatically.
Decompose the help screen into three parts: the background, the text and the title. Generate all except the main text programatically: the background as a color transformed version of the INTERPIC graphic and the title using the textgen tool.
This commit is contained in:
parent
c06cb4478c
commit
7f281321c9
8 changed files with 34 additions and 33 deletions
Binary file not shown.
Before Width: | Height: | Size: 33 KiB |
|
@ -1,5 +0,0 @@
|
||||||
for graphics/ - screen for HELP and HELP1 . Based on the INTERPIC and the HUD
|
|
||||||
font already in freedoom.
|
|
||||||
|
|
||||||
--
|
|
||||||
cph@cph.demon.co.uk
|
|
|
@ -1 +1 @@
|
||||||
cph/help.gif
|
text/help.gif
|
1
graphics/text/.gitignore
vendored
1
graphics/text/.gitignore
vendored
|
@ -3,5 +3,6 @@ wi*.gif
|
||||||
wilv*.gif
|
wilv*.gif
|
||||||
cwilv*.gif
|
cwilv*.gif
|
||||||
dmwilv*.gif
|
dmwilv*.gif
|
||||||
|
help*.gif
|
||||||
prboom.gif
|
prboom.gif
|
||||||
graphics.stamp
|
graphics.stamp
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
GRAPHICS = \
|
TEXTGEN_GRAPHICS = \
|
||||||
m_detail.gif m_disopt.gif m_disp.gif m_endgam.gif m_epi1.gif \
|
m_detail.gif m_disopt.gif m_disp.gif m_endgam.gif m_epi1.gif \
|
||||||
m_epi2.gif m_epi3.gif m_epi4.gif m_episod.gif m_gdhigh.gif \
|
m_epi2.gif m_epi3.gif m_epi4.gif m_episod.gif m_gdhigh.gif \
|
||||||
m_gdlow.gif m_hurt.gif m_jkill.gif m_lgttl.gif m_loadg.gif \
|
m_gdlow.gif m_hurt.gif m_jkill.gif m_lgttl.gif m_loadg.gif \
|
||||||
|
@ -13,7 +13,7 @@ GRAPHICS = \
|
||||||
m_mess.gif m_mouse.gif m_multi.gif m_player.gif m_serial.gif \
|
m_mess.gif m_mouse.gif m_multi.gif m_player.gif m_serial.gif \
|
||||||
m_setup.gif m_sound.gif m_stat.gif m_status.gif m_tcpip.gif \
|
m_setup.gif m_sound.gif m_stat.gif m_status.gif m_tcpip.gif \
|
||||||
m_versen.gif m_video.gif m_wad.gif m_wadopt.gif m_weap.gif \
|
m_versen.gif m_video.gif m_wad.gif m_wadopt.gif m_weap.gif \
|
||||||
prboom.gif \
|
prboom.gif helpttl.gif \
|
||||||
m_ultra.gif wibp1.gif wibp2.gif wibp3.gif wibp4.gif \
|
m_ultra.gif wibp1.gif wibp2.gif wibp3.gif wibp4.gif \
|
||||||
wicolon.gif wienter.gif wif.gif wifrgs.gif wipcnt.gif \
|
wicolon.gif wienter.gif wif.gif wifrgs.gif wipcnt.gif \
|
||||||
wiminus.gif wimstar.gif wimstt.gif wiostf.gif wiosti.gif \
|
wiminus.gif wimstar.gif wimstt.gif wiostf.gif wiosti.gif \
|
||||||
|
@ -37,13 +37,13 @@ GRAPHICS = \
|
||||||
wilv33.gif wilv34.gif wilv35.gif wilv36.gif wilv37.gif \
|
wilv33.gif wilv34.gif wilv35.gif wilv36.gif wilv37.gif \
|
||||||
wilv38.gif
|
wilv38.gif
|
||||||
|
|
||||||
all: $(GRAPHICS)
|
all: $(TEXTGEN_GRAPHICS) help.gif
|
||||||
|
|
||||||
# textgen creates multiple outputs, which is awkward to express in
|
# textgen creates multiple outputs, which is awkward to express in
|
||||||
# make. Use a witness file (graphics.stamp) as suggested in the
|
# make. Use a witness file (graphics.stamp) as suggested in the
|
||||||
# automake manual: "Handling Tools that Produce Many Outputs"
|
# automake manual: "Handling Tools that Produce Many Outputs"
|
||||||
|
|
||||||
$(GRAPHICS): graphics.stamp
|
$(TEXTGEN_GRAPHICS): graphics.stamp
|
||||||
@if test -f $@; then :; else \
|
@if test -f $@; then :; else \
|
||||||
rm -f graphics.stamp; \
|
rm -f graphics.stamp; \
|
||||||
$(MAKE) data.stamp; \
|
$(MAKE) data.stamp; \
|
||||||
|
@ -55,5 +55,14 @@ graphics.stamp: config.py fontchars ../../lumps/fraggle/freedoom.bex
|
||||||
./textgen
|
./textgen
|
||||||
@mv graphics.tmp $@
|
@mv graphics.tmp $@
|
||||||
|
|
||||||
|
help.gif: helpbg.gif helptext.gif helpttl.gif
|
||||||
|
convert helpbg.gif \
|
||||||
|
-draw 'image over 0,0 0,0 helptext.gif' \
|
||||||
|
-draw 'image over 140,5 0,0 helpttl.gif' \
|
||||||
|
help.gif
|
||||||
|
|
||||||
|
helpbg.gif: ../interpic.gif
|
||||||
|
convert ../interpic.gif -fill '#0077ff' -tint 50 helpbg.gif
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(GRAPHICS) graphics.stamp *.pyc
|
rm -f $(TEXTGEN_GRAPHICS) helpbg.gif help.gif graphics.stamp *.pyc
|
||||||
|
|
|
@ -210,6 +210,12 @@ red_graphics = {
|
||||||
'm_multi': 'Multiplayer',
|
'm_multi': 'Multiplayer',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Rendered with transparent background:
|
||||||
|
transparent_graphics = {
|
||||||
|
# Title for the HELP/HELP1 screen:
|
||||||
|
'helpttl': 'Help',
|
||||||
|
}
|
||||||
|
|
||||||
def read_bex_lump(filename):
|
def read_bex_lump(filename):
|
||||||
"""Read the BEX (Dehacked) lump from the given filename.
|
"""Read the BEX (Dehacked) lump from the given filename.
|
||||||
|
|
||||||
|
|
BIN
graphics/text/helptext.gif
Normal file
BIN
graphics/text/helptext.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
|
@ -208,20 +208,6 @@ class Font(object):
|
||||||
|
|
||||||
return command_line
|
return command_line
|
||||||
|
|
||||||
def render_transparent_text(self, text, output_filename, color):
|
|
||||||
"""Render the given text to the given output file.
|
|
||||||
|
|
||||||
The rendered text is generated with a transparent background.
|
|
||||||
"""
|
|
||||||
|
|
||||||
if UPPERCASE_FONT:
|
|
||||||
text = text.upper()
|
|
||||||
command_line = self._make_command_line(text, color)
|
|
||||||
|
|
||||||
command_line.append(output_filename)
|
|
||||||
|
|
||||||
invoke_command(command_line)
|
|
||||||
|
|
||||||
def render_text(self, text, output_filename,
|
def render_text(self, text, output_filename,
|
||||||
color=COLOR_WHITE, bgcolor=BACKGROUND_COLOR):
|
color=COLOR_WHITE, bgcolor=BACKGROUND_COLOR):
|
||||||
"""Render text to a file with the given background color."""
|
"""Render text to a file with the given background color."""
|
||||||
|
@ -230,16 +216,19 @@ class Font(object):
|
||||||
text = text.upper()
|
text = text.upper()
|
||||||
command_line = self._make_command_line(text, color)
|
command_line = self._make_command_line(text, color)
|
||||||
|
|
||||||
command_line.extend([
|
if bgcolor is not None:
|
||||||
'-background', bgcolor, '-flatten',
|
command_line.extend([
|
||||||
output_filename])
|
'-background', bgcolor, '-flatten'])
|
||||||
|
|
||||||
|
command_line.append(output_filename)
|
||||||
|
|
||||||
invoke_command(command_line)
|
invoke_command(command_line)
|
||||||
|
|
||||||
def generate_graphics(graphics, color=COLOR_WHITE):
|
def generate_graphics(graphics, color=COLOR_WHITE, bgcolor=BACKGROUND_COLOR):
|
||||||
for name, text in sorted(graphics.items()):
|
for name, text in sorted(graphics.items()):
|
||||||
print("# %s.gif: '%s'" % (name, text))
|
print("# %s.gif: '%s'" % (name, text))
|
||||||
font.render_text(text, '%s.gif' % name, color=color)
|
font.render_text(text, '%s.gif' % name,
|
||||||
|
color=color, bgcolor=bgcolor)
|
||||||
|
|
||||||
def generate_kerning_test():
|
def generate_kerning_test():
|
||||||
pairs = []
|
pairs = []
|
||||||
|
@ -257,7 +246,8 @@ font = Font('fontchars', kerning_table=FONT_KERNING_RULES)
|
||||||
# Enable to generate test image file for tweaking kerning values:
|
# Enable to generate test image file for tweaking kerning values:
|
||||||
#generate_kerning_test()
|
#generate_kerning_test()
|
||||||
|
|
||||||
generate_graphics(red_graphics, COLOR_RED)
|
generate_graphics(red_graphics, color=COLOR_RED)
|
||||||
generate_graphics(blue_graphics, COLOR_BLUE)
|
generate_graphics(blue_graphics, color=COLOR_BLUE)
|
||||||
generate_graphics(white_graphics, COLOR_WHITE)
|
generate_graphics(white_graphics, color=COLOR_WHITE)
|
||||||
|
generate_graphics(transparent_graphics, color=COLOR_RED, bgcolor=None)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue