updated readme

This commit is contained in:
vurtun 2015-12-11 00:04:17 +01:00
parent 6888141745
commit c13cc8cec7

View File

@ -3,9 +3,9 @@
This is a minimal state immediate mode graphical user interface toolkit This is a minimal state immediate mode graphical user interface toolkit
written in ANSI C and licensed under zlib. It was designed as a simple embeddable user interface for written in ANSI C and licensed under zlib. It was designed as a simple embeddable user interface for
application and does not have any direct dependencies. It does not have application and does not have any direct dependencies,
a default renderbackend, os window and input handling but instead provides a very modular a default renderbackend or OS window and input handling but instead provides a very modular
library approach by providing a simple input state storage for input and draw library approach by using simple input state for input and draw
commands describing primitive shapes as output. So instead of providing a commands describing primitive shapes as output. So instead of providing a
layered library that tries to abstract over a number of platform and layered library that tries to abstract over a number of platform and
render backends it only focuses on the actual UI. render backends it only focuses on the actual UI.
@ -15,8 +15,8 @@ render backends it only focuses on the actual UI.
- Written in C89 (ANSI C) - Written in C89 (ANSI C)
- Small codebase (~8kLOC) - Small codebase (~8kLOC)
- Focus on portability, efficiency, simplicity and minimal internal state - Focus on portability, efficiency, simplicity and minimal internal state
- No dependencies (not even the standard library)
- No global or hidden state - No global or hidden state
- No direct dependencies
- Configurable style and colors - Configurable style and colors
- UTF-8 support - UTF-8 support
@ -71,33 +71,28 @@ zr_end(&context, &window);
![example](https://cloud.githubusercontent.com/assets/8057201/10187981/584ecd68-675c-11e5-897c-822ef534a876.png) ![example](https://cloud.githubusercontent.com/assets/8057201/10187981/584ecd68-675c-11e5-897c-822ef534a876.png)
## Documentation ## Documentation
For code related documentation and information on how to link each single part to a whole I Zahnrad currently relies heavily on documentation provided inside the `zahnrad.h` header file, consisting
would recommend reading the documentation inside the `zahnrad.h` header file wich has of descriptions and important information about modules, data types and functions.
information and descriptions about each part, struct, members and functions. In addition While being quite limited in delivering information about the general high-level libray composition it
I would especially recommend reading the examples and the demo. should still offer some understanding about the inner workings and stand as a practical usage reference.
If you want to dive into the example code I would recommand starting with `example/demo/demo.c`, ## Examples
even if you don't know or want to use nanovg. It contains the usage code for every simple to use A number of usage examples can be found inside the `example` and `demo` folder which should yield a
core part of the library while providing a good looking UI. It also introduces a small set basic overview how to embed the libray into different platforms with varying APIs and provided functionality
of widgets while providing a simple example of how to do layouting. and hopefully offer a basic understanding of zahnrad's UI API.
In general it is advised to start by reading `example/demo`. It consists of a basic embedding example into
SDL, OpenGL and [NanoVG](https://github.com/memononen/nanovg) with a very simple set of used widgets and layouting.
As soon as you have a basic grip of how to use the library I would recommend looking at As soon as a basic understanding of the library is accumulated it is recommended to look into the `demo/` folder with your platform
`demo/demo.c`. It only contains the actual UI part of the GUI but offers example ussage of choice. For now a basic platform layer was implemented for Linux(X11), Windows(win32) and OpenGL with SDL and GLFW.
code for all widgets in the library. So it functions more as a reference to look how Both platform specific demos (X11, win32) use their respectable window, input, draw and font API and don't have any
a widget is supposed to be used. outside dependencies which should qualify them as the first platform to compile, run and test.
For hardware supported rendering, font both the SDL and GLFW version use zahnrad's internal vertex buffer output
and font baker.
On how to do the platform and render backend depended part I would recommend looking at Up until now you should hopefully have a basic grip of how to use zahnrad UI API and be able to embed zahnrad into
some example platform implementations for Win32 (`demo/win32/win32.c`) for windows and your plaform. From here on `demo/demo.c` should provide a basic reference on how use most widgets and layouting.
X11 (`demo/x11.xlib.c`) for linux. Both provide the absolute minimum needed platform Finally for some small actual working example apps both `example/filex` with implementation of a linux only
dependend code without using any libraries. Finally for the most complex plaform demos file browser and `example/nodedit` with a basic node editor skeleton are provided. Especially the `nodedit` example
it is definitely worth it to read the OpenGL examples with `demo/sdl/sdl.c` for should show how far you can bend the this library to your own needs.
zahnrad integration with SDL2, OpenGL and GLEW and `demo/glfw/glfw.c` for integration
with GLFW, OpenGL and GLEW. They also include usage code for the optional zahnrad font handling
and vertex buffer output.
The final two examples `example/filex/filex.c` and `example/nodedit/nodedit.c` both provide
actual example application use cases for this library. Filex is a simple file browser for Linux
and shows how to do window tiling. The node editor on the other hand is probably the more
interesting of the two since it shows how far you can bend this library to your
specific problem on hand.