0 Members and 1 Guest are viewing this topic.
ge::Menu::Menu(std::string bg_path){ m_bg = new sf::Sprite; std::cout << "receive addr " << ge::ResourceManager::getInstance()->getImage(bg_path) << std::endl; sf::Image &test = *ge::ResourceManager::getInstance()->getImage(bg_path); m_bg->SetImage(test);}
sf::Image* ge::ResourceManager::getImage(std::string path){ Item *it; if ((it = search(IMAGE, path))) { return (sf::Image*)(it->ptr); } sf::Image img; if (img.LoadFromFile(path)) { sf::Image *i = (sf::Image*)insert(&img, IMAGE, path)->ptr; std::cout << "Create image at addr " << i << std::endl; return i; } return NULL;}
Create image at addr 0x28fb40receive addr 0x28fb40cast addr 0x28fb40
struct Item{ void *ptr; std::string name; enum Type type; struct Item *next;};
Code: [Select]sf::Image *i = (sf::Image*)insert(&img, IMAGE, path)->ptr;
sf::Image *i = (sf::Image*)insert(&img, IMAGE, path)->ptr;