Release-1 Overhaul #23
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The main RWindow class will be refactored with the "Pimpl" idiom.
User-input will be abstracted as much as possible, ideally into a separate ReInput project that interlinks with ReWindow.
The ReWindow project files will be reorganized as well.
RenderingAPI will be expanded to a Renderer class interface, with default implementations provided for OpenGL (GLX, WGL), Vulkan, and WebGL backends.
We're still going to need to have a windows CPP file for the Windows implementation. This is due to Windows being dumb and deciding this is a great idea.
Right now this function uses global pointer variables to access RWindow data. Though I'm sure we can come to a solution.
My idea is for the Windows impl to have a public method wrapped by the WindowProc function. There should be a pointer to this method rather than the class itself. This is still dirty, but atleast the entire RWindow class isn't global.
Bill says to use our Event system, make it global, add methods to it and have WindowProc invoke it.
*similar to how the event system works.
Side project that intertwines: Static Service Namespaces
WindowService
InputService
RenderService
AudioService
NetworkService
Bill and I came up with this pImpl setup. We figured out that we could just make an Impl class derived by RWindow as it accomplishes the same thing in an easier to read and better way. We're also able to fill in the Impl class definition in platform specific .cpp files. These platform specific .cpp files can contain custom platform specific code used by the filled in public methods. It is also likely we can derive other classes structured the same way for RWindow.
This is a good start, but consider the inheritance model for this setup, and how the user creates the object. Are we sticking with our design goal that the user has one base RWindow class that they create, and can derive, but platform-specific stuff is moved into WindowInterfaceImpl?
Yes. See the pImpl I started work on. Anything OS/Platform dependent will be handled by the Impl. The Impl also stores information as protected so shared public facing functions in RWindow can access them directly, though the Impl would not be able to use the shared public facing functions. I think it's fairly safe to have the shared functions be defined by RWindow and access the Impl variables. The Impl variables are a part of the interface of the Impl and should not store any platform specific data. Impls should be focused on defining how the data is handled in a standard way.
We could also define the shared functions like the getters in the Impl then have their functionality defined as well leaving. With that we can access the shared functions within the Impl and private the Impl variables.
I have most of RWindow refactored to use the pImpl idiom now. I had to hack the shit out of it to test the progress so far and it works fairly well. See this working commit.
The RWindowImpl now has a Platform class which is the more interesting part of the refactor. The Platform class has purposefully been left undefined and is left up to implementers (mainly us) to utilize it.
To quote myself:
As defined in RWindowImpl:
Usage of the Platform class is completely optional and is fairly safe to use if the programmer is being smart about it.
So far I've only used it for the Linux and X11 stuff. Mainly I have used it to store those nasty globals per instance.
src/platform/linux/window.cpp
A simple example of it being used for the Linux Impl:
I haven't tried to create 2 RWindows at the same time yet, but I'll eventually get to testing that. For now my focus is on the refactor.