Results 1 to 2 of 2

Thread: ClanLib 0.8 PhysFS support

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2006
    New Zealand

    Default ClanLib 0.8 PhysFS support

    Here are some classes to provide PhysFS support to ClanLib 0.8.

    I'm switching to ClanLib 0.9 so I thought I'd better release this code while it might still be useful to someone.

    Look, a thing (get the release here):

    And an example (not tested, so it might not compile):
    #include <ClanLib/core.h>
    #include <ClanLib/application.h>
    #include "FusionPhysFS.h"
    // The standard PhysFS header
    #include "PhysFS.h"
    class PhysFSTest : public CL_ClanApplication
    virtual int main(int argc, char **argv)
    	CL_SetupCore setup_init;
    	SetupPhysFS physfs_setup(argv[0]);
    	CL_ConsoleWindow console("PhysFS Test");
    		// Configure physFS for this app
    		SetupPhysFS::configure("Organization", "App", "ZIP");
    		SetupPhysFS::add_subdirectory("Data/", "ZIP", true);
    		// Get an instance of the custom inputsource
    		InputSourceProvider_PhysFS phys_provider("");
    		// Load some stuff...
    		// .. The PhysFS way
    		//  (assuming there is a .zip file in 'Data/' which contains 'image_in_zip.png')
    		CL_PNGProvider phys_png("image_in_zip.png", &phys_provider);
    		CL_Surface surface(phys_png);
    		// ... The standard way
    		CL_PNGProvider png("image.png");
    		CL_Surface surface2(png);
    		// Output some general info
    		const PHYSFS_ArchiveInfo **i;
    		for (i = PHYSFS_supportedArchiveTypes(); *i != NULL; i++)
    			std::cout << "Supported archive: " << (*i)->extension << " which is "
    				<< (*i)->description << "." << std::endl;
    		// Display the current search path
    		std::cout << "PHYSFS search path:" << std::endl;
    		char **it ;
    		for (it = PHYSFS_getSearchPath(); *it != NULL; it++)
    			std::cout << "\t" + std::string(*it) << std::endl;
    	catch (CL_Error& e)
    		// Error
    		std::cout << e.message << std::endl;
    	// Zen
    	return 0;
    } app;

  2. #2


    This looks like it's under the zlib/libpng license correct? I find PhysFS very neat, I might want to use it in the future and what better than with something in clanlib!

Similar Threads

  1. RakNet Support (WIP)
    By SushiBox in forum Novashell Game Creation System
    Replies: 33
    Last Post: 07-11-2009, 12:01 AM
  2. Box2D Support
    By Siris in forum Novashell Game Creation System
    Replies: 7
    Last Post: 06-09-2008, 03:43 AM
  3. Does ClanLib support the Linux framebuffer or DirectFB?
    By stodge in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 11-03-2007, 07:47 PM
  4. how does clanlib support other language?
    By gison in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 06-06-2007, 02:32 AM
  5. Support
    By in forum Dink Smallwood HD
    Replies: 0
    Last Post: 07-08-2004, 05:37 AM



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts