refactor: JD8_* a namespace Jd8::
This commit is contained in:
+78
-80
@@ -1,80 +1,78 @@
|
||||
#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);
|
||||
|
||||
auto JD8_NewSurface() -> JD8_Surface;
|
||||
|
||||
auto JD8_LoadSurface(const char* file) -> JD8_Surface;
|
||||
|
||||
auto JD8_LoadPalette(const char* file) -> JD8_Palette;
|
||||
|
||||
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(const Uint8* surface);
|
||||
|
||||
void JD8_Blit(int x, int y, const Uint8* surface, int sx, int sy, int sw, int sh);
|
||||
|
||||
void JD8_BlitToSurface(int x, int y, const Uint8* surface, int sx, int sy, int sw, int sh, JD8_Surface dest);
|
||||
|
||||
void JD8_BlitCK(int x, int y, const Uint8* surface, int sx, int sy, int sw, int sh, Uint8 colorkey);
|
||||
|
||||
void JD8_BlitCKCut(int x, int y, const Uint8* surface, int sx, int sy, int sw, int sh, Uint8 colorkey);
|
||||
|
||||
void JD8_BlitCKScroll(int y, const Uint8* surface, int sx, int sy, int sh, Uint8 colorkey);
|
||||
|
||||
void JD8_BlitCKToSurface(int x, int y, const Uint8* 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.
|
||||
auto JD8_GetFramebuffer() -> Uint32*;
|
||||
|
||||
void JD8_FreeSurface(JD8_Surface surface);
|
||||
|
||||
auto JD8_GetPixel(const Uint8* surface, int x, int y) -> Uint8;
|
||||
|
||||
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(const Color* pal);
|
||||
auto JD8_FadeTickStep() -> bool;
|
||||
auto JD8_FadeIsActive() -> bool;
|
||||
|
||||
// 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();
|
||||
#pragma once
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
struct Color {
|
||||
Uint8 r;
|
||||
Uint8 g;
|
||||
Uint8 b;
|
||||
};
|
||||
|
||||
namespace Jd8 {
|
||||
|
||||
using Surface = Uint8*;
|
||||
using Palette = Color*;
|
||||
|
||||
void init();
|
||||
|
||||
void quit();
|
||||
|
||||
void clearScreen(Uint8 color);
|
||||
|
||||
auto newSurface() -> Surface;
|
||||
|
||||
auto loadSurface(const char* file) -> Surface;
|
||||
|
||||
auto loadPalette(const char* file) -> Palette;
|
||||
|
||||
void setScreenPalette(Palette palette);
|
||||
|
||||
void 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 fillRect(int x, int y, int w, int h, Uint8 color);
|
||||
|
||||
void blit(const Uint8* surface);
|
||||
|
||||
void blit(int x, int y, const Uint8* surface, int sx, int sy, int sw, int sh);
|
||||
|
||||
void blitToSurface(int x, int y, const Uint8* surface, int sx, int sy, int sw, int sh, Surface dest);
|
||||
|
||||
void blitCK(int x, int y, const Uint8* surface, int sx, int sy, int sw, int sh, Uint8 colorkey);
|
||||
|
||||
void blitCKCut(int x, int y, const Uint8* surface, int sx, int sy, int sw, int sh, Uint8 colorkey);
|
||||
|
||||
void blitCKScroll(int y, const Uint8* surface, int sx, int sy, int sh, Uint8 colorkey);
|
||||
|
||||
void blitCKToSurface(int x, int y, const Uint8* surface, int sx, int sy, int sw, int sh, 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
|
||||
// getFramebuffer() per presentar-lo.
|
||||
void flip();
|
||||
|
||||
// Accés al framebuffer ARGB de 320x200 actualitzat per l'última crida a
|
||||
// flip(). Propietat de jdraw8 — el caller no ha de lliberar-lo.
|
||||
auto getFramebuffer() -> Uint32*;
|
||||
|
||||
void freeSurface(Surface surface);
|
||||
|
||||
auto getPixel(const Uint8* surface, int x, int y) -> Uint8;
|
||||
|
||||
void putPixel(Surface surface, int x, int y, Uint8 pixel);
|
||||
|
||||
void 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 fadeStartOut();
|
||||
void fadeStartToPal(const Color* pal);
|
||||
auto fadeTickStep() -> bool;
|
||||
auto fadeIsActive() -> bool;
|
||||
|
||||
} // namespace Jd8
|
||||
|
||||
Reference in New Issue
Block a user