void Render( wsTWindow * window,wItem * Items,int nrItems,char * db,int size ) { wItem * item; txSample * image = NULL; int i; image_buffer=db; image_width=window->Width; for( i=0;i < nrItems + 1;i++ ) { item=&Items[i]; switch( item->type ) { case itButton: PutImage( &item->Bitmap,item->x,item->y,3,item->pressed ); break; case itPotmeter: if (item->phases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f ); else PutImage( &item->Bitmap,item->x,item->y,item->phases,( item->phases - 1 ) * ( item->value / 100.0f ) ); break; case itHPotmeter: if (item->phases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f ); else PutImage( &item->Bitmap,item->x,item->y,item->phases,( item->phases - 1 ) * ( item->value / 100.0f ) ); PutImage( &item->Mask,item->x + (int)( ( item->width - item->psx ) * item->value / 100.0f ),item->y,3,item->pressed ); break; case itVPotmeter: PutImage( &item->Bitmap, item->x,item->y, item->phases, item->phases * ( 1. - item->value / 100.0f ) ); PutImage( &item->Mask, item->x,item->y + (int)( ( item->height - item->psy ) * ( 1. - item->value / 100.0f ) ), 3,item->pressed ); break; case itSLabel: image=fntRender( item,0,"%s",item->label ); if ( image ) PutImage( image,item->x,item->y,1,0 ); case itDLabel: { char * t = Translate( item->label ); int l = fntTextWidth( item->fontid,t ); l=(l?l:item->width); image=fntRender( item,l-(GetTimerMS() / 20)%l,"%s",t ); } if ( image ) PutImage( image,item->x,item->y,1,0 ); break; } } wsConvert( window,db,size ); }
void RenderAll(wsTWindow *window, wItem *Items, int nrItems, char *db) { wItem *item; guiImage *image = NULL; int i, ofs; image_buffer = db; image_width = window->Width; for (i = 0; i < nrItems + 1; i++) { item = &Items[i]; switch (item->pressed) { case btnPressed: ofs = 0; break; case btnReleased: ofs = 1; break; default: ofs = 2; break; } switch (item->type) { case itButton: PutImage(&item->Bitmap, item->x, item->y, 3, ofs); break; case itPotmeter: if (item->numphases == 1) SimplePotmeterPutImage(&item->Bitmap, item->x, item->y, item->value / 100.0); else PutImage(&item->Bitmap, item->x, item->y, item->numphases, (item->numphases - 1) * (item->value / 100.0)); break; case itHPotmeter: if (item->numphases == 1) SimplePotmeterPutImage(&item->Bitmap, item->x, item->y, item->value / 100.0); else PutImage(&item->Bitmap, item->x, item->y, item->numphases, (item->numphases - 1) * (item->value / 100.0)); PutImage(&item->Mask, item->x + (item->width - item->pwidth) * (item->value / 100.0), item->y, 3, ofs); break; case itVPotmeter: PutImage(&item->Bitmap, item->x, item->y, item->numphases, item->numphases * (1.0 - item->value / 100.0)); PutImage(&item->Mask, item->x, item->y + (item->height - item->pheight) * (1.0 - item->value / 100.0), 3, ofs); break; case itSLabel: if (item->width == -1) item->width = fntTextWidth(item->fontid, item->label); image = fntRender(item, 0, item->label); if (image) PutImage(image, item->x, item->y, 1, 0); break; case itDLabel: { int x; unsigned int d; char *t = Translate(item->label); if (!item->text || (strcmp(item->text, t) != 0)) { free(item->text); item->text = strdup(t); item->textwidth = fntTextWidth(item->fontid, t); item->starttime = GetTimerMS(); item->last_x = 0; } d = GetTimerMS() - item->starttime; if (d < DLABEL_DELAY) x = item->last_x; // don't scroll yet else { int l; char c[2]; l = (item->textwidth ? item->textwidth : item->width); x = l - ((d - DLABEL_DELAY) / 20) % l - 1; c[0] = *item->text; c[1] = '\0'; if (x < (fntTextWidth(item->fontid, c) + 1) >> 1) { item->starttime = GetTimerMS(); // stop again item->last_x = x; // at current x pos } } image = fntRender(item, x, t); } if (image) PutImage(image, item->x, item->y, 1, 0); break; } } wsConvert(window, db); }