Compare commits

...

10 Commits

Author SHA1 Message Date
Tom Rothamel ee017f4bc6 The launcher now deals better with long project names.
The launcher now warns if java is missing.
2008-10-14 21:20:14 -04:00
Tom Rothamel 4d089f9a0e Fixed various editor bugs. 2008-10-14 19:35:02 -04:00
Tom Rothamel e7f9c5c2ac Making ready for 6.8.0b 2008-10-14 17:43:31 -04:00
Tom Rothamel 2df8d38c2f Add config.missing_background. 2008-10-14 17:36:51 -04:00
Tom Rothamel 17ac44d610 Ren'Py now supports the MudgeFont image-based file format. The new
renpy.register_mudgefont function is used to register a
MudgeFont.
2008-10-14 17:30:56 -04:00
Tom Rothamel 3c52c2ae3f Fixed positioning of 640x480 preferences. 2008-10-14 16:29:45 -04:00
Tom Rothamel 5a5115e29f Fixed a problem with outlines and bold/italic text. 2008-10-14 16:07:29 -04:00
Tom Rothamel 5c7ff1c97b Fixed a bug that prevented styles from being rebuilt. 2008-10-13 23:19:04 -04:00
Tom Rothamel cc820a3595 Fix bugs pointed out by delta at:
http://lemmasoft.renai.us/forums/viewtopic.php?p=58835#p58835
2008-10-13 22:49:23 -04:00
Tom Rothamel 48fff48d28 Updated tag script. 2008-10-13 17:59:53 -04:00
19 changed files with 245 additions and 123 deletions
+9
View File
@@ -13,3 +13,12 @@ jedit
lint.txt
renpy.code
traceback.txt
doc/common.css
doc/images
doc/index.html
doc/monobook.css
doc/monobook2.css
doc/reference
doc/shared.css
doc/tutorials
doc/www.renpy.org
+14 -4
View File
@@ -21,6 +21,11 @@ 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.
Newly-created games will have a Help option on the main and game
menus. This is controlled by the config.help variable. By default
the help system shows the README.html file in the game's base directory.
@@ -48,9 +53,10 @@ Game", for consistency with the game menu.
When config.developer is set and an undefined image is used in a show
or scene statement, a list of undefined images will appear centered at
the top of the screen. A black screen will be show instead of any missing
background. This makes it easier to write a script before all images are
present.
the top of the screen. A black screen (configurable with
config.missing_background) will be shown instead of any missing
background. This makes it easier to write a script before all images
are present.
The newly-documented Style.set_parent method lets you change the
@@ -74,7 +80,7 @@ Alt-F4 and Command-Q now trigger the quit event, as if you pressed the
quit button on the top of the window. The first press brings up the
quit prompt, and a second press forcibly terminates the game.
Alt-H and Command-H hide (iconify) the window.
Alt-M and Command-M iconify the window.
The new RENPY_SCREENSHOT_PATTERN environment variable lets you
@@ -91,6 +97,10 @@ The presplash code now looks for presplash.jpg in the game directory
if presplash.png is not found.
On Windows, config.window_icon will be scaled to 32x32 if it is wider
than 32 pixels. This allows the same icon to be used across platforms.
Custom mouse cursors should now be properly hidden when the mouse
leaves the window. Previously, this failed to work on the Mac OS X
platform.
+2 -1
View File
@@ -18,7 +18,8 @@ def main():
setup(name="RenPy",
windows=[ dict(script="renpy.py",
dest_base="renpy",
icon_resources=[ (1, "newicon.ico") ] ) ],
icon_resources=[ (1, "newicon.ico") ] ),
],
console=[ dict(script="renpy.py", dest_base="console") ],
+4 -1
View File
@@ -196,6 +196,9 @@ label _style_hierarchy:
jump _developer_screen
init -1050 python:
config.missing_background = "black"
init 1050 python:
if renpy.game.options.remote:
@@ -238,7 +241,7 @@ init 1050 python:
global __missing_scene
if __missing_scene:
renpy.show(name, what="black")
renpy.show(name, what=config.missing_background)
__missing_scene = False
what = " ".join(what).replace("{", "{{")
+2 -1
View File
@@ -182,7 +182,8 @@ init -1180 python hide:
filename, line = renpy.get_filename_line()
renpy.launch_editor([ filename ], line)
# The default keymap.
# The default keymap. We might also want to put some of this into
# the launcher.
km = renpy.Keymap(
rollback = renpy.rollback,
screenshot = screenshot,
+1 -1
View File
@@ -22,7 +22,7 @@ init python:
style.prefs_column.box_spacing = 5
style.prefs_frame.top_margin = 5
style.prefs_left.xpos = 100
style.prefs_left.xpos = 110
style.prefs_center.xpos = 320
style.prefs_right.xpos = 530
+2 -3
View File
@@ -203,10 +203,9 @@ init -1 python hide:
## - A label in the script, in which case that label is called to
## show help to the user.
## - A file name relative to the base directory, which is opened in a
## web browser. The filename may be followed by an # to specifiy an
## anchor inside an html file.
## web browser.
## - None, to disable help.
config.help = "README.html#renpy_help"
config.help = "README.html"
#########################################
+14 -3
View File
@@ -36,6 +36,13 @@ init:
style.hyperlink_text.color = "#0ff"
config.underlay = [
renpy.Keymap(
quit = renpy.quit_event,
iconify = renpy.iconify,
)
]
def quote(c):
n = ord(c)
if 0x20 <= n <= 0x7f:
@@ -58,13 +65,14 @@ init:
ui.add(DynamicDisplayable("Text(_(store.message), size=14, color='#fff', xpos=100, ypos=375, xmaximum=240)"))
ui.text(renpy.version(), xalign=0, yalign=1.0, size=12, color='#000')
return ui.interact(suppress_underlay=True)
return ui.interact()
def title(name):
ui.window(style='mm_root')
ui.null()
ui.frame(xminimum=350, yminimum=370)
ui.viewport(child_size=(2000, None), draggable=True, ymaximum=34)
_label_factory(name, "launcher_title", size=28)
# ui.text(name, xpos=4, ypos=4, size=30, color="#559")
@@ -93,7 +101,7 @@ init:
# ui.button(clicked=clicked, hovered=hovered)
# ui.text(text, style="button_text")
_button_factory(text, 'launcher', clicked=clicked, hovered=hovered, selected=selected)
_button_factory(text, 'launcher', clicked=clicked, hovered=hovered, selected=selected, xmaximum=200)
def prompt(name, message, cancel, default='', hint=''):
@@ -151,6 +159,8 @@ init:
mid(focus="paged_menu")
for name, desc, ret, hovered, selected in choices[page * per_page:(page + 1) * per_page]:
if len(name) > 19:
name = name[:18] + u"\u2026"
button(name, desc, clicked=ui.returns(("return", ret)), hovered=hovered, selected=selected)
ui.close()
@@ -483,7 +493,8 @@ label edit:
files.remove(i)
files.insert(0, i)
renpy.launch_editor(files)
if not renpy.launch_editor(files):
error(u"Error", u"Launching the editor failed. You may need Java, which can be downloaded for free from {a=http://www.java.com}java.com{/a}.", "start")
store.message = _(u"Launched editor with %d script files.") % len(files)
+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.0a"
version = "Ren'Py 6.8.0b"
script_version = 5003000
savegame_suffix = "-LT1.save"
+1 -1
View File
@@ -175,7 +175,7 @@ keymap = dict(
inspector = [ 'I' ],
developer = [ 'D' ],
quit = [ 'meta_q', 'alt_K_F4' ],
iconify = [ 'meta_h' ],
iconify = [ 'meta_m', 'alt_m' ],
help = [ 'K_F1', 'meta_shift_/' ],
# Say.
+10 -4
View File
@@ -718,10 +718,16 @@ class Display(object):
# Window icon.
if renpy.config.window_icon:
pygame.display.set_icon(
renpy.display.scale.image_load_unscaled(
renpy.loader.load(renpy.config.window_icon),
renpy.config.window_icon))
im = renpy.display.scale.image_load_unscaled(
renpy.loader.load(renpy.config.window_icon),
renpy.config.window_icon)
if on_windows and im.get_width() > 32:
im = renpy.display.scale.real_bilinear(im, (32, 32))
pygame.display.set_icon(im)
# If a window exists of the right size and flags, use it. Otherwise,
# make our own window.
+128 -70
View File
@@ -40,9 +40,64 @@ fonts = { }
# loaded font object corresponding to that specification.
font_cache = { }
class ImageFont(object):
pass
def size(self, text):
w = 0
if not text:
return (0, self.height)
for a, b in zip(text, text[1:]):
try:
w += self.sizes[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]]
return (w, self.height)
def render(self, text, antialias, color, black_color=(0, 0, 0, 255), background=None):
surf = pygame.Surface(self.size(text), 0,
renpy.game.interface.display.sample_surface)
if not text:
return surf
x = 0
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)
surf.blit(self.chars[text[-1]], (x, y))
if renpy.config.recolor_sfonts and \
(color != (255, 255, 255, 255) or black_color != (0, 0, 0, 255) ) and \
renpy.display.module.can_twomap:
newsurf = pygame.Surface(surf.get_size(), surf.get_flags(), surf)
renpy.display.module.twomap(surf, newsurf, color, black_color)
renpy.display.render.mutated_surface(newsurf)
surf = newsurf
return surf
def get_linesize(self):
return self.height
def get_height(self):
return self.height
def get_ascent(self):
return self.height
def get_descent(self):
return 0
class SFont(ImageFont):
@@ -69,7 +124,6 @@ class SFont(ImageFont):
# Load in the image.
surf = renpy.display.im.Image(self.filename).load(unscaled=True)
self.surf = surf
sw, sh = surf.get_size()
height = sh
@@ -116,82 +170,76 @@ class SFont(ImageFont):
i += 1
def size(self, text):
w = 0
if not text:
return (0, self.height)
class MudgeFont(ImageFont):
def __init__(self,
filename,
xml,
spacewidth,
default_kern,
kerns):
self.filename = filename
self.xml = xml
self.spacewidth = spacewidth
self.default_kern = default_kern
self.kerns = kerns
def load(self):
# Map from character to subsurface.
self.chars = { }
# Map from character to width, height.
self.sizes = { }
# 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())
height = 0
for a, b in zip(text, text[1:]):
w += self.sizes[a] + self.kerns.get(a + b, self.default_kern)
# Find each character.
for e in tree.findall("char"):
w += self.sizes[text[-1]]
char = int(e.attrib["id"])
if char < 0:
continue
c = unichr(char)
x = int(e.attrib["x"])
y = int(e.attrib["y"])
w = int(e.attrib["width"])
h = int(e.attrib["height"])
ss = surf.subsurface((x, y, w, h))
ss = renpy.display.scale.surface_scale(ss)
self.chars[c] = ss
self.sizes[c] = w
height = max(height, h)
self.height = 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
if u'\u00a0' not in self.chars:
self.chars[u'\u00a0'] = self.chars[u' ']
self.sizes[u'\u00a0'] = self.sizes[u' ']
return (w, self.height)
def render(self, text, antialias, color, black_color=(0, 0, 0, 255), background=None):
surf = pygame.Surface(self.size(text), 0,
renpy.game.interface.display.sample_surface)
if not text:
return surf
x = 0
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)
surf.blit(self.chars[text[-1]], (x, y))
if renpy.config.recolor_sfonts and \
(color != (255, 255, 255, 255) or black_color != (0, 0, 0, 255) ) and \
renpy.display.module.can_twomap:
newsurf = pygame.Surface(surf.get_size(), surf.get_flags(), surf)
renpy.display.module.twomap(surf, newsurf, color, black_color)
renpy.display.render.mutated_surface(newsurf)
surf = newsurf
return surf
def get_linesize(self):
return self.height
def get_height(self):
return self.height
def get_ascent(self):
return self.height
def get_descent(self):
return 0
def register_sfont(name=None, size=None, bold=False, italics=False, underline=False,
filename=None, spacewidth=10, default_kern=0, kerns={},
charset=u"!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"):
"""
This registers an SFont with the given details. Please note that
size, bold, italic, and underline are all advisory (used for matching), and
do not change the appearance of the font.
@param name: The name of the font being registered.
@param size: The size of the font being registered.
@param bold: The boldness of the font being registered.
@param italics: The italicness of the font being registered.
@param underline: The underline of the font being registered.
@param filename: The file containing the sfont image.
@param spacewidth: The width of a space character.
@param default_kern: The default kern spacing between characters.
@param kerns: A map from two-character strings to the kern that should
be used between those characters.
@param charset: The character set of the font. A string containing characters
in the order in which they are found in the image.
"""
if name is None or size is None or filename is None:
raise Exception("When registering an SFont, the font name, font size, and filename are required.")
@@ -199,6 +247,16 @@ def register_sfont(name=None, size=None, bold=False, italics=False, underline=Fa
fonts[(name, size, bold, italics, underline)] = sf
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.")
mf = MudgeFont(filename, xml, spacewidth, default_kern, kerns)
fonts[(name, size, bold, italics, underline)] = mf
def load_ttf(fn, size, bold, italics, underline, expand):
+7 -4
View File
@@ -1249,6 +1249,9 @@ class Text(renpy.display.core.Displayable):
surf, (sw, sh) = ts.render(text, antialias, color, black_color, user_colors, time, at, expand)
if expand:
(sw, sh) = ts.sizes(text)
actual_y = y + max_ascent - ts.get_ascent()
if surf:
@@ -1327,10 +1330,10 @@ class Text(renpy.display.core.Displayable):
maxdsy = max(maxdsy, dsy)
for expand, color, dsx, dsy in outlines:
mindsx = min(mindsx, dsx)
mindsy = min(mindsy, dsy)
maxdsx = max(maxdsx, dsx)
maxdsy = max(maxdsy, dsy)
mindsx = min(mindsx, dsx - expand)
mindsy = min(mindsy, dsy - expand)
maxdsx = max(maxdsx, dsx + expand)
maxdsy = max(maxdsy, dsy + expand)
# minds{x,y} are negative (or 0), maxds{x,y} are positive (or 0).
+36 -15
View File
@@ -29,7 +29,7 @@ _file = file
import renpy
from renpy.display.text import ParameterizedText
from renpy.display.font import register_sfont
from renpy.display.font import register_sfont, register_mudgefont
from renpy.display.behavior import Keymap
from renpy.display.minigame import Minigame
@@ -917,13 +917,41 @@ def get_filename_line():
def shell_escape(s):
s = s.replace("\\", "\\\\")
# s = s.replace("\'", "\\\'")
s = s.replace("\"", "\\\"")
s = s.replace("\$", "\\\$")
s = s.replace("\%", "\\\%")
s = s.replace("\`", "\\\`")
return s
def split_args(s):
rv = [ ]
word = ""
quoted = False
i = 0
while i < len(s):
c = s[i]
i += 1
if not quoted and c == ' ' and word:
if word:
rv.append(word)
word = ""
continue
if c == '"':
quoted = not quoted
continue
if c == '\\':
c = s[i]
i += 1
word += c
if word:
rv.append(word)
return rv
def launch_editor(filenames, line=1, transient=0):
"""
This causes an editor to be launched at the location of the current
@@ -940,16 +968,8 @@ def launch_editor(filenames, line=1, transient=0):
if not len(filenames):
return
# join = '" "'
shell = True
# if hasattr(sys, "winver"):
# shell = False
# # join = '" "'
# else:
# shell = True
# # join = "' '"
filenames = [ shell_escape(os.path.normpath(i)) for i in filenames ]
filename = filenames[0]
@@ -965,11 +985,12 @@ def launch_editor(filenames, line=1, transient=0):
cmd = cmd.replace('""', '')
try:
return subprocess.Popen(cmd, shell=shell)
subprocess.Popen(split_args(cmd))
return True
except:
if renpy.config.debug:
raise
return None
return False
# A file that log logs to.
logfile = None
+1 -1
View File
@@ -493,7 +493,7 @@ def rebuild():
global style_pending
global styles_built
if not styles_built:
if renpy.game.init_phase:
return
styles_pending = [ j for i in style_parts.values() for j in i.values() ]
@@ -13,18 +13,18 @@ init:
if platform.mac_ver()[0]:
config.editor = "open -t '%(allfiles)s'"
else:
if sys.platform == 'win32':
editor = config.renpy_base + "/editor/scite.exe"
else:
editor = config.renpy_base + "/editor/scite"
editor = os.path.normpath(editor)
editor = renpy.shell_escape(editor)
if os.path.exists(editor):
editor = renpy.shell_escape(editor)
config.editor = '"' + editor + '" "%(allfiles)s" "-open:%(filename)s" -goto:%(line)d'
config.editor_transient = config.editor+' -revert:'
config.editor = '"' + editor + '" "%(allfiles)s" -goto:%(line)d'
config.editor_transient = config.editor+' -revert:'
if config.editor:
os.environ['RENPY_EDITOR'] = config.editor
+4 -2
View File
@@ -6,6 +6,8 @@ version = renpy.version[7:]
import sys
if "retag" in sys.argv[1:]:
renpy.subprocess.call([ "svn", "rm", 'http://www.bishoujo.us/svn/renpy/tags/' + version, "-m", "Tagging " + version ])
renpy.subprocess.call([ "bzr", "tag", "--delete", version ])
renpy.subprocess.call([ "svn", "copy", ".", 'http://www.bishoujo.us/svn/renpy/tags/' + version, "-m", "Tagging " + version ])
renpy.subprocess.call([ "bzr", "tag", version ])
+2 -3
View File
@@ -200,10 +200,9 @@ init -1 python hide:
## - A label in the script, in which case that label is called to
## show help to the user.
## - A file name relative to the base directory, which is opened in a
## web browser. The filename may be followed by an # to specifiy an
## anchor inside an html file.
## web browser.
## - None, to disable help.
config.help = "README.html#renpy_help"
config.help = "README.html"
#########################################
+2 -3
View File
@@ -203,10 +203,9 @@ init -1 python hide:
## - A label in the script, in which case that label is called to
## show help to the user.
## - A file name relative to the base directory, which is opened in a
## web browser. The filename may be followed by an # to specifiy an
## anchor inside an html file.
## web browser.
## - None, to disable help.
config.help = "README.html#renpy_help"
config.help = "README.html"
#########################################