Difference between revisions of "Bobscreen"

From Sega Retro

Line 8: Line 8:
 
{{#ifeq: {{#mediadimensions:{{{1}}}}} | 256 × 224 | {{#vardefine:scale|1.25}} }}
 
{{#ifeq: {{#mediadimensions:{{{1}}}}} | 256 × 224 | {{#vardefine:scale|1.25}} }}
 
{{#ifeq: {{#mediadimensions:{{{1}}}}} | 256 × 240 | {{#vardefine:scale|1.25}} }}
 
{{#ifeq: {{#mediadimensions:{{{1}}}}} | 256 × 240 | {{#vardefine:scale|1.25}} }}
</div><div style="width:{{#expr:{{#var:screenwidth}}*{{#var:scale}}}}px; display:inline-block; text-align:center;"><div style="transform:scalex({{#var:scale}}); transform-origin:50%">[[File:{{{1}}}|{{#var:screenwidth}}px]]</div></div></includeonly><noinclude>
+
{{#if: {{{width|}}} | {{#vardefine:screenwidth|{{#expr:{{{width}}}/{{#var:scale}}}}}} }}
 +
{{#vardefine:visiblewidth|{{#expr:{{#var:screenwidth}}*{{#var:scale}}}}}}
 +
</div><div style="width:{{#var:visiblewidth}}px; display:inline-block; text-align:center;"><div style="transform:scalex({{#var:scale}}); transform-origin:50%">[[File:{{{1}}}|{{#var:screenwidth}}px]]</div></div></includeonly><noinclude>
 
This template sets the maximum width of a screenshot to 320 pixels, and corrects its aspect ratio.
 
This template sets the maximum width of a screenshot to 320 pixels, and corrects its aspect ratio.
  
Line 21: Line 23:
  
 
[[File:MagicalPuzzlePopils title.png]]
 
[[File:MagicalPuzzlePopils title.png]]
 +
 +
===Options===
 +
<tt><nowiki>{{bobscreen|MagicalPuzzlePopils title.png|width=120}}</nowiki></tt>
 +
 +
returns
 +
 +
{{bobscreen|MagicalPuzzlePopils title.png|width=120}}
 +
 +
"width" also takes into account the adjusted aspect ratio, so the image appears 120 pixels wide even if the source image is not.
  
 
[[Category:Breakout box templates]]
 
[[Category:Breakout box templates]]
 
</noinclude>
 
</noinclude>

Revision as of 15:39, 21 July 2015

This template sets the maximum width of a screenshot to 320 pixels, and corrects its aspect ratio.

Usage

{{bobscreen|MagicalPuzzlePopils title.png}}

returns






MagicalPuzzlePopils title.png

This is how the game appears on an actual Sega Game Gear. The original image taken from an emulator is below:

MagicalPuzzlePopils title.png

Options

{{bobscreen|MagicalPuzzlePopils title.png|width=120}}

returns






MagicalPuzzlePopils title.png

"width" also takes into account the adjusted aspect ratio, so the image appears 120 pixels wide even if the source image is not.