Changed general namespace...
This commit is contained in:
parent
cc4b6ecb73
commit
93e9893e90
4
xiewer.c
4
xiewer.c
@ -11,9 +11,9 @@ int main (int argc, char * * argv) {
|
||||
|
||||
xlesses_configure (640, 480, "Xiewer");
|
||||
|
||||
data = xprite_import (argv [1], & width, & height);
|
||||
data = sprite_import (argv [1], & width, & height);
|
||||
|
||||
xprite_swap_channels (data, width, height);
|
||||
sprite_swap_channels (data, width, height);
|
||||
|
||||
while (xlesses_active == true) {
|
||||
xlesses_render_background_colour (0xff00ffff);
|
||||
|
@ -20,7 +20,7 @@ int main (int argc, char * * argv) {
|
||||
|
||||
data = (unsigned int *) stbi_load (argv [index], & width, & height, null, 4);
|
||||
|
||||
xprite_export (argv [index], width, height, data);
|
||||
sprite_export (argv [index], width, height, data);
|
||||
|
||||
data = deallocate (data);
|
||||
}
|
||||
|
22
xprite.h
22
xprite.h
@ -3,7 +3,7 @@
|
||||
|
||||
#include <xolatile/xtandard.h>
|
||||
|
||||
static unsigned int xprite_colour [128] = {
|
||||
static unsigned int sprite_colour [128] = {
|
||||
0x00000000, 0xff222222, 0xff444444, 0xff666666, 0xff888888, 0xffaaaaaa, 0xffcccccc, 0xffeeeeee,
|
||||
0x11000000, 0xff000022, 0xff000044, 0xff000066, 0xff000088, 0xff0000aa, 0xff0000cc, 0xff0000ee,
|
||||
0x22000000, 0xff002200, 0xff004400, 0xff006600, 0xff008800, 0xff00aa00, 0xff00cc00, 0xff00ee00,
|
||||
@ -22,7 +22,7 @@ static unsigned int xprite_colour [128] = {
|
||||
0xff000000, 0xff221122, 0xff442244, 0xff663366, 0xff884488, 0xffaa55aa, 0xffcc66cc, 0xffee77ee
|
||||
};
|
||||
|
||||
static void * xprite_import (char * path, int * width, int * height) {
|
||||
static void * sprite_import (char * path, int * width, int * height) {
|
||||
unsigned char check_width = 0;
|
||||
unsigned char check_height = 0;
|
||||
|
||||
@ -38,8 +38,8 @@ static void * xprite_import (char * path, int * width, int * height) {
|
||||
* width = (int) check_width;
|
||||
* height = (int) check_height;
|
||||
|
||||
fatal_failure ((* width) == 0, "xprite_import: Invalid sprite width.");
|
||||
fatal_failure ((* height) == 0, "xprite_import: Invalid sprite height.");
|
||||
fatal_failure ((* width) == 0, "sprite_import: Invalid sprite width.");
|
||||
fatal_failure ((* height) == 0, "sprite_import: Invalid sprite height.");
|
||||
|
||||
data = allocate ((* width) * (* height) * (int) sizeof (* data));
|
||||
|
||||
@ -50,7 +50,7 @@ static void * xprite_import (char * path, int * width, int * height) {
|
||||
file_read (file, & colour, 1);
|
||||
|
||||
if ((colour & 0x80) == 0) {
|
||||
data [move] = xprite_colour [colour];
|
||||
data [move] = sprite_colour [colour];
|
||||
} else {
|
||||
int offset;
|
||||
|
||||
@ -60,7 +60,7 @@ static void * xprite_import (char * path, int * width, int * height) {
|
||||
repeat += 1;
|
||||
|
||||
for (offset = 0; offset < repeat; ++offset) {
|
||||
data [move + offset] = xprite_colour [colour];
|
||||
data [move + offset] = sprite_colour [colour];
|
||||
}
|
||||
|
||||
move += repeat - 1;
|
||||
@ -72,13 +72,13 @@ static void * xprite_import (char * path, int * width, int * height) {
|
||||
return (data);
|
||||
}
|
||||
|
||||
static void xprite_export (const char * path, int width, int height, unsigned int * data) {
|
||||
static void sprite_export (const char * path, int width, int height, unsigned int * data) {
|
||||
int file, move;
|
||||
|
||||
file = file_open (path, O_RDWR | O_TRUNC | O_CREAT);
|
||||
|
||||
fatal_failure ((width <= 0) || (width >= 256), "xprite_export: Invalid sprite width.");
|
||||
fatal_failure ((height <= 0) || (height >= 256), "xprite_export: Invalid sprite height.");
|
||||
fatal_failure ((width <= 0) || (width >= 256), "sprite_export: Invalid sprite width.");
|
||||
fatal_failure ((height <= 0) || (height >= 256), "sprite_export: Invalid sprite height.");
|
||||
|
||||
file_write (file, & width, 1);
|
||||
file_write (file, & height, 1);
|
||||
@ -89,7 +89,7 @@ static void xprite_export (const char * path, int width, int height, unsigned in
|
||||
|
||||
for (repeat = 1; (move + repeat < width * height) && (data [move] == data [move + repeat]) && (repeat < 256); ++repeat);
|
||||
|
||||
for (colour = 0; (data [move] != xprite_colour [colour]) && (colour < 128); ++colour);
|
||||
for (colour = 0; (data [move] != sprite_colour [colour]) && (colour < 128); ++colour);
|
||||
|
||||
if (colour == 128) colour = 127;
|
||||
|
||||
@ -109,7 +109,7 @@ static void xprite_export (const char * path, int width, int height, unsigned in
|
||||
file = file_close (file);
|
||||
}
|
||||
|
||||
static void xprite_swap_channels (unsigned int * data, int width, int height) {
|
||||
static void sprite_swap_channels (unsigned int * data, int width, int height) {
|
||||
int move;
|
||||
|
||||
for (move = 0; move < width * height; ++move) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user