I am currently implementing a small soft, I want this soft work on Mac Os and Window Os, so I want use GLFW for mac environment and Window API for windows environment (I know GLFW is cross platform but that's not the point..)
My problem is a design implementation problem: I have created a windowManager class that keep an instance of a Window class. This Window keep an instance of an objet that is PatternWindow , PatternWindow is a interface. I have a objet PatternGLFW3_VULKAN that implement PatternWindow. this PatternGLFW3_VULKAN have an instance GLFWwindow * _window, and PatternGLFW3_VULKAN initialize _window with glfwCreateWindow(...).
class Window
{
public:
somefunction(...)
initializePatternWindow(unique_ptr<PatternWindow>&& patternWindow)
private:
unique_ptr<PatternWindow> _patternWindow;
}
class PatternWindow
{
public:
PatternWindow();
virtual ~PatternWindow();
virtual void initialize() = 0;
virtual void destroy () = 0;
};
class PatternGLFW3_VULKAN : public PatternWindow
{
public:
PatternGLFW3_VULKAN ();
~PatternGLFW3_VULKAN();
virtual void initialize();
virtual void destroy();
const GLFWwindow& getWindow() const {return *_window;}
private:
GLFWwindow * _window;
};
My question is about the getWindow() function in my PatternGLFW3_VULKAN class, how I can create a virtual getWindow() function in my PatternWindow class in order to get my GLFWwindow* window of the PatternGLFW3_VULKAN in run time if I am on Mac Os environment, I can create a virtual function GLFWwindow& getWindow() in my PatternWindow, but if I run my soft on Window environment , the type GLFWwindow of the virtual function getWindow() of the patternWindow class won't be correct...
How can I do in order to have a virtuel getWindow() in PatternWindow my that return GLFWwindow or a instance the Windows API screen in run time ?
Aucun commentaire:
Enregistrer un commentaire