Tutorial finalizado
This commit is contained in:
6
game.cpp
6
game.cpp
@@ -4,16 +4,14 @@ void init()
|
||||
{
|
||||
jInit("tutorial_paleta", 320, 240, 2);
|
||||
jSetPal(0, 0x00000000);
|
||||
jSetPal(1, 0xffff0000);
|
||||
jSetPal(2, 0xffffffff);
|
||||
jCls(0);
|
||||
jSurface peiv = jLoadSurface("williams.gif");
|
||||
jLoadPal("pal02.gif");
|
||||
jLoadPal("pal01.gif");
|
||||
jSetSource(peiv);
|
||||
}
|
||||
|
||||
void update()
|
||||
{
|
||||
jCls(0);
|
||||
jBlit(0, 0, 0, 0, 29, 64);
|
||||
jBlit(100, 60, 0, 0, 29, 64);
|
||||
}
|
||||
@@ -18,6 +18,7 @@ static Uint32 paleta[256];
|
||||
static int jWidth = 320;
|
||||
static int jHeight = 240;
|
||||
static int jZoom = 2;
|
||||
static int transparentColor = 0;
|
||||
|
||||
jSurface jNewSurface(int w, int h)
|
||||
{
|
||||
@@ -54,6 +55,7 @@ void jBlit(int dx, int dy, int sx, int sy, int w, int h)
|
||||
{
|
||||
if (jSourceSurf == NULL)
|
||||
return;
|
||||
|
||||
for (int iy = 0; iy < h; ++iy)
|
||||
{
|
||||
for (int ix = 0; ix < w; ++ix)
|
||||
@@ -152,7 +154,7 @@ void jFlip()
|
||||
|
||||
void jPutPixel(int x, int y, Uint8 color)
|
||||
{
|
||||
if (x < 0 || y < 0 || x >= jDestSurf->w || y >= jDestSurf->h)
|
||||
if (x < 0 || y < 0 || x >= jDestSurf->w || y >= jDestSurf->h || color == transparentColor)
|
||||
return;
|
||||
jDestSurf->data[x + y * jDestSurf->w] = color;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user