[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Q:SIM_AGENT - like displays with SWARM?
From: |
Marcus G. Daniels |
Subject: |
Re: Q:SIM_AGENT - like displays with SWARM? |
Date: |
13 Apr 1999 09:25:15 -0700 |
>>>>> "EW" == Eric Werk <address@hidden> writes:
EW> I like the way the agents moved in
EW> continuous space and were represented by easily-identifiable
EW> characters. I was wondering how to make a similar graphic output
EW> with the SWARM system, for my agents.
One way is to make Pixmaps that represent text strings (and put them
on a fine raster). Another way is to put the agents on a Canvas, like this:
#import <simtools.h>
#import <gui.h>
#define WAIT while (GUI_EVENT_ASYNC ()) {} sleep (1);
int
main (int argc, const char **argv)
{
id <Canvas> canvas;
id <NodeItem> critter1, critter2;
initSwarm (argc, argv);
canvas = [Canvas create: globalZone];
[canvas setWidth: 250 Height: 250];
[canvas setWindowTitle: "Canvas"];
[canvas pack];
critter1 = [OvalNodeItem createBegin: globalZone];
[critter1 setCanvas: canvas];
[critter1 setX: 100 Y: 100];
[critter1 setString: "Critter1"];
critter1 = [critter1 createEnd];
critter2 = [OvalNodeItem createBegin: globalZone];
[critter2 setCanvas: canvas];
[critter2 setX: 150 Y: 150];
[critter2 setString: "Critter2"];
critter2 = [critter2 createEnd];
WAIT;
[critter1 moveX: 50 Y: 0];
WAIT;
[critter2 moveX: 0 Y: 50];
WAIT;
while (1) { while (GUI_EVENT_ASYNC ()) {} }
}
/*
Local Variables:
compile-command: "/opt/src/mgd/packages/development/egcs/bin/gcc -o canvas -g
-Wno-import -L/opt/SUNWtcl/8.0/sun4/lib -R/opt/SUNWtcl/8.0/sun4/lib
-L/opt/SDGblt/2.4g/lib -R/opt/SDGblt/2.4g/lib -L/opt/SDGlibffi/1.20/lib
-R/opt/SDGlibffi/1.20/lib -L/opt/SDGswarm/1.4.1/lib -L/opt/SDGzlib/1.1.3/lib
-L/usr/local/X11/lib -R/usr/local/X11/lib -L/usr/openwin/lib -R/usr/openwin/lib
-L/opt/SDGhdf5/1.0.1/lib -I/opt/SDGswarm/1.4.1/include canvas.m -lanalysis
-lsimtools -lsimtoolsgui -lactivity -ltkobjc -lrandom -lobjectbase -ldefobj
-lcollections -lmisc -ltclobjc -ltk8.0 -ltcl8.0 -lBLT -lsocket -ldl -lnsl
-L/usr/openwin/lib -lhdf5 -lpng -lz -lXpm -lX11 -lffi -lm -lobjc -lpthread
-lposix4"
End:
*/
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.