Jump to content

chunkyguy

Members
  • Posts

    2
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://whackylabs.com

Profile Information

  • Location
    India

chunkyguy's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Awesome. :) Please send me the tweaks if you think they apply to others, too. Basically, the tweak is just to change the way we load resources, as the Mac apps have this sandboxing system where all the assests are within that sandbox. I guess everyone who uses SFML on mac knows about it. We just need to modify two methods: //main.cpp int main(int argc, char* argv[]) { if(!init(800, 600)) return 1; vector data_files; data_files.push_back(resourcePath() + "Example.SCML"); data_files.push_back(resourcePath() + "knight.scml"); data_files.push_back(resourcePath() + "Hero.SCML"); data_files.push_back(resourcePath() + "fish.scml"); main_loop(data_files); quit(); return 0; } //SCML_SFML.cpp bool FileSystem::loadImageFile(int folderID, int fileID, const std::string& filename) { sf::Texture* img = new sf::Texture; img->loadFromFile(resourcePath() + filename); if(img == NULL) return false; if(!SCML_MAP_INSERT(images, SCML_MAKE_PAIR(folderID, fileID), img)) { printf("SCML_SFML::FileSystem failed to load image: Loading %s duplicates a folder/file id (%d/%d)\n", SCML_TO_CSTRING(filename), folderID, fileID); delete img; return false; } return true; } Here resourcePath() is available from the ResourcePath.hpp, that comes with SFML, and is also available on github And when adding the images and the .scml files to the project, keeping them with the .SCML file at the root level with other images added with 'Folder Type' reference. Such that the images are available at path: YourApp.app/Contents/Resources/mon_arms/hand_0_2.png For example, this is how my Xcode's Project Navigator looks like I hope this helps all the SFML Mac devs. If not, let me know, I'd be glad to help :)
  2. I was able to run your api on Mac using the SFML renderer after a little tweaking. Thanks!
×
×
  • Create New...