• Advertisement
Sign in to follow this  
  • entries
    17
  • comments
    37
  • views
    8925

PWindow and IVideoDriver

Sign in to follow this  

277 views

Hi, how are you??

well, proceeding, let me explain the IVideoDriver class...

Check out the code:

IVideoDriver


public:
virtual void RestoreDefaultSettings(void) = 0;
virtual void PrepareScene(void) = 0;
virtual void DrawScene(HDC AHDC) = 0;
virtual void ResizeDriver(SRect* ADimension) = 0;

virtual void SetClearColor(SColor* AColor)= 0;




The IVideoDriver is just an interface that contains all the drawing functions (until now just the "prepare" functions, none of REAL drawing is done) of the engine... the POpenGLDriver only implement this interface with OpenGL methods.

All the graphicobjects have a pointer to IVideoDriver to perform its drawing.

Now..the PWindow class..one of most important classes:

PWindow: PInputEventReceiver


private:
bool FFullScreen;
bool FNeedResize;

std::string FName;
std::string FCaption;
SColor* FBackgroundColor;

HWND FHandle;
HDC FHDC;
HGLRC FHRC;
HCURSOR FCursor;
public:
PWindow(std::string AWindowName, SRect* ABounds, IVideoDriver* AVideoDriver);
~PWindow();

bool GetFullScreen(void);
void SetFullScree(bool AValue);

bool GetNeedResize(void);
void SetNeedResize(bool AValue);

void Show();
void Hide();

std::string GetName(void);

std::string GetCaption(void);
void SetCaption(std::string AValue);

SColor* GetBackgroundColor(void);
void SetBackgroundColor(SColor* AValue);

HWND GetHandle(void);
void SetHandle(HWND AValue);

HDC GetHDC(void);
void SetHDC(HDC AValue);

HGLRC GetHGLRC(void);
void SetHGLRC(HGLRC AValue);

void Draw();




This class control the windows of the application. Until now there are no complex methods that need explanation..maybe in the future =P

Okay, tomorrow I'll show the example of a simple Main.cpp that create and show a window with a background color.

Any suggestion or question...comment please =D

Thanx
See you tomorrow..
Sign in to follow this  


2 Comments


Recommended Comments

Everything is looking to be shaping up rather elegantly thus far. It's pretty obvious that you're no novice programmer, and you have plenty of design moves and techniques that are proving to provide sound structure to the engine.

I'll keep on reading as long as you keep on writing. :) Who knows, maybe I'll learn something myself!

Share this comment


Link to comment
I appreciate your interest =D

Certainly I'll keep writing and hoping that more people like you, read, learn and teach me about game programming, this is just my first "project"...

again...thanx for your courtesy...

Share this comment


Link to comment

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