Ejemplo n.º 1
0
static int	display_manufacture_handler(window_info *win)
{
	Uint8 str[80];
	int i;

	// keep the main and recipe windows opacity in sync
	if (recipe_win >= 0)
	{
		static int last_recipes_opaque = -1, last_main_opaque = -1;
		if (win->opaque != last_main_opaque)
			last_recipes_opaque = last_main_opaque = windows_list.window[recipe_win].opaque = win->opaque;
		else if (windows_list.window[recipe_win].opaque != last_recipes_opaque)
			last_recipes_opaque = last_main_opaque = win->opaque = windows_list.window[recipe_win].opaque;
	}

	glColor3f(0.77f,0.57f,0.39f);
	glEnable(GL_TEXTURE_2D);

	glColor3f(1.0f,1.0f,1.0f);
	//ok, now let's draw the objects...
	for(i=35;i>=0;i--){
		if(manufacture_list[i].quantity > 0) {
			int x_start,y_start;
			int use_large = (mouse_over_main_pos == i) && enlarge_text();

			//get the x and y
			x_start=SLOT_SIZE*(i%GRID_COLS)+1;
			y_start=SLOT_SIZE*(i/GRID_COLS);

			draw_item(manufacture_list[i].image_id,x_start,y_start,SLOT_SIZE);

			safe_snprintf((char *)str, sizeof(str), "%i",manufacture_list[i].quantity);
			y_start += (i&1) ? 2 : SLOT_SIZE - ((use_large) ?win->default_font_len_y :win->small_font_len_y);
			if (use_large)
				draw_string_shadowed_zoomed(x_start, y_start, (unsigned char*)str, 1, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, win->current_scale);
			else
				draw_string_small_shadowed_zoomed(x_start, y_start, (unsigned char*)str, 1, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, win->current_scale);
		}
	}

	//ok, now let's draw the mixed objects
	draw_production_pipe(win, pipeline_x,manufacture_menu_y_len-recipe_y_offset, -1);

	//now, draw the inventory text, if any.
	if (last_items_string_id != inventory_item_string_id)
	{
		put_small_text_in_box_zoomed((unsigned char*)inventory_item_string, strlen(inventory_item_string), win->len_x-2*win->small_font_len_x, items_string, win->current_scale);
		last_items_string_id = inventory_item_string_id;
	}
	draw_string_small_zoomed(win->small_font_len_x,manufacture_menu_y_len-text_y_offset,(unsigned char *)items_string,4, win->current_scale);

	// Render the grid *after* the images. It seems impossible to code
	// it such that images are rendered exactly within the boxes on all
	// cards
	glDisable(GL_TEXTURE_2D);
	glColor3f(0.77f,0.57f,0.39f);

	//draw the grid
	rendergrid(GRID_COLS, GRID_ROWS, 0, 0, SLOT_SIZE, SLOT_SIZE);

	//Draw recipe control buttons
	draw_recipe_controls(win);
	glEnable(GL_TEXTURE_2D);

	mouse_over_main_pos = -1;
	mouse_over_pipe_pos = -1;

#ifdef OPENGL_TRACE
CHECK_GL_ERRORS();
#endif //OPENGL_TRACE
	return 1;
}
Ejemplo n.º 2
0
int	display_manufacture_handler(window_info *win)
{
	Uint8 str[80];
	int i;

	//dirty hack for opacity
	//if manufacture_win is opaque then recipe_win should be and viceversa
	if (recipes_shown) win->opaque=windows_list.window[recipe_win].opaque;
	else windows_list.window[recipe_win].opaque=win->opaque;	

	glColor3f(0.77f,0.57f,0.39f);
	glEnable(GL_TEXTURE_2D);

	glColor3f(1.0f,1.0f,1.0f);
	//ok, now let's draw the objects...
	for(i=35;i>=0;i--){
		if(manufacture_list[i].quantity > 0) {
			int x_start,y_start;

			//get the x and y
			x_start=33*(i%12)+1;
			y_start=33*(i/12);

			draw_item(manufacture_list[i].image_id,x_start,y_start,33);
			
			safe_snprintf((char *)str, sizeof(str), "%i",manufacture_list[i].quantity);
			draw_string_small_shadowed(x_start, (i&1)?(y_start+17):(y_start+7), (unsigned char*)str, 1,1.0f,1.0f,1.0f, 0.0f, 0.0f, 0.0f);
		}
	}

	//ok, now let's draw the mixed objects
	draw_production_pipe(2,manufacture_menu_y_len-37, -1);

	//now, draw the inventory text, if any.
	if (last_items_string_id != inventory_item_string_id)
	{		
		put_small_text_in_box((unsigned char*)inventory_item_string, strlen(inventory_item_string), win->len_x-8, items_string);
		last_items_string_id = inventory_item_string_id;
	}
	draw_string_small(4,manufacture_menu_y_len-85,(unsigned char *)items_string,4);

	// Render the grid *after* the images. It seems impossible to code
	// it such that images are rendered exactly within the boxes on all 
	// cards
	glDisable(GL_TEXTURE_2D);
	glColor3f(0.77f,0.57f,0.39f);
	
	//draw the grid
	rendergrid(12,3,0,0,33,33);
	
	//Draw the bottom grid - NOT NEEDED, DONE IN draw_production_pipe
	//rendergrid(6,1,0, manufacture_menu_y_len-37, 33, 33);

	//Draw recipe control buttons
	draw_recipe_controls();
	glEnable(GL_TEXTURE_2D);

#ifdef OPENGL_TRACE
CHECK_GL_ERRORS();
#endif //OPENGL_TRACE
	return 1;
}