Zoom Viewport for Ren'Py
A downloadable asset pack
Overview
This screen language add-on will let you create a special viewport which can be zoomed in and out of using the mousewheel, pinch-zoom gesture on touch screens, or separate buttons. Designed to require very little setup - just add your contents to the zoom viewport and it will figure out the rest. Useful for map screens, flow charts, inventories, investigation sections, and more!
Features
- A ZoomViewport class with a CDSL wrapper so you can easily add it to your screens (it's just zoom_viewport: instead of viewport:)
- Customize lots of aspects about the zooming functionality:
- Define zoom max/min (or let it automatically figure out the minimum zoom level so the entire viewport contents are visible) and starting zoom.
- Adjust the speed and amount of the zoom.
- Callbacks for position and zoom changes - use it to bring up tooltips when the player is focused on a particular area, change screens, or trigger other effects.
- Special zoom_align property to adjust where the viewport contents go when they don't fill the viewport area - for example, you can center them inside the viewport space.
- Zooming centers the mouse cursor when zooming with the mouse wheel, or the center between two fingers when using a pinch gesture for intuitive navigation.
- Functions the same as a viewport in all other aspects; add draggable True to drag the contents around, use the mousewheel for zooming or for regular scrolling, provide xinitial/yinitial values, etc.
- Handles events as you would expect, so button actions etc. will all still work within the viewport at any zoom level
- Use the mouse wheel for zooming or a pinch gesture on touch screens. You can also include buttons with the provided VPZoom screen action to zoom in and out.
Instructions
Download zoom_viewport.zip and unzip it to get 01_zoom_viewport.rpy, multitouch_common.rpy, and zoom_vp_examples.rpy. Drop these files into your project's game/ folder. Several examples are provided in zoom_vp_examples.rpy, which you can try out by jumping to the label test_zoom_vp.
Compatibility
The zoom viewport has been tested for compatibility with Ren'Py 7.6-7.7 and 8.1-8.2, and is expected to be compatible with earlier Ren'Py versions but has not been tested. Leave a message in the stickied thread if you run into any bugs.
Terms of Use
You may:
- Use this code in commercial and noncommercial projects, provided you package the code into an rpa file for release - the code to do so is included in the files.
- Modify and edit this code to suit your needs.
You may not:
- Resell all or part of this code as-is or sell it with modifications
- Release any projects created using this code without providing attribution
Attribution must be credited as Feniks, with a link to either the page with this code or to https://feniksdev.com.
Credits
Pixel interior by LimeZu (not included in zip)
Special thank you to Wind Chimes Games for help testing the viewport (+ some feature ideas)!
Final Notes
You may be interested in my other viewport, Parallax Viewport for Ren'Py, or my Multi-Touch Zoom Gallery, which adapts the zoom code into a gallery format.
I also have a variety of tutorials on my website, feniksdev.com.
Status | Released |
Category | Assets |
Rating | Rated 5.0 out of 5 stars (1 total ratings) |
Author | Feniks |
Genre | Visual Novel |
Made with | Ren'Py |
Tags | Graphical User Interface (GUI), Kinetic Novel, Ren'Py, User Interface (UI) |
Download
Click download now to get access to the following files:
Development log
- Zoom Viewport Released!Jul 07, 2024