Hello Interaction!


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

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

          

The program starts by loading the required modules core, base , display 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.

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-display -ldjnn-gui

If you have downloaded the Smala sources you will find in cookbook/stand_alone the skeleton of a Smala application. Change the paths in the provided Makefile to fit with your own installation.