summaryrefslogtreecommitdiff
path: root/src/layer.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-06-08 21:43:44 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-06-08 21:43:44 +0000
commit4919e623c6695a80aaf96187253756dcbb72bf87 (patch)
tree948fbcc211b1a8f13e3830853edef6505234bab2 /src/layer.c
parenta8110d0786e7931715a0d7116ed7d4c23697bdb6 (diff)
- kod bol prepisany tak aby dokazal pracovat aj s arenami vascimi ako je obrazovka okna
( ako pozadie na arenu sa da pouzit aj tepeta aj textura ) git-svn-id: http://opensvn.csie.org/tuxanci_ng@62 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/layer.c')
-rwxr-xr-xsrc/layer.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/layer.c b/src/layer.c
index d8740dc..07ec40f 100755
--- a/src/layer.c
+++ b/src/layer.c
@@ -109,20 +109,27 @@ void drawLayer()
void drawLayerCenter(int x, int y)
{
layer_t *this;
- int offset_x, offset_y;
+ int screen_x, screen_y;
int i;
- offset_x = x - WINDOW_SIZE_X/2;
- offset_y = y - WINDOW_SIZE_Y/2;
+ getCenterScreen(&screen_x, &screen_y, x, y);
for( i = 0 ; i < listLayer->count ; i++ )
{
this = (layer_t *)listLayer->list[i];
+ if( (this->x - screen_x) + this->w < 0 || (this->x - screen_x) > WINDOW_SIZE_X ||
+ (this->y - screen_y) + this->h < 0 || (this->y - screen_y) > WINDOW_SIZE_Y )
+ {
+ continue;
+ }
+
drawImage(this->image,
- this->x - offset_x, this->y - offset_y,
+ this->x - screen_x, this->y - screen_y,
this->px, this->py,
this->w, this->h);
+
+ //printf("%d %d\n", this->x - screen_x, this->y - screen_y);
}
destroyListItem(listLayer, free);