//window.h
class window
{
public:
virtual ~window(){};//必须是虚函数
public:
virtual void set_titile(const char* title_) = 0;//纯虚函数
virtual void set_background_color(int r_, int g_, int b_, int a_) = 0;
virtual void set_size(int width_, int height_) = 0;
};
window* create_window();
//window.cpp
class linux_window
:public window
{
public:
~win_window(){}
public:
void set_title(const char* title_){\\暂时不实现功能}
void set_background_color(int r_, int g_, int b_, int a_){\\暂时不实现功能}
void set_size(int width_, int height_){\\暂时不实现功能}
};
class android_window
:public window
{
public:
~win_window(){}
public:
void set_title(const char* title_){\\暂时不实现功能}
void set_background_color(int r_, int g_, int b_, int a_){\\暂时不实现功能}
void set_size(int width_, int height_){\\暂时不实现功能}
};
window* create_window()
{
window* wind = NULL;
if(system_str == "win32")
wind = new win_window();
else if(system_str == "linux")
wind = new linux_window();
else if(system_str == "android")
wind = new android_window();
else
wind = NULL;
return wind;
}
原文:http://blog.csdn.net/angle502/article/details/42249367