 |
CUGL 1.3
Cornell University Game Library
|
44 #ifndef __CU_NINEPATCH_H__
45 #define __CU_NINEPATCH_H__
48 #include <cugl/math/CURect.h>
49 #include <cugl/2d/CUNode.h>
50 #include <cugl/renderer/CUTexture.h>
51 #include <cugl/renderer/CUVertex.h>
52 #include <cugl/renderer/CUSpriteBatch.h>
95 #pragma mark Constructors
121 virtual void dispose()
override;
222 #pragma mark Static Constructors
233 static std::shared_ptr<NinePatch>
alloc() {
234 std::shared_ptr<NinePatch> node = std::make_shared<NinePatch>();
235 return (node->init() ? node :
nullptr);
253 static std::shared_ptr<NinePatch>
allocWithFile(
const std::string& filename) {
254 std::shared_ptr<NinePatch> node = std::make_shared<NinePatch>();
255 return (node->initWithFile(filename) ? node :
nullptr);
273 static std::shared_ptr<NinePatch>
allocWithFile(
const std::string& filename,
const Rect& interior) {
274 std::shared_ptr<NinePatch> node = std::make_shared<NinePatch>();
275 return (node->initWithFile(filename,interior) ? node :
nullptr);
289 static std::shared_ptr<NinePatch>
allocWithTexture(
const std::shared_ptr<Texture>& texture) {
290 std::shared_ptr<NinePatch> node = std::make_shared<NinePatch>();
291 return (node->initWithTexture(texture) ? node :
nullptr);
310 static std::shared_ptr<NinePatch>
allocWithTexture(
const std::shared_ptr<Texture>& texture,
311 const Rect& interior) {
312 std::shared_ptr<NinePatch> node = std::make_shared<NinePatch>();
313 return (node->initWithTexture(texture,interior) ? node :
nullptr);
336 const std::shared_ptr<JsonValue>& data) {
337 std::shared_ptr<NinePatch> result = std::make_shared<NinePatch>();
338 if (!result->initWithData(loader,data)) { result =
nullptr; }
339 return std::dynamic_pointer_cast<Node>(result);
344 #pragma mark Attributes
383 void setTexture(
const std::shared_ptr<Texture>& texture);
510 #pragma mark Rendering
534 virtual void draw(
const std::shared_ptr<SpriteBatch>& batch,
552 virtual std::string
toString(
bool verbose=
false)
const override;
555 #pragma mark Internal Helpers
Definition: CUNinePatch.h:70
std::shared_ptr< Texture > & getTexture()
Definition: CUNinePatch.h:390
Rect _interior
Definition: CUNinePatch.h:77
virtual bool initWithData(const SceneLoader *loader, const std::shared_ptr< JsonValue > &data) override
static std::shared_ptr< NinePatch > allocWithTexture(const std::shared_ptr< Texture > &texture)
Definition: CUNinePatch.h:289
static std::shared_ptr< NinePatch > alloc()
Definition: CUNinePatch.h:233
CU_DISALLOW_COPY_AND_ASSIGN(NinePatch)
GLenum getDestinationBlendFactor() const
Definition: CUNinePatch.h:475
static const std::shared_ptr< Texture > & getBlankTexture()
GLenum _srcFactor
Definition: CUNinePatch.h:89
Definition: CUColor4.h:1084
virtual std::string toString(bool verbose=false) const override
GLenum _dstFactor
Definition: CUNinePatch.h:91
std::vector< Vertex2 > _vertices
Definition: CUNinePatch.h:82
unsigned short generatePatch(const Rect &src, const Rect &dst, unsigned short offset)
bool _rendered
Definition: CUNinePatch.h:80
static std::shared_ptr< NinePatch > allocWithFile(const std::string &filename, const Rect &interior)
Definition: CUNinePatch.h:273
void setBlendFunc(GLenum srcFactor, GLenum dstFactor)
Definition: CUNinePatch.h:447
Definition: CUSceneLoader.h:77
void setBlendEquation(GLenum equation)
Definition: CUNinePatch.h:492
virtual bool init() override
Definition: CUNinePatch.h:133
bool initWithTexture(const std::shared_ptr< Texture > &texture)
const std::shared_ptr< Texture > & getTexture() const
Definition: CUNinePatch.h:397
static std::shared_ptr< NinePatch > allocWithFile(const std::string &filename)
Definition: CUNinePatch.h:253
virtual void generateRenderData()
virtual void draw(const std::shared_ptr< SpriteBatch > &batch, const Mat4 &transform, Color4 tint) override
bool initWithFile(const std::string &filename)
void setTexture(const std::string &filename)
Definition: CUNinePatch.h:369
void setInterior(const Rect &interior)
GLenum getBlendEquation() const
Definition: CUNinePatch.h:506
GLenum _blendEquation
Definition: CUNinePatch.h:87
virtual void dispose() override
static std::shared_ptr< Texture > allocWithFile(const std::string &filename)
Definition: CUTexture.h:269
static std::shared_ptr< NinePatch > allocWithTexture(const std::shared_ptr< Texture > &texture, const Rect &interior)
Definition: CUNinePatch.h:310
~NinePatch()
Definition: CUNinePatch.h:110
std::shared_ptr< Texture > _texture
Definition: CUNinePatch.h:74
virtual void setContentSize(const Size &size) override
void refresh()
Definition: CUNinePatch.h:540
GLenum getSourceBlendFactor() const
Definition: CUNinePatch.h:461
std::vector< unsigned short > _indices
Definition: CUNinePatch.h:84
static std::shared_ptr< Node > allocWithData(const SceneLoader *loader, const std::shared_ptr< JsonValue > &data)
Definition: CUNinePatch.h:335
const Rect & getInterior() const
Definition: CUNinePatch.h:427