Floppy
19-09-2009 02:33:52
Hi,
I am pretty new to this so be gentle =)
I want to place my MOIS code in a separate class to avoid messy code. I have looked at the example "Using MOIS" on the wiki and noticed that the KeyPressed/Released function is passed directly to the keylistener;
I do not want to act upon the input in this class, only provide the user of the class with some handy functions for getting mouse positions and what keys are pressed etc.. I am thinking that I want my KeyPressed function to return a bool telling the caller whether the button passed to it is pressed or not. With the current setup this is not possible? As I understand it I have to iterate through the listener inside the KeyPressed function to see if the key passed to it was pressed or not, then just return?
/Thanks in advance
EDIT:
Let me put it like this.. In my main class, I am initializing my IOHandler object and passing it *this*(the main class/object) so that I have access to all the member variables and can modify them when I handle all the input inside the IOHandler object. Is this good programming? Shouldn't this be done outside the IOHandler, in the main object?
I am pretty new to this so be gentle =)
I want to place my MOIS code in a separate class to avoid messy code. I have looked at the example "Using MOIS" on the wiki and noticed that the KeyPressed/Released function is passed directly to the keylistener;
inputKeyboard.KeyPressed += new MOIS.KeyListener.KeyPressedHandler(KeyPressed);
inputKeyboard.KeyReleased += new MOIS.KeyListener.KeyReleasedHandler(KeyReleased);
I do not want to act upon the input in this class, only provide the user of the class with some handy functions for getting mouse positions and what keys are pressed etc.. I am thinking that I want my KeyPressed function to return a bool telling the caller whether the button passed to it is pressed or not. With the current setup this is not possible? As I understand it I have to iterate through the listener inside the KeyPressed function to see if the key passed to it was pressed or not, then just return?
/Thanks in advance
EDIT:
Let me put it like this.. In my main class, I am initializing my IOHandler object and passing it *this*(the main class/object) so that I have access to all the member variables and can modify them when I handle all the input inside the IOHandler object. Is this good programming? Shouldn't this be done outside the IOHandler, in the main object?