0.1 (alpha)
Pre-release
Pre-release
First release of window-mini.
To link libwindow-mini.lib/libwindow-mini.a..
- on windows (using mingw)..
- add library gdi32
- on linux..
- add library X11
Here is an example of using window-mini in C..
#include <window_mini.h>
int bQuit = 0;
int on_window_closed(int window)
{
bQuit = 1;
return 1;
}
int main(int argc, char** argv)
{
int window;
do
{
if(wm_load() != 1)
{
break;
}
progress = EProgress_LoadedWindowMini;
struct wm_add_window_parameters_t parameters = wm_add_window_parameters_default;
struct wm_window_source_t source = wm_window_source_default;
if(wm_add_window(¶meters, &source, &window) != 1)
{
break;
}
progress = EProgress_AddedWindow;
while(bQuit == 0)
{
wm_poll();
}
if(progress >= EProgress_AddedWindow)
{
wm_remove_window(window);
}
if(progress >= EProgress_LoadedWindowMini)
{
wm_unload();
}
return 0;
}
Here is an example of using window-mini in C++..
#include <window_mini.hpp>
bool bQuit = false;
// overriding WMWindow is not required, WMWindow can be used directly..
// .. (though on_closed couldn't be detected then)
class MyWindow : public WMWindow
{
public:
virtual bool on_closed() override
{
bQuit = false;
return true;
}
};
int main(int argc, char** argv)
{
do
{
if(wm_load() != 1)
{
break;
}
progress = EProgress_LoadedWindowMini;
MyWindow window; //< must be in a different scope than wm_unload, as otherwise would try to call wm_remove_window from WMWindow destructor after wm_unload has been called
struct wm_window_parameters_t parameters;
if(!wm_add_window(¶meters, &window))
{
break;
}
progress = EProgress_AddedWindow;
while(!bQuit)
{
wm_poll();
}
} while(0);
if(progress >= EProgress_LoadedWindowMini)
{
wm_unload();
}
return 0;
}