Please take a look at my graphic library sdl_chomik_widgets-0.0.4.zip. You can unpack it into a separate folder. The library is in its early stage. You can resize the windows (those intended to be resizable).
The library requires sdl_chomik 0.2.0 or later.
# first you need to include the library
include "sdl_chomik_widgets.sdl_chomik"
# load extra images
<create new image "background_tile.png">;
let my background tile image index = <the created image index>;
<create new image "chomik.png">;
let my chomik image index = <the created image index>;
# then create all your widgets
<please create new window widget at 32 and 32 of width 6 and height 6>;
let my window A index = <the made widget index>; # you may store the indeces to your own variables
<please create new button widget at 100 and 100 of width 3 and height 1 and text "HELLO">;
let my button X hello index = <the made widget index>;
# optionally you may attach the buttons to your windows:
# then they will not be standalone any more
<please attach widget <my button X hello index> to <my window A index>>;
# you may also register the click handlers
<please register on click { <print "hello">; } for the button index <my button X hello index>>;
# assign the event handlers...
let on mouse motion = value code
{
<please handle mouse motion on <the widget mode>>;
};
let on mouse button left=value code
{
<please handle mouse left click on <the widget mode>>;
};
let sdl loop body = value code
{
<show image <my background tile image index> 0 0>;
<please show all widgets>;
<show image <my chomik image index> 0 0>;
};
# ... and then run the SDL loop
<sdl loop>;