diff options
author | kdx <kikoodx@paranoici.org> | 2023-09-01 22:37:34 +0200 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-09-01 22:37:34 +0200 |
commit | 0e80ee2d2cb6d4d70d9dd765fdf2fdae13ec30d8 (patch) | |
tree | 8f2a260fac4fc3d96c60698a6088b5b0f76b8398 | |
parent | c52ff6682752c0df74ccdd3361939f86f1f15808 (diff) | |
download | px-0e80ee2d2cb6d4d70d9dd765fdf2fdae13ec30d8.tar.gz |
autodetermine buffer size
-rw-r--r-- | src/px.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -39,7 +39,7 @@ pxInit(void) pxtexture = SDL_CreateTexture(___tzr_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, - PX_WIDTH, PX_HEIGHT); + ___tzr_config.width, ___tzr_config.height); if (pxtexture == NULL) { fprintf(stderr, "%s\n", SDL_GetError()); return -1; @@ -66,10 +66,10 @@ pxFlip(void) return -1; } - for (int y = 0; y < PX_HEIGHT; y++) { - for (int x = 0; x < PX_WIDTH; x++) { + for (int y = 0; y < ___tzr_config.height; y++) { + for (int x = 0; x < ___tzr_config.width; x++) { const int ix = x << 2; - PxCol col = pxbuf[x + y * PX_WIDTH]; + PxCol col = pxbuf[x + y * ___tzr_config.width]; if (pxpal[col].spal) col = pxpal[col].spal - 1; pixels[ix + y * pitch + 0] = pxpal[col].b; @@ -90,8 +90,8 @@ pxCls(PxCol c) { for (int y = pxclip.y; y < pxclip.y + pxclip.h; y++) for (int x = pxclip.x; x < pxclip.x + pxclip.w; x++) { - pxbuf[x + y * PX_WIDTH] = c; - pxzbuf[x + y * PX_WIDTH] = 0; + pxbuf[x + y * ___tzr_config.width] = c; + pxzbuf[x + y * ___tzr_config.width] = 0; } } |