Beispiel #1
0
// virtual
void   GLUI_Slider::set_float_val( float new_float )
{
   CLAMP(new_float, float_low, float_high);
   float_val = new_float;
   output_live(true);
   if (can_draw())
      draw_translated_active_area();
}
Beispiel #2
0
// virtual
void   GLUI_Slider::set_int_val( int new_int )
{
   CLAMP(new_int, int_low, int_high);
   int_val =   new_int;
   output_live(true);
   if (can_draw())
      draw_translated_active_area();
}
void    GLUI_Listbox::set_int_val( int new_val )
{
  /*  int_val = new_val;              */

  do_selection( new_val );

  /*** Update the variable we're (possibly) pointing to, and update the main gfx ***/
  output_live(true);
}
void    GLUI_RadioGroup::set_int_val( int new_val )
{
  if ( new_val == int_val )
    return;

  set_selected( new_val );
  draw_group( true );  

  output_live(true);
     
}
Beispiel #5
0
void  GLUI_Rotation::reset( void )
{
  ball->init(); /** reset quaternion, etc. **/
  ball->set_params( vec2( (float)(w/2), (float)((h-18)/2)), 
		   (float) 2.0*(h-18) );

  set_spin( this->damping );	

  copy_ball_to_float_array();

  translate_and_draw_front();

  output_live(true); /*** Output live and draw main grx window ***/
}
Beispiel #6
0
void    GLUI_TextBox::set_text( const char *new_text )
{
  text = new_text;

  substring_start = 0;
  substring_end   = text.length() - 1;
  insertion_pt    = -1;
  sel_start       = 0;
  sel_end         = 0;
  visible_lines   = 0;
  start_line      = 0;
  curr_line       = 0;
  num_lines       = 0;

  if ( can_draw() )
    update_and_draw_text();

  /*** Now update the live variable ***/
  output_live(true);
}
void    GLUI_EditText::set_text( char *new_text )
{
  strncpy(text,new_text,sizeof(GLUI_String));
  substring_start = 0;
  substring_end   = (int)strlen( text ) - 1;
  insertion_pt    = -1;
  sel_start       = 0;
  sel_end         = 0;

  if ( can_draw() )
    update_and_draw_text();

  /** Update the spinner, if we have one **/
  if ( spinner ) {
    spinner->float_val = this->float_val;
    spinner->int_val   = this->int_val;
  }

  /*** Now update the live variable ***/
  output_live(true);
}
Beispiel #8
0
void    GLUI_EditText::set_text( const char *new_text )
{
  text=new_text;
  substring_start = 0;
  substring_end   = (int) text.length() - 1;
  insertion_pt    = -1;
  sel_start       = 0;
  sel_end         = 0;

  if ( can_draw() )
    update_and_draw_text();

  /** Update the spinner, if we have one **/
  if ( spinner ) {
    spinner->float_val = this->float_val;
    spinner->int_val   = this->int_val;
  }

  /*** Now update the live variable ***/
  output_live(true);
}
Beispiel #9
0
GLUI_Slider::GLUI_Slider(GLUI_Node *parent, const char *name,
                         int id, GLUI_CB cb,
                         int the_data_type,
                         float limit_lo,
                         float limit_hi,
                         void *data)
{
   common_init();
   user_id = id;
   callback = cb;
   set_name( name );
   data_type = the_data_type;
   ptr_val = data;

   if ( data_type == GLUI_SLIDER_INT ) {
      set_int_limits((int)limit_lo, (int)limit_hi);
      if ( data == NULL ) {
         set_int_val(int_low);
         live_type = GLUI_LIVE_NONE;
      } else
         live_type = GLUI_LIVE_INT;

   } else if ( data_type == GLUI_SLIDER_FLOAT ) {
      set_float_limits(limit_lo, limit_hi);
      if ( data == NULL ) {
         set_float_val(float_low);
         live_type = GLUI_LIVE_NONE;
      } else
         live_type = GLUI_LIVE_FLOAT;
   }

   parent->add_control( this );

   init_live();

   //In case the live var was out of range,
   //(and got clamped) we update the live
   //var to the internal value
   output_live(false);
}
Beispiel #10
0
void        GLUI_Rotation::idle( void )
{
  spinning = ball->is_spinning;

  if ( can_spin == true AND spinning == true ) {
    copy_float_array_to_ball();
    ball->idle();

    *ball->rot_ptr = *ball->rot_ptr * ball->rot_increment;

    mat4 tmp_rot;
    tmp_rot = *ball->rot_ptr;

    copy_ball_to_float_array();

    draw_active_area_only = true;
    translate_and_draw_front();
    draw_active_area_only = false;

    output_live(true); /** output live and update gfx **/
  }
  else { 
  }
}