ref: 0590ba5de9b6b9c07a6de2f2b1f7246e6cefa22c
parent: 5127d1b424617d41c24be5f682950cdf39dade0e
author: Jacob Moody <moody@posixcafe.org>
date: Wed Feb 22 23:24:00 EST 2023
fix gears
--- a/SDL_Examples/gears.c
+++ b/SDL_Examples/gears.c
@@ -274,6 +274,7 @@
// initialize SDL video:
int winSizeX = 640;
int winSizeY = 480;
+ Image *image;
unsigned int fps = 0;
unsigned int flat = 0;
unsigned int setenspec = 1;
@@ -311,8 +312,7 @@
if (initdraw(nil, nil, "gears") < 0) {
sysfatal("%r");
}
- winSizeX = Dx(screen->r);
- winSizeY = Dy(screen->r);
+ image = allocimage(display, Rect(0, 0, winSizeX, winSizeY), screen->chan, 0, DNotacolor);
// initialize TinyGL:
// unsigned int pitch;
@@ -431,7 +431,9 @@
}
// swap buffers:
- loadimage(screen, screen->r, (uchar*)frameBuffer->pbuf, winSizeX*winSizeY*4);
+ loadimage(image, image->r, (uchar*)frameBuffer->pbuf, winSizeX*winSizeY*4);
+ draw(screen, screen->r, image, nil, ZP);
+ flushimage(display, 1);
/*
if (!noSDL)
ZB_copyFrameBuffer(frameBuffer, sdl_screen->pixels, sdl_screen->pitch);