GDdraw2d_cursor
Synopsis
Define a module to draw a cross-hair cursor
group GDdraw2d_cursor_notify_templ {
int+IPort2 state;
GDview_ref_templ+IPort2+read+nonotify &view_in;
method+notify_inst init_func = "GDdraw2d_cursor_create";
method+notify_deinst del_func() = "GDdraw2d_cursor_delete";
method+notify_val upd_func = "GDdraw2d_cursor_update";
};GDdraw2d_cursor_notify_templ GDdraw2d_cursor_templ {
int+IPort2 x;
int+IPort2 y;
int immed<export=3>;
enum mode<export=3> {
choices = {"Clear", "Append"};
};
int size<export=3>;
int thickness<export=3>;
float red<export=3>;
float green<export=3>;
float blue<export=3>;
GDcamera_templ+IPort2 &cam_in;
GDobject_templ+IPort2 &obj_in;
Mesh+OPort2 out_mesh;
ptr+nonotify local_ptr<NEvisible=0>;
};GDdraw2d_cursor_templ GDdraw2d_cursor {
immed = 1;
mode = 0;
size = 10;
thickness = 0;
red = 1.0;
green = 1.0;
blue = 1.0;
};Description
These templates define a module to draw a full screen cross-hair cursor. GDdraw2d_cursor_notify_templ defines the elements that cause the module's update method to execute. GDdraw2d_cursor_templ defines the additional elements that are used at execution time but do not trigger an activation. GDdraw2d_cursor provides initial values to some of the elements. This is the template that should be instanced.GDdraw2d_cursor displays a 2D cross-hair cursor and translates the cursor's screen coordinates to a field.
Input
This input indicates that a draw cursor operation is in progress: 1 means that the operation is beginning; 2 means that the operation is in progress; and 3 means that the operation is completed. You typically connect this to a UItwoPoint's state subobject.
These inputs are the x and y screen space coordinates of the cursor. You typically connect these to the x and y parameters of the UItwoPoint connected to state.
An optional connection to a Graphics Display Kit object. Without a connection to an object, GDdraw2d_cursor creates a field in the connected camera's coordinate system. With a connection to an object, GDdraw2d_cursor creates a field in the connected object's coordinate system.
Parameters
This parameter when set to 1 indicates that immediate mode is on. In immediate mode, GDdraw2d_cursor translates the cursor's position to a field continually during the UItwoPoint interaction. When immed is set to 0, GDdraw2d_cursor translates the cursor's position to a field only at the end of the UItwoPoint interaction.
Output Port
The output field containing the point that the cross-hair was centered at in the appropriate coordinate system.
Example
Libraries.Graphics_Display.Interactivity.UI_Interactivity.DrawCursor2d
File
See also related modules