void    GLUI_RadioButton::draw( int x, int y )
{
  int orig;

  orig = set_to_glut_window();

  if ( NOT group OR NOT can_draw() )
    return;

  /*** See if we're the currently-selected button.  If so, draw ***/
  if ( group->int_val == this->user_id ) {
    if ( enabled )
      glui->std_bitmaps.draw( GLUI_STDBITMAP_RADIOBUTTON_ON, 0, 0 );
    else
      glui->std_bitmaps.draw( GLUI_STDBITMAP_RADIOBUTTON_ON_DIS, 0, 0 );
  }
  else {
    if ( enabled ) 
      glui->std_bitmaps.draw( GLUI_STDBITMAP_RADIOBUTTON_OFF, 0, 0 );
    else
      glui->std_bitmaps.draw( GLUI_STDBITMAP_RADIOBUTTON_OFF_DIS, 0, 0 );
  }

  draw_active_area();

  draw_name( text_x_offset, 10 );

  restore_window(orig);
}
예제 #2
0
void    GLUI_Slider::draw_translated_active_area( void )
{
    int orig;
    int win_h , win_w;

    if ( NOT glui )
        return;

    orig = set_to_glut_window();
    win_h = glutGet( GLUT_WINDOW_HEIGHT );
    win_w = glutGet(GLUT_WINDOW_WIDTH);

    glMatrixMode( GL_MODELVIEW );
    glPushMatrix();
    glLoadIdentity();
    glTranslatef( (float) win_w/2.0, (float) win_h/2.0, 0.0 );
    glRotatef( 180.0, 0.0, 1.0, 0.0 );
    glRotatef( 180.0, 0.0, 0.0, 1.0 );
    glTranslatef( (float) -win_w/2.0, (float) -win_h/2.0, 0.0 );
    glTranslatef( (float) this->x_abs + .5, (float) this->y_abs + .5, 0.0 );

    draw_active_area();

    glMatrixMode( GL_MODELVIEW );
    glPopMatrix();

    restore_window(orig);
}
예제 #3
0
/* Prints out all relevant information for a cache entry, and prints
 * a board showing the active area.
 */
