48 lines
1.7 KiB
C++
48 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
namespace draw
|
|
{
|
|
// Estructura per a mantindre una superficie de pintat, la "pantalla virtual" de tota la vida
|
|
struct surface
|
|
{
|
|
uint16_t w; // Ample de la superficie
|
|
uint16_t h; // Alt de la superficie
|
|
uint8_t *pixels; // pixels de la superficie
|
|
};
|
|
|
|
void init(const char* titol, const uint16_t width, const uint16_t height, const uint8_t zoom);
|
|
void quit();
|
|
|
|
surface *createSurface(const int width, const int height);
|
|
surface *loadSurface(const char *filename);
|
|
void freeSurface(surface *surface);
|
|
|
|
void draw(surface *src, surface *dst, uint16_t src_offset, uint16_t w, uint16_t h, uint16_t dst_x, uint16_t dst_y);
|
|
void draw(surface *src, surface *dst);
|
|
|
|
void cls(const uint8_t color, surface *dst);
|
|
|
|
/// @brief Estableix la paleta del sistema carregant-la d'un GIF
|
|
/// @param filename nom de l'arxiu GIF d'on carregar la paleta
|
|
void loadPalette(const char *filename);
|
|
|
|
void setPalette(uint8_t *paleta);
|
|
uint8_t *getPalette();
|
|
void setColor(const uint8_t index, const uint8_t r, const uint8_t g, const uint8_t b);
|
|
void getColor(const uint8_t index, uint8_t *r, uint8_t *g, uint8_t *b);
|
|
void blackout();
|
|
|
|
void fadeDown(const uint8_t r, const uint8_t g, const uint8_t b, const uint8_t espera); // espera son el nombre de waitVsync a executar en cada iteració del bucle
|
|
void fadeUp(const uint8_t *paleta, const uint8_t espera);
|
|
|
|
void putPixel(const int x, const int y, const uint8_t color, surface *dst);
|
|
uint8_t getPixel(const int x, const int y, surface *src);
|
|
|
|
void vline(const int x, const int y1, const int y2, const uint8_t color, surface *dst);
|
|
|
|
void waitVsync();
|
|
void render();
|
|
}
|