Building a GUI toolkit with gloss

104 views
Skip to first unread message

Adrian Sieber

unread,
Nov 18, 2020, 5:18:03 PM11/18/20
to Haskell Gloss
Somehow I have started to develop a GUI toolkit on top of gloss 😅. Now, before I descent even further down this rabbit hole, I wanted to ask if there is a reason why this is an awful idea?

It will be a lot of low level pixel calculation work for sure, but I like the thought of most of my code being written in pure Haskell and having the full flexibility of changing anything.

What are your thoughts on this?

Manuel Bärenz

unread,
Nov 19, 2020, 6:37:40 AM11/19/20
to haskel...@googlegroups.com
> What are your thoughts on this? --

I've thought about doing this myself for a little Gloss game
(https://github.com/turion/sonnendemo) and I think it's in principle a
good idea. Actually, I expected something like this to exist, but it
didn't (I think).

It's harder for some Gloss pictures than other. E.g. how would you do
collision detection for text? You would have to know how wide each
character is in order to find out whether someone clicked on it.

Maybe there already exists something like that for OpenGL? Not sure how
much that would help though.


Ben Lippmeier

unread,
Nov 22, 2020, 1:51:28 AM11/22/20
to haskel...@googlegroups.com, Adrian Sieber
You’ll need to put some work in to get decent text support. Traditionally Gloss has just used the GLUT support for vector fonts, which isn’t good enough for a nice GUI library. There are real Haskell font libraries now, several on Hackage, but I haven’t looked into integrating one yet.

Ben.


Chris Smith

unread,
Nov 22, 2020, 10:23:27 AM11/22/20
to haskel...@googlegroups.com
I think it depends on your use case.  If you want to make more interactive demos, great. You should acknowledge going in, though, that you will not end up with a production-ready UI toolkit.

 In particular, accessibility will be essentially impossible to get right.  You will have users who have adjusted their UI settings to increase text sizes, use high contrast color schemes, etc., and these settings live in OS-specific places and are built into native controls.  Even worse, screen readers really heavily on being able to introspect widgets, extract their properties, manipulate focus, etc.

--
You received this message because you are subscribed to the Google Groups "Haskell Gloss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-glos...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/haskell-gloss/97266006-deed-411a-8a9d-351d40990163n%40googlegroups.com.

Adrian Sieber

unread,
Nov 25, 2020, 7:19:38 PM11/25/20
to Haskell Gloss
You’ll need to put some work in to get decent text support. Traditionally Gloss has just used the GLUT support for vector fonts, which isn’t good enough for a nice GUI library. There are real Haskell font libraries now, several on Hackage, but I haven’t looked into integrating one yet.

I was actually thinking about building all UI elements (including text) with sprites for the time being. (Especially since gloss has no support for anti-aliasing at the moment. Btw: Maybe we can bump up the priority of this feature a little 😇). So this would leave me with layouting and user interaction.

I guess a few things should better be implemented in OpenGL / GLUT, but I have not much knowledge about it, and honestly I'm not really keen on learning more about it 😅. So this would also be kind of a fun experiment how much can be achieved in Haskell already.


 In particular, accessibility will be essentially impossible to get right.  You will have users who have adjusted their UI settings to increase text sizes, use high contrast color schemes, etc., and these settings live in OS-specific places and are built into native controls.  Even worse, screen readers really heavily on being able to introspect widgets, extract their properties, manipulate focus, etc. 

Thanks for bringing this up. Hadn't thought about that yet, to be honest.
But unfortunately, I don't have the capacity to take this into consideration right now. Hopefully in the future.


Reply all
Reply to author
Forward
0 new messages