- jdraw8.hpp: typedef → using (JD8_Surface, JD8_Palette) - jdraw8.cpp: NULL → nullptr, C-casts → static_cast/reinterpret_cast, anon enum FadeType → enum class - momia.cpp: NULL → nullptr - bola/mapa/marcador/momia/engendro: explicit als constructors Zero canvis de lògica ni ownership. Primera fase de la modernització RAII. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
81 lines
2.7 KiB
C++
81 lines
2.7 KiB
C++
#pragma once
|
|
#include <SDL3/SDL.h>
|
|
|
|
struct Color {
|
|
Uint8 r;
|
|
Uint8 g;
|
|
Uint8 b;
|
|
};
|
|
|
|
using JD8_Surface = Uint8*;
|
|
using JD8_Palette = Color*;
|
|
|
|
void JD8_Init();
|
|
|
|
void JD8_Quit();
|
|
|
|
void JD8_ClearScreen(Uint8 color);
|
|
|
|
JD8_Surface JD8_NewSurface();
|
|
|
|
JD8_Surface JD8_LoadSurface(const char* file);
|
|
|
|
JD8_Palette JD8_LoadPalette(const char* file);
|
|
|
|
void JD8_SetScreenPalette(JD8_Palette palette);
|
|
|
|
void JD8_FillSquare(int ini, int height, Uint8 color);
|
|
|
|
// Omple un rectangle arbitrari de la pantalla amb un color paletat.
|
|
// Pensat per a UI senzilla (barra de progrés del BootLoader, etc.).
|
|
void JD8_FillRect(int x, int y, int w, int h, Uint8 color);
|
|
|
|
void JD8_Blit(JD8_Surface surface);
|
|
|
|
void JD8_Blit(int x, int y, JD8_Surface surface, int sx, int sy, int sw, int sh);
|
|
|
|
void JD8_BlitToSurface(int x, int y, JD8_Surface surface, int sx, int sy, int sw, int sh, JD8_Surface dest);
|
|
|
|
void JD8_BlitCK(int x, int y, JD8_Surface surface, int sx, int sy, int sw, int sh, Uint8 colorkey);
|
|
|
|
void JD8_BlitCKCut(int x, int y, JD8_Surface surface, int sx, int sy, int sw, int sh, Uint8 colorkey);
|
|
|
|
void JD8_BlitCKScroll(int y, JD8_Surface surface, int sx, int sy, int sh, Uint8 colorkey);
|
|
|
|
void JD8_BlitCKToSurface(int x, int y, JD8_Surface surface, int sx, int sy, int sw, int sh, JD8_Surface dest, Uint8 colorkey);
|
|
|
|
// Converteix la pantalla indexada a ARGB. El Director crida aquesta
|
|
// funció al final de cada tick i després llegeix el framebuffer via
|
|
// JD8_GetFramebuffer() per presentar-lo.
|
|
void JD8_Flip();
|
|
|
|
// Accés al framebuffer ARGB de 320x200 actualitzat per l'última crida a
|
|
// JD8_Flip(). Propietat de jdraw8 — el caller no ha de lliberar-lo.
|
|
Uint32* JD8_GetFramebuffer();
|
|
|
|
void JD8_FreeSurface(JD8_Surface surface);
|
|
|
|
Uint8 JD8_GetPixel(JD8_Surface surface, int x, int y);
|
|
|
|
void JD8_PutPixel(JD8_Surface surface, int x, int y, Uint8 pixel);
|
|
|
|
void JD8_SetPaletteColor(Uint8 index, Uint8 r, Uint8 g, Uint8 b);
|
|
|
|
// API de fade no bloquejant (màquina d'estats). `FadeStart*` inicia el
|
|
// fade; `FadeTickStep` aplica un pas i retorna `true` quan el fade ha
|
|
// acabat. Un pas correspon visualment a una iteració del fade original
|
|
// (32 passos en total). El caller és responsable de fer el Flip entre
|
|
// passos si el vol veure animat. `FadeIsActive` permet saber si hi ha
|
|
// un fade en curs per a enllaçar-lo amb un altre subsistema.
|
|
// L'embolcall `scenes::PaletteFade` ho fa més idiomàtic per a escenes.
|
|
void JD8_FadeStartOut();
|
|
void JD8_FadeStartToPal(JD8_Palette pal);
|
|
bool JD8_FadeTickStep();
|
|
bool JD8_FadeIsActive();
|
|
|
|
// JD_Font JD_LoadFont( char *file, int width, int height);
|
|
|
|
// void JD_DrawText( int x, int y, JD_Font *source, char *text);
|
|
|
|
// char *JD_GetFPS();
|