uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit a44dbd969666d1729af03f3f82248412592a2857
parent 8aae16a9d0b10d2ac7e4083037f96b6dfc386943
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Wed, 12 Apr 2023 20:00:17 -0700

(screen.c) Merge all checks

Diffstat:
Msrc/devices/screen.c | 18+++++++++---------
Msrc/uxnemu.c | 3+--
2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/devices/screen.c b/src/devices/screen.c @@ -86,15 +86,15 @@ screen_resize(UxnScreen *p, Uint16 width, Uint16 height) bg = realloc(p->bg.pixels, width * height), fg = realloc(p->fg.pixels, width * height); pixels = realloc(p->pixels, width * height * sizeof(Uint32)); - if(bg) p->bg.pixels = bg; - if(fg) p->fg.pixels = fg; - if(pixels) p->pixels = pixels; - if(bg && fg && pixels) { - p->width = width; - p->height = height; - screen_fill(p, &p->bg, 0, 0, p->width, p->height, 0); - screen_fill(p, &p->fg, 0, 0, p->width, p->height, 0); - } + if(!bg || !fg || !pixels) + return; + p->bg.pixels = bg; + p->fg.pixels = fg; + p->pixels = pixels; + p->width = width; + p->height = height; + screen_fill(p, &p->bg, 0, 0, p->width, p->height, 0); + screen_fill(p, &p->fg, 0, 0, p->width, p->height, 0); } void diff --git a/src/uxnemu.c b/src/uxnemu.c @@ -399,9 +399,8 @@ handle_events(Uxn *u) SDL_free(event.drop.file); } /* Audio */ - else if(event.type >= audio0_event && event.type < audio0_event + POLYPHONY) { + else if(event.type >= audio0_event && event.type < audio0_event + POLYPHONY) uxn_eval(u, PEEK2(&u->dev[0x30 + 0x10 * (event.type - audio0_event)])); - } /* Mouse */ else if(event.type == SDL_MOUSEMOTION) mouse_pos(u, &u->dev[0x90], clamp(event.motion.x - PAD, 0, uxn_screen.width - 1), clamp(event.motion.y - PAD, 0, uxn_screen.height - 1));