A
adylevy
i wanna write a class that handles key & mouse events,
so any other class that wants to get mouse & keyboard events will write
a pointer to this class, and then when an events occurs, this class
will call
all the subscribed classes ..
i scatched something like that :
class Handle_input{
public:
class(*registered)[10];
void reg(void*val){
registered[1]=(class*)val;
}
void run(){
registered[1]->run();
}
};
Hanle_input inpt; as a global.
and then every class will run
inpt.reg(this);
its not working ;-) .. if anyone has an idea on how to get it close to
working ... plz ..
thanks.
p.s
it might not be the direction at all... but that's what i was thinking
of, any ideas will be helping.
so any other class that wants to get mouse & keyboard events will write
a pointer to this class, and then when an events occurs, this class
will call
all the subscribed classes ..
i scatched something like that :
class Handle_input{
public:
class(*registered)[10];
void reg(void*val){
registered[1]=(class*)val;
}
void run(){
registered[1]->run();
}
};
Hanle_input inpt; as a global.
and then every class will run
inpt.reg(this);
its not working ;-) .. if anyone has an idea on how to get it close to
working ... plz ..
thanks.
p.s
it might not be the direction at all... but that's what i was thinking
of, any ideas will be helping.