1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-25 18:33:11 +00:00

less padding on CRT style, overscan option

This commit is contained in:
Steven Hugg 2018-11-24 13:44:07 -05:00
parent 764fafa035
commit a511d81c97
4 changed files with 12 additions and 7 deletions

View File

@ -244,12 +244,12 @@ div.emuspacer {
border-radius:20px; border-radius:20px;
border: 4px solid #222; border: 4px solid #222;
outline-color: #666; outline-color: #666;
padding: 30px; padding: 20px;
background: #000; background: #000;
margin-top:40px; margin-top:40px;
margin-left:7.5%; margin-left:5%;
margin-right:7.5%; margin-right:5%;
width: 85%; width:90%;
pointer-events:auto; pointer-events:auto;
} }
canvas.pixelated { canvas.pixelated {

View File

@ -53,7 +53,9 @@ function _setKeyboardEvents(canvas:HTMLElement, callback:KeyboardCallback) {
}; };
}; };
export var RasterVideo = function(mainElement:HTMLElement, width:number, height:number, options?) { type VideoCanvasOptions = {rotate?:number, overscan?:boolean};
export var RasterVideo = function(mainElement:HTMLElement, width:number, height:number, options?:VideoCanvasOptions) {
var canvas, ctx; var canvas, ctx;
var imageData, arraybuf, buf8, datau32; var imageData, arraybuf, buf8, datau32;
var vcanvas; var vcanvas;
@ -79,6 +81,9 @@ export var RasterVideo = function(mainElement:HTMLElement, width:number, height:
if (options && options.rotate) { if (options && options.rotate) {
this.setRotate(options.rotate); this.setRotate(options.rotate);
} }
if (options && options.overscan) {
vcanvas.css('padding','0px');
}
ctx = canvas.getContext('2d'); ctx = canvas.getContext('2d');
imageData = ctx.createImageData(width, height); imageData = ctx.createImageData(width, height);
datau32 = new Uint32Array(imageData.data.buffer); datau32 = new Uint32Array(imageData.data.buffer);

View File

@ -123,7 +123,7 @@ const _ColecoVisionPlatform = function(mainElement) {
} }
}; };
cpu = this.newCPU(membus, iobus); cpu = this.newCPU(membus, iobus);
video = new RasterVideo(mainElement,canvasWidth,numVisibleScanlines); video = new RasterVideo(mainElement,canvasWidth,numVisibleScanlines,{overscan:true});
video.create(); video.create();
audio = new MasterAudio(); audio = new MasterAudio();
psg = new SN76489_Audio(audio); psg = new SN76489_Audio(audio);

View File

@ -78,7 +78,7 @@ const _JSNESPlatform = function(mainElement) {
start() { start() {
var self = this; var self = this;
video = new RasterVideo(mainElement,256,224); video = new RasterVideo(mainElement,256,224,{overscan:true});
audio = new SampleAudio(audioFrequency); audio = new SampleAudio(audioFrequency);
video.create(); video.create();
var idata = video.getFrameData(); var idata = video.getFrameData();