Difference between revisions of "Bobscreen"

From Sega Retro

Line 2: Line 2:
 
{{#vardefine:screenwidth|{{#mediawidth:{{{1}}}}}}}
 
{{#vardefine:screenwidth|{{#mediawidth:{{{1}}}}}}}
 
{{#vardefine:scale|1}}
 
{{#vardefine:scale|1}}
 +
{{#vardefine:yscale|1}}
 
{{#ifexpr: {{#mediawidth:{{{1}}}}} > 320 | {{#vardefine:screenwidth|320}} }}
 
{{#ifexpr: {{#mediawidth:{{{1}}}}} > 320 | {{#vardefine:screenwidth|320}} }}
 
{{#ifeq: {{#mediadimensions:{{{1}}}}} | 512 × 448 | {{#vardefine:screenwidth|256}}{{#vardefine:scale|1.25}} }}
 
{{#ifeq: {{#mediadimensions:{{{1}}}}} | 512 × 448 | {{#vardefine:screenwidth|256}}{{#vardefine:scale|1.25}} }}
Line 8: Line 9:
 
{{#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}} }}
 +
{{#ifeq: {{#mediadimensions:{{{1}}}}} | 704 × 480 | {{#vardefine:yscale|1.1}} }}
 +
{{#ifeq: {{#mediadimensions:{{{1}}}}} | 352 × 240 | {{#vardefine:yscale|1.1}} }}
 +
{{#ifeq: {{#mediadimensions:{{{1}}}}} | 704 × 224| {{#vardefine:yscale|1.071}} }}
 +
{{#ifeq: {{#mediadimensions:{{{1}}}}} | 352 × 224| {{#vardefine:yscale|1.176}} }}
 
{{#if: {{{width|}}} | {{#vardefine:screenwidth|{{#expr:{{{width}}}/{{#var:scale}}}}}} }}
 
{{#if: {{{width|}}} | {{#vardefine:screenwidth|{{#expr:{{{width}}}/{{#var:scale}}}}}} }}
 
{{#vardefine:visiblewidth|{{#expr:{{#var:screenwidth}}*{{#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}}x384px]]</div></div></includeonly><noinclude>
+
 
 +
{{#vardefine:newheight|{{#expr:{{#var:screenheight}}*{{#var:scale}}}}}}
 +
{{#vardefine:vmargin|{{#expr:(({{#mediaheight:{{{1}}}}}*{{#var:yscale}})-{{#mediaheight:{{{1}}}}})/2}}}}
 +
 
 +
</div><div style="width:{{#var:visiblewidth}}px; display:inline-block; text-align:center;"><div style="transform:scalex({{#var:scale}}); {{#ifeq:{{#var:yscale}}|1||transform:scaley({{#var:yscale}}); margin-top:{{#var:vmargin}}px; margin-bottom:{{#var:vmargin}}px;}} transform-origin:50%">[[File:{{{1}}}|{{#var:screenwidth}}x384px]]</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 32: Line 41:
  
 
"width" also takes into account the adjusted aspect ratio, so the image appears 120 pixels wide even if the source image is not.
 
"width" also takes into account the adjusted aspect ratio, so the image appears 120 pixels wide even if the source image is not.
 +
 +
==Height==
 +
In addition, this template corrects heights:
 +
[[File:WinterHeat title.png|320px]] -> {{bobscreen|WinterHeat title.png}}
 +
 +
 +
[[File:Clockwork Knight Title.png|320px]] -> {{bobscreen|Clockwork Knight Title.png}}
  
 
[[Category:Breakout box templates]]
 
[[Category:Breakout box templates]]
 
</noinclude>
 
</noinclude>

Revision as of 08:52, 11 February 2017

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.

Height

In addition, this template corrects heights:

WinterHeat title.png ->










WinterHeat title.png


ClockworkKnightUSPAL Title.png ->










ClockworkKnightUSPAL Title.png