Hello Interaction!


/* main.sma */
use core
use base
use gui

_main_
Component root {
  Frame f ("Hello Interaction!", 0, 0, 500, 400)
  Exit quit (0, 1)
  f.close->quit
}

run root
run syshook
          

The program starts by loading the required modules core, base and gui. The keyword _main_ states that this file contains the main program, then we build a tree of components. The program appends three children to the root component: a Frame, an Exit component, and what we call a Binding (symbolized by the arrow) that connects the built-in close frame's child to the quit component. The last two lines start the root component then the event loop provided by Smala and named syshook.

Compile this program with:

smalac main.sma

This will generate a main.cpp file that can be compiled with:

gcc -I<path-to-djnn-header> main.cpp -o app -L<path-to-djnn-libs> -ldjnn-core -ldjnn-base -ldjnn-gui

For convenience, you can find here the skeleton of a Smala application. Change the paths in the provided Makefile to fit with your own installation.