mirror of
https://github.com/edubart/otclient.git
synced 2025-10-19 05:53:26 +02:00
Rework stdext classes
Implement new classes: * stdext::any => ligher replacement for boost::any * stdext::packed_any => like any but optimized to use less memory * stdext::shared_object => ligher replacement for std::shared_ptr * stdext::shared_object_ptr => replacement for boost::intrusive_ptr * stdext::fast_storage => for storing dynamic data * stdext::packed_storage => same but with less memory * stdext::packed_vector => std::vector with less memory Compiling should be a little faster now because global boost including is not needed anymore
This commit is contained in:
@@ -34,7 +34,7 @@ public:
|
||||
void enableBilinearFilter();
|
||||
void processAnimation();
|
||||
|
||||
AnimatedTexturePtr asAnimatedTexture() { return self_cast<AnimatedTexture>(); }
|
||||
AnimatedTexturePtr asAnimatedTexture() { return static_self_cast<AnimatedTexture>(); }
|
||||
|
||||
private:
|
||||
std::vector<uint> m_framesTextureId;
|
||||
|
@@ -44,21 +44,21 @@ class ParticleSystem;
|
||||
class ParticleEffect;
|
||||
class ParticleEffectType;
|
||||
|
||||
typedef boost::intrusive_ptr<Image> ImagePtr;
|
||||
typedef boost::intrusive_ptr<Texture> TexturePtr;
|
||||
typedef boost::intrusive_ptr<AnimatedTexture> AnimatedTexturePtr;
|
||||
typedef boost::intrusive_ptr<BitmapFont> BitmapFontPtr;
|
||||
typedef boost::intrusive_ptr<CachedText> CachedTextPtr;
|
||||
typedef boost::intrusive_ptr<FrameBuffer> FrameBufferPtr;
|
||||
typedef boost::intrusive_ptr<Shader> ShaderPtr;
|
||||
typedef boost::intrusive_ptr<ShaderProgram> ShaderProgramPtr;
|
||||
typedef boost::intrusive_ptr<PainterShaderProgram> PainterShaderProgramPtr;
|
||||
typedef boost::intrusive_ptr<Particle> ParticlePtr;
|
||||
typedef boost::intrusive_ptr<ParticleEmitter> ParticleEmitterPtr;
|
||||
typedef boost::intrusive_ptr<ParticleAffector> ParticleAffectorPtr;
|
||||
typedef boost::intrusive_ptr<ParticleSystem> ParticleSystemPtr;
|
||||
typedef boost::intrusive_ptr<ParticleEffect> ParticleEffectPtr;
|
||||
typedef boost::intrusive_ptr<ParticleEffectType> ParticleEffectTypePtr;
|
||||
typedef stdext::shared_object_ptr<Image> ImagePtr;
|
||||
typedef stdext::shared_object_ptr<Texture> TexturePtr;
|
||||
typedef stdext::shared_object_ptr<AnimatedTexture> AnimatedTexturePtr;
|
||||
typedef stdext::shared_object_ptr<BitmapFont> BitmapFontPtr;
|
||||
typedef stdext::shared_object_ptr<CachedText> CachedTextPtr;
|
||||
typedef stdext::shared_object_ptr<FrameBuffer> FrameBufferPtr;
|
||||
typedef stdext::shared_object_ptr<Shader> ShaderPtr;
|
||||
typedef stdext::shared_object_ptr<ShaderProgram> ShaderProgramPtr;
|
||||
typedef stdext::shared_object_ptr<PainterShaderProgram> PainterShaderProgramPtr;
|
||||
typedef stdext::shared_object_ptr<Particle> ParticlePtr;
|
||||
typedef stdext::shared_object_ptr<ParticleEmitter> ParticleEmitterPtr;
|
||||
typedef stdext::shared_object_ptr<ParticleAffector> ParticleAffectorPtr;
|
||||
typedef stdext::shared_object_ptr<ParticleSystem> ParticleSystemPtr;
|
||||
typedef stdext::shared_object_ptr<ParticleEffect> ParticleEffectPtr;
|
||||
typedef stdext::shared_object_ptr<ParticleEffectType> ParticleEffectTypePtr;
|
||||
typedef std::vector<ShaderPtr> ShaderList;
|
||||
|
||||
#endif
|
||||
|
@@ -48,7 +48,7 @@ void FontManager::clearFonts()
|
||||
bool FontManager::importFont(std::string fontFile)
|
||||
{
|
||||
try {
|
||||
if(!boost::ends_with(fontFile, ".otfont"))
|
||||
if(!stdext::ends_with(fontFile, ".otfont"))
|
||||
fontFile += ".otfont";
|
||||
|
||||
OTMLDocumentPtr doc = OTMLDocument::parse(fontFile);
|
||||
|
@@ -40,7 +40,7 @@ ImagePtr Image::load(const std::string& file)
|
||||
ImagePtr image;
|
||||
try {
|
||||
// currently only png images are supported
|
||||
if(!boost::ends_with(file, ".png"))
|
||||
if(!stdext::ends_with(file, ".png"))
|
||||
stdext::throw_exception("image file format no supported");
|
||||
|
||||
// load image file data
|
||||
|
@@ -84,7 +84,7 @@ void ParticleSystem::update()
|
||||
return;
|
||||
m_lastUpdateTime = g_clock.seconds() - std::fmod(elapsedTime, delay);
|
||||
|
||||
auto self = self_cast<ParticleSystem>();
|
||||
auto self = static_self_cast<ParticleSystem>();
|
||||
for(int i = 0; i < elapsedTime / delay; ++i) {
|
||||
|
||||
// update emitters
|
||||
|
@@ -63,7 +63,7 @@ TexturePtr TextureManager::getTexture(const std::string& fileName)
|
||||
if(!texture) {
|
||||
try {
|
||||
// currently only png textures are supported
|
||||
if(!boost::ends_with(filePath, ".png"))
|
||||
if(!stdext::ends_with(filePath, ".png"))
|
||||
stdext::throw_exception("texture file format no supported");
|
||||
|
||||
// load texture file data
|
||||
|
Reference in New Issue
Block a user