CL_CollisionOutline::CL_CollisionOutline(const CL_StringRef &filename, const CL_VirtualDirectory &directory, int alpha_limit, CL_OutlineAccuracy accuracy, bool get_insides)
{
	CL_String file_extension = CL_PathHelp::get_extension(filename);

	CL_IODevice file = directory.open_file_read(filename);
	*this = CL_CollisionOutline(file, file_extension, alpha_limit, accuracy, get_insides);
}
void CL_CSSDocument_Impl::load(const CL_String &filename, const CL_VirtualDirectory &directory)
{
	CL_String path = CL_PathHelp::get_fullpath(filename, CL_PathHelp::path_type_file);

	// Load document into a buffer:

	CL_IODevice input = directory.open_file_read(filename);

	int size = input.get_size();
	if (size < 0)
		throw CL_Exception("IODevice does not support get_size()");
	CL_DataBuffer data(size);
	int bytes_read = input.read(data.get_data(), data.get_size());
	data.set_size(bytes_read);

	// Start parsing:

	unsigned char *data_ptr = (unsigned char *) data.get_data();
	whitespace_comments(data_ptr, bytes_read);

	int pos = 0;
	while (pos < bytes_read)
	{
		unsigned char ch = data_ptr[pos];
		switch (ch)
		{
		case ' ':
		case '\t':
		case '\r':
		case '\n':
			pos++;
			break;

		case '@': // import
			pos = load_import(data_ptr, pos, bytes_read, directory, path);
			break;

		default: // ruleset
			pos = load_ruleset(data_ptr, pos, bytes_read);
			break;
		}
	}
}
Esempio n. 3
0
void CL_GUIComponent::create_components(const CL_StringRef &filename, const CL_VirtualDirectory &dir)
{
	CL_IODevice device;
	device = dir.open_file_read(filename);
	create_components(device);
}
Esempio n. 4
0
CL_ShaderObject CL_ShaderObject::load(CL_GraphicContext &gc, CL_ShaderType shader_type, const CL_StringRef &filename, const CL_VirtualDirectory &directory)
{
	CL_IODevice file = directory.open_file_read(filename);
	return CL_ShaderObject::load(gc, shader_type, file);
}
void CL_FontProvider_Freetype::load_font(const CL_FontDescription &desc, const CL_VirtualDirectory &directory)
{
	CL_IODevice file = directory.open_file_read(desc.get_typeface_name());
	load_font(desc, file);
}
void CL_CollisionOutline::load(const CL_StringRef &filename, const CL_VirtualDirectory &directory)
{
	CL_IODevice file = directory.open_file_read(filename);
	load(file);
}
CL_OutlineProviderFile::CL_OutlineProviderFile(const CL_StringRef &filename, const CL_VirtualDirectory &directory)
{
	CL_IODevice file = directory.open_file_read(filename);
	impl = CL_SharedPtr<CL_OutlineProviderFile_Generic> (new CL_OutlineProviderFile_Generic( file ));
}