🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

PGraphicObject and PInputEventReceiver

Published December 26, 2005
Advertisement
Today I should explain the PWindow class and IVideoDriver interface..but...looking the project, I decided to show the PGraphicObject (all the graphic objects will derive from it, so...) and the PInputEventReciever first, because the PWindow class derives from PInputEventReciever =D

Check the code:

PGraphicObject

private:  bool FVisible;		  IVideoDriver* FVideoDriver;  SRect* FBounds;public:  PGraphicObject(SRect* ABounds, IVideoDriver* AVideoDriver);  ~PGraphicObject(void);		  bool GetVisible(void);  void SetVisible(bool AValue);		  SRect* GetBounds(void);  void SetBounds(SRect* AValue);  IVideoDriver* GetVideoDriver(void);  void SetVideoDriver(IVideoDriver* AValue);  virtual void Draw(void) = 0;


This class have not much to explain...any doubt ask me please...

PInputEventReceiver

private:  void (*FOnMouseMove)(SCoord* AMousePosition);  void (*FOnMouseDown)(SCoord* AMousePosition, ENMouseButton AMouseButton);  void (*FOnMouseUp)(SCoord* AMousePosition, ENMouseButton AMouseButton);  void (*FOnKeyDown)(int AKey);  void (*FOnKeyUp)(int AKey);protected:  virtual void DoMouseMove(SCoord* AMousePosition);  virtual void DoMouseDown(SCoord* AMousePosition, ENMouseButton AMouseButton);  virtual void DoMouseUp(SCoord* AMousePosition, ENMouseButton AMouseButton);		  virtual void DoKeyDown(int AKey);  virtual void DoKeyUp(int AKey);public:  PInputEventReciever(SRect* ABounds, IVideoDriver* AVideoDriver);  ~PInputEventReciever(void);  void OnMouseMove(void (*AOnMouseMove)(SCoord* AMousePosition));  void OnMouseDown(void (*AOnMouseDown)(SCoord* AMousePosition, ENMouseButton AMouseButton));  void OnMouseUp(void (*AOnMouseUp)(SCoord* AMousePosition, ENMouseButton AMouseButton));  void OnKeyDown(void (*AOnKeyDown)(int AKey));  void OnKeyUp(void (*AOnKeyDown)(int AKey));  virtual void Draw() = 0;


This class just have the pointers to the methods. All the PInputEventReceivers objects, will be registered in the MouseDriver and KeyboardDriver on PDevice and the events will be fired from these drivers to the recievers.

just like I said, the PWindow class derives from PInputEventReceiver.

Tomorrow I'll show the PWindow class and the IVideoDriver interface..
at this time, I promisse..hehe

leave comments with suggestions, critics or love phrases =P

well..see you tomorrow..
Previous Entry The PDevice Class
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

Another Demo

1125 views

Link resolved....

1176 views

Update....

1149 views

Let's play... = )

1103 views

A little doubt

954 views

PLayer

991 views
Advertisement