Closed m0ppers closed 6 years ago
I am looking how to implement that.
I propose the following:
I introduce a new class called system_os (system_win, system_unix ...)
That's made to initialize system properties and objects (excepting windows, drawing contexts and timing modules). It can be used to configure application native properties, system memory manager / scheduler configuration, BIOS properties, system interrupts / signals handling, whatever is OS / HW specific per platform.
It will have several methods:
It will wrap X11 and Win32 into a unified and simple interface, it does not need to be more complicated than that. What do you think?
sounds very good 👍
I have pushed a new version of the engine with the new system class. That reduces the cube example to one single cpp file (as it should be).
I have not checked the code, at all, on MacOs. It SHOULD work on Linux (I'll check that back home). It does work on Windows OS (compiled with mingw64 & VS).
Any thoughts / feedback on the current implementation @m0ppers?
I would have done it differently (HATE global static variables :D) but it is totally sufficient for now and works :)
Right now the API doesn't provide a way to shutdown in a clean way (that I am aware of) for non windows platforms.
For windows there is this possibility (which is provided by windows and not by le3d):
https://github.com/Marzac/le3d/blob/master/examples/cube/cube_win.cpp#L62
The unix example just quits on keypress. apart from that the mainloop is just and endless loop. for the amiga I currently do a hard exit() whenever the user clicks the close button. This is a non graceful exit.
What I would like to have is something like glfw is doing:
https://github.com/glfw/glfw/blob/master/examples/simple.c#L134
This way one could set a static global variable defined in the window_PLATFORM.cpp and which could be queried by the mainloop and allow for a simple graceful exit.
What do you think?