Don't do anything to respond to viewport size by default, as the window
has fixed size in most cases anyway (always fullscreen, canvas of fixed
size in browser etc.). Makes the initial implementation requirements
much simpler and shorter.
* The default (empty) implementation of virtuals shouldn't be called,
thus this effectively protects the user from doing it.
* Only the application itself knows best when and how to call
rendering-related functions such as swapBuffers() and redraw(), thus
they are protected.
* Functions for setting up fullscreen or hiding the mouse may be called
from user code outside the application, thus they are kept public.
We need to create one instance, send it to subclasses and then check its
state, thus we expect that the user always operatres with the original
instance.
They are something like singletons (or they expect that behavior
internally), moreover some code might hold pointer to them, thus
movement is not desired.
Somebody would just want to defer context creation after parsing
arguments or doing some validations without any particular setup, thus
having to write even the {} is annoying.
Added missing tryCreateContext() implementations. Error messages are
printed only by tryCreateContext(), createContext() is only a thin
wrapper which exits the application if tryCreateContext() fails and
doesn't print any additional information on the output.
Hopefully I didn't break anything :-)
Sdl2Application is now taken as base implementation (it was GLUT
previously) and all others are copying/referencing the documentation
from it. When SDL2 is included in all major distributions (Ubuntu, I'm
looking at you), it will replace GLUT as the default application.
They are now not exposed to the user at all, as their API will be
probably changed and reworked in the future to allow GLX/EGL-specific
extension to be used. Also this looks scary in the documentation.
Doing it the same way as in Sdl2Application, as this doesn't have any
performance impact (just alias for already present variable).
The other way around, i.e. combining mouse buttons and keyboard
modifiers in Sdl2Application, would have unnecessary performance
penalty, as keyboard modifiers must be queried with separate function,
even if they won't probably be used at all.
Qt employs similar approach.
The old way is preserved for backwards compatibility, but marked as
deprecated and will be removed in future releases.
Makes some cases less consistent (and some convenience shortcuts
impossible), but goes well with the attitude "don't use pointer when it
can't be null".
As it now isn't passed by pointer, this allows doing things like this:
/* Lost all hope in this hardware */
if(!awesomeFeatureSupported)
createContext({});
Robust *Framebuffer::read() access, ability to query robust buffer
access behavior in Context::flags(), ability to check graphics reset
status and reset notification policy in Renderer.
Each implementation of *Application::Configuration will have different
methods tailored to feature set of the underlying toolkit. Currently
each windowed application's Configuration has only window title (except
NaClApplication) and window size. WindowlessGlxApplication has empty
class. More features will come later. Also created introductionary
documentation for Platform namespace.
It prevents unwanted implicit conversions from e.g. nullptr to Camera,
Vector2 to Physics::Point etc. By making all the constructors explicit
it is easier to routinely add the keyword to all new classes instead of
thinking about cases when to add and when not to.
In SDL they are only for keyboard events and there is no support
for mouse modifiers like in X. Also reordered the enum in
AbstractXApplication to make it consistent.
Because with NaCl WindowContext doesn't make sense anymore, the classes
are now renamed:
* Contexts namespace -> Platform
* *WindowContext -> Application
Hopefully this is (one of) last crazy renaming runs.