std::string ResourceManager::find(std::string filename) {
	FilePath fp = paths.find(filename);
	std::string result = fp.filepath();
	if (result == "") {
		AL_WARN("al::ResourceManager: could not find: %s", filename.c_str());
		return "";
	} else {
		return result;
	}

}
int main (int argc, char * const argv[]) {
	searchpaths.addAppPaths(argc, argv);
	searchpaths.addSearchPath(searchpaths.appPath() + "../../share");
	searchpaths.print();

	// load in a "scene"
	FilePath path = searchpaths.find("ducky.obj");
	printf("reading %s\n", path.filepath().c_str());

	ascene = Scene::import(path.filepath());
	if (ascene==0) {
		printf("error reading %s\n", path.filepath().c_str());
		return -1;
	} else {
		ascene->getBounds(scene_min,scene_max);
		scene_center = (scene_min + scene_max) / 2.f;
		ascene->dump();
	}
	File frag_file(searchpaths.find("basicFragment.glsl"), "r", true);
	File vert_file(searchpaths.find("basicVertex.glsl"), "r", true);

	printf("frag_file %s\n", frag_file.path().c_str());
	printf("vert_file %s\n", vert_file.path().c_str());

	frag.source(frag_file.readAll(), Shader::FRAGMENT);
	vert.source(vert_file.readAll(), Shader::VERTEX);

	win1.add(new StandardWindowKeyControls);
	win1.create(Window::Dim(640, 480));

	Image img(searchpaths.find("hubble.jpg").filepath());
	tex.allocate(img.array());

	MainLoop::start();

	return 0;
}
  MyApp() {
    // search for the font in the root directory
    // in this case, our font lives here: allocore/share/fonts/
    SearchPaths searchPaths;
    searchPaths.addSearchPath(".");
    FilePath filePath = searchPaths.find("VeraMoIt.ttf");
    if (!filePath.valid()) {
      cerr << "Font file not found! Exiting..." << endl;
      exit(1);
    }
    font = new Font(filePath.filepath(), 20);

    mesh.primitive(Graphics::TRIANGLES);
    addSphere(mesh, 1.0, 32, 32);
  }
Exemplo n.º 4
0
File::File(const FilePath& path, const std::string& mode, bool open_)
:	mImpl(new Impl()), 
	mPath(path.filepath()), mMode(mode), mContent(0), mSizeBytes(0), mFP(0)
{	if(open_) open(); }
	void watch(FilePath f, bool immediate=true) { watch(f.filepath(), immediate); }