Function:ss2scs
From S2PLOT
ss2scs
Set the camera speed.
Prototype
void ss2scs(float spd);
Description
Set the camera speed (ie. increment amount for camera movements. Values between 0.01 and 20.0 are reasonably sensible.
See Also
ss2qcs | Query the camera speed. |
ss2qca | Query the camera aperture. |
ss2sca | Set the camera aperture. |
ss2sc | Set the camera position, up vector and view direction. |
ss2qc | Query the camera position, up vector and view direction. |
Code Example
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "s2plot.h"
void cb(double *t, int *kc)
{
static int lkc = 0; /* Count of key presses */
static float spd = 1.0; /* Set the camera increment */
if (lkc != *kc) { /* Query whether <space> was pressed */
spd += 2.0; /* Update the camera increment */
}
ss2scs(spd); /* Set the new camera increment */
char string[32]; /* Write current increment to screen */
sprintf(string,"%.2f",spd);
s2textxy(0,0,0,string); /* Display text */
lkc = *kc; /* Update key press count */
}
int main(int argc, char *argv[])
{
srand48((long)time(NULL)); /* Seed random numbers */
s2opend("/s2mono",argc, argv); /* Open the display: mono */
s2swin(-1.,1., -1.,1., -1.,1.); /* Set the window coordinates */
s2box("BCDE",0,0,"BCDE",0,0,"BCDE",0,0); /* Draw coordinate box */
s2lab("","","","Press <space> to change camera movement increment, then +/- to test zooming\n");
cs2scb(cb); /* Install dynamic callback */
s2show(1); /* Open the s2plot window */
return 1;
}
Back to S2PLOT function list.