本文整理汇总了C++中can_draw函数的典型用法代码示例。如果您正苦于以下问题:C++ can_draw函数的具体用法?C++ can_draw怎么用?C++ can_draw使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了can_draw函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: glLineWidth
void GLUI_Separator::draw( int x, int y )
{
int width, indent, orig;
int cont_x, cont_y, cont_w, cont_h, cont_x_off, cont_y_off;
if ( NOT can_draw() )
return;
orig = set_to_glut_window();
if ( parent() != NULL ) {
get_this_column_dims(&cont_x, &cont_y, &cont_w, &cont_h,
&cont_x_off, &cont_y_off);
width = cont_w - cont_x_off*2;
}
else {
width = this->w;
}
indent = width * .05;
glLineWidth( 1.0 );
glBegin( GL_LINES );
glColor3f( .5, .5, .5 );
glVertex2i( indent, GLUI_SEPARATOR_HEIGHT/2-1 );
glVertex2i( width-indent, GLUI_SEPARATOR_HEIGHT/2-1 );
glColor3f( 1., 1., 1. );
glVertex2i( indent, GLUI_SEPARATOR_HEIGHT/2 );
glVertex2i( width-indent, GLUI_SEPARATOR_HEIGHT/2 );
glEnd();
restore_window(orig);
}
示例2: set_to_glut_window
void GLUI_StaticText::set_text( char *text )
{
int orig, state;
orig = set_to_glut_window();
state = glui->set_front_draw_buffer();
/**** Erase old text first *****/
glMatrixMode( GL_MODELVIEW );
glPushMatrix();
translate_to_origin();
erase_text();
glPopMatrix();
set_name( text );
if ( NOT can_draw() )
return;
/**** Redraw the text in the window ****/
glMatrixMode( GL_MODELVIEW );
glPushMatrix();
translate_to_origin();
draw_text();
glPopMatrix();
glui->restore_draw_buffer(state);
restore_window( orig );
}
示例3: glEnable
void GLUI_RadioButton::draw_active_area( void )
{
int text_width, left, right, orig;
if ( NOT can_draw() )
return;
orig = set_to_glut_window();
text_width = _glutBitmapWidthString( glui->font, name );
left = text_x_offset-3;
right = left + 7 + text_width;
if ( active ) {
glEnable( GL_LINE_STIPPLE );
glLineStipple( 1, 0x5555 );
glColor3f( 0., 0., 0. );
} else {
glColor3ub( glui->bkgd_color.r, glui->bkgd_color.g, glui->bkgd_color.b );
}
glBegin( GL_LINE_LOOP );
glVertex2i(left,0); glVertex2i( right,0);
glVertex2i(right,h+1); glVertex2i( left,h+1);
glEnd();
glDisable( GL_LINE_STIPPLE );
restore_window(orig);
}
示例4: glEnable
void GLUI_Rotation::iaction_draw_active_area_persp( void )
{
if ( NOT can_draw() )
return;
copy_float_array_to_ball();
setup_texture();
setup_lights();
glEnable(GL_CULL_FACE );
glMatrixMode( GL_MODELVIEW );
glPushMatrix();
mat4 tmp_rot = *ball->rot_ptr;
glMultMatrixf( (float*) &tmp_rot[0][0] );
/*** Draw the checkered box ***/
/*glDisable( GL_TEXTURE_2D ); */
draw_ball( 1.96 );
glPopMatrix();
glDisable( GL_TEXTURE_2D );
glDisable( GL_LIGHTING );
glDisable( GL_CULL_FACE );
}
示例5:
void GLUI_RadioGroup::draw( int x, int y )
{
if ( NOT can_draw() )
return;
draw_group(false);
}
示例6: glMatrixMode
void GLUI_StaticText::set_text( const char *text )
{
int orig;
/**** Erase old text first *****/
glMatrixMode( GL_MODELVIEW );
glPushMatrix();
translate_to_origin();
erase_text();
glPopMatrix();
set_name( (char *) text );
if ( NOT can_draw() )
return;
orig = set_to_glut_window();
/**** Redraw the text in the window ****/
glMatrixMode( GL_MODELVIEW );
glPushMatrix();
translate_to_origin();
draw_text();
glPopMatrix();
restore_window( orig );
}
示例7: set_to_glut_window
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);
}
示例8: find_arrow
int GLUI_Spinner::mouse_down_handler( int local_x, int local_y )
{
this->state = find_arrow( local_x, local_y );
/* printf( "spinner: mouse down : %d/%d arrow:%d\n", local_x, local_y,
find_arrow( local_x, local_y ));
*/
if ( state != GLUI_SPINNER_STATE_UP AND state != GLUI_SPINNER_STATE_DOWN )
return true;
reset_growth();
if ( can_draw() )
draw_arrows();
/*** ints and floats behave a bit differently. When you click on
an int spinner, you expect the value to immediately go up by 1, whereas
for a float it'll go up only by a fractional amount. Therefore, we
go ahead and increment by one for int spinners ***/
if ( data_type == GLUI_SPINNER_INT ) {
if ( state == GLUI_SPINNER_STATE_UP )
edittext->set_float_val( edittext->float_val + 1.0 );
else if ( state == GLUI_SPINNER_STATE_DOWN )
edittext->set_float_val( edittext->float_val - .9 );
}
do_click();
return false;
}
示例9:
void GLUI_Spinner::draw_arrows( void )
{
if ( NOT can_draw() )
return;
translate_and_draw_front();
}
示例10: if
void GLUI_Translation::iaction_draw_active_area_ortho( void )
{
if ( NOT can_draw() )
return;
/********* Draw emboss circles around arcball control *********/
float radius;
radius = (float)(h-22)/2.0; /* MIN((float)w/2.0, (float)h/2.0); */
glLineWidth( 1.0 );
draw_emboss_box( (int) -radius-2, (int)radius+2,
(int)-radius-2, (int)radius+2 );
glMatrixMode( GL_MODELVIEW );
glPushMatrix();
glTranslatef( .5, .5, .5 );
/* glScalef( radius-1.0, radius-1.0, radius-1.0 ); */
if ( trans_type == GLUI_TRANSLATION_Z )
draw_2d_z_arrows((int)radius-1);
else if ( trans_type == GLUI_TRANSLATION_XY )
draw_2d_xy_arrows((int)radius-1);
else if ( trans_type == GLUI_TRANSLATION_X )
draw_2d_x_arrows((int)radius-1);
else if ( trans_type == GLUI_TRANSLATION_Y )
draw_2d_y_arrows((int)radius-1);
glPopMatrix();
}
示例11: CLAW_PRECOND
/**
* \brief Draws a new glyph on this sheet.
* \param c The character to draw.
* \param face The font face from which we take the glyph.
*/
void bear::visual::true_type_font::glyph_sheet::draw_character
( charset::char_type c, const freetype_face& face )
{
CLAW_PRECOND( can_draw( c, face ) );
const size_box_type glyph_size( face.get_glyph_size(c) );
if ( m_next_position.x + glyph_size.x + 2 * s_margin.x >= m_image.width() )
{
m_next_position.x = 0;
m_next_position.y += m_current_line_height;
m_current_line_height = 0;
}
m_image.draw( face.get_glyph( c ), m_next_position + s_margin );
character_placement placement;
placement.clip = clip_rectangle( m_next_position, glyph_size + 2 * s_margin );
placement.metrics = face.get_glyph_metrics( c );
placement.metrics =
glyph_metrics
( placement.metrics.get_advance() - s_margin,
placement.metrics.get_bearing() - s_margin );
m_placement[ c ] = placement;
m_next_position.x += glyph_size.x + 2 * s_margin.x;
m_current_line_height =
std::max
( m_current_line_height, (unsigned int)( glyph_size.y + 2 * s_margin.y ) );
} // true_type_font::glyph_sheet::draw_character()
示例12: find_insertion_pt
int GLUI_TextBox::mouse_down_handler( int local_x, int local_y )
{
int tmp_insertion_pt;
if ( debug ) dump( stdout, "-> MOUSE DOWN" );
tmp_insertion_pt = find_insertion_pt( local_x, local_y );
if ( tmp_insertion_pt == -1 ) {
if ( glui )
glui->deactivate_current_control( );
return false;
}
insertion_pt = tmp_insertion_pt;
sel_start = sel_end = insertion_pt;
keygoal_x = insert_x;
if ( can_draw())
update_and_draw_text();
if ( debug ) dump( stdout, "<- MOUSE UP" );
return true;
}
示例13: CLAMP
// 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();
}
示例14:
void GLUI_StaticText::draw_text( void )
{
if ( NOT can_draw() )
return;
erase_text();
draw_name( 0, 9 );
}
示例15: do_drag
int GLUI_Spinner::mouse_held_down_handler( int local_x, int local_y,
int new_inside)
{
int new_state;
if ( state == GLUI_SPINNER_STATE_NONE )
return false;
/* printf("spinner: mouse held: %d/%d inside: %d\n",local_x,local_y,
new_inside);
*/
if ( state == GLUI_SPINNER_STATE_BOTH ) { /* dragging? */
do_drag( local_x, local_y );
}
else { /* not dragging */
new_state = find_arrow( local_x, local_y );
if ( new_state == state ) {
/** Still in same arrow **/
do_click();
}
else {
if ( new_inside OR 1) {
/** The state changed, but we're still inside - that
means we moved off the arrow: begin dragging **/
state = GLUI_SPINNER_STATE_BOTH;
}
else {
/*** Here check y of mouse position to determine whether to
drag ***/
/* ... */
}
}
/*** We switched to up/down dragging ***/
if ( state == GLUI_SPINNER_STATE_BOTH ) {
glutSetCursor( GLUT_CURSOR_UP_DOWN );
last_x = local_x;
last_y = local_y;
/** If the spinner has limits, we reset the growth value, since
reset_growth() will compute a new growth value for dragging
vs. clicking. If the spinner has no limits, then we just let the
growth remain at whatever the user has incremented it up to **/
if ( edittext->has_limits != GLUI_LIMIT_NONE )
reset_growth();
}
if ( can_draw() )
draw_arrows();
}
return false;
}