SRL Archive - OSR Help

Drawing objects on screen?


ookamocka

2013-03-09 11:16:21

what's the best way to go about drawing objects onto the smart client, i.e. circles etc.?

e.g. drawing a small circle somewhere on the minimap at coords x,y?

Sjoe

2013-03-09 11:20:02


procedure SMART_DrawCircle(Clear: Boolean; Center: TPoint; Radius: Integer; Fill: Boolean; Color: TColor);

//example:

SMART_DrawCircle(False, Point(252, 50), 5, False, clRed);

if 'Fill' is true it will fill the circle, otherwise it draws just the border.
if 'Clear' is true it will clear the SMART Canvas: meaning it will remove the drawing.

Insert your coords x,y in Point(x,y)

ookamocka

2013-03-09 11:47:51

From: Sjoekeloe

procedure SMART_DrawCircle(Clear: Boolean; Center: TPoint; Radius: Integer; Fill: Boolean; Color: TColor);

//example:

SMART_DrawCircle(False, Point(252, 50), 5, False, clRed);

if 'Fill' is true it will fill the circle, otherwise it draws just the border.
if 'Clear' is true it will clear the SMART Canvas: meaning it will remove the drawing.

Insert your coords x,y in Point(x,y)


awesome! this'll make debugging so much easier =D


oh, i forgot to ask… deleting/moving the circle around?

or better yet would probably be documentation of the smart functions?


haven't found the documentation but i did find this function…

procedure SMART_ClearCanvasArea(Area: TBox);

would constant clearing/redrawing to keep it updated lag up the processing of the script too much? or would there be a better way to keep the objects where i need them dynamically?


oh and another edit… if that is the way to do it (constant clear/redraw) is there a way to multithread so I can have it running while my script is running? yes, I know i can just put it in the main loop, but i'd rather multithread it if possible

Le Jingle

2013-03-09 12:26:05

TTimer, doesn't work as far as I know; thus multithreading with your current build won't happen in the script runtime.

You can, however, add some waits to your loops to help lower intensive CPU functions.

ookamocka

2013-03-09 12:37:36

From: Le Jingle
TTimer, doesn't work as far as I know; thus multithreading with your current build won't happen in the script runtime.

You can, however, add some waits to your loops to help lower intensive CPU functions.


oh, well that sucks =/

so would repeated drawing/clearing be the best way of keeping objects drawn dynamically on the screen/

Le Jingle

2013-03-09 13:07:30

From: ookamocka
oh, well that sucks =/

so would repeated drawing/clearing be the best way of keeping objects drawn dynamically on the screen/


Yes, for if the object moves, you'd need to redraw it, thus done via clearing a canvas area (less intensive for clearing a smaller area, rather than clearing the entire screen).

ookamocka

2013-03-09 13:31:50

From: Le Jingle
Yes, for if the object moves, you'd need to redraw it, thus done via clearing a canvas area (less intensive for clearing a smaller area, rather than clearing the entire screen).


sounds good.