games/nes: cleanup and resize handling
This commit is contained in:
parent
eeac553c36
commit
29491679b8
4 changed files with 23 additions and 8 deletions
|
@ -6,7 +6,6 @@
|
|||
u16int pc, curpc;
|
||||
u8int rA, rX, rY, rS, rP;
|
||||
int nmi;
|
||||
extern int map;
|
||||
|
||||
static u8int
|
||||
fetch8(void)
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
extern u16int pc, curpc;
|
||||
extern u8int rA, rX, rY, rS, rP;
|
||||
extern uchar mem[32768];
|
||||
extern int scale;
|
||||
extern uchar mem[32768], ppuram[16384], oam[256];
|
||||
extern u16int pput, ppuv;
|
||||
extern u8int ppusx;
|
||||
extern int mirr;
|
||||
|
||||
extern int map, scale;
|
||||
extern uchar *prg, *chr;
|
||||
extern int nprg, nchr, nmi, map;
|
||||
|
||||
extern int keys;
|
||||
|
||||
enum {
|
||||
FLAGC = 1<<0,
|
||||
|
|
|
@ -9,12 +9,9 @@ uchar mem[32768];
|
|||
uchar ppuram[16384];
|
||||
uchar oam[256];
|
||||
uchar *prgb[2], *chrb[2];
|
||||
extern uchar *prg, *chr;
|
||||
extern int nprg, nchr;
|
||||
u16int pput, ppuv;
|
||||
u8int ppusx;
|
||||
static int vramlatch = 1, keylatch = 0xFF;
|
||||
extern int keys, nmi, map, mirr;
|
||||
|
||||
static void
|
||||
nrom(int p, u8int)
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
#include <libc.h>
|
||||
#include <thread.h>
|
||||
#include <draw.h>
|
||||
#include <mouse.h>
|
||||
#include "dat.h"
|
||||
#include "fns.h"
|
||||
|
||||
int ppuy, ppux, odd;
|
||||
uchar pic[256*240*4*9];
|
||||
extern uchar oam[256];
|
||||
|
||||
static void
|
||||
pixel(int x, int y, int val, int back)
|
||||
|
@ -248,8 +248,21 @@ static void
|
|||
flush(void)
|
||||
{
|
||||
extern Rectangle picr;
|
||||
extern Image *tmp;
|
||||
extern Image *tmp, *bg;
|
||||
extern Mousectl *mc;
|
||||
Mouse m;
|
||||
Point p;
|
||||
|
||||
while(nbrecv(mc->c, &m) > 0)
|
||||
;
|
||||
if(nbrecvul(mc->resizec) > 0){
|
||||
if(getwindow(display, Refnone) < 0)
|
||||
sysfatal("resize failed: %r");
|
||||
p = divpt(addpt(screen->r.min, screen->r.max), 2);
|
||||
picr = (Rectangle){subpt(p, Pt(scale * 128, scale * 120)), addpt(p, Pt(scale * 128, scale * 120))};
|
||||
bg = allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, 0xCCCCCCFF);
|
||||
draw(screen, screen->r, bg, nil, ZP);
|
||||
}
|
||||
if(tmp){
|
||||
loadimage(tmp, tmp->r, pic, 256*240*4*scale*scale);
|
||||
draw(screen, picr, tmp, nil, ZP);
|
||||
|
|
Loading…
Reference in a new issue