From 1e656ce31aca56aa802245b220850ebba6672d93 Mon Sep 17 00:00:00 2001 From: oroborus Date: Fri, 22 Aug 2008 11:55:33 +0000 Subject: - podpora split screenu v bigArenacha pri hre na jednom PC :) ( zatial teka technikca verzia ) git-svn-id: http://opensvn.csie.org/tuxanci_ng@238 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e --- src/client/layer.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 8 deletions(-) (limited to 'src/client/layer.c') diff --git a/src/client/layer.c b/src/client/layer.c index c0c9c03..5aa8124 100755 --- a/src/client/layer.c +++ b/src/client/layer.c @@ -110,19 +110,12 @@ void drawLayerCenter(int x, int y) int i; //int count = 0; - getCenterScreen(&screen_x, &screen_y, x, y); + getCenterScreen(&screen_x, &screen_y, x, y, WINDOW_SIZE_X, WINDOW_SIZE_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; - } -*/ if( this->x + this->w < screen_x || this->x > screen_x + WINDOW_SIZE_X || this->y + this->h < screen_y || this->y > screen_y + WINDOW_SIZE_Y ) { @@ -145,6 +138,55 @@ void drawLayerCenter(int x, int y) listLayer = newList(); } +void drawLayerSplit(int local_x, int local_y, int x, int y, int w, int h) +{ + layer_t *this; + int i; + //int count = 0; + + for( i = 0 ; i < listLayer->count ; i++ ) + { + this = (layer_t *)listLayer->list[i]; + + if( this->x + this->w < x || this->x > x + w || + this->y + this->h < y || this->y > y + h ) + { + continue; + } + + //count++; + + if( local_x + (this->x - x) < local_x ) + { + //this->x = local_x; + int z; + z = ( local_x + (this->x - x) + this->w ) - local_x; + z = local_x - ( local_x + (this->x - x) ); + + this->x += z; + this->px += z; + this->w -= z; + } + + if( local_x + (this->x - x) + this->w > local_x+w ) + { + this->w -= ( local_x + (this->x - x) + this->w ) - (local_x + w); + } + + drawImage(this->image, + local_x + (this->x - x), local_y + (this->y - y), + this->px, this->py, + this->w, this->h); + + //printf("%d %d\n", this->x - screen_x, this->y - screen_y); + } + + //printf("count = %d\n", count); + + destroyListItem(listLayer, free); + listLayer = newList(); +} + void flushLayer() { destroyListItem(listLayer, free); -- cgit v1.2.3