Ejemplo n.º 1
0
struct disp_struct *
disp_table_new_from_nk_file (const char * filename)
{
  struct disp_struct *disp;
  struct disp_table *table;
  FILE * f;
  int j, npt, nread;
  float wlmax, wlmin;

  disp = disp_new (DISP_TABLE);
  table = & disp->disp.table;

  f = fopen (filename, "r");

  if (f == NULL)
    {
      notify_error_msg (LOADING_FILE_ERROR, "Cannot open %s", filename);
      return NULL;
    }

  nread = fscanf(f, "%*i %f %f %i\n", & wlmin, & wlmax, &npt);
  if (nread < 3)
    {
      notify_error_msg (LOADING_FILE_ERROR, "File %s not in NK format",
			filename);
      return NULL;
    }

  disp_table_init (table, npt+1);

  for (j = 0; j <= npt; j++)
    {
      float nr, ni;

      nread = fscanf(f, "%f %f\n", & nr, & ni);
      if (nread < 2)
	{
	  notify_error_msg (LOADING_FILE_ERROR, "invalid format for nk table");
	  goto disp_nk_free;
	}

      set_index_value (table, j, nr, ni);
    }

  set_range (table, wlmin * 1.0E3, wlmax * 1.0E3);

  fclose (f);
  return disp;

 disp_nk_free:
  disp_table_free (disp);
  fclose (f);
  return NULL;
}
Ejemplo n.º 2
0
void AnimatedSprite::set_index( int index )
{
    set_index_value( anim_index, index );
}
Ejemplo n.º 3
0
void AnimatedSprite::set_start_index( int index )
{
    set_index_value( start_index, index );
}