12 ms·
Raygui – A simple and easy-to-use immediate-mode GUI library
- welklkjlerg 5y ago
- weakfish 5y agoLooks like metal gear solid. Nice.
- frankzander 5y agoThe used font is really cruel ... I hope it's interchangeable
- crispyalmond 5y agoIt does support changing the font
- b20000 5y agovery cool. there are already immediate mode libs with a focus on tools. what i’m more interested in is really great gui libs that make architecting multimedia or audio applications easy without requiring me to learn and use game engines. ideally on top of opengl(es) and linux (arm) support. i am thinking about applications where you want cooler UI effects and UX than what we are all used to, like what you sometimes see in games. i just don’t want to do all the drawing myself and don’t want to use game engines. stuff like qt is too heavyweight and too much traditional UI focused. most UI frameworks also have little support built in for advanced producer/consumer or multithreading/work load balancing scenarios and expect you to roll all that stuff yourself over and over.
- Pulcinella 5y agoCocoa and CoreAnimation on the Mac allow you to apply arbitrary CoreImage filters to UI elements (not just images) and you can even write your own filters using the Metal shading language (though that’s basically doing a lot of the drawing yourself). Unfortunately this doesn’t work on iOS (probably for power consumption reasons). Apple does have some filters for things like Gaussian blurs, but they are a private API.
- teawrecks 5y agoImmediate mode GUIs are usually pretty inefficient. I wouldn't use it as a permanent solution in a product. More like a quick way to add controls to avoid having to close the app and edit a config file, or recompile with different params. Usually you want app GUIs with a style that matches the rest of the apps. Though mobile kinda changed that. I don't know of a performant UI framework for building non traditional desktop apps.
- Flankk 5y agoJUCE is the best option. Shopify came out with React Native Skia, which allows you to draw whatever you need. You can also use Skia directly but it's only a drawing library. I wanted to use something like IMGUI but it's hard to theme and not designed for consumer products. This raygui looks cool but it's bitmap fonts which is no good for i18n. Edit: Looks like it uses real fonts it just includes a crappy one. I'll have to take a closer look at this.
- deleted 5y ago[deleted]
- chrisdalke 5y agoRelated, check out raylib, the rendering/game engine made by the same author! I’ve used Raylib and raygui on a few RPi based projects and recommend it. It’s a really simple, intuitive way to get an OpenGL-based UI running. Good alternative to web-based UIs because it has similar simplicity but runs on devices with lower specs. I built this pinball machine with raylib: https://youtu.be/iiBn7FVzlcc https://youtu.be/iiBn7FVzlcc
- matthewfcarlson 5y agoThis is fantastic, it’s a shame this doesn’t have more views. If it’s okay, I submitted it to the hackaday.com tip line.
- chrisdalke 5y agoThanks! A little more detail at https://www.chrisdalke.com/projects/mini-pinball-machine/ https://www.chrisdalke.com/projects/mini-pinball-machine/, and the Raylib-based code is on GitHub: https://github.com/chrisdalke/mini-pinball-machine https://github.com/chrisdalke/mini-pinball-machine
- wly_cdgr 5y agoRay is amazing. He's been at it since around 2014. Super friendly, super responsive dude
- deckarep 5y agoBrilliant project and execution. I love the idea of bringing the tactile experience together with a digital gaming experience.
- akselmo 5y agoIve been making a simple wolfenstein 3d clone with raylib and C, its so easy to jump into even for a complete newbie in C like me!
- deaddodo 5y agoRaylib is great and one of my preferred libraries for writing emulators in. But I will say if you’re expecting something like imgui or nuklear with Raygui, it’s not nearly as advanced or usable.
- 999900000999 5y agoWould it be possible to define the GUI with XML, Unity just added this officially and it makes life much better. Then you do something like rootGUI.Query("elementID").RegisterCallback( e => otherFunc(e));
- dividuum 5y agoThe joy of immediate mode guis is that you don't have to register callbacks or manually modify (for example) the visibility of elements in response to some action. Instead you do: if checkbox(&show_debug, "Show debugging features") { if button("Run some test") { test()
- pjmlp 5y agoJoy for ones, pain for others, I don't miss coding GUIs like MS-DOS MODE X or Linux's SVGAlib.
- 999900000999 5y agoBut then if you need to change some non interactive parts of the UI, your digging though source code instead of modifying XML. Defining the UI via code becomes cumbersome, stuff like adding attributes, etc
- rstat1 5y agoChanging attributes of UI elements defined in code vs some XML format is in my mind the same level of effort. button.SetBackground(<color>) or <button backgroundColor="<color>" /> I see no difference there. EDIT: Ok the main difference I guess would be having to switch files (and thus context) which could be annoying. Plus there's also the non-zero performance impact from having to parse an XML format.
- 999900000999 5y agoWhat if you have stacked elements, or elements within elements. <Box> <Button> <Icon/> </Button> </Box> In code it's something weird like Box(button( Icon() )))
- a-priori 5y agoBefore you start picking up a library like this, keep in mind that no immediate-mode GUI library I'm aware of (including this one from what I can see in the source code) has support for assistive technologies such as screen readers. To them the whole UI is one big black box, so your program is completely useless to anyone with a wide range of disabilities.
- milansuk 5y agoDo operation systems have APIs, so the program can send them what is on the screen? I mean just description like: There is the button with title "Push me" in the rectangle(50, 50, 100, 70), etc. Or are there any "screen reader" libraries?
- fatih-erikli 5y agoThere's a10n standards defined by w3c, https://www.w3.org/TR/using-aria/ https://www.w3.org/TR/using-aria/.
- a-priori 5y agoYes. I don’t know about Windows but I know that for OSX you need to implement the NSAccessibility protocol in AppKit. This gives you a way to describe the hierarchy of the UI and to notify the system of important changes.
- deleted 5y ago[deleted]
- pjmlp 5y agoYes they do, at least Apple, Google and Microsoft ones. On GNU/Linux, I think the only thing that exists in the Gtk+ features that were originally sponsored by Sun.
- malkia 5y agoEven systems like Qt, where things are drawn using non-native widgets support that (I was long proponent of wxWidgets, because I thought assistive tech is only support only if you use native widgets. The idea of API where you explain what you are showing, and how to interact with it never came to my mind, but with ARIA - like any browser that's the way to go). Not only that, but I thhink assistive tech should allow you do to easier GUI testing too, but haven't digged into that idea yet (probably folks already are)
- nanochad 5y agoImmediate mode GUI is a very nifty concept. Kind of like learning about fully persistent data structures for the first time. But I wonder, does it scale?
- synergy20 5y agoI have seen quite often 'immediate mode gui' on HN and elsewhere these days,I rarely do GUI myself, where are these im-gui's use cases? gaming only? or some embedded boards with limited resources can benefit to draw some pixels on a small LCD for a simple GUI(even that people are more likely use some light-weight x11 like libraries instead of im-gui library)? Other than game-development why is im-gui better than those normal widget kits we are relatively more familiar with: gtk, qt,etc)? or im-gui is specifically for gaming coding?
- flohofwoe 5y agoIt's (more or less) just a different approach to describe a UI through code which does away with objects, event handlers or data binding. Very convenient for purely code driven UI development.
- quotemstr 5y agoMany people at a certain point in their careers become infatuated with the idea of making a "small", "simple", and "opinionated" component free from legacy "BS". They have the skill to implement the core of that component but lack the wisdom and humility to understand that the "BS" complexity exists for good reasons, that their "small" component is subject to those reasons, and that they haven't actually found a fundamentally better approach that avoids the "BS", but merely skipped the hard parts of software engineering. You just have to let people go through this phase. You should nod, smile, and compliment them on the economy of their vision. This phase hones skills people need for more serious endeavors. Butt God help you if you actually use one of these "small" systems in production!
- throwaway684936 5y agoImmediate mode is generally used for quick and dirty developer tools. It's rarely used for user-facing UI. You're free to waste your time carefully architecting an MVC application any time you want a few text boxes and sliders to fiddle with something. Microsoft, Google, Nvidia, Valve, Id, Blizzard, Ubisoft will continue to use immediate mode where they deem it useful, in spite of your advice.
- 5y ago
- hexomancer 5y agoDoes it support RTL languages? My main problem with DearImgui is lack of RTL language support. I think one of the biggest factors which deter people from using immediate mode GUI is lack of support for many languages.
- artemonster 5y agoWhat languages?
- poisonborz 5y agohttps://en.wikipedia.org/wiki/Right-to-left_script https://en.wikipedia.org/wiki/Right-to-left_script
- hn_version_0023 5y agoI believe they’re referring to languages that read “Right To Left”
- artemonster 5y agoThanks!
- eliasnaur 5y agoFWIW, Gio (gioui.org) recently added support for RTL languages and complex scripts. So there's no fundamental reason immediate mode UIs can't have the nice features you're used to from retained mode UIs.
- infogulch 5y agoThere has been a recent explosion of immediate-mode GUIs recently, but I'm skeptical that an immediate-mode solution can cover our GUI needs now and into the future. High refresh rate screens are a reality so you only have 3-6ms to render each frame, as well as high resolution screens at 4k-8k. That's a lot of pixels to push with a CPU on every frame. As another comment points out we also need accessibility. I would generalize this need as "GUIs need to be reinterpretable", this need is not limited to those with disabilities and such a capability can be useful to anyone that wants to customize, automate, and integrate their digital tools. Are immediate-mode GUIs up to the task? What is driving their authors to pursue this design? Why aren't they choosing a declarative design?
- hexomancer 5y agoAll these pixels have to be pushed every frame even with classic GUI. The only difference is that it is usually done by the operating system.
- infogulch 5y agoThe advantage of a declarative design is that it can be accelerated by the GPU which has a much better scaling computational architecture to serve this need.
- Kranar 5y agoThis doesn't make any sense. GPUs know nothing about declarative or imperative designs. Many immediate mode GUIs output a vertex buffer or a list of draw commands that can then be rendered anyway you choose, including having it rendered by a GPU.
- _trackno5 5y agoCan you give more details on how this GPU acceleration works?
- dymk 5y agoBoth declarative and imperative UI frameworks benefit just fine from GPU acceleration, that's orthogonal to the underlying drawing mechanism
- AbuAssar 5y agoDoes anyone care to explain what immediate mode means?
- deleted 5y ago[deleted]
- delian66 5y agoSee https://en.wikipedia.org/wiki/Immediate_mode_(computer_graphics) https://en.wikipedia.org/wiki/Immediate_mode_(computer_graph... , and https://en.wikipedia.org/wiki/Immediate_mode_GUI https://en.wikipedia.org/wiki/Immediate_mode_GUI . TLDR: instead of declaring your GUI objects/components ahead of time, and letting a framework render the prepared scene graph (while calling you back when there are user triggered state changes), you just draw the GUI objects yourself in your main loop, just like you draw all your other objects (backgrounds, sprites, models etc).
- modeless 5y agoImmediate mode is a style of API where important state is kept in user code instead of being retained inside the API implementation. For example, an immediate mode GUI checkbox implementation does not store a boolean value determining whether the checkbox is checked. Instead, user code passes that information as a function parameter whenever the UI needs to be drawn. Even the fact that a checkbox exists on screen is not stored in the GUI library. The checkbox is simply drawn when user code requests it each frame. Couterintuitively this is often less complicated than the traditional "retained mode" style of GUI libraries because there is no duplication of state. That means no setup or teardown of widget object trees, no syncing of state between GUI objects and application code, no hooking up or removing event handlers, no "data binding", etc. The structure and function of your UI is naturally expressed in the code of the functions that draw it, instead of in ephemeral and opaque object trees that only exist in RAM after they're constructed at runtime. You retain control over the event loop and you define the order in which everything happens rather than receiving callbacks in some uncertain order from someone else's event dispatching code. Crucially, "immediate mode" is a statement about the interface of the library, not the internals. Common objections of the form "immediate mode GUIs can't support X" or "immediate mode GUIs are inefficient because Y" are generally false and based on a misconception that immediate mode GUIs are forbidden from retaining any internal state at all. It is perfectly normal for an immediate mode library to retain various types of internal state for efficiency or other reasons, and this is fine as long as the state stored in user code remains the source of truth. This can even go as far as internally constructing a whole retained widget tree and maintaining it via React-like tree diffing.
- pmorici 5y agoCan this be used with the Linux frame buffer device on embedded systems without a window manager?
- msie 5y agoWhere's the source code? :D I looked under /src and didn't find much. I couldn't find raygui.c and that should be under /src.
- deleted 5y ago[deleted]
- msie 5y agoOops it’s header only lib.