/*
 * sge.h for the fredygames.com browser build of Super Transball 2: the three pieces of the SDL Graphics
 * Extension (SGE) that the game uses, written anew on top of SDL2 in st2sdl12.c (the SGE library itself
 * is not part of this build):
 *   - sge_transform: rotate and scale a surface about a pivot (nearest pixel, as SGE without flags);
 *   - sge_make_cmap / sge_cmcheck / sge_destroy_cmap: pixel-exact collision maps, where a pixel is solid
 *     when it differs from the surface's color key (0 when it has none, as in SDL 1.2).
 * Copyright (C) 2026 FredyGames. GNU GPL version 2 or later, like Super Transball 2.
 */
#ifndef ST2_SGE_H
#define ST2_SGE_H

#include "st2sdl12.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct
{
  Uint8 *map; /* one byte per pixel: 1 = solid */
  int w, h;
} sge_cdata;

SDL_Rect sge_transform (SDL_Surface * src, SDL_Surface * dst, float angle, float xscale, float yscale,
                        Uint16 px, Uint16 py, Uint16 qx, Uint16 qy, Uint8 flags);
sge_cdata *sge_make_cmap (SDL_Surface * img);
int sge_cmcheck (sge_cdata * cd1, Sint16 x1, Sint16 y1, sge_cdata * cd2, Sint16 x2, Sint16 y2);
void sge_destroy_cmap (sge_cdata * cd);

#ifdef __cplusplus
}
#endif

#endif
