mirror of
https://github.com/orangeglo/gbnp.git
synced 2026-08-28 03:24:23 -05:00
Expand menu entry size from 96 -> 128, add pokemon font
This commit is contained in:
@@ -100,12 +100,12 @@ Vue.component('bitmap-preview', {
|
||||
renderCanvas: function() {
|
||||
let canvas = this.$refs.canvas;
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.putImageData(new ImageData(this.data, 96, 8), 0, 0);
|
||||
ctx.putImageData(new ImageData(this.data, 128, 8), 0, 0);
|
||||
ctx.imageSmoothingEnabled = false;
|
||||
ctx.scale(2, 2);
|
||||
ctx.drawImage(ctx.canvas, 0, 0);
|
||||
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||||
}
|
||||
},
|
||||
template: '<canvas width="192" height="16" ref="canvas"></canvas>'
|
||||
template: '<canvas width="256" height="16" ref="canvas"></canvas>'
|
||||
});
|
||||
|
||||
@@ -14,10 +14,11 @@ const BITMAP_PREVIEW_BYTES = [
|
||||
[0x00, 0x00, 0x00, 0xFF] // black
|
||||
]
|
||||
const FONTS = [
|
||||
{ style: 'normal 16px Pixeltype', y: 7 },
|
||||
{ style: 'normal 8px Gameboy', y: 7 },
|
||||
{ style: 'normal 16px Pixeltype', y: 7 },
|
||||
{ style: 'normal 8px Nokia', y: 7 },
|
||||
{ style: 'normal 16px Gamer', y: 7 }
|
||||
{ style: 'normal 16px Gamer', y: 7 },
|
||||
{ style: 'normal 8px Pokemon', y: 7 },
|
||||
]
|
||||
|
||||
class Menu {
|
||||
@@ -121,16 +122,19 @@ class ROM {
|
||||
|
||||
const canvas = document.createElement("canvas");
|
||||
canvas.height = 8;
|
||||
canvas.width = 96;
|
||||
canvas.width = 128;
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.imageSmoothingEnabled = false;
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.fillRect(0, 0, 96, 8);
|
||||
ctx.fillRect(0, 0, 128, 8);
|
||||
const font = FONTS[fontIndex || 0];
|
||||
ctx.font = font.style;
|
||||
ctx.fillStyle = 'black';
|
||||
ctx.fillText(this.menuText,1,font.y);
|
||||
const imageData = ctx.getImageData(0, 0, 96, 8).data;
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.fillRect(127, 0, 127, 8);
|
||||
|
||||
const imageData = ctx.getImageData(0, 0, 128, 8).data;
|
||||
|
||||
for (let i = 0; i < imageData.length; i+=16){
|
||||
let byte = 0;
|
||||
@@ -144,8 +148,8 @@ class ROM {
|
||||
}
|
||||
|
||||
let outputBuffer = []
|
||||
for (let h = 0; h < 24; h+=2) {
|
||||
for (let i = h; i < 192; i+=24) {
|
||||
for (let h = 0; h < 32; h+=2) {
|
||||
for (let i = h; i < 256; i+=32) {
|
||||
let a = buffer[i]
|
||||
let b = buffer[i+1]
|
||||
|
||||
@@ -347,8 +351,6 @@ class Processor {
|
||||
// title bitmap
|
||||
romFile.writeBytes(rom.bitmapBuffer);
|
||||
|
||||
rom.bitmapBuffer
|
||||
|
||||
romFileIndex += 512
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user