Coder Social home page Coder Social logo

haorenhl007 / wrui Goto Github PK

View Code? Open in Web Editor NEW

This project forked from emoon/wrui

0.0 2.0 0.0 1.71 MB

C wrapper for UI libraries (like Qt, wxWidgets, dear imgui) with a common C API

License: MIT License

Lua 92.98% C 0.71% Shell 0.06% Batchfile 1.17% C++ 5.08%

wrui's Introduction

wrui

Wrui is a wrapper for UI libraries (like Qt, wxWidgets, dear imgui) with a common C API. Motivations for these are:

  • Using C++ APIs from other languages (such as Rust, Haskell, D, etc) is really annoying because of no standard ABI. Using a C API this can bring popular C++ libraries to these lanugages.
  • Some people still prefer to code in C because of its simplicity.
  • Wrui will only expose one single symbol which is a table of function pointers. There are several upsides to this:
    • Shared libraries don't need to hard-link with a Wrui shared library. It only needs to be sent one single pointer.
    • Possible for a main application to update with bug fixes without affecting plugins.
    • All code wrapping a certain library can be within one shared library. That makes linking of the main application (for langs that uses static linking) much faster as the library can be loaded in run-time instead of linked with.
    • Clearer separation
  • Having a common API but the possibility of using different backends make it possible to integrate a UI into another application. Say that you have a game that use OpenGL and know how to use Wrui. Then it should be possible to use dear imgui (example) backend + Wrui inside that application.

Status

Development is currently in the very early stages of just figuring things out. How the C API should work and the design goals. I'm currently considering something signal based similar to Qt. Doing it type-safe would be quite hard in C without pre-processing which I would like to avoid. Considering keeping it not type-safe for C and have other langs adding that support if wanted.

Plan of attack

  • Try to implement an API that works for dear imgui and Qt. These APIs are quite different so should be interesting to get a common base.

Why not use imgui style of programming?

While I really like the way imgui style programming works it's hard (if not close to impossible) to do with existing libraries (like Qt) while it's quite possible to do it the other way around. So I decided to try to go for a basic signal model and see how well it works. This is still an experiment and may actually not work out but time will tell.

Non-goals

  • Having diffrent UI backends to behave exactly the same will likely be very hard. Wrui will make a best effort in doing so but there will likely be areas where something can't be supported in one or another simply because how that library is implemented. The plan here is to provide documenation that states this and with run-time warnings as well.

wrui's People

Contributors

emoon avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.