Esempio n. 1
0
    Image::Image(const std::string filelocation, float x, float y, float width, float height) {
        this->x = x;
        this->y = y;
        this->_width = width;
        this->_height = height;
        isImage = true;

        ImageCache *imageCache = ImageCache::getInstance();

        if(!imageCache->isCached(filelocation)) {
            imageCache->insertIntoCache(filelocation, ImageLoader::createPNG(filelocation));
        }
        _imageItem = imageCache->getFromCache(filelocation);

        createRectangle();
    }
Esempio n. 2
0
    Particles::Particles(unsigned count, string texturename, Color color, float lifetime, float totalLifetime, float speed, Vector3 scale, Vector3 direction, float density, unsigned randomness) {
        this->count             = count;
        this->scale             = scale;
        this->direction         = direction;
        this->density           = density;
        this->lifetime          = lifetime;
        this->currentLifetime   = 0;
        this->totalLifetime     = totalLifetime;
        this->texture           = nullptr;
        this->color             = color;
        this->speed             = speed;
        this->randomness        = randomness + 1;
        this->randomnessHalf    = this->randomness / 2.0f;

        ImageCache *imagecache = ImageCache::getInstance();

        if(texturename != "") {
            if(!imagecache->isCached(texturename)) {
                imagecache->insertIntoCache(texturename, ImageLoader::createPNG(texturename));
            }

            this->texture = imagecache->getFromCache(texturename);
        }
    }