32 lines
1.3 KiB
C
32 lines
1.3 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ML_bmp_8_or_cl.c */
|
|
/* | Project : monochromelib */
|
|
/* */
|
|
/* By: Pierre "PierrotLL" Le Gall <legallpierre89@gmail.com> */
|
|
/* Last updated: 2011/11/22 */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include <monochrome/internals.h>
|
|
|
|
void ML_bmp_8_or_cl(const unsigned char *bmp, int x, int y)
|
|
{
|
|
unsigned short line;
|
|
char i, shift, begin=0, end=8, bool1=1, bool2=1, *screen, *p=(char*)&line;
|
|
if(!bmp || x<-7 || x>127 || y<-7 || y>63) return;
|
|
if(y < 0) begin = -y;
|
|
if(y > 56) end = 64-y;
|
|
shift = 8-(x&7);
|
|
if(x < 0) bool1 = 0;
|
|
if(x>120 || shift==8) bool2 = 0;
|
|
screen = ML_vram_adress()+(y+begin<<4)+(x>>3);
|
|
for(i=begin ; i<end ; i++)
|
|
{
|
|
line = bmp[i]<<shift;
|
|
if(bool1) screen[0] |= *p;
|
|
if(bool2) screen[1] |= *(p+1);
|
|
screen += 16;
|
|
}
|
|
}
|