Hi, I know this is an old topic, but I still haven't found a solution I completely understood. So I'll just post my case.

I'm trying to implement easyhttpd, a server class into an existing ogre class. This httpd server works with a callback function that I need to provide but it would be an immense amount of work to have all the functionality I need to be static. Is there any workaround, some sort of trick to get past this problem? I hope you understand what I mean. I find these things hard to explain, so I'll just post my code:

class OgreApplication: public UndefOgre {
protected:
public:
	OgreApplication() {
	}
	
	~OgreApplication() {
	}
	
        //THIS FUNCTION SHOULD BE STATIC
	int handleIndex( ehttp &obj, void *cookie )
	{
		obj.out_set_file( "index_template.html");
		
	}
	
protected:
	void createScene(void) {
		//create httpd server
		ehttp	http;
		// Initalize EhttpD
		if( http.init() != EHTTP_ERR_OK )
		{
			cout << "ERROR: CAN'T INITIALIZE SERVER" << endl;
			exit(1);
		}
		
		http.add_handler("/", handleIndex ); //THIS DOES NOT WORK
		
		mSceneMgr->setAmbientLight(ColourValue(.1, .1, .1));
		for (int i = 0; i < 20; i++) {
			SceneNode *node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
			Entity *ent1 = mSceneMgr->createEntity(strcomb("BPathCube", nextNum("BPathCube")), SceneManager::PT_CUBE);
			ent1->setMaterialName("test");
			
			node->attachObject(ent1);
			node->setScale(.2, .2, .2);
			node->setPosition(0, 0, i * 80);
			node->setVisible(true);
		}
	}
};

thank you very much

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.