4c0eabcc5c
surf.source.push(surface) surf.source.pop() surf.target.push(surface) surf.target.pop()
69 lines
1.8 KiB
C++
69 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <vector>
|
|
#include <stack>
|
|
|
|
namespace mini
|
|
{
|
|
namespace surf
|
|
{
|
|
#define SCREEN 0
|
|
//#define MAX_SURFACES 100
|
|
|
|
#define SURF_NOTHING 0
|
|
#define SURF_EXTERNAL 1
|
|
#define SURF_GENERATED 2
|
|
|
|
struct surface_t {
|
|
char* name {nullptr};
|
|
uint8_t* p {nullptr};
|
|
uint16_t w, h;
|
|
uint32_t size;
|
|
int clip[4] {0, 0, 0, 0};
|
|
uint8_t flags {SURF_NOTHING};
|
|
};
|
|
|
|
struct state_t {
|
|
std::vector<surface_t> surfaces;
|
|
int dest_surface = -1;
|
|
int source_surface = -1;
|
|
std::stack<int> dest_stack;
|
|
std::stack<int> source_stack;
|
|
};
|
|
extern state_t state;
|
|
|
|
void init();
|
|
void quit();
|
|
|
|
uint8_t create(int w, int h);
|
|
uint8_t load(const char* filename, const bool external = false);
|
|
uint8_t load(uint8_t* buffer, const char* name);
|
|
void reloadsurfs();
|
|
void save(uint8_t surface, const char* filename, uint8_t *pal, uint8_t colors=0);
|
|
void destroy(uint8_t surface);
|
|
int width(uint8_t surface);
|
|
int height(uint8_t surface);
|
|
void cls(uint8_t color=0);
|
|
|
|
namespace target {
|
|
void set(uint8_t surface);
|
|
uint8_t get();
|
|
void push(uint8_t surface);
|
|
void pop();
|
|
}
|
|
|
|
namespace source {
|
|
void set(uint8_t surface);
|
|
uint8_t get();
|
|
void push(uint8_t surface);
|
|
void pop();
|
|
}
|
|
|
|
namespace clip {
|
|
void set(int x, int y, int w, int h);
|
|
void reset(int surface=-1);
|
|
void recalculate();
|
|
}
|
|
}
|
|
} |