X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fresources.cpp;h=35af009697647a8a2900718b46728ff3a0c8e2c3;hb=c2635c5a3dca6a6cea5562fd387beb0662b18cf0;hp=650140ba4552f59b066f00cc5677b5d34dfd9734;hpb=d7ae291415a21cc886fe318070b41ac8d3e57a30;p=libs%2Fgltk.git diff --git a/source/resources.cpp b/source/resources.cpp index 650140b..35af009 100644 --- a/source/resources.cpp +++ b/source/resources.cpp @@ -1,3 +1,10 @@ +/* $Id$ + +This file is part of libmspgltk +Copyright © 2007 Mikko Rasa, Mikkosoft Productions +Distributed under the LGPL +*/ + #include #include "resources.h" @@ -34,14 +41,16 @@ const GL::Font &Resources::get_default_font() const GL::Font *Resources::create_font(const string &name) { RefPtr fnt=new GL::Font; - DataFile::load(*fnt, (path/(name+".font")).str()); + DataFile::load(*fnt, (path/(name+".font")).str(), *this); + if(!default_font) + default_font=fnt.get(); return fnt.release(); } GL::Texture2D *Resources::create_texture(const string &name) { RefPtr tex=new GL::Texture2D; - tex->image((path/(name+".png")).str()); + tex->load_image((path/(name+".png")).str()); tex->set_min_filter(GL::LINEAR); return tex.release(); } @@ -51,9 +60,15 @@ Resources::Loader::Loader(Resources &r): Collection::Loader(r), res(r) { + add("default_font", &Loader::default_font); add("font", &Loader::font); } +void Resources::Loader::default_font(const string &name) +{ + res.default_font=res.get(name); +} + void Resources::Loader::font(const string &name) { RefPtr fnt=new GL::Font;