[Solved] switchDemo1's input into bufferd from unbuffered

satchigi

27-05-2011 18:40:06

hello

I want use Demo's source code with buffered input system, (for using with my framework)
so I've tried switch the code. but so many error.

I really did my best(I wasted my 2day, skiped going to school. )
but I coudln't because of lack of knowledge.

so I really wonder somebody could fix Demo1's source code into buffered input system for me.

just Demo1. plz.

Lax

27-05-2011 22:15:07

At first you have to derive your class from the OIS::KeyListener
You have to create the inputmanager and the keyboard in buffered mode:

OIS::ParamList paramList;
this->pRenderWindow->getCustomAttribute("WINDOW", &hWnd);
paramList.insert(OIS::ParamList::value_type("WINDOW", Ogre::StringConverter::toString(hWnd)));
this->pInputManager = OIS::InputManager::createInputSystem(paramList);
this->pKeyboard = static_cast<OIS::Keyboard*>(this->pInputManager->createInputObject(OIS::OISKeyboard, true));
this->pKeyboard->setEventCallback(this); //this is the pointer to your class

The second parameter (true) indicates to create buffered mode.
Then you must implement the correspondent functions:

bool keyPressed(const OIS::KeyEvent &keyEventRef);
bool keyReleased(const OIS::KeyEvent &keyEventRef);


Take a look at the tutorium: http://www.ogre3d.org/tikiwiki/BasicTutorial5Source.

satchigi

28-05-2011 00:41:58

thx for reply.

I aleady checked that tutorial.

Although I have some experience changing unbuffered into buffered input, I couldn't
only on OgreNewt's demo because it has some special structure that
using OIS input system as a customeframelistener its own separated h,cpp file.

I derived class properly and I put what you mentioned.
But even ESC is not work.

After much consideration, I reached a conclusion that the problem comes from
difference that tutorial is including BaseApplication.h/cpp file but myproject is not.

but I can't add more class to derive because demos framework structure doesn't allow that.

I really wonder somebody check it for me. thx

satchigi

28-05-2011 17:25:39

I just solved by some old tutorial that deriving class from exmpleframelistener.
(OgreNewt demo's framelistner class derives exampleframelistner too.)

I had to initialize constructor (win,cam,true,true).
Last two parmameter mean bufferedkeboard, bufferedmouse. (default is on false).

I'm so glad :D