コード例 #1
0
ファイル: visibility.c プロジェクト: CODECOMMUNITY/libcss
css_error css__cascade_visibility(uint32_t opv, css_style *style, 
		css_select_state *state)
{
	uint16_t value = CSS_VISIBILITY_INHERIT;

	UNUSED(style);

	if (isInherit(opv) == false) {
		switch (getValue(opv)) {
		case VISIBILITY_VISIBLE:
			value = CSS_VISIBILITY_VISIBLE;
			break;
		case VISIBILITY_HIDDEN:
			value = CSS_VISIBILITY_HIDDEN;
			break;
		case VISIBILITY_COLLAPSE:
			value = CSS_VISIBILITY_COLLAPSE;
			break;
		}
	}

	if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
			isInherit(opv))) {
		return set_visibility(state->computed, value);
	}

	return CSS_OK;
}
コード例 #2
0
ファイル: obs-scene.c プロジェクト: AnthonySuper/obs-studio
static inline void remove_without_release(struct obs_scene_item *item)
{
	item->removed = true;
	set_visibility(item, false);
	signal_item_remove(item);
	detach_sceneitem(item);
}
コード例 #3
0
void
tm_frame_rep::dialogue_end () {
  if (!is_nil (dialogue_win)) {
    set_visibility (dialogue_win, false);
    destroy_window_widget (dialogue_win);
    dialogue_win= widget ();
    dialogue_wid= widget ();
  }
}
コード例 #4
0
ファイル: x_window.cpp プロジェクト: KarlHegbloom/texmacs
void
x_window_rep::set_full_screen (bool flag) {
  if (full_screen_flag == flag) return;
  string old_name= get_name ();
  if (old_name == "")
    old_name= as_string (name);
  if (flag) {
    save_win= win;
    name= NULL;
    save_x= win_x; save_y= win_y;
    save_w= win_w; save_h= win_h;
    initialize ();
    XMoveResizeWindow (dpy, win, 0, 0,
		       gui->screen_width, gui->screen_height);
    move_event   (0, 0);
    resize_event (gui->screen_width, gui->screen_height);
    set_visibility (true);
    XSetInputFocus (dpy, win, PointerRoot, CurrentTime);
  }
  else {
    set_visibility (false);
    Window_to_window->reset (win);
    nr_windows--;
    XDestroyWindow (dpy, win);
    win= save_win;
    set_visibility (false);
    Window_to_window->reset (win);
    nr_windows--;
    XDestroyWindow (dpy, win);
    //FIXME: is this 'as_charp' a possible memory leak?
    name= as_charp (old_name);
    win_x= save_x; win_y= save_y;
    win_w= save_w; win_h= save_h;
    initialize ();
    set_visibility (true);
    XMoveResizeWindow (dpy, win, save_x, save_y, save_w, save_h);
    resize_event (save_w, save_h);
    move_event   (save_x, save_y);
  }
  set_name (old_name);
  full_screen_flag= flag;
}
コード例 #5
0
ファイル: visibility.c プロジェクト: CODECOMMUNITY/libcss
css_error css__compose_visibility(const css_computed_style *parent,	
		const css_computed_style *child,
		css_computed_style *result)
{
	uint8_t type = get_visibility(child);

	if (type == CSS_VISIBILITY_INHERIT) {
		type = get_visibility(parent);
	}

	return set_visibility(result, type);
}
コード例 #6
0
ファイル: tag.c プロジェクト: mztriz/bspwm
void tag_node(monitor_t *m, desktop_t *d, node_t *n, desktop_t *ds, unsigned int tags_field)
{
    if (num_tags < 1)
        return;
    bool visible = is_visible(ds, n);
    n->client->tags_field = tags_field;
    if ((visible && (tags_field & d->tags_field) == 0)
            || (!visible && (tags_field & d->tags_field) != 0)) {
        set_visibility(m, d, n, !visible);
        arrange(m, d);
    }
}
コード例 #7
0
ファイル: sk_scene.cpp プロジェクト: gsi-upm/SmartSim
void SkScene::set_visibility ( int skel, int visgeo, int colgeo, int vaxis )
 {
   if ( !_skeleton ) return;

   if (_needsInit)
	   initInternal();

   const std::vector<SkJoint*>& joints = _skeleton->joints();
   for (size_t i=0; i<joints.size(); i++ )
    { 
      set_visibility ( joints[i], skel, visgeo, colgeo, vaxis );
    }
 }
