示例#1
0
文件: state.c 项目: qb1/curseofwar
void adjust_cursor(struct state *s, struct ui *ui, int cursi, int cursj) {
  cursi = IN_SEGMENT(cursi, 0, s->grid.width-1);
  cursj = IN_SEGMENT(cursj, 0, s->grid.height-1);
  if ( is_visible(s->grid.tiles[cursi][cursj].cl) ) {
    ui->cursor.i = cursi;
    ui->cursor.j = cursj;
  }
  else if ( is_visible(s->grid.tiles[ui->cursor.i][cursj].cl) ) {
    ui->cursor.j = cursj;
  }
  else {
    int i = cursi-1;
    i = IN_SEGMENT(i, 0, s->grid.width-1);
    if (is_visible(s->grid.tiles[i][cursj].cl)) {
      ui->cursor.i = i;
      ui->cursor.j = cursj;
    }
    else{
      i = cursi+1;
      i = IN_SEGMENT(i, 0, s->grid.width-1);
      if (is_visible(s->grid.tiles[i][cursj].cl)) {
        ui->cursor.i = i;
        ui->cursor.j = cursj;
      }
    }
  }
}
示例#2
0
/**
 * Changes the current desktop to the desktop before the current.
 */
void ClientModel::prev_desktop()
{
    // We have to add the maximum desktops back in, since C++ doesn't
    // guarantee what will happen with a negative modulus
    unsigned long long desktop_index =
        (m_current_desktop->desktop - 1 + m_max_desktops)
        % m_max_desktops;

    // We can't change while a window is being moved or resized
    if (m_desktops.count_members_of(MOVING_DESKTOP) > 0 ||
            m_desktops.count_members_of(RESIZING_DESKTOP) > 0)
        return;

    UserDesktop* old_desktop = m_current_desktop;
    m_current_desktop = USER_DESKTOPS[desktop_index];

    Window old_focus = m_focused;
    if (m_focused != None)
    {
        if (is_child(m_focused) && !is_visible(get_parent_of(m_focused)))
            unfocus(false);

        if (is_client(m_focused) && !is_visible(m_focused))
            unfocus(false);
    }

    m_changes.push(new ChangeCurrentDesktop(old_desktop, m_current_desktop));

    // If we can still focus the window we were focused on before, then do so
    // Otherwise, figure out the next logical window in the focus cycle
    if (m_focused != None && m_focused == old_focus)
        m_current_desktop->focus_cycle.set(m_focused);
    else
        sync_focus_to_cycle();
}
示例#3
0
void CanvasModulate::_notification(int p_what) {

	if (p_what==NOTIFICATION_ENTER_CANVAS) {

		if (is_visible()) {
			VS::get_singleton()->canvas_set_modulate(get_canvas(),color);
			add_to_group("_canvas_modulate_"+itos(get_canvas().get_id()));
		}



	} else if (p_what==NOTIFICATION_EXIT_CANVAS) {

		if (is_visible()) {
			VS::get_singleton()->canvas_set_modulate(get_canvas(),Color(1,1,1,1));
			remove_from_group("_canvas_modulate_"+itos(get_canvas().get_id()));
		}
	} else if (p_what==NOTIFICATION_VISIBILITY_CHANGED) {

		if (is_visible()) {
			VS::get_singleton()->canvas_set_modulate(get_canvas(),color);
			add_to_group("_canvas_modulate_"+itos(get_canvas().get_id()));
		} else {
			VS::get_singleton()->canvas_set_modulate(get_canvas(),Color(1,1,1,1));
			remove_from_group("_canvas_modulate_"+itos(get_canvas().get_id()));
		}

		update_configuration_warning();
	}
}
示例#4
0
static void
glw_freefloat_layout(glw_freefloat_t *ff, glw_rctx_t *rc)
{
  glw_t *w = &ff->w;
  glw_t *c;
  int i, candpos = -1;

  float vmin = 1;

  for(i = 0; i < ff->num_visible; i++) {
    if(ff->visible[i] == NULL) {
      candpos = i;
    } else {
      vmin = GLW_MIN(ff->visible[i]->glw_parent_v, vmin);
    }
  }

  if(vmin > 1.0 / (float)ff->num_visible && candpos != -1) {
    /* Insert new entry */

    if(ff->pick != NULL)
      ff->pick = glw_next_widget(ff->pick);
    
    if(ff->pick == NULL)
      ff->pick = glw_first_widget(w);

    if(ff->pick != NULL && !is_visible(ff, ff->pick)) {
      ff->visible[candpos] = ff->pick;
      setup_floater(ff, ff->pick);
    }
  }

  for(i = 0; i < ff->num_visible; i++) {
    if((c = ff->visible[i]) == NULL)
      continue;

    if(c->glw_parent_v >= 1) {
      ff->visible[i] = NULL;
    } else {
      glw_layout0(c, rc);
    }

    if(c->glw_class->gc_ready ? c->glw_class->gc_ready(c) : 1)
      c->glw_parent_v += c->glw_parent_s;
    c->glw_parent_s += c->glw_parent_s2;
  }

  qsort(ff->visible, ff->num_visible, sizeof(void *), zsort);

  c = ff->pick;

  // Layout next few items to pick, to preload textures, etc

  for(i = 0; i < 3 && c != NULL; i++, c = glw_next_widget(c)) {
    if(!is_visible(ff, c))
      glw_layout0(c, rc);
  }
}
示例#5
0
文件: edge.cpp 项目: johan/Knotter
void Edge::paint(QPainter *painter,
                const QStyleOptionGraphicsItem *,
                QWidget *)
{
    if ( !is_visible() && !highlight)
        return;

    QPen pen(QColor("#0088ff"),2);
    pen.setCosmetic(true);

    if ( highlight && is_visible() )
    {
        pen.setColor(QColor("#00ccff"));
        pen.setWidth(pen.width()*2);
    }

    if ( type == WALL )
    {
        pen.setWidth(pen.width()*3);
        pen.setCapStyle(Qt::FlatCap);
    }
    else if ( type == INVERTED )
        pen.setStyle(Qt::DashLine);

    painter->setPen(pen);

    //if ( type != WALL )
        painter->drawLine(start->pos(),end->pos());
    /*else
    {
        QPainterPathStroker pps;
        pps.setWidth(pen.width()+1);
        QPainterPath pp(start->pos());
        pp.lineTo(end->pos());
        painter->drawPath(pps.createStroke(pp));
    }*/

    if ( type == WALL )
    {
        QPen p(Qt::white,pen.width()/3);
        p.setCosmetic(true);
        painter->setPen(p);
        painter->drawLine(start->pos(),end->pos());
    }

    if ( type == HOLE )
    {
        QLineF l = QLineF( start->pos(),end->pos() ).normalVector();
        l.setLength(5);
        l.translate((end->pos()-start->pos())/2);
        painter->drawLine(l);
        l.setLength(-5);
        painter->drawLine(l);
    }

}
示例#6
0
void LightOccluder2D::_notification(int p_what) {

	if (p_what==NOTIFICATION_ENTER_CANVAS) {

		VS::get_singleton()->canvas_light_occluder_attach_to_canvas(occluder,get_canvas());
		VS::get_singleton()->canvas_light_occluder_set_transform(occluder,get_global_transform());
		VS::get_singleton()->canvas_light_occluder_set_enabled(occluder,is_visible());

	}
	if (p_what==NOTIFICATION_TRANSFORM_CHANGED) {

		VS::get_singleton()->canvas_light_occluder_set_transform(occluder,get_global_transform());
	}
	if (p_what==NOTIFICATION_VISIBILITY_CHANGED) {

		VS::get_singleton()->canvas_light_occluder_set_enabled(occluder,is_visible());
	}

	if (p_what==NOTIFICATION_DRAW) {

		if (get_tree()->is_editor_hint()) {

			if (occluder_polygon.is_valid()) {

				DVector<Vector2> poly = occluder_polygon->get_polygon();

				if (poly.size()) {
					if (occluder_polygon->is_closed()) {
						Vector<Color> color;
						color.push_back(Color(0,0,0,0.6));
						draw_polygon(Variant(poly),color);
					} else {

						int ps=poly.size();
						DVector<Vector2>::Read r = poly.read();
						for(int i=0;i<ps-1;i++) {

							draw_line(r[i],r[i+1],Color(0,0,0,0.6),3);
						}
					}
				}
			}
		}
	}


	if (p_what==NOTIFICATION_EXIT_CANVAS) {

		VS::get_singleton()->canvas_light_occluder_attach_to_canvas(occluder,RID());
	}


}
示例#7
0
/**
 * @brief Displays the entity on the map.
 */
