-loadpal now loads a palette from disk and returns it in a table.
-setpal sets a palette from a table as the current palette.
This commit is contained in:
12
mini.cpp
12
mini.cpp
@@ -292,7 +292,7 @@ void color(uint8_t color) {
|
||||
ds::pen_color=color;
|
||||
}
|
||||
|
||||
void loadpal(const char* filename) {
|
||||
uint32_t *loadpal(const char* filename) {
|
||||
FILE *f = fopen(filename, "rb");
|
||||
if (f) {
|
||||
fseek(f, 0, SEEK_END);
|
||||
@@ -303,9 +303,15 @@ void loadpal(const char* filename) {
|
||||
fclose(f);
|
||||
uint32_t *pal = LoadPalette(buffer);
|
||||
free(buffer);
|
||||
memcpy(palette, pal, 1024);
|
||||
free(pal);
|
||||
return pal;
|
||||
//memcpy(palette, pal, 1024);
|
||||
//free(pal);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void setpal(uint32_t *pal) {
|
||||
memcpy(palette, pal, 1024);
|
||||
}
|
||||
|
||||
void setcolor(uint8_t index, uint32_t color) {
|
||||
|
||||
Reference in New Issue
Block a user