-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfgui_sprite.c
52 lines (42 loc) · 1.37 KB
/
fgui_sprite.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
FemtoGUI
fgui_sprite.c:
Sprite functions
copyright:
Copyright (c) 2006-2008 Bastiaan van Kesteren <[email protected]>
This program comes with ABSOLUTELY NO WARRANTY; for details see the file LICENSE.
This program is free software; you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
remarks:
*/
#include "fgui.h"
#include <string.h>
#define FGUI_CODE
#include "fgui_helper.h"
extern fgui_t fgui;
void fgui_sprite(const int x, const int y, const unsigned char *sprite)
/*
Copy a sprite to the given x/y location.
'sprite' must point to a valid sprite array. Elements in the array are:
0,1 sprite width in bits (pixels)
2,3 sprite height in bits (pixels)
4-n The actual pixel data
*/
{
copypixeldata(x, y, &sprite[4], (sprite[0]<<8) | sprite[1], (sprite[2]<<8) | sprite[3], bitstobytesup((sprite[0]<<8) | sprite[1]), fgui.fgcolor);
}
int fgui_spritewidth(const unsigned char *sprite)
/*
Get width of given sprite, in pixels
*/
{
return (sprite[0]<<8) | sprite[1];
}
int fgui_spriteheight(const unsigned char *sprite)
/*
Get height of given sprite, in pixels
*/
{
return (sprite[2]<<8) | sprite[3];
}