static void
print_persistent_cache_entry(struct persistent_cache_entry *entry)
{
  int r;

  gprintf("%omovenum         = %d\n",  entry->movenum);
  gprintf("%oscore	     = %d\n",  entry->score);
  gprintf("%ocost	     = %d\n",  entry->cost);
  gprintf("%oroutine         = %s\n",  routine_id_to_string(entry->routine));
  gprintf("%oapos            = %1m\n", entry->apos);
  if (entry->bpos != NO_MOVE)
    gprintf("%obpos          = %1m\n", entry->bpos);
  if (entry->cpos != NO_MOVE)
    gprintf("%ocpos            = %1m\n", entry->cpos);
  gprintf("%oresult          = %s\n",  result_to_string(entry->result));
  if (entry->result_certain != -1)
    gprintf("%oresult_certain  = %d\n",  entry->result_certain);
  if (entry->node_limit != -1)
    gprintf("%onode_limit      = %d\n",  entry->node_limit);
  if (entry->move != NO_MOVE)
    gprintf("%omove            = %1m\n", entry->move);
  if (entry->move2 != NO_MOVE)
    gprintf("%omove2           = %1m\n", entry->move2);
  
  for (r = 0; r < MAX_CACHE_DEPTH; r++) {
    if (entry->stack[r] == 0)
      break;
    gprintf("%ostack[%d]      = %C %1m\n", r, entry->move_color[r],
	    entry->stack[r]);
  }

  draw_active_area(entry->board, entry->apos);
}
예제 #4
0
void    GLUI_Graph::draw_translated_active_area( int front )
{
	int win_h;
	int win_w;

	GLUI_DRAWINGSENTINAL_IDIOM;

	win_h = glutGet(GLUT_WINDOW_HEIGHT);
	win_w = glutGet(GLUT_WINDOW_WIDTH);

	glMatrixMode( GL_MODELVIEW );
	glPushMatrix();
	glLoadIdentity();
	glTranslatef( (float) win_w/2.0, (float) win_h/2.0, 0.0 );
	glRotatef( 180.0, 0.0, 1.0, 0.0 );
	glRotatef( 180.0, 0.0, 0.0, 1.0 );
	glTranslatef( (float) -win_w/2.0, (float) -win_h/2.0, 0.0 );
	glTranslatef( (float) this->x_abs + .5, (float) this->y_abs + .5, 0.0 );

	draw_active_area();

	glMatrixMode( GL_MODELVIEW );
	glPopMatrix();

}
예제 #5
0
void    GLUI_ActiveText::draw_translated_active_area( )
{
   GLUI_DRAWINGSENTINAL_IDIOM;

   glPushMatrix();
      translate_to_origin();
      draw_active_area();
   glPopMatrix();
}
예제 #6
0
void    GLUI_ActiveText::draw( int x, int y )
{
  GLUI_DRAWINGSENTINAL_IDIOM;

  draw_active_area();

  draw_active_box(0, w-1, 0, h);

}
예제 #7
0
void    GLUI_Mouse_Interaction::draw( int x, int y )
{
  GLUI_DRAWINGSENTINAL_IDIOM
  int text_width	= string_width( this->name );
  int x_left			= this->w/2 - text_width/2;

  if ( NOT draw_active_area_only ) {
    draw_name( x_left, h-4 );
    draw_active_box( x_left-4, x_left+string_width( name )+4, 
		     h, h-14 );
  }

  draw_active_area();
}
void   GLUI_RadioButton::draw_checked( void )
{
  int orig;

  if ( NOT can_draw() )
    return;

  orig = set_to_glut_window();
  if ( enabled )
    glui->std_bitmaps.draw( GLUI_STDBITMAP_RADIOBUTTON_ON, 0, 0 );
  else
    glui->std_bitmaps.draw( GLUI_STDBITMAP_RADIOBUTTON_ON_DIS, 0, 0 );    
  draw_active_area();
  restore_window(orig);
}
int    GLUI_Mouse_Interaction::mouse_held_down_handler( int local_x, int local_y,
							int inside)
{  
  iaction_mouse_held_down_handler( local_x-x_abs, local_y-y_abs , inside );

  draw_active_area();

  /** Tell the main graphics window to update iteself **/
  if( glui )
    glui->post_update_main_gfx();

  execute_callback();

  return false;
}
/* For debugging purposes. */
static void
print_persistent_owl_cache_entry(int k)
{
  struct owl_cache *entry = &(persistent_owl_cache[k]);
  gprintf("%omovenum         = %d\n",  entry->movenum);
  gprintf("%otactical_nodes  = %d\n",  entry->tactical_nodes);
  gprintf("%oroutine         = %s\n",  routine_to_string(entry->routine));
  gprintf("%o(apos)          = %1m\n", entry->apos);
  gprintf("%o(bpos)          = %1m\n", entry->bpos);
  gprintf("%o(cpos)          = %1m\n", entry->cpos);
  gprintf("%oresult          = %d\n",  entry->result);
  gprintf("%o(move)          = %1m\n", entry->move);
  gprintf("%o(move2)         = %1m\n", entry->move2);
  
  draw_active_area(entry->board, entry->apos);
}
예제 #11
0
void    GLUI_Slider::draw( int x, int y )
{
    int orig;

    if ( NOT glui )
        return;

    orig = set_to_glut_window();


    draw_emboss_box(        0,
                            w,
                            GLUI_SLIDER_NAME_TOP_BORDER +
                            GLUI_SLIDER_FONT_HEIGHT - 1 -
                            GLUI_SLIDER_FONT_MID_HEIGHT,
                            h );

    draw_bkgd_box( GLUI_SLIDER_NAME_INDENT-1,
                   GLUI_SLIDER_NAME_INDENT +
                   string_width(name.string) +
                   2*GLUI_SLIDER_NAME_SIDE_BORDER - 1,
                   0,
                   0 +
                   GLUI_SLIDER_FONT_FULL_HEIGHT +
                   GLUI_SLIDER_NAME_TOP_BORDER +
                   GLUI_SLIDER_NAME_BOTTOM_BORDER);

    draw_name(      GLUI_SLIDER_NAME_INDENT +
                    GLUI_SLIDER_NAME_SIDE_BORDER,
                    GLUI_SLIDER_FONT_HEIGHT-1 +
                    GLUI_SLIDER_NAME_TOP_BORDER);

    draw_active_area();

    restore_window(orig);

    draw_active_box(        GLUI_SLIDER_NAME_INDENT,
                            GLUI_SLIDER_NAME_INDENT +
                            string_width(name.string) +
                            2*GLUI_SLIDER_NAME_SIDE_BORDER - 1,
                            0,
                            GLUI_SLIDER_FONT_FULL_HEIGHT +
                            GLUI_SLIDER_NAME_TOP_BORDER +
                            GLUI_SLIDER_NAME_BOTTOM_BORDER - 1);

}
void    GLUI_Mouse_Interaction::draw( int x, int y )
{
  int orig;
  int text_width	= string_width( this->name );
  int x_left			= this->w/2 - text_width/2;
  
  if ( NOT glui )
    return;

  if ( NOT draw_active_area_only ) {
    orig = set_to_glut_window();
    draw_name( x_left, h-4 );
    restore_window(orig);

    draw_active_box( x_left-4, x_left+string_width( name.string )+4, 
		     h, h-14 );
  }

  draw_active_area();
}
예제 #13
0
void    GLUI_Graph::draw( int x, int y )
{

  GLUI_DRAWINGSENTINAL_IDIOM;

	draw_emboss_box(	0,
							w,
							GLUI_GRAPH_NAME_TOP_BORDER +
							GLUI_GRAPH_FONT_HEIGHT - 1 -
							GLUI_GRAPH_FONT_MID_HEIGHT,
							h );

	draw_bkgd_box( GLUI_GRAPH_NAME_INDENT-1,
						GLUI_GRAPH_NAME_INDENT +
						string_width(name) +
						2*GLUI_GRAPH_NAME_SIDE_BORDER - 1,
						0,
						0 +
						GLUI_GRAPH_FONT_FULL_HEIGHT +
						GLUI_GRAPH_NAME_TOP_BORDER +
						GLUI_GRAPH_NAME_BOTTOM_BORDER);

	draw_name(	GLUI_GRAPH_NAME_INDENT +
					GLUI_GRAPH_NAME_SIDE_BORDER,
					GLUI_GRAPH_FONT_HEIGHT-1 +
					GLUI_GRAPH_NAME_TOP_BORDER);

	draw_active_area();

	draw_active_box(	GLUI_GRAPH_NAME_INDENT,
							GLUI_GRAPH_NAME_INDENT +
							string_width(name) +
							2*GLUI_GRAPH_NAME_SIDE_BORDER - 1,
							0,
							GLUI_GRAPH_FONT_FULL_HEIGHT +
							GLUI_GRAPH_NAME_TOP_BORDER +
							GLUI_GRAPH_NAME_BOTTOM_BORDER - 1);

}
/* For debugging purposes. */
static void
print_persistent_reading_cache_entry(int k)
{
  struct reading_cache *entry = &(persistent_reading_cache[k]);
  int r;
  gprintf("%oboardsize       = %d\n",  entry->boardsize);
  gprintf("%omovenum         = %d\n",  entry->movenum);
  gprintf("%onodes           = %d\n",  entry->nodes);
  gprintf("%oscore           = %d\n",  entry->score);
  gprintf("%oremaining_depth = %d\n",  entry->remaining_depth);
  gprintf("%oroutine         = %d\n",  entry->routine);
  gprintf("%ostr             = %1m\n", entry->str);
  gprintf("%oresult          = %d\n",  entry->result);
  gprintf("%omove            = %1m\n", entry->move);
  
  for (r = 0; r < MAX_READING_CACHE_DEPTH; r++) {
    if (entry->stack[r] == 0)
      break;
    gprintf("%ostack[%d]      = %C %1m\n", r, entry->move_color[r],
	    entry->stack[r]);
  }

  draw_active_area(entry->board, NO_MOVE);
}