I’m in the same boat as everyone else, really excited to play around with this. Tracking the UI events using processes looks cool, it looks like api for this piece is modeled after genservers which makes it feel familiar. It seems like all of the tools would be a place to build a “retained mode” style ui library using this as the backbone, where you could have predefined ui elements and positioning.
I don’t know much about OpenGL, I’m curious how this compares to wxWidgets and the wx/gl erlang libraries. I know that wx has a lot of predefined ui stuff, but I think you are able to create more ‘freeform’ things with it as well. The api here certainly looks a lot nicer and more elixiry. The notes mention that he’s using glut, which I guess is another OpenGL toolkit. Does he say in the talk if that binding happens using ports?
He does a nice overview of the API here, hopefully we’ll be able to check out the internals soon enough.
The Colors.Style code he showed looked like a good case for compile time code generation, rather than manually creating a function for each of the css spec named colors. I whipped something together using colors directly from the spec, though I kind of like the configuration-esque aesthetic of his. I just copy-pasted directly from the page and did some minor search-replaces to make it easier to parse.
defmodule CssColors do
# Colors definitions taken from csswg Extended Color / SVG spec
#
# https://www.w3.org/TR/SVG/types.html#ColorKeywords
# ...
# antiquewhite 250,235,215
# aqua 0,255,255
# aquamarine 127,255,212
# ...
@colors "priv/colors-spec" |> File.read!
def to_rgba({r, g, b, a}),
do: {r, g, b, a}
def to_rgba({r, g, b}),
do: {r, g, b, 0xFF}
def to_rgba(<<r::size(8), g::size(8), b::size(8), a::size(8)>>),
do: {r, g, b, a}
def to_rgba(named) when is_atom(named),
do: to_rgba(named, 0xFF)
def to_rgba({named, alpha}) when is_atom(named),
do: to_rgba(named, alpha)
for line <- String.split(@colors, "\n", trim: true) do
[name_str, rgb_str] = String.split(line)
name = String.to_atom(name_str)
[r, g, b] = String.split(rgb_str, ",") |> Enum.map(&String.to_integer/1)
def to_rgba(unquote(name), a), do: {unquote(r), unquote(g), unquote(b), a}
end
end