void CustomEnemy::display_on_map() {

  if (is_visible()) {
    script->event_pre_display();
  }

  Enemy::display_on_map();

  if (is_visible()) {
    script->event_post_display();
  }
}
示例#8
0
文件: ou_carai.cpp 项目: mecirt/7k2
//--------- Begin of function UnitCaravan::detect_stop ---------//
//
void UnitCaravan::detect_stop()
{
	int i, x=INFO_X1;

	for( i=0 ; i<MAX_STOP_FOR_CARAVAN ; i++ )
	{
		if( is_own() && button_set_stop[i].detect() )
			power.issue_command( COMMAND_SET_CARAVAN_STOP, sprite_recno, i+1 );		// i+1 - stop id., passed as a parameter of the command

		if( !stop_array[i].firm_recno )
			continue;

		if( button_go_stop[i].detect() )
		{
			Firm* firmPtr = firm_array[ stop_array[i].firm_recno ];
			world.go_loc( firmPtr->center_x, firmPtr->center_y );
		}

		if( !is_own() )
			continue;

		if(button_cancel_stop[i].detect())
		{
			if(is_visible())
			{
				del_stop(i+1, COMMAND_PLAYER);
				se_ctrl.immediate_sound("TURN_OFF");
			}
		}

		if(button_reset_stop[i].detect() )
		{
			if( is_visible() )
			{
				set_stop_pick_up(i+1, NO_PICK_UP, COMMAND_PLAYER);
				se_ctrl.immediate_sound("TURN_OFF");
			}
		}

		for(int b=0; b<MAX_GOODS_SELECT_BUTTON; ++b)
		{
			if(button_select_array[i][b].detect())
			{
				se_ctrl.immediate_sound(
					button_select_array[i][b].elastic_flag || button_select_array[i][b].pushed_flag ?
					(char*)"TURN_ON" : (char*)"TURN_OFF");

				set_stop_pick_up(i+1, b+FIRST_GOODS_SELECT_BUTTON, COMMAND_PLAYER); // b = 1 - MAX_PICK_UP_GOODS
			}
		}
	}
}
Dictionary AnimationPlayerEditor::get_state() const {

	Dictionary d;

	d["visible"]=is_visible();
	if (is_visible() && player) {
		d["player"]=EditorNode::get_singleton()->get_edited_scene()->get_path_to(player);
		d["animation"]=player->get_current_animation();
		d["editing"]=edit_anim->is_pressed();
	}

	return d;

}
void EditorFileDialog::_post_popup() {

	ConfirmationDialog::_post_popup();
	if (invalidated) {
		update_file_list();
		invalidated=false;
	}
	if (mode==MODE_SAVE_FILE)
		file->grab_focus();
	else
		item_list->grab_focus();

	if (is_visible() && get_current_file()!="")
		_request_single_thumbnail(get_current_dir().plus_file(get_current_file()));

	if (is_visible()) {
		Ref<Texture> folder = get_icon("folder","FileDialog");
		recent->clear();


		bool res = access==ACCESS_RESOURCES;
		Vector<String> recentd = EditorSettings::get_singleton()->get_recent_dirs();
		for(int i=0;i<recentd.size();i++) {
			bool cres = recentd[i].begins_with("res://");
			if (cres!=res)
				continue;
			String name = recentd[i];
			if (res && name=="res://") {
				name="/";
			} else {
				name=name.get_file()+"/";
			}

			//print_line("file: "+name);
			recent->add_item(name,folder);
			recent->set_item_metadata( recent->get_item_count()-1,recentd[i]);
		}

		local_history.clear();
		local_history_pos=-1;
		_push_history();

		_update_favorites();
	}

	set_process_unhandled_input(true);

}
示例#11
0
文件: maze.c 项目: GNOME/gcompris
static void
gcDisplay(struct vector position, int viewdir,
	  struct screenparam sp, int xmin, int xmax, int dy, gboolean left_wall)
{
  int dxl=dx_left(sp,xmin,dy,left_wall),
    dxr=dx_right(sp,xmax,dy,left_wall),
    i=0;
  gboolean is_exit=FALSE;

