Mercurial > fife-parpg
comparison engine/core/video/image_location.cpp @ 150:6e7d228def30
Lazy loading for animations.
Uses a Resource-Pointer class that behaves like
a pointer to an IResource, but only loads the
resource on demand.
There's a slight change of API, which is already
adapted to in the XML loaders. If you use
Animation.addFrame directly, either adapt to the
change or wait a few hours for a backwards compatibility
solution.
author | phoku@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sat, 11 Oct 2008 12:03:59 +0000 |
parents | fb6ccb367dd1 |
children | 376b8afc9a18 |
comparison
equal
deleted
inserted
replaced
149:823544621b5b | 150:6e7d228def30 |
---|---|
39 m_parent_image(NULL) { | 39 m_parent_image(NULL) { |
40 m_type = RES_TYPE_IMAGE; | 40 m_type = RES_TYPE_IMAGE; |
41 } | 41 } |
42 | 42 |
43 bool ImageLocation::operator ==(const ResourceLocation& loc) const { | 43 bool ImageLocation::operator ==(const ResourceLocation& loc) const { |
44 if (!ResourceLocation::operator==(loc)) { | 44 if( m_type != loc.getType() ) |
45 return false; | 45 return false; |
46 } | 46 |
47 const ImageLocation* r = dynamic_cast<const ImageLocation*>(&loc); | 47 const ImageLocation* r = dynamic_cast<const ImageLocation*>(&loc); |
48 if (!r) { | 48 if (!r) { |
49 return false; | 49 return false; |
50 } | 50 } |
51 | 51 |
62 return false; | 62 return false; |
63 } | 63 } |
64 if (m_parent_image != r->m_parent_image) { | 64 if (m_parent_image != r->m_parent_image) { |
65 return false; | 65 return false; |
66 } | 66 } |
67 if( getFilename() != loc.getFilename() ) | |
68 return false; | |
67 return true; | 69 return true; |
68 } | 70 } |
69 | 71 |
70 bool ImageLocation::operator <(const ResourceLocation& loc) const { | 72 bool ImageLocation::operator <(const ResourceLocation& loc) const { |
71 if( m_type < loc.getType() ) | 73 if( m_type < loc.getType() ) |