Difference between revisions of "Bobscreen"

From Sega Retro

(the moment of truth)
Line 1: Line 1:
 
<includeonly><div style="display:none">
 
<includeonly><div style="display:none">
{{#vardefine:screenwidth|{{#mediawidth:{{{1}}}}}}}
+
{{#vardefine:imagewidth|{{#mediawidth:{{{1}}}}}}}
{{#vardefine:screenheight|{{#mediaheight:{{{1}}}}}}}
+
{{#vardefine:imageheight|{{#mediaheight:{{{1}}}}}}}
{{#vardefine:scale|1}}
+
{{#vardefine:xratio|{{#if:{{{forcewidescreen|}}}|16|4}}}}
{{#vardefine:yscale|1}}
+
{{#vardefine:yratio|{{#if:{{{forcewidescreen|}}}|9|3}}}}
{{#ifexpr: {{#mediawidth:{{{1}}}}} > 320 | {{#vardefine:screenwidth|320}} }}
+
{{#if:{{{forcewidescreen|}}}||{{
{{#ifexpr: {{#mediaheight:{{{1}}}}} > 240 | {{#vardefine:screenheight|240}} }}
+
#ifeq: {{#mediadimensions:{{{1}}}}} | 320 × 224 |{{#vardefine:xratio|10}}{{#vardefine:yratio|7}}|}}{{
{{#ifeq: {{#mediadimensions:{{{1}}}}} | 512 × 448 | {{#vardefine:screenwidth|256}}{{#vardefine:scale|1.25}} }}
+
#ifeq: {{#mediadimensions:{{{1}}}}} | 248 × 192 |{{#vardefine:xratio|31}}{{#vardefine:yratio|24}}|}}
{{#ifeq: {{#mediadimensions:{{{1}}}}} | 512 × 480 | {{#vardefine:screenwidth|256}}{{#vardefine:scale|1.25}} }}
 
{{#ifeq: {{#mediadimensions:{{{1}}}}} | 160 × 144 | {{#vardefine:scale|1.2}} }}
 
{{#ifeq: {{#mediadimensions:{{{1}}}}} | 256 × 224 | {{#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 × 448 | {{#vardefine:yscale|1.176}} }}
 
{{#ifeq: {{#mediadimensions:{{{1}}}}} | 352 × 224 | {{#vardefine:yscale|1.176}} }}
 
{{#ifeq: {{{forcewidescreen|}}}|yes|
 
{{#ifeq: {{#mediaheight:{{{1}}}}}|224|{{#vardefine:yscale|{{#expr:{{#var:yscale}}*0.804}}}}{{#vardefine:wsmargin|22}}|}}
 
{{#ifeq: {{#mediaheight:{{{1}}}}}|448|{{#vardefine:yscale|{{#expr:{{#var:yscale}}*0.804}}}}{{#vardefine:wsmargin|22}}|}}
 
{{#ifeq: {{#mediaheight:{{{1}}}}}|240|{{#vardefine:yscale|{{#expr:{{#var:yscale}}*0.75}}}}{{#vardefine:wsmargin|30}}|}}
 
{{#ifeq: {{#mediaheight:{{{1}}}}}|480|{{#vardefine:yscale|{{#expr:{{#var:yscale}}*0.75}}}}{{#vardefine:wsmargin|30}}|}}
 
 
}}
 
}}
{{#if: {{{width|}}} | {{#vardefine:screenwidth|{{#expr:{{{width}}}/{{#var:scale}}}}}} }}
 
{{#vardefine:visiblewidth|{{#expr:{{#var:screenwidth}}*{{#var:scale}}}}}}
 
  
{{#vardefine:newheight|{{#expr:{{#var:screenheight}}*{{#var:scale}}}}}}
+
<!-- vertical monitors -->
{{#vardefine:vmargin|{{#expr:((({{#var:screenheight}}*{{#var:yscale}})-{{#var:screenheight}})/2){{#ifeq:{{{forcewidescreen|}}}|yes|+{{#var:wsmargin}}|}}}}}}
+
{{#ifexpr:{{#mediawidth:{{{1}}}}} < {{#mediaheight:{{{1}}}}}|
 +
{{#vardefine:oldxratio|{{#var:xratio}}}}
 +
{{#vardefine:xratio|{{#var:yratio}}}}
 +
{{#vardefine:yratio|{{#var:oldxratio}}}}
 +
|}}
 +
{{#vardefine:calculatedheight|{{#var:imageheight}}}}
 +
{{#vardefine:calculatedwidth|{{#expr:({{#var:calculatedheight}}/{{#var:yratio}})*{{#var:xratio}}}}}}
 +
 
 +
 
 +
{{#if:{{{width|}}}|{{#vardefine:calculatedwidth|{{{width}}}}}{{#vardefine:calculatedheight|{{#expr:({{#var:calculatedwidth}}/{{#var:xratio}})*{{#var:yratio}}}}}}|}}
 +
{{#if:{{{height|}}}|{{#vardefine:calculatedheight|{{{height}}}}}{{#vardefine:calculatedwidth|{{#expr:({{#var:calculatedheight}}/{{#var:yratio}})*{{#var:xratio}}}}}}|}}
 +
 
 +
{{#vardefine:xscale|{{#expr:{{#var:calculatedwidth}}/{{#var:imagewidth}}}}}}
 +
{{#vardefine:yscale|{{#expr:{{#var:calculatedheight}}/{{#var:imageheight}}}}}}
 +
 
 +
{{#vardefine:hmargin|{{#expr:({{#var:calculatedwidth}}-{{#var:imagewidth}})/2}}}}
 +
{{#vardefine:vmargin|{{#expr:({{#var:calculatedheight}}-{{#var:imageheight}})/2}}}}
 +
</div><div class="bobscreen" style="margin-bottom: {{#var:vmargin}}px; margin-top: {{#var:vmargin}}px; margin-left: {{#var:hmargin}}px; margin-right: {{#var:hmargin}}px; display:inline-block; text-align:center;"><div style="transform:scale({{#var:xscale}},{{#var:yscale}}); transform-origin:50%;">[[File:{{{1}}}]]</div></div></includeonly><noinclude>
  
</div><div class="bobscreen" 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 34: Line 35:
  
 
returns
 
returns
 
+
{{bobscreenTest|MagicalPuzzlePopils title.png}}
{{bobscreen|MagicalPuzzlePopils title.png}}
 
 
 
 
This is how the game appears on an actual [[Sega Game Gear]]. The original image taken from an emulator is below:
 
This is how the game appears on an actual [[Sega Game Gear]]. The original image taken from an emulator is below:
  
Line 42: Line 41:
  
 
===Options===
 
===Options===
<tt><nowiki>{{bobscreen|MagicalPuzzlePopils title.png|width=120}}</nowiki></tt>
+
<tt><nowiki>{{bobscreenTest|MagicalPuzzlePopils title.png|width=120}}</nowiki></tt>
  
 
returns
 
returns
 
+
{{bobscreenTest|MagicalPuzzlePopils title.png|width=120}}
{{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.
 
"width" also takes into account the adjusted aspect ratio, so the image appears 120 pixels wide even if the source image is not.
  
 
==Height==
 
==Height==
 
In addition, this template corrects heights:
 
In addition, this template corrects heights:
[[File:WinterHeat title.png|320px]] -> {{bobscreen|WinterHeat title.png}}
+
[[File:WinterHeat title.png]] -> {{bobscreenTest|WinterHeat title.png}}
 +
 
 +
 
 +
[[File:Clockwork Knight Title.png]] -> {{bobscreenTest|Clockwork Knight Title.png}}
  
  
[[File:Clockwork Knight Title.png|320px]] -> {{bobscreen|Clockwork Knight Title.png}}
+
[[File:NiGHTS title.png]] -> {{bobscreenTest|NiGHTS title.png}}
  
  
[[File:NiGHTS title.png|320px]] -> {{bobscreen|NiGHTS title.png}}
+
[[File:NiGHTS title.png]] -> {{bobscreenTest|NiGHTS title.png|width=320}}
  
 
==Anamorphic widescreen==
 
==Anamorphic widescreen==
[[File:VirtuaFighter 32X Widescreen2.png]] -> {{bobscreen|VirtuaFighter 32X Widescreen2.png|forcewidescreen=yes}}
+
widescreen [[File:VirtuaFighter 32X Widescreen2.png]] -> {{bobscreenTest|VirtuaFighter 32X Widescreen2.png|forcewidescreen=yes}}
 +
 
 +
 
 +
widescreen [[File:VirtuaFighter 32X Widescreen2 PAL.png]] -> {{bobscreenTest|VirtuaFighter 32X Widescreen2 PAL.png|forcewidescreen=yes}}
 +
 
 +
 
 +
widescreen w200 [[File:VirtuaFighter 32X Widescreen2 PAL.png]] -> {{bobscreenTest|VirtuaFighter 32X Widescreen2 PAL.png|forcewidescreen=yes|width=200}}
 +
 
 +
 
 +
widescreen h200 [[File:VirtuaFighter 32X Widescreen2 PAL.png]] -> {{bobscreenTest|VirtuaFighter 32X Widescreen2 PAL.png|forcewidescreen=yes|height=200}}
 +
 
 +
==Vertical monitors==
 +
 
 +
{{bobscreenTest|Deep Scan.png}}
  
 +
{{bobscreenTest|Deep Scan.png|height=320}}
  
[[File:VirtuaFighter 32X Widescreen2 PAL.png]] -> {{bobscreen|VirtuaFighter 32X Widescreen2 PAL.png|forcewidescreen=yes}}
+
{{bobscreenTest|Deep Scan.png|width=200}}
  
TODO: Get width parameter to work properly here.
+
==Master System==
 +
[[File:Alex Kidd in Miracle World Title.png]] -> {{bobscreenTest|Alex Kidd in Miracle World Title.png}}
  
 
[[Category:Breakout box templates]]
 
[[Category:Breakout box templates]]
 
</noinclude>
 
</noinclude>

Revision as of 06:23, 7 July 2018


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

{{bobscreenTest|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


NiGHTS title.png ->

NiGHTS title.png


NiGHTS title.png ->

NiGHTS title.png

Anamorphic widescreen

widescreen VirtuaFighter 32X Widescreen2.png ->

VirtuaFighter 32X Widescreen2.png


widescreen VirtuaFighter 32X Widescreen2 PAL.png ->

VirtuaFighter 32X Widescreen2 PAL.png


widescreen w200 VirtuaFighter 32X Widescreen2 PAL.png ->

VirtuaFighter 32X Widescreen2 PAL.png


widescreen h200 VirtuaFighter 32X Widescreen2 PAL.png ->

VirtuaFighter 32X Widescreen2 PAL.png

Vertical monitors

Deep Scan.png


Deep Scan.png


Deep Scan.png

Master System

Alex Kidd in Miracle World Title.png ->

Alex Kidd in Miracle World Title.png