  if (dxl<=0) // seek from the middle left for a wall
    {  if (dxr<i) i=dxr;
      while (i>=dxl && !is_visible(position,viewdir,vector_ctor(i,dy),left_wall,&is_exit))
	--i;
    }
  if (i>=dxl) // wall found
    {  // draw it
      struct Trapez t=Trapez_hide(wall_coords(sp,vector_ctor(i,dy),left_wall),xmin,xmax);
      draw_Trapez(threedgroup,t,is_exit?"green":color(left_wall?TURN_LEFT(viewdir):viewdir),"black");
      // draw left of it
      if (t.x_left-1>=xmin) gcDisplay(position,viewdir,sp,xmin,t.x_left-1,dy,left_wall);
      // right of it ...
      xmin=t.x_right+1;
    }

  i=1;
  is_exit=FALSE;
  if (dxr>=1) // seek from the middle right for a wall
    {  if (dxl>i) i=dxl;
      while (i<=dxr && !is_visible(position,viewdir,vector_ctor(i,dy),left_wall,&is_exit))
	++i;
    }
  if (i<=dxr) // wall found
    {
      struct Trapez t=Trapez_hide(wall_coords(sp,vector_ctor(i,dy),left_wall),xmin,xmax);
      draw_Trapez(threedgroup,t,is_exit?"green":color(left_wall?TURN_RIGHT(viewdir):viewdir),"black");
      // draw right of it
      if (t.x_right+1<xmax)
	gcDisplay(position,viewdir,sp,t.x_right+1,xmax,dy,left_wall);
      // draw right of it
      if (t.x_right+1<xmax)
	gcDisplay(position,viewdir,sp,t.x_right+1,xmax,dy,left_wall);
      // left of it ...
      xmax=t.x_left-1;
    }

