X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Fmoof%2Fsprite.cc;h=602fc2cbe4cfa6361f7629d7d7028f04114261a4;hp=7548ab0b8b7ae7b975b4f88bb1f66222240e241c;hb=44b3014bce798789e795242d1556cb7449e6386a;hpb=382626aad0a683ed8642a6a807eea743db45f7f8 diff --git a/src/moof/sprite.cc b/src/moof/sprite.cc index 7548ab0..602fc2c 100644 --- a/src/moof/sprite.cc +++ b/src/moof/sprite.cc @@ -1,13 +1,11 @@ -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +/*] Copyright (c) 2009-2011, Charles McGarvey [***************************** **] All rights reserved. * -* vi:ts=4 sw=4 tw=75 -* * Distributable under the terms and conditions of the 2-clause BSD license; * see the file COPYING for a complete text of the license. * -**************************************************************************/ +*****************************************************************************/ #include // FILE #include // strncmp @@ -16,6 +14,8 @@ #include #include +#include + #include "dispatcher.hh" #include "log.hh" #include "opengl.hh" @@ -25,16 +25,16 @@ namespace moof { -sprite::sprite(const std::string& path, int tile) +sprite::sprite(const std::string& name, int tile) { - image_ = resource::load(path); - image_->tile_coordinates(tile, tile_); + image(name); + sprite::tile(tile); } sprite::sprite(const image_handle& image, int tile) : image_(image) { - image_->tile_coordinates(tile, tile_); + sprite::tile(tile); } sprite::sprite(const sprite& sprite, int tile) @@ -43,11 +43,9 @@ sprite::sprite(const sprite& sprite, int tile) image_ = sprite.image_; } - -void sprite::image(const std::string& path) +void sprite::image(const std::string& name) { - image_ = resource::load(path); - // FIXME what about tiles? + image_ = resource::load(name, "png"); } void sprite::tile(int tile) @@ -55,7 +53,6 @@ void sprite::tile(int tile) if (image_) image_->tile_coordinates(tile, tile_); } - void sprite::bind() const { if (image_) image_->bind(); @@ -66,7 +63,6 @@ void sprite::reset_binding() image::reset_binding(); } - void sprite::draw(const vector3 vertices[4]) const { bind(); @@ -77,7 +73,6 @@ void sprite::draw(const vector3 vertices[4]) const glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } - /* void min_filter(GLuint filter) { @@ -107,7 +102,6 @@ void sprite::draw(const vector3 vertices[4]) const glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, mWrapT); } - bool sprite::tile_coordinates(int index, scalar coords[8], orientation orientation) const {