fs2port/port/include/framebuffer.h
2026-05-13 21:32:05 -05:00

30 lines
1.2 KiB
C

// Software framebuffer for the FS2 port. Owns a 280x192 8-bit
// palette-indexed image AND a parallel Apple II hires bitplane
// (40x192 = 7680 bytes) that the scenery viewport renders into so
// chunk5's bit-pattern color generation works as on real hardware.
// At blit time, viewport rows decode from the bitplane; panel rows
// (below VIEWPORT_BOTTOM) use the palette image as before.
#ifndef FRAMEBUFFER_H
#define FRAMEBUFFER_H
#include <stdint.h>
#include "hires.h"
#include "palette.h"
#include "types.h"
typedef struct FramebufferT {
uint8_t pixels[NATIVE_WIDTH * NATIVE_HEIGHT];
uint8_t hires[HIRES_PAGE_BYTES];
} FramebufferT;
void framebufferClear(FramebufferT *fb, ColorE color);
void framebufferFillRect(FramebufferT *fb, int16_t x, int16_t y, int16_t w, int16_t h, ColorE color);
void framebufferFillRow(FramebufferT *fb, int16_t y, ColorE color);
void framebufferSetPixel(FramebufferT *fb, int16_t x, int16_t y, ColorE color);
// Copy the framebuffer into a 32-bit RGB SDL pixel buffer (any
// upscaling is applied here so SDL just blits a flat surface).
void framebufferBlitTo32(const FramebufferT *fb, uint32_t *dst, int dstWidth, int dstHeight);
#endif