  if (xmin<=xmax) // draw in the middle (no wall there)
    gcDisplay(position,viewdir,sp,xmin,xmax,dy+!left_wall,!left_wall);
}
示例#12
0
std::vector<std::shared_ptr<GUIText>> GUIWindow::generate_this_text_data() {
    std::vector<std::shared_ptr<GUIText>> text_data;
    if(!is_visible())
        return text_data;

    return text_data;
}
static void
meta_surface_actor_x11_process_damage (MetaSurfaceActor *actor,
                                       int x, int y, int width, int height)
{
  MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
  MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);

  priv->received_damage = TRUE;

  if (meta_window_is_fullscreen (priv->window) && !priv->unredirected && !priv->does_full_damage)
    {
      MetaRectangle window_rect;
      meta_window_get_frame_rect (priv->window, &window_rect);

      if (x == 0 &&
          y == 0 &&
          window_rect.width == width &&
          window_rect.height == height)
        priv->full_damage_frames_count++;
      else
        priv->full_damage_frames_count = 0;

      if (priv->full_damage_frames_count >= 100)
        priv->does_full_damage = TRUE;
    }

  if (!is_visible (self))
    return;

  cogl_texture_pixmap_x11_update_area (priv->texture, x, y, width, height);
}
示例#14
0
文件: oun_info.cpp 项目: mecirt/7k2
//--------- Begin of function Unit::commanded_soldier_count ---------//
//
// Return the no. of soldiers commanded by this unit.
//
int Unit::commanded_soldier_count()
{
	if( rank_id != RANK_GENERAL && rank_id != RANK_KING )
		return 0;

	//--------------------------------------//

	err_when( !team_info );

   int soldierCount=0;

   if( is_visible() )
   {
		soldierCount = team_info->member_count-1;

      if( soldierCount < 0 )  // member_count can be 0
         soldierCount = 0;
   }
   else
   {
      if( unit_mode == UNIT_MODE_OVERSEE )
      {
         FirmCamp* firmCamp = firm_array[unit_mode_para]->cast_to_FirmCamp();

         if( firmCamp )			// it can be an overseer of a seat of powre
				soldierCount = firmCamp->soldier_count;
      }
   }

   return soldierCount;
}
示例#15
0
void CanvasItem::_update_callback() {



	if (!is_inside_tree()) {
		pending_update=false;
		return;
	}

	VisualServer::get_singleton()->canvas_item_clear(get_canvas_item());
	//todo updating = true - only allow drawing here
	if (is_visible()) { //todo optimize this!!
		if (first_draw) {
			notification(NOTIFICATION_VISIBILITY_CHANGED);
			first_draw=false;
		}
		drawing=true;
		notification(NOTIFICATION_DRAW);
		emit_signal(SceneStringNames::get_singleton()->draw);
		if (get_script_instance()) {
			Variant::CallError err;
			get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_draw,NULL,0);
		}
		drawing=false;

	}
	//todo updating = false
	pending_update=false; // don't change to false until finished drawing (avoid recursive update)
}
// same as terrain_block
void zz_ocean_block::render_runit (unsigned int runit_index)
{	
	assert(runit_index < num_runits);

	// light can be NULL
	assert(is_visible());

	zz_runit& ru = runits[runit_index];
	zz_mesh * mesh = ru.mesh;
	zz_material * mat = ru.material;
	const zz_shader * shader = (mat) ? mat->get_shader() : NULL;
	zz_light * light = ru.light;

	assert(mesh && mat && shader);

	// set modelviewTM from modelview_worldTM
	mat4 modelview_worldTM;
	get_modelview_worldTM(modelview_worldTM);
	znzin->renderer->set_modelview_matrix(modelview_worldTM);
	znzin->renderer->set_world_matrix(get_worldTM());

	if (!mat->get_device_updated())
		return;

	if (!mesh->get_device_updated())
		return;

	znzin->renderer->render(mesh, mat, light);
}
示例#17
0
文件: OUNITIF.cpp 项目: AMDmi3/7kaa
//--------- Begin of function Unit::detect_basic_info ---------//
//
int Unit::detect_basic_info()
{
	//--- detect pressing on the name to center the unit on the screen ---//

	if( is_visible() && mouse.single_click( INFO_X1, INFO_Y1, INFO_X2, INFO_Y1+21 ) )
	{
		world.go_loc( next_x_loc(), next_y_loc() );
		return 1;
	}

	//-------- detect resign button ----------//

	// ###### patch begin Alex 10/1 ########//
	// if( is_own() && rank_id != RANK_KING )
	if( nation_recno == nation_array.player_recno && rank_id != RANK_KING )
	{
		if( button_resign.detect(KEY_DEL) )
		{
			group_resign();
			return 1;
		}
	}
	// ###### patch end Alex 10/1 ########//

	return 0;
}
示例#18
0
文件: ui.cpp 项目: sidpoison/dokun
void GUI::on_draw()
{
	GUI * parent = get_parent();
	if(parent != nullptr)
	{
		// keep object within parent bounds (keep from moving outside parent)
        if(get_x() <= parent->get_x()) {set_position(parent->get_x(), get_y());}
        if(get_y() <= parent->get_y()) {set_position(get_x(), parent->get_y());}
	    if(get_x() >= parent->get_x() + (parent->get_width() - get_width()))   {set_position(parent->get_x() + (parent->get_width() - get_width()), get_y());}
	    if(get_y() >= parent->get_y() + (parent->get_height() - get_height())) {set_position(get_x(), parent->get_y() + (parent->get_height() - get_height()));}
	
	    // keep object from exceeding parent size (width and height) UPDATED: 9-7-2018
	    if(get_width () > parent->get_width ()) set_size(parent->get_width(), get_height()); // if object is wider than parent, make width equal to parent's width
		if(get_height() > parent->get_height()) set_size(get_width(), parent->get_height()); // if object is taller than parent, make height equal to parent's height
	}	
	if(is_visible()) 
	{
		for(int i = 0; i < Factory::get_gui_factory()->get_size(); i++)
		{
			GUI * gui = static_cast<GUI*>(Factory::get_gui_factory()->get_object(i));
			// draw all children if visible (child ui can also have their own visibility)
			if(is_parent_of(*gui)) {
				gui->draw(); 
			}
			// set focus to the gui that is pressed
			if(gui->is_pressed())
		    {
			    gui->set_focused(true);
		    }
		}
	}
	// if mouse is over ui and mouse is pressed, set as current focus
}
示例#19
0
文件: ou_caraa.cpp 项目: 112212/7k2
//------- Begin of function UnitCaravan::think_set_pick_up_type --------//
//
// Think about setting the pick up types of this caravan's stops.
//
void UnitCaravan::think_set_pick_up_type()
{
	if( !is_visible() )		// cannot change pickup type if the caravan is inside a market place.
		return;

	if( stop_defined_num < 2 )
		return;

	//------------------------------------------//

	err_when( firm_array.is_deleted(stop_array[0].firm_recno) );
	err_when( firm_array.is_deleted(stop_array[1].firm_recno) );

	Firm* firmPtr1 = firm_array[stop_array[0].firm_recno];
	Firm* firmPtr2 = firm_array[stop_array[1].firm_recno];

	if( firmPtr1->firm_id != FIRM_MARKET ||		// only when both firms are markets
		 firmPtr2->firm_id != FIRM_MARKET )
	{
		return;
	}

	//--- think in both directions as a market can sell both raw materials and finished goods ---//

	think_set_pick_up_type2( 1, 2 );
	think_set_pick_up_type2( 2, 1 );
}
示例#20
0
// --------------------------------------------------------
// change the bitmap
// --------------------------------------------------------
void t_bitmap_layer_window::set_bitmap( t_bitmap_layer const* bitmap, t_screen_point point )
{
	if (bitmap == m_bitmap)
		return;

	t_screen_rect rect;
	bool          was_visible = is_visible();

	set_visible( false );
	m_bitmap = bitmap;
	if (bitmap == 0)
		rect = t_screen_rect( point.x, point.y, point.x, point.y );
	else
	{
		if (bitmap->get_alpha_depth() > 0)
			m_has_transparency = k_some_transparency;
		else
			m_has_transparency = k_no_transparency;
		rect = bitmap->get_rect() + point;
	}
	on_bitmap_changed();
	move( rect );
	set_visible( was_visible );
	get_parent()->update_size();
}
示例#21
0
void ToolTip::show(const Point &position)
{
	if (is_visible())
		return;
	set_geometry(Rect(position, get_size()));
	set_visible(true, false);
}
示例#22
0
void EditorLog::_flip_request() {

	if (is_visible())
		hide();
	else
		show();
}
示例#23
0
void InfoBox::UpdateDialog()
{
    if( !is_visible() ) return;
#if 0
    if( !f_editCharAction && f_refActionGroup )
    {
        f_editCharAction = f_refActionGroup->get_action( "Edit::Edit" );
    }
#endif

    f_infoBuffer->erase( f_infoBuffer->begin(), f_infoBuffer->end() );
    //
    if( f_char )
    {
        GenerateAbilityString();
        GenerateBuiltinString();
        GenerateStatString();
        //
        AddCR();
        AddNotesString();
        //
        //MakeReadOnly();
    }
    show_all();
}
示例#24
0
文件: oun_act.cpp 项目: mecirt/7k2
// --------- Begin of function Unit::teleport --------//
// return 1 on success
int Unit::teleport(int targetXLoc, int targetYLoc )
{
	// ###### begin Gilbert 21/3 ########//
	if( !is_visible() )
		return 0;
	// ###### end Gilbert 21/3 ########//

	if( world.check_unit_space( targetXLoc, targetYLoc, 
		targetXLoc+loc_width-1, targetYLoc+loc_height-1, mobile_type) )
	{
		stop_order();

		int dx, dy;
		for( dy = 0; dy < loc_width; ++dy )
			for( dx = 0; dx < loc_height; ++dx )
				world.get_loc(next_x_loc()+dx, next_y_loc()+dy)->remove_unit( mobile_type );
		
		cur_x = go_x = next_x = targetXLoc * LOCATE_WIDTH;
		cur_y = go_y = next_y = targetYLoc * LOCATE_HEIGHT;

		for( dy = 0; dy < loc_width; ++dy )
			for( dx = 0; dx < loc_height; ++dx )
				world.get_loc( next_x_loc()+dx, next_y_loc()+dy)->set_unit( sprite_recno, mobile_type );

		explore_area();

		return 1;
	}

	return 0;
}
示例#25
0
void EditorAssetLibrary::_notification(int p_what) {

	switch (p_what) {
		case NOTIFICATION_READY: {

			error_tr->set_texture(get_icon("Error", "EditorIcons"));
			reverse->set_icon(get_icon("Sort", "EditorIcons"));

			error_label->raise();
		} break;

		case NOTIFICATION_VISIBILITY_CHANGED: {

			if (is_visible()) {
				_repository_changed(0); // Update when shown for the first time
			}
		} break;

		case NOTIFICATION_PROCESS: {

			HTTPClient::Status s = request->get_http_client_status();
			bool visible = s != HTTPClient::STATUS_DISCONNECTED;

			if (visible != load_status->is_visible()) {
				load_status->set_visible(visible);
			}

			if (visible) {
				switch (s) {

					case HTTPClient::STATUS_RESOLVING: {
						load_status->set_value(0.1);
					} break;
					case HTTPClient::STATUS_CONNECTING: {
						load_status->set_value(0.2);
					} break;
					case HTTPClient::STATUS_REQUESTING: {
						load_status->set_value(0.3);
					} break;
					case HTTPClient::STATUS_BODY: {
						load_status->set_value(0.4);
					} break;
					default: {}
				}
			}

			bool no_downloads = downloads_hb->get_child_count() == 0;
			if (no_downloads == downloads_scroll->is_visible()) {
				downloads_scroll->set_visible(!no_downloads);
			}

		} break;
		case NOTIFICATION_THEME_CHANGED: {

			library_scroll_bg->add_style_override("panel", get_stylebox("bg", "Tree"));
			error_tr->set_texture(get_icon("Error", "EditorIcons"));
			reverse->set_icon(get_icon("Sort", "EditorIcons"));
		} break;
	}
}
示例#26
0
void Light2D::_update_light_visibility() {

	if (!is_inside_tree())
		return;

	VS::get_singleton()->canvas_light_set_enabled(canvas_light,enabled && is_visible());
}
示例#27
0
文件: state.c 项目: qb1/curseofwar
void ui_init(struct state *s, struct ui *ui) {
  /* cursor location */
  ui->cursor.i = s->grid.width/2;
  ui->cursor.j = s->grid.height/2;
  int i, j;
  for (i=0; i<s->grid.width; ++i) {
    for (j=0; j<s->grid.height; ++j) {
      if (s->grid.tiles[i][j].units[s->controlled][citizen] > 
          s->grid.tiles[ui->cursor.i][ui->cursor.j].units[s->controlled][citizen]) {
        ui->cursor.i = i;
        ui->cursor.j = j;
      }
    }
  }
  /* find the leftmost visible tile */
  int xskip_x2 = MAX_WIDTH * 2 + 1;
  int xrightmost_x2 = 0;
  for(i=0; i<s->grid.width; ++i)
    for(j=0; j<s->grid.height; ++j)
      if(is_visible(s->grid.tiles[i][j].cl)) {
        int x = i*2 + j;
        if (xskip_x2 > x)
          xskip_x2 = x;
        if (xrightmost_x2 < x)
          xrightmost_x2 = x;
      }
  ui->xskip = xskip_x2/2;
  ui->xlength = (xrightmost_x2+1)/2 - xskip_x2/2;
}
示例#28
0
void zz_sky::render (bool recursive)
{
	assert(is_visible());
	
	// save rotation
	quat rot = this->get_rotation();
	// rotation axis (z-axis)
	const vec3 axis(0, 0, 1);

	// render the first object only
	rotate_by_axis(this->rot_angles_current[0]*ZZ_TO_RAD, axis);

	invalidate_transform();

	// TODO: extract this code out of render() call
	zz_material * mat = runits[0].material;
	if (mat) {
		mat->set_alpha_test(true);
		mat->set_receive_fog(receive_fog);			
		mat->set_ztest(ztest);
		mat->set_zwrite(false);
	}
	// render unit
	render_runit(0);
	// restore rotation
	set_rotation(rot);
	invalidate_transform();
}
示例#29
0
void HGTalkWindow::on_show_hide()
{
	if(is_visible())
	  hide();
	else
	  show();
}
示例#30
0
void ToolTip::show_delayed(const Point &position, int delay_time)
{
	if (is_visible())
		return;
	set_geometry(Rect(position, get_size()));
	impl->timer_show_delayed.start(delay_time, false);
}