Exemplo n.º 1
0
void mapper_tile_ani_render(void)
{
	int i;
	float x, y;
	bool held = al_is_bitmap_drawing_held();

	if(mapper_tileset->tile[mapper_current_tile]->flags & T3F_TILE_FLAG_ANIMATED)
	{
		for(i = 0; i < mapper_tileset->tile[mapper_current_tile]->frame_list_total; i++)
		{
			x = (i % 20) * 32;
			y = (i / 20) * 32;
			t3f_draw_animation(mapper_tileset->tile[mapper_tileset->tile[mapper_current_tile]->frame_list[i]]->ap, t3f_color_white, mapper_tick, x, y, 0, 0);
			if(i == mapper_current_frame)
			{
				al_hold_bitmap_drawing(true);
				al_draw_rectangle(x + 0.5, y + 0.5, x + 31 + 0.5, y + 31 + 0.5, al_map_rgba_f(0.0, 1.0, 0.0, 1.0), 1.0);
				al_hold_bitmap_drawing(held);
			}
		}
	}
	else
	{
		t3f_draw_animation(mapper_tileset->tile[mapper_current_tile]->ap, t3f_color_white, mapper_tick, 0, 0, 0, 0);
	}
}
Exemplo n.º 2
0
void title_render(void)
{
	al_clear_to_color(al_map_rgba_f(0.0, 0.0, 0.0, 1.0));
	al_draw_textf(font[FONT_GAME], al_map_rgba_f(1.0, 1.0, 1.0, 1.0), 320, 0, ALLEGRO_ALIGN_CENTRE, "High Score: %06d", high_score);
	t3f_draw_animation(animation[ANIMATION_TITLE], al_map_rgba_f(1.0, 1.0, 1.0, 1.0), state_ticks, 320 - al_get_bitmap_width(animation[ANIMATION_TITLE]->bitmap[0]) / 2, 60, 0, 0);
	hyperlink_page_render(menu[current_menu]);
}
Exemplo n.º 3
0
void mapper_tilemap_render(void)
{
	int i;
	float lx, ty, scale;

	if(mapper_tilemap)
	{
		for(i = 0; i < mapper_tilemap->layers; i++)
		{
			if(!t3f_key[ALLEGRO_KEY_L] || i == mapper_current_layer)
			{
				t3f_render_tilemap(mapper_tilemap, mapper_tileset, i, mapper_tick, mapper_camera.x, mapper_camera.y, mapper_camera.z, t3f_color_white);
			}
		}
		al_hold_bitmap_drawing(false);
		if(!mapper_tilemap_hover_fail)
		{
			scale = mapper_tilemap->layer[mapper_current_layer]->scale;
			lx = mapper_tilemap_hover_x * mapper_tileset->width * scale + mapper_tilemap->layer[mapper_current_layer]->x - mapper_camera.x + 0.5;
			ty = mapper_tilemap_hover_y * mapper_tileset->height * scale + mapper_tilemap->layer[mapper_current_layer]->y - mapper_camera.y + 0.5;
			al_draw_rectangle(lx, ty, lx + (float)mapper_tileset->width * scale - 1.0 + 0.5, ty + (float)mapper_tileset->height * scale - 1.0 + 0.5, al_map_rgba_f(0.0, 1.0, 0.0, 0.5), 1.0);
		}
		t3f_draw_animation(mapper_tileset->tile[mapper_current_tile]->ap, al_map_rgba_f(1.0, 1.0, 1.0, 0.5), mapper_tick, t3f_mouse_x + 16, t3f_mouse_y + 16, 0, 0);
		al_draw_textf(mapper_font, t3f_color_white, 0, 416, 0, "Layer Position = (%4.2f, %4.2f, %4.2f)", mapper_tilemap->layer[mapper_current_layer]->x, mapper_tilemap->layer[mapper_current_layer]->y, mapper_tilemap->layer[mapper_current_layer]->z);
		al_draw_textf(mapper_font, t3f_color_white, 0, 432, 0, "Camera Position = (%4.2f, %4.2f, %4.2f)", mapper_camera.x, mapper_camera.y, mapper_camera.z);
		al_draw_textf(mapper_font, t3f_color_white, 0, 448, 0, "Current Layer = %d", mapper_current_layer);
		al_draw_textf(mapper_font, t3f_color_white, 0, 464, 0, "Current Tile = %d", mapper_current_tile);
	}
	else
	{
		al_draw_textf(mapper_font, t3f_color_white, 0, 0, 0, "Please create or load a tilemap.");
	}
}
Exemplo n.º 4
0
void mapper_tileset_render(void)
{
	int i;
	int prow;
	int row, col;

	if(mapper_tileset)
	{
		prow = (t3f_virtual_display_width / mapper_tileset->width);
		for(i = 0; i < mapper_tileset->tiles; i++)
		{
			row = i % prow;
			col = i / prow;
			t3f_draw_animation(mapper_tileset->tile[i]->ap, t3f_color_white, mapper_tick, row * mapper_tileset->width, col * mapper_tileset->height, 0, 0);
			if(i == mapper_hover_tile)
			{
				al_hold_bitmap_drawing(false);
				al_draw_rectangle(row * mapper_tileset->width + 0.5, col * mapper_tileset->height + 0.5, row * mapper_tileset->width + mapper_tileset->width - 1 + 0.5, col * mapper_tileset->height + mapper_tileset->height - 1 + 0.5, al_map_rgba_f(0.0, 1.0, 0.0, 0.5), 1.0);
				al_hold_bitmap_drawing(true);
			}
			if(i == mapper_tileset->tiles - 1)
			{
				al_hold_bitmap_drawing(false);
				al_draw_rectangle(row * mapper_tileset->width + 0.5, col * mapper_tileset->height + 0.5, row * mapper_tileset->width + mapper_tileset->width - 1 + 0.5, col * mapper_tileset->height + mapper_tileset->height - 1 + 0.5, al_map_rgba_f(1.0, 0.0, 0.0, 0.5), 1.0);
				al_hold_bitmap_drawing(true);
			}
			if(i == mapper_current_tile)
			{
				al_hold_bitmap_drawing(false);
				al_draw_rectangle(row * mapper_tileset->width + 0.5, col * mapper_tileset->height + 0.5, row * mapper_tileset->width + mapper_tileset->width - 1 + 0.5, col * mapper_tileset->height + mapper_tileset->height - 1 + 0.5, al_map_rgba_f(1.0, 1.0, 1.0, 0.5), 1.0);
				al_hold_bitmap_drawing(true);
			}
		}
	}
	else
	{
		al_draw_textf(mapper_font, t3f_color_white, 0, 0, 0, "Please create or load a tileset.");
	}
}
void powerup_render(void)
{
	int i;
	
	for(i = 0; i < GAME_MAX_POWERUPS; i++)
	{
		if(powerup[i].active)
		{
			switch(powerup[i].type)
			{
				case POWERUP_TYPE_SPIRIT:
				{
					t3f_draw_animation(animation[ANIMATION_SPIRIT], al_map_rgba_f(1.0, 1.0, 1.0, (float)powerup[i].var / 120.0), powerup[i].tick, powerup[i].x, powerup[i].y, 0, 0);
					break;
				}
				case POWERUP_TYPE_UPGRADE:
				{
					break;
				}
			}
		}
	}
}