In a first step we are going through the minimal needed application initialization to display some contend using disko.
To follow this part, have a look at the tutorials/01 folder.
During initialization disko assumes that there are some files existent, that make things a little easier to maintain later on. These files are:
In this tutorial, each step will provide its own version of these files, and subsequent explanations, what can be achieved with them.
The function mmsInit() is used to initialize a disko application.
bool mmsInit(MMSINIT_FLAGS flags, int argc = 0, char *argv[] = NULL, string configfile = "");
The parameters are used as follows:
flags decide which different systems should be initialized. E.g. plugin manager,
window manager, event manager etc. argc and argv are mainly
used to deliver parameter to underlying frameworks, especially DirectFB. configfile
is the filename of disko configuration file. This file contains the configuration to the
different systems provided by disko. If empty, disko will search /etc/
and ~./disko/ for diskorc.xml.
Most important for now are the graphic settings. In this example these settings are configured to use the DirectFB X11 backend, in 800x600 and ARGB for pixelformat.
Example 1. diskorc.xml dfbsettings
<dfbsettings >
<parameter name="xres" value="800" />
<parameter name="yres" value="600" />
<parameter name="outputtype" value="x11" />
<parameter name="videolayerid" value="0" />
<parameter name="videolayerpixelformat" value="ARGB" />
<parameter name="videolayeroptions" value="" />
<parameter name="videolayerbuffermode" value="BACKSYSTEM" />
<parameter name="graphicslayerid" value="0" />
<parameter name="graphicslayerpixelformat" value="ARGB" />
<parameter name="graphicslayeroptions" value="" />
<parameter name="graphicslayerbuffermode" value="BACKSYSTEM" />
<parameter name="vrect.x" value="0" />
<parameter name="vrect.y" value="0" />
<parameter name="vrect.w" value="800" />
<parameter name="vrect.h" value="600" />
<parameter name="touchrect.x" value="0" />
<parameter name="touchrect.y" value="0" />
<parameter name="touchrect.w" value="0" />
<parameter name="touchrect.h" value="0" />
</dfbsettings>
To see the full file, just have a look into the diskorc.xml in the tutorials/01 folder.
We use mmsInit() to just initialize the disko system with the window manager and a local diskorc.xml.
mmsInit(MMSINIT_WINDOWMANAGER, argc, argv,"./diskorc.xml");
To see something happen on the screen we will have to create a window first, and add a basic label to that window. This is achieved by following code.
/* create a root window */
MMSRootWindow *window = new MMSRootWindow("","100%","100%");
/* create and add hello world label */
MMSLabel *mylabel = new MMSLabel(window, "");
mylabel->setFont("./","DejaVuSansMono.ttf",16);
mylabel->setText("Hello World");
window->add(mylabel);As you can see we chose a RootWindow to create. Disko knows three different types of windows RootWindow, Mainwindow and OSDWindow. RootWindows are windows that should be used for the main application windows. More information to the topic will follow later in this tutorial.
Windows can be shown or hided. To see the window on the screen we will show this window by a simple
window->show();
After that, the application has nothing to do in peculiar.
while(1) sleep(1);
After startup the application could be stopped by pressing Ctrl+C.

The resulting window should look like this