Live data from Hacker News

Raygui – A simple and easy-to-use immediate-mode GUI library

github.com

81–90 of 117 posts

Re: Raygui – A simple and easy-to-use immediate-mode GUI library

#81

Earlier quoted context omitted.

> Now attach some callbacks. Not that any of this is relevant to immediate mode GUI, but the actual attachment of callbacks can be done identically in code no matter how the base UI design is done if you want it separately, but if you do it in code (whether with normal syntax or a funky transform like JSX) you can also have the option of direct attachment. > With pure code, I have to attach the callbacks directly to…

Let's say you have a really complex UI. Would you really define your UI in code over XML or HTML

Yes.

The more complex and more dynamic the UI, the worse the separation gets. The worst of it being when you’re writing code to generate your XML/HTML, and probably introducing a third “templating” language to continue the pretense that HTML/XML is not just standard data structures defined in a different syntax.

The purpose of XML/HTML is to make your GUI specification independent of the programming language itself, and independent of any particular library (anyone can spit out an HTML … it’s quite difficult for C++ to construct a Java Button class).

And there’s some notion that it’s easier for “non-programmers” to edit, without being bogged down programming language details (its “easier” to learn HTML than Java… and as programmers we eat the cost by now having to learn both)

Re: Raygui – A simple and easy-to-use immediate-mode GUI library

#82

Related, 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

Brilliant project and execution. I love the idea of bringing the tactile experience together with a digital gaming experience.

Re: Raygui – A simple and easy-to-use immediate-mode GUI library

#83

Earlier quoted context omitted.

All 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.

The 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.

This 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.

Re: Raygui – A simple and easy-to-use immediate-mode GUI library

#84

Before 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.

Do 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?

Aren't you then trying to bridge an immediate mode API (rendering controls) and a retained mode API (assistive tech).

Re: Raygui – A simple and easy-to-use immediate-mode GUI library

#85

I 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 thos…

The immediate mode gui is largely a myth, IMHO.

The concept of gui fully controlled by program data works well for interfaces consisting of a single button. As soon as we have two buttons, each button has a position, and the positions is the data of the gui itself (retained data), not of the program.

Imagine a multi-tab interface - which tab is currently active and has its controls drawn is the property of the gui (retained data), again.

An action that can be invoked through a menu and can also be added to a toolbar. The toolbar can be expanded or collapsed. Again, that's data of the gui itself (of the view), not of the program (the model).

The currently focused button should be highlighted somehow - the property of the gui again.

Selected elements of a list (they should be highlighted). Expanded/collapsed state of a tree widget nodes. Scroll positions.

So, the immediate mode guis are interesting and somewhat liberating because they demonstrate one can easily build simple ui without complex widget libs, but the results are limited, and very soon stop being really immediate mode. When evolving, they become reinvented wheels of retained mode guis.

Re: Raygui – A simple and easy-to-use immediate-mode GUI library

#86

Before 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.

The immediate mode Gio (gioui.org) toolkit has support for accessibility (on Android for now), IME and, recently, RTL text layout. Disclaimer: I'm the author.

pretty awesome lib!

Re: Raygui – A simple and easy-to-use immediate-mode GUI library

#87

Related, 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

Ive 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!

Re: Raygui – A simple and easy-to-use immediate-mode GUI library

#88
post #73

Earlier quoted context omitted.

The best explanation is probably the one by Casey Muratori ( https://caseymuratori.com/blog_0001 ). He devised the technique and conied the term in 2002.

Can't imagine he was the first person to use this technique. I'd assume any game written from the point where it was reasonable to continually redraw the screen instead of using incremental repainting would've used such a technique, because it's simply the easiest way to implement random ad-hoc GUIs if you don't have a widget toolkit underneath you (and possibly even if you do).

Probably. I was using a similar technique in the late 80s in turbo pascal. Casey has the merit to have given it a name and make a video about it.

Re: Raygui – A simple and easy-to-use immediate-mode GUI library

#89

Earlier quoted context omitted.

Do 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?

Aren't you then trying to bridge an immediate mode API (rendering controls) and a retained mode API (assistive tech).

Yes. This has influenced the design of my AccessKit [1] project. With AccessKit, the application (or GUI toolkit) pushes tree updates to the platform adapter, which maintains a complete tree that it uses to implement the platform-specific accessibility API. Each application-supplied tree update can be a full tree or just the nodes that have changed. So an immediate-mode GUI can push a full tree every frame. There just has to be some way of keeping node IDs stable across frames.

[1]: https://github.com/AccessKit/accesskit

Re: Raygui – A simple and easy-to-use immediate-mode GUI library

#90
post #28

Earlier quoted context omitted.

But 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

Changing attributes of UI elements defined in code vs some XML format is in my mind the same level of effort. button.SetBackground( ) or " /> 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.

The nice thing about separating the view definition from the controller code is you can work on the view without actually running code. Most retained mode GUIs have standalone view editor. That's essentially not possible in immediate mode guis without a lot more mocking of code.
Post reply on HN