11. Utilisation du Yocto-MaxiDisplay en C#
}
//clean up
disp.resetAll();
// retreive the display size
w
= disp.get_displayWidth();
h
= disp.get_displayHeight();
// reteive the first layer
l0
= disp.get_displayLayer(0);
// display a text in the middle of the screen
l0.drawText(w
// visualize each corner
l0.moveTo(0,
l0.lineTo(0,
l0.lineTo(5,
l0.moveTo(0, h
l0.lineTo(0, h
l0.lineTo(5, h
l0.moveTo(w
l0.lineTo(w
l0.lineTo(w
l0.moveTo(w
l0.lineTo(w
l0.lineTo(w
// draw a circle in the top left corner of layer 1
l1
= disp.get_displayLayer(1);
l1.clear();
l1.drawCircle(h
// and animate the layer
Console.WriteLine("Use Ctrl-C to
x
= 0;
y
= 0;
vx
= 1;
vy
= 1;
while (disp.isOnline()) {
x
+= vx;
y
+= vy;
if
((x
< 0) ||
if
((y
< 0) ||
l1.setLayerPosition(x, y,
YAPI.Sleep(5,
}
YAPI.FreeAPI();
}
}
}
11.4. Contrôle de la partie module
Chaque module peut-être contrôlé d'une manière similaire, vous trouverez ci-dessous un simple
programme d'exemple affichant les principaux paramètres d'un module et permettant d'activer la
balise de localisation.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace
ConsoleApplication1
{
class
Program
{
static
void
usage()
{
string
execname
Console.WriteLine("Usage:");
62
/
2, h
/
2, YDisplayLayer.ALIGN.CENTER,
5);
0);
0);
- 6);
- 1);
- 1);
-
1, h
- 6);
-
1, h
- 1);
-
6, h
- 1);
-
1,
5);
-
1,
0);
-
6,
0);
/
8, h
/
8, h
/ 8);
(x
>
w
-
(h
/ 4)))
(y
>
h
-
(h
/ 4)))
0);
ref errmsg);
= System.AppDomain.CurrentDomain.FriendlyName;
stop");
vx
= -vx;
vy
= -vy;
"Hello
world!");
www.yoctopuce.com