Uderzo v0.9.1 Uderzo.Bindings View Source
Uderzo Elixir->C bindings in Clixir. Note that for demo purposes, this is a hodgepodge of various modules - NanoVG, GLFW, utility methods, demo methods; there's nothing however that precludes a clean separation. Yet ;-)
Link to this section Summary
Functions
Create a window using the GLFW library. The window will have the indicated height and width.
Destroy the indicated window. window
is a window handle returned from
glfw_create_window/4
.
Complete a frame. Similarly to uderzo_start_frame/2
, this
does some housekeeping and eventually a buffer swap to
display the frame. When complete, this sends the atom
:uderzo_end_frame_done
to pid
. This can be used to
synchronize on complete frames.
Initialize Uderzo. Calling this is mandatory.
Setup the start of a frame. This function combines several things that should happen at the start of every frame: get the window size, the cursor position, etcetera, then set the viewport and clear the framebuffer.
Link to this section Functions
Create a window using the GLFW library. The window will have the indicated height and width.
Upon completion, one of two results will be sent to pid
:
{:error, error_message}
when an error occurs{:glfw_create_window_result, window_handle}
on success. Thewindow_handle
must be stored and passed into later drawing operations.
On the RaspberryPi 3 VideoCore target, this function still needs to be called even though an actual window is not created.
Destroy the indicated window. window
is a window handle returned from
glfw_create_window/4
.
Complete a frame. Similarly to uderzo_start_frame/2
, this
does some housekeeping and eventually a buffer swap to
display the frame. When complete, this sends the atom
:uderzo_end_frame_done
to pid
. This can be used to
synchronize on complete frames.
On the Raspberry Pi 3 this function will also copy the
contents of the frame to the secondary framebuffer, /dev/fb1
,
if available. This secondary framebuffer usually corresponds with a
correctly configured HAT display (see the Nerves demo in the Uderzo
source repository for an example).
Initialize Uderzo. Calling this is mandatory.
Upon completion, pid
will receive :uderzo_initialized
, after which
drawing can commence.
Setup the start of a frame. This function combines several things that should happen at the start of every frame: get the window size, the cursor position, etcetera, then set the viewport and clear the framebuffer.
When this function completes, it sends the mouse location and window dimensions back:
{:uderzo_start_frame_result, mouse_x, mouse_y, win_width, win_height}
It's recommended to wait for this message and then send the rest of the frame drawing commands.