aboutsummaryrefslogtreecommitdiff
path: root/zinclib.d/doc/HOWTO
blob: 6d41c5b18afde5e3b0e0e793b7c3204a79b4b848 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
How to use zinclib
==================

Required lines
--------------

To use zinclib in you code you need to include zinclib :

 #include "Zinc.hpp"

Then you must load the tcl interpreter and the zinc library :

 Zinc::load (argv[0]);


Zinc usage
----------

First create a zinc widget. Each widget has its own windows and
instantly visible. 

  Zinc* zn = new Zinc (ZINC_BACKEND_OPENGL);


All available functions are in Zinc.hpp and ZincPath.hpp
You can change and read properties of the widget with set and get
commands. Ex :

  zn->setWidth (640);


To draw in the widget, you need to create items uning itemCreate
functions. The parent group can be NULL, in which case, the default
one will be used.

  ZincItem* item = zn->itemCreateRectangle (NULL, 10, 10, 100, 100);

To change item property, use itemSet functions.

  zn->itemSetFilled (item, true);

To remove an item use itemRemove

  zn->itemRemove (item);

Don't forget do delete item returned by itemCreate. This is different
from removing it from zinc. Usualy, delete item is called after
removing it, but you can delete it whenever you want.


Many zinc function can take a tag as an argument. To use such a tag,
create it using createTag.

  ZincItem* tag = zn->createTag ("tag");
  zn->itemSetFilled (tag, true);