Skip to content

Commit

Permalink
Merge pull request #2 from Fordi/master
Browse files Browse the repository at this point in the history
[Issue #1] Fixed render scaling
  • Loading branch information
andychase authored Sep 6, 2020
2 parents 95d66fd + 5072e65 commit 96739fb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,33 @@
canvas.removeAttribute('style');
}
}, false);

const fullScreen = () => {
document.getElementById('screen').requestFullscreen();
};
</script>
</head>
<body>
<canvas id="screen" width="480" height="320"></canvas>
<section id="gameinfo">
<p>The Game Boy Advance's buttons are mapped as follows:</p>
<table id="mapping">
<tr>
<td>Up</td>
<td>Up</td>
</tr>
<tr>
<td>Down</td>
<td>Down</td>
</tr>
<tr>
<td>Left</td>
<td>Left</td>
</tr>
<tr>
<td>Right</td>
<td>Right</td>
</tr>
<tr>
<td>A</td>
<td>Z</td>
Expand Down Expand Up @@ -306,6 +326,7 @@
<button class="bigbutton" onclick="reset()">RESET</button>
<button onclick="gba.downloadSavedata()">Download Savegame</button>
<button onclick="screenshot()">Screenshot</button>
<button onclick="fullScreen()">Full screen</button>
<label id="pixelated">
<input type="checkbox" onchange="setPixelated(this.checked)">
<p>Pixelated</p>
Expand Down
2 changes: 1 addition & 1 deletion js/gba.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ GameBoyAdvance.prototype.setCanvas = function(canvas) {
this.setCanvasDirect(this.indirectCanvas);
var targetContext = canvas.getContext('2d');
this.video.drawCallback = function() {
targetContext.drawImage(self.indirectCanvas, 0, 0, canvas.offsetWidth, canvas.offsetHeight);
targetContext.drawImage(self.indirectCanvas, 0, 0, canvas.width, canvas.height);
}
} else {
this.setCanvasDirect(canvas);
Expand Down

0 comments on commit 96739fb

Please sign in to comment.