Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/BusyStudent/Btk
A library for developing Gui based on SDL2
https://github.com/BusyStudent/Btk
btk cpp17 generic gui-toolkit sdl2 simple
Last synced: 6 days ago
JSON representation
A library for developing Gui based on SDL2
- Host: GitHub
- URL: https://github.com/BusyStudent/Btk
- Owner: BusyStudent
- License: mit
- Archived: true
- Created: 2020-10-01T12:38:11.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-06-16T08:39:33.000Z (over 2 years ago)
- Last Synced: 2024-08-02T07:14:30.605Z (3 months ago)
- Topics: btk, cpp17, generic, gui-toolkit, sdl2, simple
- Language: C
- Homepage: https://btk-project.github.io/
- Size: 5.9 MB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-xmake - Btk
README
# Btk
![Logo](./logo/logo.svg)
Btk is a C++ tiny retained mode GUI library based on SDL2 and nanovg.
It was written in morden C++,so it was very easy to use.
***Still developing***
## CI
|Platform| CI Status|
| --- | --- |
|Linux |![C/C++ CI on Linux](https://github.com/BusyStudent/Btk/workflows/C/C++%20CI%20on%20Linux/badge.svg)|
|Windows |[![C/C++ CI on Windows](https://github.com/BusyStudent/Btk/actions/workflows/windows.yml/badge.svg)](https://github.com/BusyStudent/Btk/actions/workflows/windows.yml)|----
## Tiny example
Just create a window and add widget on here
```cpp
//Include all headers
#includeusing Btk::Library;
using Btk::Window;
using Btk::Button;struct App:public Window{
App():Window("Hello World",100,100){
//Add a button and connect signal
auto &btn = add("Close the window");
//Or
// auto *btn = new Button("Close the window");
// add(btn);
// Set the button's position and size
btn.set_rect(0,0,100,100);//You can connect to a limbda
// btn.signal_clicked().connect([this](){
// close();
// });
//Or connect to a member fucnction
btn.signal_clicked().connect(
&App::close,
this
);
//when the object was destroyed,
//The connection will be disconnected automatically
}
};
int main(){
Library lib;//< For initialize / Quit
//Or call Init() and Quit() explicitly
App app;
app.mainloop();
}
```----
## Features
- Almost no macro,the signal system was written in template
- The Library will use the font in os
- UTF-8 support----
## TODO List
- [ ] Add more useful widgets
- [ ] MessageLoop need to be refactored
- [ ] Rewrite ImageView By OpenGL to implement AntiAlias
- [ ] Add CMake
- [ ] Add GLX and WGL OpenGL Adapter
- [ ] Add API to get system color and system metrics
- [ ] Widget Interface need to be refactored
- [ ] String Interface need to be refactored to fit STL
- [ ] Font need to be refactored,Current font backend is not good enough(need hb support)
- [ ] Renderer backend DPI support----
## Widgets List
| Widgets | Done? | TODO | Description |
| --- | --- | --- | --- |
| Button | | | |
| RadioButton | | | |
| CheckButton | | | |
| ImageView| | | |
| TextBox | |Refactoring| |
| ProgressBar | | | |
| EmbedWindow | No | | |
| ScrollBar| | | |
| SilderBar| | | |
| Canvas | | | |
| GLCanvas | | | |
| GLWidget | No | | |
| Label | | | |
| Line | | | |
| Layout | | | |
| BoxLayout| | | |
| StackedWidget| | | |----
## Renderer Backend
| Backend | Done? | Description |
| --- | --- | --- |
| Vulkan | No | |
| Software | | Has many bugs|
| OpenGLESv3 | | |
| Direct3D11 | | |
| SDLRender | No | |----
## Building prerequisites
### Linux
- G++ with C++17 support
- SDL2
- SDL2-image (optional)
- fontconfig (optional,for select font)
- libgif (optional,for display gif)
- freetype2 (optional)
- scons or xmake### Windows
- MINGW or vs2017
- SDL2
- SDL2-image (optional)
- freetype2 (optional)
- libgif (optional)
- scons or xmake### Android
- Still developing
----
## Build
```console
btk@btk:sudo apt install libsdl2-dev
btk@btk:scons
```or
```console
xmake
```## ThirdParty
[SDL2](https://www.libsdl.org/) - For Event Handling
[SDL_image (optional)](https://www.libsdl.org/) - Load image
[stb (optional)](https://github.com/nothings/stb) - Load image,render font,textbox edit etc...
[nanovg](https://github.com/memononen/nanovg) - Render UIetc...
## License
MIT
## Some md for dev
[Folder strucutre](./src/README.md)