This library is a cross-platform simple window framework containing only two files, swfw.c
and swfw.h
.
This library still hasn't reached its first major release, which means that the API might change and break backward compatility.
-
Platforms:
- Linux and BSD
in-progress
- X11
in-progress
- Wayland
in-progress
- X11
- Windows
not-started
- Mac OS
not-started
- Web (using Emscripten)
not-started
- Mobile (Android and iOS)
not-started
- Linux and BSD
-
Graphic APIs:
- No hardware acceleration
- GL
- Vulkan
The graphic APIs will be supported depending on the platform.
- Input:
- Keyboard
in-progress
- Mouse
in-progress
- Tablet
not-started
- Controller
not-started
- Keyboard
As controller and tablet input are not used by everyone, especially by small developers, it will be possible to disable their implementation in compilation time using macros. By default, their implementation will be enabled.
This project doesn't include a build system because it's intended that you add the files swfw.c
and swfw.h
in the build system of your project.
On Linux and BSD, the library can be compiled to support only X11, only Wayland, or both.
The macro SWFW_X11
is used for supporting X11, and the macro SWFW_WAYLAND
is used for supporting Wayland. With GCC, the macros can be defined using the -D
option:
# When no macro is provided, `SWFW_X11` is automatically defined internally.
gcc -c ./swfw.c
gcc -DSWFW_X11 -c ./swfw.c
gcc -DSWFW_WAYLAND -c ./swfw.c
gcc -DSWFW_X11 -DSWFW_WAYLAND -c ./swfw.c
The last option above is for building with support for both X11 and Wayland backends.
On Linux and BSD, when including swfw.h
in your file, the same macros for the supported backends should be defined before the inclusion of the header:
#if defined(__bsdi__) || defined(__linux__)
#define SWFW_X11
#endif
#include "swfw.h"
#if defined(__bsdi__) || defined(__linux__)
#define SWFW_WAYLAND
#endif
#include "swfw.h"
#if defined(__bsdi__) || defined(__linux__)
#define SWFW_X11
#define SWFW_WAYLAND
#endif
#include "swfw.h"
On Windows, Mac OS and Web, there are only one backend for each of these platforms, then there's no need to define any backend macro, only include the files swfw.c
and swfw.h
in the build system.
Contributions are very welcome. The coding style is similar to Linux Kernel coding style, but some flexibiliy is allowed.
You can use the e-mail in my profile to contact me.
The source code of this project is licensed under the terms of the ZLIB license:
Copyright (C) 2017 Felipe Ferreira da Silva
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
- The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
- Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
- This notice may not be removed or altered from any source distribution.