Exemplo n.º 1
0
void game_tile_draw( struct game_tile* tile, struct game_tile* dest, int step ) {
	GLfloat xfactor = ogl_xfactor();
	GLfloat alpha = 1.0;
	const struct config_game_sel *config = &config_get()->iface.theme.game_sel;
	
	if( tile && tile->game && tile->game->texture && dest ) {
		GLfloat width = (((GLfloat)tile->game->texture->width * tile_scale)/2) * xfactor;
		GLfloat height = (((GLfloat)tile->game->texture->height * tile_scale)/2) * xfactor;
		
		ogl_load_alterego();
		if( config->orientation == CONFIG_PORTRAIT ) {
			glTranslatef(
				(tile->pos[X] + config->offset1 + (((dest->pos[X]-tile->pos[X])/steps)*step)) * x_scale * xfactor,
				(tile->pos[Y] + config->offset2 + (((dest->pos[Y]-tile->pos[Y])/steps)*step)) * y_scale * xfactor,
				tile->pos[Z] + (((dest->pos[Z]-tile->pos[Z])/steps)*step) -5.0
				);
			glRotatef( tile->angle[X] + (((dest->angle[X]-tile->angle[X])/steps)*step), 1.0, 0.0, 0.0 );
			glRotatef( tile->angle[Y] + (((dest->angle[Y]-tile->angle[Y])/steps)*step), 0.0, 1.0, 0.0 );
			glRotatef( tile->angle[Z] + (((dest->angle[Z]-tile->angle[Z])/steps)*step), 0.0, 0.0, 1.0 );
		}
		else {
			glTranslatef(
				-((tile->pos[Y] + config->offset2 + (((dest->pos[Y]-tile->pos[Y])/steps)*step)) * x_scale * xfactor),
				-((tile->pos[X] + config->offset1 + (((dest->pos[X]-tile->pos[X])/steps)*step)) * y_scale * xfactor),
				tile->pos[Z] + (((dest->pos[Z]-tile->pos[Z])/steps)*step) -5.0
				);
			glRotatef( -(tile->angle[Y] + (((dest->angle[Y]-tile->angle[Y])/steps)*step)), 1.0, 0.0, 0.0 );
			glRotatef( -(tile->angle[X] + (((dest->angle[X]-tile->angle[X])/steps)*step)), 0.0, 1.0, 0.0 );
			glRotatef( -(tile->angle[Z] + (((dest->angle[Z]-tile->angle[Z])/steps)*step)), 0.0, 0.0, 1.0 );
		}
		if( zoom && tile == game_tile_current ) {
			glTranslatef( 0.0, 0.0, (steps-zoom)/5 );
			alpha = (tile->alpha/steps)*(zoom);
			zoom--;
		}
		else if( hide_direction != 0 ) {
			alpha = tile->alpha - (tile->alpha/(GLfloat)steps)*(GLfloat)(step+1);
		}
		else {
			alpha = tile->alpha + ((dest->alpha - tile->alpha)/steps) * step;
		}
		glColor4f( 1.0, 1.0, 1.0, alpha );
		glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
		glEnable(GL_TEXTURE_2D);
		glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
		glBindTexture( GL_TEXTURE_2D, tile->game->texture->id );
		glBegin( GL_QUADS );
			glTexCoord2f(0.0, 0.0); glVertex3f( -width,  height, 0.0);
			glTexCoord2f(0.0, 1.0); glVertex3f( -width, -height, 0.0);
			glTexCoord2f(1.0, 1.0); glVertex3f(  width,	-height, 0.0);
			glTexCoord2f(1.0, 0.0); glVertex3f(  width,  height, 0.0);		
		glEnd();
		glDisable(GL_TEXTURE_2D);
	}
}
Exemplo n.º 2
0
void bg_draw( void ) {
	if( bg_texture ) {
		ogl_load_alterego();
		glEnable( GL_TEXTURE_2D );
		glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
		glBindTexture( GL_TEXTURE_2D, bg_texture->id );
		glColor4f( 1.0, 1.0, 1.0, alpha );
		glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
		glRotatef( angle, 0.0, 0.0, 1.0 );
		glTranslatef( 0.0, 0.0, -10.0 );
		glBegin( GL_QUADS );
			glTexCoord2f(0.0, 0.0); glVertex3f( -BG_SIZE,  BG_SIZE, 0.0 );
			glTexCoord2f(0.0, 1.0); glVertex3f( -BG_SIZE, -BG_SIZE, 0.0 );
			glTexCoord2f(1.0, 1.0); glVertex3f(  BG_SIZE, -BG_SIZE, 0.0 );
			glTexCoord2f(1.0, 0.0); glVertex3f(  BG_SIZE,  BG_SIZE, 0.0 );
		glEnd();
		glDisable( GL_TEXTURE_2D );
		angle -= angle_step;
	}
}
Exemplo n.º 3
0
void snap_draw( void ) {
	const struct config_snap *config = &config_get()->iface.theme.snap;
	
	if( visible ) {
		struct texture *t = texture;
		GLfloat xfactor = ogl_xfactor();
		GLfloat yfactor = ogl_yfactor();
		GLfloat xsize, ysize, hide_offset;
		
		if( video )
			t = video_get_frame();
				
		if( t == NULL )
			t = noise[frame/noise_skip];
		
		xsize = (width/2) * scale * xfactor;
		ysize = (height/2) * scale * xfactor;
		
		hide_offset = (((hidden_offset - config->offset1) / (GLfloat)steps) * (GLfloat)step);

		ogl_load_alterego();
		if( hide_direction == -1 ) {
			if( config_get()->iface.theme.game_sel.orientation == CONFIG_PORTRAIT )
				glTranslatef( (hidden_offset - hide_offset) * xfactor, config->offset2 * yfactor, DEPTH );
			else
				glTranslatef( config->offset2 * xfactor, (hidden_offset - hide_offset) * yfactor, DEPTH );
		}
		else {
			if( config_get()->iface.theme.game_sel.orientation == CONFIG_PORTRAIT )
				glTranslatef( (config->offset1 + hide_offset) * xfactor, config->offset2 * yfactor, DEPTH );
			else
				glTranslatef( config->offset2 * xfactor, (config->offset1 + hide_offset) * yfactor, DEPTH );
		}
		glRotatef( config->angle_x, 1.0, 0.0, 0.0 );
		glRotatef( config->angle_y, 0.0, 1.0, 0.0 );
		glRotatef( config->angle_z, 0.0, 0.0, 1.0 );
		glColor4f( 1.0, 1.0, 1.0, 1.0 );
		glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
		glEnable(GL_TEXTURE_2D);
		glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
	
		glBindTexture( GL_TEXTURE_2D, t->id );		
		glBegin( GL_QUADS );
			glTexCoord2f(0.0, 0.0); glVertex3f(-xsize,  ysize, 0.0);
			glTexCoord2f(0.0, 1.0); glVertex3f(-xsize, -ysize, 0.0);
			glTexCoord2f(1.0, 1.0); glVertex3f( xsize, -ysize, 0.0);
			glTexCoord2f(1.0, 0.0); glVertex3f( xsize,  ysize, 0.0);	
		glEnd();

		if( config->platform_icons && platform_count() > 1 && platform_texture ) {
			GLfloat platform_xsize = platform_texture->width;
			GLfloat platform_ysize = platform_texture->height; 

			if( platform_xsize > platform_ysize ) {
				platform_ysize = platform_scale * platform_ysize/platform_xsize;
				platform_xsize = platform_scale;
			}
			else {
				platform_xsize = platform_scale * platform_xsize/platform_ysize;
				platform_ysize = platform_scale;
			}

			glTranslatef( xsize * 0.8, -ysize * 0.9, 0.1 );
			glRotatef( -config->angle_z, 0.0, 0.0, 1.0 );
			glBindTexture( GL_TEXTURE_2D, platform_texture->id );
			glBegin( GL_QUADS );
				glTexCoord2f(0.0, 0.0); glVertex3f(-platform_xsize,  platform_ysize, 0.0);
				glTexCoord2f(0.0, 1.0); glVertex3f(-platform_xsize, -platform_ysize, 0.0);
				glTexCoord2f(1.0, 1.0); glVertex3f( platform_xsize, -platform_ysize, 0.0);
				glTexCoord2f(1.0, 0.0); glVertex3f( platform_xsize,  platform_ysize, 0.0);	
			glEnd();
		}
		
		if( ++frame >= NUM_NOISE * noise_skip )
			frame = 0;
			
		if( step && --step == 0 ) {
			if( hide_direction < 0 ) {
				visible = 0;
				snap_clear();
			}
			else {
				visible = 1;
			}
			hide_direction = 0;
		}
	}
}