本文整理汇总了C++中can_draw函数的典型用法代码示例。如果您正苦于以下问题:C++ can_draw函数的具体用法?C++ can_draw怎么用?C++ can_draw使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了can_draw函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:chadaustin,项目名称:isugamedev,代码行数:35,代码来源:glui_separator.cpp
示例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 );
}
开发者ID:icharlie,项目名称:glui-cs553,代码行数:29,代码来源:glui_statictext.cpp
示例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);
}
开发者ID:elvisciotti,项目名称:opengl-vs-dot-net-graphics,代码行数:30,代码来源:glui_radio.cpp
示例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 );
}
开发者ID:Benignoperez,项目名称:jot-lib,代码行数:28,代码来源:glui_rotation.C
示例5:
void GLUI_RadioGroup::draw( int x, int y )
{
if ( NOT can_draw() )
return;
draw_group(false);
}
开发者ID:elvisciotti,项目名称:opengl-vs-dot-net-graphics,代码行数:7,代码来源:glui_radio.cpp
示例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 );
}
开发者ID:philippedax,项目名称:vreng,代码行数:26,代码来源:glui_statictext.cpp
示例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);
}
开发者ID:elvisciotti,项目名称:opengl-vs-dot-net-graphics,代码行数:29,代码来源:glui_radio.cpp
示例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;
}
开发者ID:caomw,项目名称:slam6d-1,代码行数:30,代码来源:glui_spinner.cpp
示例9:
void GLUI_Spinner::draw_arrows( void )
{
if ( NOT can_draw() )
return;
translate_and_draw_front();
}
开发者ID:caomw,项目名称:slam6d-1,代码行数:7,代码来源:glui_spinner.cpp
示例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();
}
开发者ID:Benignoperez,项目名称:jot-lib,代码行数:28,代码来源:glui_translation.C
示例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()
开发者ID:LibreGames,项目名称:bear,代码行数:37,代码来源:true_type_font.cpp
示例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;
}
开发者ID:383530895,项目名称:liquidfun,代码行数:26,代码来源:glui_textbox.cpp
示例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();
}
开发者ID:QuLogic,项目名称:jot-lib,代码行数:9,代码来源:glui_slider.cpp
示例14:
void GLUI_StaticText::draw_text( void )
{
if ( NOT can_draw() )
return;
erase_text();
draw_name( 0, 9 );
}
开发者ID:philippedax,项目名称:vreng,代码行数:8,代码来源:glui_statictext.cpp
示例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;
}
开发者ID:caomw,项目名称:slam6d-1,代码行数:56,代码来源:glui_spinner.cpp
示例16: redraw
void GLUI_EditText::update_and_draw_text( void )
{
if ( NOT can_draw() )
return;
update_substring_bounds();
/* printf( "ss: %d/%d\n", substring_start, substring_end ); */
redraw();
}
开发者ID:EBone,项目名称:Faust,代码行数:10,代码来源:glui_edittext.cpp
示例17: glDisable
void GLUI_StaticText::erase_text( void )
{
if ( NOT can_draw() )
return;
set_to_bkgd_color();
glDisable( GL_CULL_FACE );
glBegin( GL_TRIANGLES );
glVertex2i( 0,0 ); glVertex2i( w, 0 ); glVertex2i( w, h );
glVertex2i( 0, 0 ); glVertex2i( w, h ); glVertex2i( 0, h );
glEnd();
}
开发者ID:philippedax,项目名称:vreng,代码行数:12,代码来源:glui_statictext.cpp
示例18: printf
int GLUI_EditText::special_handler( int key,int modifiers )
{
if ( NOT glui )
return false;
if ( debug )
printf( "SPECIAL:%d - mod:%d subs:%d/%d ins:%d sel:%d/%d\n",
key, modifiers, substring_start, substring_end,insertion_pt,
sel_start, sel_end );
if ( key == GLUT_KEY_LEFT ) {
if ( (modifiers & GLUT_ACTIVE_CTRL) != 0 ) {
insertion_pt = find_word_break( insertion_pt, -1 );
}
else {
insertion_pt--;
}
}
else if ( key == GLUT_KEY_RIGHT ) {
if ( (modifiers & GLUT_ACTIVE_CTRL) != 0 ) {
insertion_pt = find_word_break( insertion_pt, +1 );
}
else {
insertion_pt++;
}
}
else if ( key == GLUT_KEY_HOME ) {
insertion_pt = 0;
}
else if ( key == GLUT_KEY_END ) {
insertion_pt = (int) text.length();
}
/*** Update selection if shift key is down ***/
if ( (modifiers & GLUT_ACTIVE_SHIFT ) != 0 )
sel_end = insertion_pt;
else
sel_start = sel_end = insertion_pt;
CLAMP( insertion_pt, 0, (int) text.length()); /* Make sure insertion_pt
is in bounds */
CLAMP( sel_start, 0, (int) text.length()); /* Make sure insertion_pt
is in bounds */
CLAMP( sel_end, 0, (int) text.length()); /* Make sure insertion_pt
is in bounds */
/******** Now redraw text ***********/
if ( can_draw())
update_and_draw_text();
return true;
}
开发者ID:EBone,项目名称:Faust,代码行数:53,代码来源:glui_edittext.cpp
示例19: draw
void GLUI_Column::draw( int x, int y )
{
int orig;
int panel_x, panel_y, panel_w, panel_h, panel_x_off, panel_y_off;
int y_diff;
if ( NOT can_draw() )
return;
if ( int_val == 1 ) { /* Draw a vertical bar */
orig = set_to_glut_window();
if ( parent() != NULL ) {
get_this_column_dims(&panel_x, &panel_y, &panel_w, &panel_h,
&panel_x_off, &panel_y_off);
y_diff = y_abs - panel_y;
if ( 0 ) {
glLineWidth(1.0);
glBegin( GL_LINES );
glColor3f( .5, .5, .5 );
glVertex2i( -GLUI_XOFF+1, -y_diff + GLUI_SEPARATOR_HEIGHT/2 );
glVertex2i( -GLUI_XOFF+1, -y_diff + panel_h - GLUI_SEPARATOR_HEIGHT/2);
glColor3f( 1.0, 1.0, 1.0 );
glVertex2i( -GLUI_XOFF+2, -y_diff + GLUI_SEPARATOR_HEIGHT/2 );
glVertex2i( -GLUI_XOFF+2, -y_diff + panel_h - GLUI_SEPARATOR_HEIGHT/2);
glEnd();
}
else {
glLineWidth(1.0);
glBegin( GL_LINES );
glColor3f( .5, .5, .5 );
glVertex2i( -2, 0 );
glVertex2i( -2, h );
/*glVertex2i( 0, -y_diff + GLUI_SEPARATOR_HEIGHT/2 ); */
/*glVertex2i( 0, -y_diff + panel_h - GLUI_SEPARATOR_HEIGHT/2); */
glColor3f( 1.0, 1.0, 1.0 );
glVertex2i( -1, 0 );
glVertex2i( -1, h );
/*glVertex2i( 1, -y_diff + GLUI_SEPARATOR_HEIGHT/2 ); */
/*glVertex2i( 1, -y_diff + panel_h - GLUI_SEPARATOR_HEIGHT/2); */
glEnd();
}
}
restore_window(orig);
}
}
开发者ID:Benignoperez,项目名称:jot-lib,代码行数:52,代码来源:glui_column.cpp
示例20: gluQuadricDrawStyle
void GLUI_Rotation::draw_ball( float radius )
{
if ( NOT can_draw() )
return;
if (quadObj == NULL) quadObj = gluNewQuadric();
if (quadObj) {
gluQuadricDrawStyle(quadObj, GLU_FILL);
gluQuadricNormals(quadObj, GLU_SMOOTH);
gluQuadricTexture(quadObj, true );
gluSphere(quadObj, radius, 16, 16);
}
}
开发者ID:Benignoperez,项目名称:jot-lib,代码行数:13,代码来源:glui_rotation.C
注:本文中的can_draw函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论