[plugin] Picture in Picture

Post your work in progress addons and get feedback

Post » Sat Feb 13, 2016 4:11 pm

Description

Currently only works with WebGL disabled

Picture in picture is an addon for Construct 2 which allows you to easily set up viewports within your game which capture other parts of the layout. It can be used to easily create split screen games or co-op games where seeing your partners view could help (see Portal 2 for example).

The plugin adds a PiP object which is blank in the editor and is just a viewport, see the demo for example. This viewport can then be used to show any part of the current layout. So you could have a character with the scrollto behaviour and then have a PiP object in the corner which shows you another player.

Properties
Each PiP viewport has three properties:

  • Capture Type
    This can either be set to 'Display Relative' or 'Viewport Relative' and sets the base capture area for the viewport. If the option is set to 'Display Relative' the viewport will capture the entire screen and scale it into the canvas. If the option is set to 'Viewport Relative' the viewport will capture an area the size of the viewport.
  • Capture Scale
    This is a percentage which describes the area captured by the viewport, if the scale is 100, it will not scale the image further than Capture Type. If the scale is 50 the image displayed on the viewport will be 2x bigger than when it was captured etc.
  • Capture below
    This can either be true or false, it sets whether the viewport will capture the entire rendered screen or just layers below it (to prevent guis being captured etc).

Actions
The PiP object has 5 actions:

  • Enable/Disable viewport
    Sets whether the viewport is displaying what it is capturing.
  • Set viewport position
    Sets the location to be captured by the viewport.
  • Set capture type
    Sets the 'Capture Type' property as described above
  • Set capturing below
    Sets the 'Capture below' property as described above.
  • Set viewport scale
    Sets the 'Capture Scale' property as described above.

Conditions
The PiP object has no conditions.

Expressions
The PiP object has 6 expressions:

  • viewportcapturebelow
    Returns the value of the 'Capture below' property as an integer with 1 being true and 0 being false.
  • viewportcapturescale
    Returns the value of the 'Capture Scale' property as a float.
  • viewportcapturetype
    Returns the value of the 'Capture Type' property as an integer where 0 is 'Display Relative' and 1 is 'Viewport Relative'.
  • viewportenabled
    Returns whether the viewport is enabled as an integer with 1 being true and 0 being false.
  • viewportx
    Returns the x coordinate of the position the viewport is currently capturing.
  • viewporty
    Returns the y coordinate of the position the viewport is currently capturing.

[size=150]Download
Last edited by briggybros on Sat Apr 02, 2016 7:52 pm, edited 2 times in total.
Nothing goes unanswered!
B
22
S
5
G
1
Posts: 430
Reputation: 3,388

Post » Sun Feb 14, 2016 1:53 am

Really good plugin but here is less than 20 frames
Image
B
6
S
1
Posts: 34
Reputation: 474

Post » Mon Feb 15, 2016 7:41 pm

@dellong to make it work properly, for every viewport I needed to re-render the screen so that it captured the correct area, and this is probably why it's so intensive. I will look into optimising as soon as possible.
Nothing goes unanswered!
B
22
S
5
G
1
Posts: 430
Reputation: 3,388

Post » Wed Mar 30, 2016 5:41 pm

Your demo .capx tells that it was using plugin version 1.1. However your .c2addon file is version 1.0. Can you provide a download link for PiP v.1.1 please?
B
59
S
13
G
5
Posts: 251
Reputation: 5,751

Post » Sat Apr 02, 2016 7:52 pm

@Wolod I was making it for the next version, which I lost when I updated my pc. Sorry
Nothing goes unanswered!
B
22
S
5
G
1
Posts: 430
Reputation: 3,388


Return to Work in Progress Addons

Who is online

Users browsing this forum: ddamico and 0 guests