Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    17
  • comments
    37
  • views
    8992

PGraphicObject and PInputEventReceiver

Sign in to follow this  
Kerkhoff

243 views

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..
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!