Compare commits

...

4 Commits

Author SHA1 Message Date
Tom Rothamel 7422fe43b8 Fix a bug building mac distributions on windows.
Ready 6.8.0d.
2008-10-17 10:06:57 -04:00
Tom Rothamel 879c45a5b3 Releasing 6.8.0c 2008-10-15 15:43:29 -04:00
Tom Rothamel db0d205374 Added BMFont support. 2008-10-15 15:36:05 -04:00
Tom Rothamel f20594a2b5 Add build_launchertrans to version control.
Remove obsolete files.
2008-10-15 12:40:26 -04:00
10 changed files with 218 additions and 132 deletions
+6
View File
@@ -22,3 +22,9 @@ doc/reference
doc/shared.css
doc/tutorials
doc/www.renpy.org
testing
translations.rpy
launchertrans.rpy
jcc
scite/scite.zip
screenshot*
+4 -3
View File
@@ -21,9 +21,10 @@ to have additional whitespace inserted between words so that the left
and right margins are even, except on the last line of a paragraph.
Ren'Py now supports the MudgeFont image-based file format. The new
renpy.register_mudgefont function is used to register a
MudgeFont.
Ren'Py now supports the MudgeFont and BMFont image-based font file
formats. The new renpy.register_mudgefont function is used to register
a MudgeFont, and the renpy.register_bmfon function is used to register
a BMFont.
Newly-created games will have a Help option on the main and game
-55
View File
@@ -1,55 +0,0 @@
This file contains boilerplate information about running Ren'Py that
can be included into the README for your game. It may be necessary to
change some of the filenames in this document, to make it specific to
your game.
Feel free to use this in your projects.
Running the Game
================
(Windows)
If this game was installed on Windows using an installer, then you can
run it by choosing the shortcut left by the installer. If this game
was installed on Windows using the cross-platform zip file, then it
can be run by executing the run_game.exe file.
(Macintosh)
For information about running Ren'Py games on Mac OS 10.3 or higher,
please go to http://www.bishoujo.us/renpy/mac.html .
(Linux/Unix)
For information about running Ren'Py games under Linux and Unix,
please go to http://www.bishoujo.us/renpy/linux.html . At the very
least, you will need to compile the _renpy module. Read
the file module/README.txt for details.
Playing the Game
================
By default, the game starts running in full screen mode. On some
computers, especially some virtual machines, this can lead to mouse
problems. To fix this, press 'f'.
Some of the more interesting game actions can be performed as follows:
- The left mouse button is used to advance to the next line of
dialogue, or to pick menu options.
- The right mouse button brings you into a menu screen where you can
save the game, load the game, change preferences, return to the main
menu, or quit entirely.
- Scrolling the mouse wheel up or pushing page up returns you to the
previous screen.
- Holding down the CTRL key skips dialogue. By default, it only
skips read dialogue, but this can be changed by a preference. Tab
toggles skip mode.
-21
View File
@@ -1,21 +0,0 @@
A version of dissolve that only draws the pixels that are being
dissolved, while doing a straight-blit on pixels that remain the same
between the two images.
Figure out some way of having variables updated in a new context saved
permanently, even if we return to the outer context because of a
rollback or something. Need to be very careful here.
Dynamic variables, parameterized labels, etc.
Implement an extension mechanism of some sort, so that users can drop
packages of Ren'Py code into the Ren'Py directory, and get stuff like
speech support.
Implement speech control support.
BPP conversion (perhaps as a package).
Automatically scale to a fixed size.
Hide picture-mouse when leaving window, restore it when entering window.
+51
View File
@@ -0,0 +1,51 @@
1#!/usr/bin/env python
import glob
import re
from sets import Set as set
import sys
seen_files = set()
seen_strings = set()
def tl(fn, s):
s = eval(s)
if len(s) < 3:
return
if s in seen_strings:
return
if fn not in seen_files:
print >>out
print >>out, " # Translatable strings found in", fn
print >>out
seen_files.add(fn)
print >>out, " config.translations[%r] = %r" % (s, s)
seen_strings.add(s)
def process(fn):
data = file(fn).read()
for m in re.finditer(r'\bu\"(\\"|[^"])+\"', data):
tl(fn, m.group(0))
for m in re.finditer(r"\bu\'(\\'|[^'])+\'", data):
tl(fn, m.group(0))
if __name__ == "__main__":
# out = file("extras/translations.rpy", "w")
out = sys.stdout
print >>out, "# This file contains a list of all of the phrases you can translate"
print >>out, "# from the Ren'Py launcher."
print >>out, ""
print >>out, "init python:"
for fn in glob.glob("launcher/*.rpy"):
process(fn)
-12
View File
@@ -1,12 +0,0 @@
import sys
import os
try:
import Image
except ImportError:
print "Could not import the Image module. Please ensure that the Python Imaging"
print "Library (PIL) is properly installed."
sys.exit(-1)
+7 -5
View File
@@ -98,6 +98,8 @@ init python:
dfn = destdir + "/" + fn
else:
dfn = fn
dfn = dfn.replace("\\", "/")
rv.append((sfn, dfn))
@@ -280,7 +282,7 @@ label distribute:
win_data = { }
if os.path.exists(project.path + "/icon.ico"):
win_data[config.renpy_base + "/renpy.exe"] = pefile.change_icons(
win_data[project.name + ".exe"] = pefile.change_icons(
config.renpy_base + "/renpy.exe",
project.path + "/icon.ico",
)
@@ -306,7 +308,7 @@ label distribute:
zi.external_attr = long(0100666) << 16
data = file(fn, "rb").read()
data = win_data.get(fn, data)
data = win_data.get(an, data)
zf.writestr(zi, data)
@@ -379,11 +381,11 @@ label distribute:
quoted_name = project.name.replace("&", "&amp;").replace("<", "&lt;")
info_plist = file(config.renpy_base + "/renpy.app/Contents/Info.plist", "rb").read().replace("Ren'Py Launcher", quoted_name)
mac_data[config.renpy_base + "/renpy.app/Contents/Info.plist"] = info_plist
mac_data[project.name + ".app/Contents/Info.plist"] = info_plist
if os.path.exists(project.path + "/icon.icns"):
icon_data = file(project.path + "/icon.icns", "rb").read()
mac_data[config.renpy_base + "/renpy.app/Contents/Resources/launcher.icns"] = icon_data
mac_data[project.name + ".app/Contents/Resources/launcher.icns"] = icon_data
zf = zipfile.ZipFile(name + "-mac.zip", "w", zipfile.ZIP_DEFLATED)
@@ -411,7 +413,7 @@ label distribute:
zi.external_attr = long(0100666) << 16
data = file(fn, "rb").read()
data = mac_data.get(fn, data)
data = mac_data.get(an, data)
zf.writestr(zi, data)
zf.close()
+1 -1
View File
@@ -27,7 +27,7 @@
# ***** ***** ***** ***** ***** ***** **** ***** ***** ***** *****
# Be sure to change script_version in launcher/script_version.rpy, too!
# Also check to see if we have to update renpy.py.
version = "Ren'Py 6.8.0b"
version = "Ren'Py 6.8.0d"
script_version = 5003000
savegame_suffix = "-LT1.save"
+148 -34
View File
@@ -42,6 +42,21 @@ font_cache = { }
class ImageFont(object):
# ImageFonts are expected to have the following fields defined by
# a subclass:
# Font global:
# height - The line height, the height of each character cell.
# kerns - The kern between wach pair of characters.
# default_kern - The default kern.
# baseline - The y offset of the font baseline.
# Per-character:
# width - The width of each character.
# advance - The advance of each character.
# offsets - The x and y offsets of each character.
# chars - A map from a character to the surface containing that character.
def size(self, text):
w = 0
@@ -50,11 +65,11 @@ class ImageFont(object):
for a, b in zip(text, text[1:]):
try:
w += self.sizes[a] + self.kerns.get(a + b, self.default_kern)
w += self.advance[a] + self.kerns.get(a + b, self.default_kern)
except KeyError:
raise Exception("Character %r not found in %s." % (a, type(self).__name__))
w += self.sizes[text[-1]]
w += self.width[text[-1]]
return (w, self.height)
@@ -69,10 +84,12 @@ class ImageFont(object):
y = 0
for a, b in zip(text, text[1:]):
surf.blit(self.chars[a], (x, y))
x += self.sizes[a] + self.kerns.get(a + b, self.default_kern)
xoff, yoff = self.offsets[a]
surf.blit(self.chars[a], (x + xoff, y + yoff))
x += self.advance[a] + self.kerns.get(a + b, self.default_kern)
surf.blit(self.chars[text[-1]], (x, y))
xoff, yoff = self.offsets[text[-1]]
surf.blit(self.chars[text[-1]], (x + xoff, y + yoff))
if renpy.config.recolor_sfonts and \
(color != (255, 255, 255, 255) or black_color != (0, 0, 0, 255) ) and \
@@ -87,17 +104,17 @@ class ImageFont(object):
return surf
def get_linesize(self):
return self.height
return self.height + 10
def get_height(self):
return self.height
def get_ascent(self):
return self.height
return self.baseline
def get_descent(self):
return 0
return -(self.height - self.baseline)
class SFont(ImageFont):
@@ -116,25 +133,30 @@ class SFont(ImageFont):
def load(self):
# Map from character to subsurface.
self.chars = { }
# Map from character to width, height.
self.sizes = { }
self.width = { }
self.advance = { }
self.offsets = { }
# Load in the image.
surf = renpy.display.im.Image(self.filename).load(unscaled=True)
sw, sh = surf.get_size()
height = sh
self.height = height
self.baseline = height
# Create space characters.
self.chars[u' '] = pygame.Surface((self.spacewidth, height), 0, surf)
self.sizes[u' '] = self.spacewidth
self.chars[u'\u00a0'] = self.chars[u' ']
self.sizes[u'\u00a0'] = self.sizes[u' ']
self.width[u' '] = self.spacewidth
self.advance[u' '] = self.spacewidth
self.offsets[u' '] = (0, 0)
self.chars[u'\u00a0'] = self.chars[u' ']
self.width[u'\u00a0'] = self.width[u' ']
self.advance[u'\u00a0'] = self.advance[u' ']
self.offsets[u'\u00a0'] = self.offsets[u' ']
# The color key used to separate characters.
i = 0
while True:
@@ -165,8 +187,9 @@ class SFont(ImageFont):
ss = renpy.display.scale.surface_scale(ss)
self.chars[c] = ss
self.sizes[c] = i - start
self.width[c] = i - start
self.advance[c] = i - start
self.offsets[c] = (0, 0)
i += 1
@@ -188,15 +211,13 @@ class MudgeFont(ImageFont):
def load(self):
# Map from character to subsurface.
self.chars = { }
# Map from character to width, height.
self.sizes = { }
self.width = { }
self.advance = { }
self.offsets = { }
# Load in the image.
surf = renpy.display.im.Image(self.filename).load(unscaled=True)
self.surf = surf
# Parse the xml file.
tree = etree.fromstring(renpy.loader.load(self.xml).read())
@@ -220,21 +241,110 @@ class MudgeFont(ImageFont):
ss = renpy.display.scale.surface_scale(ss)
self.chars[c] = ss
self.sizes[c] = w
self.width[c] = w
self.advance[c] = w
self.offsets[c] = (0, 0)
height = max(height, h)
self.height = height
self.baseline = height
# Create space characters.
if u' ' not in self.chars:
self.chars[u' '] = pygame.Surface((self.spacewidth, height), 0, surf)
self.sizes[u' '] = self.spacewidth
self.width[u' '] = self.spacewidth
self.advance[u' '] = self.spacewidth
self.offsets[u' '] = (0, 0)
if u'\u00a0' not in self.chars:
self.chars[u'\u00a0'] = self.chars[u' ']
self.sizes[u'\u00a0'] = self.sizes[u' ']
self.width[u'\u00a0'] = self.width[u' ']
self.advance[u'\u00a0'] = self.advance[u' ']
self.offsets[u'\u00a0'] = self.offsets[u' ']
def parse_bmfont_line(l):
w = ""
line = [ ]
quote = False
for c in l:
if c == "\r" or c == "\n":
continue
if c == " " and not quote:
if w:
line.append(w)
w = ""
continue
if c == "\"":
quote = not quote
continue
w += c
if w:
line.append(w)
map = dict(i.split("=", 1) for i in line[1:])
return line[0], map
class BMFont(ImageFont):
def __init__(self, filename):
self.filename = filename
def load(self):
self.chars = { }
self.width = { }
self.advance = { }
self.offsets = { }
self.kerns = { }
self.default_kern = 0
pages = { }
f = renpy.loader.load(self.filename)
for l in f:
kind, args = parse_bmfont_line(l)
if kind == "common":
self.height = int(args["lineHeight"])
self.baseline = int(args["base"])
elif kind == "page":
pages[int(args["id"])] = renpy.display.im.Image(args["file"]).load(unscaled=True)
elif kind == "char":
c = unichr(int(args["id"]))
x = int(args["x"])
y = int(args["y"])
w = int(args["width"])
h = int(args["height"])
xo = int(args["xoffset"])
yo = int(args["yoffset"])
xadvance = int(args["xadvance"])
page = int(args["page"])
ss = pages[page].subsurface((x, y, w, h))
ss = renpy.display.scale.surface_scale(ss)
self.chars[c] = ss
self.width[c] = w + xo
self.advance[c] = xadvance
self.offsets[c] = (xo, yo)
f.close()
if u'\u00a0' not in self.chars:
self.chars[u'\u00a0'] = self.chars[u' ']
self.width[u'\u00a0'] = self.width[u' ']
self.advance[u'\u00a0'] = self.advance[u' ']
self.offsets[u'\u00a0'] = self.offsets[u' ']
def register_sfont(name=None, size=None, bold=False, italics=False, underline=False,
filename=None, spacewidth=10, default_kern=0, kerns={},
@@ -250,13 +360,17 @@ def register_sfont(name=None, size=None, bold=False, italics=False, underline=Fa
def register_mudgefont(name=None, size=None, bold=False, italics=False, underline=False,
filename=None, xml=None, spacewidth=10, default_kern=0, kerns={}):
if name is None or size is None or filename is None:
raise Exception("When registering a Mudge Font, the font name, font size, filename, and xmlfilename are required.")
if name is None or size is None or filename is None or xml is None:
raise Exception("When registering a Mudge Font, the font name, font size, filename, and xml filename are required.")
mf = MudgeFont(filename, xml, spacewidth, default_kern, kerns)
fonts[(name, size, bold, italics, underline)] = mf
def register_bmfont(name=None, size=None, bold=False, italics=False, underline=False,
filename=None):
bmf = BMFont(filename)
fonts[(name, size, bold, italics, underline)] = bmf
def load_ttf(fn, size, bold, italics, underline, expand):
+1 -1
View File
@@ -29,7 +29,7 @@ _file = file
import renpy
from renpy.display.text import ParameterizedText
from renpy.display.font import register_sfont, register_mudgefont
from renpy.display.font import register_sfont, register_mudgefont, register_bmfont
from renpy.display.behavior import Keymap
from renpy.display.minigame import Minigame