Beispiel #1
0
	void ColoredImageCanvas::serialize(ContentSerializer &serializer)
	{
		serializer.write_object<Content>();
		serializer.write_list(object_table.table.get_entries());
		
		for(ObjectListHash::Table::Iterator i = object_table.table.begin(); i != object_table.table.end(); ++i)
		{
			ObjectList *list = *i;
			ContentEntry &entry = serializer.write_object<ContentEntry>();

			entry.texture = list->key->texture;
			entry.indices = list->size * 6;
			
			GLshort *vertex_map = entry.vertex_buffer.setup(entry.indices * 2);
			GLubyte *color_map = entry.color_buffer.setup(entry.indices * 4);
			GLfloat *coords_map = entry.coords_buffer.setup(entry.indices * 2);
			
			for(ObjectList::Iterator j = list->begin(); j != list->end(); ++j)
			{
				Object *object = *j;

				vertex_map = buffer_quad(vertex_map, object->x, object->y, object->width, object->height);
			
				color_map = buffer_color(color_map, object->color);
				color_map = buffer_color(color_map, object->color);
				color_map = buffer_color(color_map, object->color);

				color_map = buffer_color(color_map, object->color);
				color_map = buffer_color(color_map, object->color);
				color_map = buffer_color(color_map, object->color);

				coords_map = buffer_coords(coords_map, object->atlas_entry->x, object->atlas_entry->y, object->atlas_entry->x2, object->atlas_entry->y2);
			}

			entry.vertex_buffer.unmap();
			entry.color_buffer.unmap();
			entry.coords_buffer.unmap();
		}
	}
std::vector<std::string> AttributeContainer::PrettyVectorColored()
{
    std::string result = "";
    std::vector<std::string> string_vec;

    TCODColor health_color = HealthAttribute::attribute_color;
    TCODColor mana_color = ManaAttribute::attribute_color;
    TCODColor armor_color = ArmorAttribute::attribute_color;
    TCODColor damage_color = DamageAttribute::attribute_color;
    TCODColor speed_color = SpeedAttribute::attribute_color;

    string_vec.push_back(buffer_color("HCV", this->health->current_val, health_color));
    string_vec.push_back(buffer_color("HMV", this->health->max_val, health_color));
    string_vec.push_back(buffer_color("HRR", this->health->regen_rate, health_color));
    string_vec.push_back(buffer_color("HRI", this->health->regen_interval, health_color));

    string_vec.push_back(buffer_color("MCV", this->mana->current_val, mana_color));
    string_vec.push_back(buffer_color("MMV", this->mana->max_val, mana_color));
    string_vec.push_back(buffer_color("MRR", this->mana->regen_rate, mana_color));
    string_vec.push_back(buffer_color("MRI", this->mana->regen_interval, mana_color));

    string_vec.push_back(buffer_color("ACV", this->armor->current_val, armor_color));
    string_vec.push_back(buffer_color("AMV", this->armor->max_val, armor_color));
    string_vec.push_back(buffer_color("ARR", this->armor->regen_rate, armor_color));
    string_vec.push_back(buffer_color("ARI", this->armor->regen_interval, armor_color));

    string_vec.push_back(buffer_color("DCV", this->get_effective_damage()->get_raw_total(), damage_color));
    string_vec.push_back(buffer_color("DMV", this->damage->max_val, damage_color));
    string_vec.push_back(buffer_color("DRR", this->damage->regen_rate, damage_color));
    string_vec.push_back(buffer_color("DRI", this->damage->regen_interval, damage_color));

    string_vec.push_back(buffer_color("SCV", this->speed->current_val, speed_color));
    string_vec.push_back(buffer_color("SMV", this->speed->max_val, speed_color));
    string_vec.push_back(buffer_color("SRR", this->speed->regen_rate, speed_color));
    string_vec.push_back(buffer_color("SRI", this->speed->regen_interval, speed_color));

    return string_vec;
};