]> Dogcows Code - chaz/yoink/blobdiff - src/moof/sprite.hh
converted image management to resource handles
[chaz/yoink] / src / moof / sprite.hh
diff --git a/src/moof/sprite.hh b/src/moof/sprite.hh
new file mode 100644 (file)
index 0000000..3cee872
--- /dev/null
@@ -0,0 +1,57 @@
+
+/*]  Copyright (c) 2009-2010, 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.
+*
+**************************************************************************/
+
+#ifndef _MOOF_SPRITE_HH_
+#define _MOOF_SPRITE_HH_
+
+/**
+ * \file sprite.hh
+ * Image-loading and OpenGL texture loading.
+ */
+
+#include <string>
+
+#include <moof/image.hh>
+#include <moof/math.hh>
+
+
+namespace moof {
+
+
+class sprite
+{
+public:
+
+       sprite() {}
+       explicit sprite(const std::string& path, int tile = image::no_tile);
+       explicit sprite(const image_handle& image, int tile = image::no_tile);
+       explicit sprite(const sprite& sprite, int tile = image::no_tile);
+
+       void image(const std::string& path);
+       void tile(int tile);
+
+       void bind() const;
+       static void reset_binding();
+
+       void draw(const vector3 vertices[4]) const;
+
+
+private:
+
+       image_handle    image_;
+       scalar                  tile_[8];
+};
+
+
+} // namespace moof
+
+#endif // _MOOF_SPRITE_HH_
+
This page took 0.024216 seconds and 4 git commands to generate.