Function:ss2txh

From S2PLOT

(Difference between revisions)
Jump to: navigation, search

Current revision

ss2txh

Enable/disable/toggle the visibility of the cursor cross-hair

Prototype

void ss2txh(int enabledisable);

Description

Enable, disable or toggle the visibility of the cursor cross-hair depending on the value of enabledisable:

  • enabledisable = 1 Enable cross-hair
  • enabledisable = 0 Disable cross-hair
  • enabledisable = -1 Toggle current state of cross-hair visibility

The cross-hair can also be toggled by using the key combination Cntrl-C.

See Also

ss2qxh Query the visibility of the cursor cross-hair


Code Example

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include "s2plot.h"

void cb(double *t, int *kc)
{
   static int cnt = 0;				/* Keep count between calls */
   if (cnt == 25) {				/* About once per second */
      ss2txh(-1);				/* Toggle crosshairs on/off */
      cnt = 0;					/* Reset count */
   } else {
      cnt++;					/* Keep on counting */
   }
}


int main(int argc, char *argv[])
{
   int N = 100;					/* Number of points */
   float x, y, z;				/* Positions */
   float r, g, b;				/* Colours */
   int i;

   srand48((long)time(NULL));			/* Seed random numbers */

   s2opend("/?",argc, argv);			/* Open the display */
   s2swin(-1.,1., -1.,1., -1.,1.);		/* Set the window coordinates */
   s2box("BCDET",0,0,"BCDET",0,0,"BCDET",0,0);	/* Draw coordinate box */

   s2slw(3);	/* Note this does NOT change linewidth - use ns2thpoint */
   for (i=0;i<N;i++) {				/* Random data positions */
      x = drand48()*2.0 - 1.0;
      y = drand48()*2.0 - 1.0;
      z = drand48()*2.0 - 1.0;
      r = drand48();
      g = drand48();
      b = drand48();
      ns2thpoint(x,y,z, r,g,b, 3);		/* Draw the thick point */
   }

   cs2scb(&cb);					/* Install a callback */

   s2show(1);					/* Open the s2plot window */
   
   return 1;
}

Back to S2PLOT function list.


Personal tools