From 4919e623c6695a80aaf96187253756dcbb72bf87 Mon Sep 17 00:00:00 2001 From: oroborus Date: Sun, 8 Jun 2008 21:43:44 +0000 Subject: - 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 --- src/layer.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/layer.c') 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); -- cgit v1.2.3