コード例 #8
0
ファイル: obs-scene.c プロジェクト: ab22/obs-studio
static void scene_load_item(struct obs_scene *scene, obs_data_t *item_data)
{
	const char            *name = obs_data_get_string(item_data, "name");
	obs_source_t          *source = obs_get_source_by_name(name);
	struct obs_scene_item *item;
	bool visible;

	if (!source) {
		blog(LOG_WARNING, "[scene_load_item] Source %s not found!",
				name);
		return;
	}

	item = obs_scene_add(scene, source);
	if (!item) {
		blog(LOG_WARNING, "[scene_load_item] Could not add source '%s' "
		                  "to scene '%s'!",
		                  name, obs_source_get_name(scene->source));
		
		obs_source_release(source);
		return;
	}

	obs_data_set_default_int(item_data, "align",
			OBS_ALIGN_TOP | OBS_ALIGN_LEFT);

	item->rot     = (float)obs_data_get_double(item_data, "rot");
	item->align   = (uint32_t)obs_data_get_int(item_data, "align");
	visible = obs_data_get_bool(item_data, "visible");
	obs_data_get_vec2(item_data, "pos",    &item->pos);
	obs_data_get_vec2(item_data, "scale",  &item->scale);

	set_visibility(item, visible);

	item->bounds_type =
		(enum obs_bounds_type)obs_data_get_int(item_data,
				"bounds_type");
	item->bounds_align =
		(uint32_t)obs_data_get_int(item_data, "bounds_align");
	obs_data_get_vec2(item_data, "bounds", &item->bounds);

	obs_source_release(source);

	update_item_transform(item);
}
コード例 #9
0
ファイル: tag.c プロジェクト: mztriz/bspwm
void tag_desktop(monitor_t *m, desktop_t *d, unsigned int tags_field)
{
    if (num_tags < 1)
        return;
    bool dirty = false;
    unsigned int old_tags_field = d->tags_field;
    d->tags_field = tags_field;
    for (node_t *n = first_extrema(d->root); n != NULL; n = next_leaf(n, d->root)) {
        bool old_visible = (old_tags_field & n->client->tags_field) != 0;
        bool visible = (tags_field & n->client->tags_field) != 0;
        if (old_visible != visible) {
            set_visibility(m, d, n, visible);
            dirty = true;
        }
    }
    if (dirty)
        arrange(m, d);
    if (d == mon->desk)
        put_status();
}
コード例 #10
0
void
tm_frame_rep::dialogue_start (string name, widget wid) {
  if (is_nil (dialogue_win)) {
    string lan= get_output_language ();
    if (lan == "russian") lan= "english";
    name= translate (name, "english", lan);
    dialogue_wid= wid;
    dialogue_win= plain_window_widget (dialogue_wid, name);

    widget win= concrete_window () -> win;
    SI ox, oy, dx, dy, ex= 0, ey= 0;
    get_position (win, ox, oy);
    get_size (win, dx, dy);
    get_size (dialogue_win, ex, ey);
    ox += (dx - ex) >> 1;
    oy -= (dy - ey) >> 1;
    set_position (dialogue_win, ox, oy);
    set_visibility (dialogue_win, true);
  }
}
コード例 #11
0
ファイル: visibility.c プロジェクト: CODECOMMUNITY/libcss
css_error css__initial_visibility(css_select_state *state)
{
	return set_visibility(state->computed, CSS_VISIBILITY_VISIBLE);
}
コード例 #12
0
ファイル: visibility.c プロジェクト: CODECOMMUNITY/libcss
css_error css__set_visibility_from_hint(const css_hint *hint,
		css_computed_style *style)
{
	return set_visibility(style, hint->status);
}
コード例 #13
0
void main_game::run(float dt) {
    game_base::run(dt);
	// world position for interactions
	world_mouse_pos = camera.viewport_to_world(mouse->position, screen_rect);

	nebular_background->run(camera);
	current_level->run(dt);

	if (state == game_state::game_base) {
		bullet_particle_system.upload(dt, screen_rect);
		sparks_particle_system.upload(dt, screen_rect);
		ship_sys.run(dt, screen_rect);
		ship_sys.calc_screen_pos(camera, screen_rect);
		background_dust->run(camera, screen_rect);
		waypoint_visualizer->run();
		trails_renderer->run(camera);

		if (ship_sys.size() > 0) {
			auto button_container = (ui::ui_container*)ui.named_elements["ship_button_container"];

			uint32_t current_button_count = 0;

			for (auto button_it = button_container->begin(); button_it != button_container->end(); ++button_it) {
				current_button_count++;
			}

			if (current_button_count < ship_sys.size()) {
				for (uint32_t i = 0; i < ship_sys.size() - current_button_count; ++i) {
					auto new_selection_button = new ship_selection_button(button_container);
				}
			}

			auto current_button = (ship_selection_button*)*button_container->begin();

			for (auto ship_it = ship_sys.begin(); ship_it != ship_sys.end(); ++ship_it) {
				auto screen_pos = (*ship_it)->screen_position;

				current_button->set_margin_left(floor(screen_pos.x - 8.f));
				current_button->set_margin_top(floor(screen_pos.y - 8.f));

				if ((*ship_it)->team == 0) {
					if (exists_in(teams[0].selected_ships, *ship_it)) {
						current_button->set_selection_state(ship_selection_button_state::selected);
					} else {
						current_button->set_selection_state(ship_selection_button_state::player);
					}

				} else {
					current_button->set_selection_state(ship_selection_button_state::enemy);
				}

				current_button->assc_ship = *ship_it;
				current_button->mouse_button_released(ui::get_ui_handler(&main_game::ship_selection_button_mouse_released, this));

				current_button = (ship_selection_button*)current_button->get_next_leaf();
			}

			while (current_button) {
				current_button->set_visibility(false);
				current_button = (ship_selection_button*)current_button->get_next_leaf();
			}

			button_container->arrange_layout(viewport);
		}

		// camera movements
		if (mouse->wheel_y > 0) {
			camera.zoom_in(dt);
		}

		if (mouse->wheel_y < 0) {
			camera.zoom_out(dt);
		}

		if (mouse->is_down(mouse_buttons::middle)) {
			camera.move(mouse->delta.reflect_y());
		}


		if (mouse->was_pressed(mouse_buttons::left)) {
			// enabled selection rect
			if (!ui.render_context.is_drawn_pixel(world_mouse_pos)) {
				selection_anchor = world_mouse_pos;
				is_selection_active = true;
				selection_renderer->show();
			}
		}

		if (is_selection_active) {
			if (!ui.render_context.is_drawn_pixel(world_mouse_pos)) {
				teams[0].previous_selected_ships.clear();
				teams[0].selected_ships.swap(teams[0].previous_selected_ships);

				// create selection rect
				selection_rect.position.x = min(selection_anchor.x, world_mouse_pos.x);
				selection_rect.position.y = min(selection_anchor.y, world_mouse_pos.y);
				selection_rect.size.width = abs(selection_anchor.x - world_mouse_pos.x);
				selection_rect.size.height = abs(selection_anchor.y - world_mouse_pos.y);
				selection_renderer->set_rect(selection_rect);

				// find ships inside selection rect
				rect ship_rect;
				for (auto& current_ship : teams[0].ships) {

					ship_rect.position.x = current_ship->transform.position.x - current_ship->dimension.size.width * 0.5f;
					ship_rect.position.y = current_ship->transform.position.y - current_ship->dimension.size.height * 0.5f;
					ship_rect.size.width = current_ship->dimension.size.width;
					ship_rect.size.height = current_ship->dimension.size.height;

					if (selection_rect.intersects(ship_rect)) {
						teams[0].selected_ships.push_back(current_ship);
					}
				}

				// check if some ship was selected
				for (auto selected_ship : teams[0].selected_ships) {
					if (!exists_in(teams[0].previous_selected_ships, selected_ship)) {
						selected_ship->select();
					}
				}

				// check if some ship was unselected
				for (auto prev_selected_ship : teams[0].previous_selected_ships) {
					if (!exists_in(teams[0].selected_ships, prev_selected_ship)) {
						prev_selected_ship->unselect();
					}
				}
			}
		}

		if (mouse->was_released(mouse_buttons::left)) {
			// disabled selection rect
			is_selection_active = false;
			selection_renderer->hide();
		}

		if (mouse->was_pressed(mouse_buttons::right)) {
			if (ui.is_drawn_pixel(mouse->position)) {

			} else {
				// order selected ships to fly to mouse position 
				waypoint new_waypoint;
				new_waypoint.type = waypoint_type::fly_to_position;
				new_waypoint.position_target = world_mouse_pos;

				add_waypoint_to_selection(new_waypoint);
			}
		}

		// damp screen shake amplitude
		screen_shake.set_amplitude(screen_shake.get_amplitude() * exp(-4.0f * dt));
	}

	if (state == game_state::loading) {
		if (!loader.is_finished()) {
			((ui_label*)ui.named_elements["loading_label"])->set_text(std::to_string((int)(loader.get_progress() * 100.f)));
			loader.load(hub, 10.f);
			loading_squares->run(loader.get_progress());
		} else {
			change_game_state(game_state::game_base);
		}
	}
}
コード例 #14
0
static VALUE
rb_mod_private(int argc, VALUE *argv, VALUE module)
{
    return set_visibility(argc, argv, module, NOEX_PRIVATE);
}
コード例 #15
0
static VALUE
rb_mod_protected(int argc, VALUE *argv, VALUE module)
{
    return set_visibility(argc, argv, module, NOEX_PROTECTED);
}
コード例 #16
0
ファイル: Object.cpp プロジェクト: stevewolter/rapidSTORM
void Object::hide() { set_visibility(false); }
コード例 #17
0
ファイル: tm_window.cpp プロジェクト: mgubi/texmacs
void
window_hide (int win) {
    ASSERT (window_table->contains (win), "window does not exist");
    widget pww= window_table [win];
    set_visibility (pww, false);
}
コード例 #18
0
ファイル: tm_window.cpp プロジェクト: mgubi/texmacs
void
tm_window_rep::map () {
    set_visibility (win, true);
}
コード例 #19
0
ファイル: tm_window.cpp プロジェクト: mgubi/texmacs
void
tm_window_rep::unmap () {
    set_visibility (win, false);
}
コード例 #20
0
ファイル: obs-scene.c プロジェクト: AnthonySuper/obs-studio
static void scene_load_item(struct obs_scene *scene, obs_data_t *item_data)
{
	const char            *name = obs_data_get_string(item_data, "name");
	obs_source_t          *source = obs_get_source_by_name(name);
	const char            *scale_filter_str;
	struct obs_scene_item *item;
	bool visible;

	if (!source) {
		blog(LOG_WARNING, "[scene_load_item] Source %s not found!",
				name);
		return;
	}

	item = obs_scene_add(scene, source);
	if (!item) {
		blog(LOG_WARNING, "[scene_load_item] Could not add source '%s' "
		                  "to scene '%s'!",
		                  name, obs_source_get_name(scene->source));
		
		obs_source_release(source);
		return;
	}

	obs_data_set_default_int(item_data, "align",
			OBS_ALIGN_TOP | OBS_ALIGN_LEFT);

	item->rot     = (float)obs_data_get_double(item_data, "rot");
	item->align   = (uint32_t)obs_data_get_int(item_data, "align");
	visible = obs_data_get_bool(item_data, "visible");
	obs_data_get_vec2(item_data, "pos",    &item->pos);
	obs_data_get_vec2(item_data, "scale",  &item->scale);

	set_visibility(item, visible);

	item->bounds_type =
		(enum obs_bounds_type)obs_data_get_int(item_data,
				"bounds_type");
	item->bounds_align =
		(uint32_t)obs_data_get_int(item_data, "bounds_align");
	obs_data_get_vec2(item_data, "bounds", &item->bounds);

	item->crop.left   = (uint32_t)obs_data_get_int(item_data, "crop_left");
	item->crop.top    = (uint32_t)obs_data_get_int(item_data, "crop_top");
	item->crop.right  = (uint32_t)obs_data_get_int(item_data, "crop_right");
	item->crop.bottom = (uint32_t)obs_data_get_int(item_data, "crop_bottom");

	scale_filter_str = obs_data_get_string(item_data, "scale_filter");
	item->scale_filter = OBS_SCALE_DISABLE;

	if (scale_filter_str) {
		if (astrcmpi(scale_filter_str, "point") == 0)
			item->scale_filter = OBS_SCALE_POINT;
		else if (astrcmpi(scale_filter_str, "bilinear") == 0)
			item->scale_filter = OBS_SCALE_BILINEAR;
		else if (astrcmpi(scale_filter_str, "bicubic") == 0)
			item->scale_filter = OBS_SCALE_BICUBIC;
		else if (astrcmpi(scale_filter_str, "lanczos") == 0)
			item->scale_filter = OBS_SCALE_LANCZOS;
	}

	if (item->item_render && !item_texture_enabled(item)) {
		obs_enter_graphics();
		gs_texrender_destroy(item->item_render);
		item->item_render = NULL;
		obs_leave_graphics();

	} else if (!item->item_render && item_texture_enabled(item)) {
		obs_enter_graphics();
		item->item_render = gs_texrender_create(GS_RGBA, GS_ZS_NONE);
		obs_leave_graphics();
	}

	obs_source_release(source);

	update_item_transform(item);
}
コード例 #21
0
static VALUE
rb_mod_public(int argc, VALUE *argv, VALUE module)
{
    return set_visibility(argc, argv, module, NOEX_PUBLIC);
}
コード例 #22
0
ファイル: Object.cpp プロジェクト: stevewolter/rapidSTORM
void Object::show() { set_visibility(true); }