Hello everybody, (using LabWindows/CVI 6.0)
my program displays in the CANVAS an bitmap (map). A person will walk through this map (from one point to another) and is displayed with a rectangle. When the person change his position, the panel will cleaned and then the map will display again and then the new position of the person.
The functions I used work when I don't use the for-loop. (only one "go-through")
When I use the for-loop, it displays no rectangle until it release the loop and than the program hang-up.
int CVICALLBACK MOVING_FUNC (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
int startX, startX;
int endX, endY;
int displayX, displayY;
int truedisplayY;
int map;
int i;
int sts = startX;
int color = MakeColor(255,0,0);
for (i=startX; i<=endX; i++)
{
truedisplayY = ((endY - startY)/(endX - startX)) * (sts - startX) + startY;
displayY = RoundRealToNearestInteger(truedisplayY);
displayX = sts;
CanvasClear(panel, PANEL_CANVAS, VAL_ENTIRE_OBJECT);
CanvasDrawBitmap(panel, PANEL_CANVAS, map, VAL_ENTIRE_OBJECT, MakeRect(0,0, VAL_KEEP_SAME_SIZE, VAL_KEEP_SAME_SIZE);
SetCtrlAttribute(panel, PANEL_CANVAS, ATTR_PEN_COLOR, color);
SetCtrlAttribute(panel, PANEL_CANVAS, ATTR_PEN_FILL_COLOR, color);
CanvasDrawRect(panel, PANEL_CANVAS, MakeRect(displayY, displayX, 5, 5), VAL_DRAW_FRAME_AND_INTERIOR);
sts = sts + 1;
Delay(1);
}
return 0;
}
thx
Florian