I had a similar effect, using simple layers and masks. (It was for a hide and seek hunt, using a magnifying glass.)
The top layer would be the small font image, the bottom layer would be the 2x font image. The mask just pokes a hole through the top layer. (Maybe I did it reverse, so the mask was inverted and only showed the top layer as the hole?!?
The 2x image can just be a normal image-scale. (Again, it might be better to reverse the scale so the smaller one has 0.5 scale. This will retain the full pixel-detail of the "seemingly larger image", which is actually just normal sized, in relation to the smaller image.)
This was in the script.rpy
Code: Select all
init python:
class TrackCursor(renpy.Displayable):
def __init__(self, child, **kwargs):
super(TrackCursor, self).__init__(**kwargs)
self.child = renpy.displayable(child)
self.x = None
self.y = None
def render(self, width, height, st, at):
rv = renpy.Render(width, height)
if self.x is not None:
cr = renpy.render(self.child, width, height, st, at)
cw, ch = cr.get_size()
rv.blit(cr, (self.x - cw / 2, self.y - ch / 2))
return rv
def event(self, ev, x, y, st):
if (x != self.x) or (y != self.y):
self.x = x
self.y = y
renpy.redraw(self, 0)
# The game starts here.
label start:
show screen xray("full_pic1", "behind_pic2")
"What are you looking for?"
show screen xray("full_pic2", "behind_pic2")
"Do you need better glasses?"
# This ends the game
return
This goes in screens.rpy
Code: Select all
################################################################################
## In-game screens
################################################################################
image lense = TrackCursor("lenses")
image rims = TrackCursor("glasses")
transform noalpha:
alpha 0.0
screen xray(full_IMG, behind_IMG):
add full_IMG
add AlphaMask(behind_IMG, "lense")
add "lense" at noalpha
add "rims"
Images needed...
- full_pic1.jpg
- behind_pic1.jpg
- full_pic2.jpg
- behind_pic2.jpg
- lenses.png (The hole mask)
- glasses.png (The rim of the glasses)
NOTE: The "lenses" were the actual "mask-hole", which you see through. The "Rims" are the edges of the glasses, which shows over the mask-hole.
Your "behind_pic1.jpg" should be the 2x image, in this sample. Also note that both of my images were alpha images. So this should be transparent safe, over a solid background of other images in a scene. (It should only poke a hole through the full_pic, showing the behind_pic.)
P.S. Realize that your smaller image text has to be a bit away from the edge... The text will be 2x larger, but stationary. You would have to alter the position of the "behind" picture, with the cursor movement, by 2x on X and Y, to get a true magnifying effect.
Below is a quick sample image, directly from this source-code I use as my demo.
The attached lenses and rims images, just click with a mouse and "Save as..." and use a paint-program, or "open in new window", to see the transparent sections, which should be a bit more "grey" in a "new window". I didn't realize the forum uses a white background. The lenses in this sample are just "white".