Difference between revisions of "BobscreenTest"
From Sega Retro
(fixed some errors) |
|||
Line 7: | Line 7: | ||
| 704 × 480 = 0.9 <!--Saturn PAL--> | | 704 × 480 = 0.9 <!--Saturn PAL--> | ||
| 512 × 448 = 1.25 <!--PlayStation 2--> | | 512 × 448 = 1.25 <!--PlayStation 2--> | ||
− | + | | 1 | |
}}}}{{#vardefine:vscale|{{#switch:{{#mediadimensions:{{{1}}}}} | }}}}{{#vardefine:vscale|{{#switch:{{#mediadimensions:{{{1}}}}} | ||
| 224 × 256 = 1.25 <!--Vertical arcade (e.g. Deep Scan)--> | | 224 × 256 = 1.25 <!--Vertical arcade (e.g. Deep Scan)--> | ||
− | | 1 | + | | {{#ifeq:{{{forcewidescreen}}}|yes|0.8|1}} |
}}}}{{#vardefine:is3d|{{#switch:{{#mediadimensions:{{{1}}}}} | }}}}{{#vardefine:is3d|{{#switch:{{#mediadimensions:{{{1}}}}} | ||
| 512 × 192 = yes <!--Master System--> | | 512 × 192 = yes <!--Master System--> | ||
| 496 × 192 = yes <!--Master System (cropped)--> | | 496 × 192 = yes <!--Master System (cropped)--> | ||
| no | | no | ||
− | }}}}{{#if:{{{width|}}} | {{#vardefine:bswidth|{{{width|}}}}} {{#vardefine:bsheight|{{w2h|{{{1}}}|{{#expr:{{{width|}}}/{{#var:hscale}}}}}}}} | + | }}}}{{#if:{{{width|}}} | {{#vardefine:bswidth|{{{width|}}}}} {{#vardefine:bsheight|{{#expr:{{w2h|{{{1}}}|{{#expr:{{{width|}}}/{{#var:hscale}}}}}}*{{#var:vscale}}}}}} |
− | }}{{#if:{{{height|}}} | {{#vardefine:bsheight|{{{height|}}}}} {{#vardefine:bswidth| | + | }}{{#if:{{{height|}}} | {{#vardefine:bsheight|{{{height|}}}}} {{#vardefine:bswidth|{{h2w|{{{1}}}|{{#expr:{{{height|}}}}}/{{#var:vscale}}}}}} |
}}{{#if:{{{width|}}}{{{height|}}} || {{#ifexpr:({{#mediawidth:{{{1}}}}}*{{#var:hscale}})<{{#ifeq:{{#var:is3d}}|yes|641|321}} | }}{{#if:{{{width|}}}{{{height|}}} || {{#ifexpr:({{#mediawidth:{{{1}}}}}*{{#var:hscale}})<{{#ifeq:{{#var:is3d}}|yes|641|321}} | ||
− | | {{#vardefine:bswidth|{{#expr:{{#mediawidth:{{{1}}}}}*{{#var:hscale}}}}}}{{#vardefine:bsheight|{{#mediaheight:{{{1}}}}}}} | + | | {{#vardefine:bswidth|{{#expr:{{#mediawidth:{{{1}}}}}*{{#var:hscale}}}}}}{{#vardefine:bsheight|{{#expr:{{#mediaheight:{{{1}}}}}*{{#var:vscale}}}}}} |
| {{#vardefine:bswidth|320}}{{#vardefine:bsheight|{{w2h|{{{1}}}|{{#expr:320/{{#var:hscale}}}}}}}}}} | | {{#vardefine:bswidth|320}}{{#vardefine:bsheight|{{w2h|{{{1}}}|{{#expr:320/{{#var:hscale}}}}}}}}}} | ||
}}{{#vardefine:rawwidth|{{#expr:trunc({{#var:bswidth}}/{{#var:hscale}})}}}}{{#ifeq:{{#var:is3d}}|yes|{{#vardefine:bswidth|{{#expr:{{#var:bswidth}}/2}}}}}} | }}{{#vardefine:rawwidth|{{#expr:trunc({{#var:bswidth}}/{{#var:hscale}})}}}}{{#ifeq:{{#var:is3d}}|yes|{{#vardefine:bswidth|{{#expr:{{#var:bswidth}}/2}}}}}} | ||
− | <div class="bobscreen" style="width:{{#var:bswidth}}px; height | + | {{#var:bswidth}},{{#var:bsheight}} |
+ | <div class="bobscreen" style="width:{{#var:bswidth}}px; height:{{#var:bsheight}}px; outline:red solid 1px; display:inline-block; text-align:center; overflow:hidden;"> | ||
<div style="transform:scale({{#var:hscale}},{{#var:vscale}}); transform-origin:0% 0%; outline:green solid 1px; width:{{#var:rawwidth}}px !important;"> | <div style="transform:scale({{#var:hscale}},{{#var:vscale}}); transform-origin:0% 0%; outline:green solid 1px; width:{{#var:rawwidth}}px !important;"> | ||
[[File:{{{1}}}|{{#var:rawwidth}}px]] | [[File:{{{1}}}|{{#var:rawwidth}}px]] |
Revision as of 15:19, 13 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
192,144
This is how the game appears on an actual Sega Game Gear. The original image taken from an emulator is below:
Options
{{bobscreenTest|MagicalPuzzlePopils title.png|width=120}}
returns
120,90
"width" also takes into account the adjusted aspect ratio, so the image appears 120 pixels wide even if the source image is not.