• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ set_active函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中set_active函数的典型用法代码示例。如果您正苦于以下问题:C++ set_active函数的具体用法?C++ set_active怎么用?C++ set_active使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了set_active函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: set_active

void Visualization_layer::activate() {
    set_active(true);
}
开发者ID:balint-miklos,项目名称:mesecina,代码行数:3,代码来源:Visualization_layer.cpp


示例2: memset

void CL_GL1CreationHelper::set_multisampling_pixel_format(const CL_GL1WindowDescription &gldesc)
{
	PIXELFORMATDESCRIPTOR pfd;
	memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
	pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
	pfd.nVersion = 1;
	pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
	pfd.iPixelType = PFD_TYPE_RGBA;
	if (gldesc.get_doublebuffer()) pfd.dwFlags |= PFD_DOUBLEBUFFER;
	if (gldesc.get_stereo()) pfd.dwFlags |= PFD_STEREO;
	pfd.cColorBits = gldesc.get_buffer_size();
	pfd.cRedBits = gldesc.get_red_size();
	pfd.cGreenBits = gldesc.get_green_size();
	pfd.cBlueBits = gldesc.get_blue_size();
	pfd.cAlphaBits = gldesc.get_alpha_size();
	pfd.cDepthBits = gldesc.get_depth_size();
	pfd.cStencilBits = gldesc.get_stencil_size();
	if (gldesc.is_layered())
	{
		pfd.cAlphaBits = 8;
		pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE; // | PFD_DRAW_TO_BITMAP
	}

	if (gldesc.get_multisampling() < 1)
	{
		int pixelformat = ChoosePixelFormat(hdc, &pfd);
		SetPixelFormat(hdc, pixelformat, &pfd);
	}
	else
	{
		int pixelformat = ChoosePixelFormat(hdc, &pfd);

		set_active();
		ptr_wglChoosePixelFormatEXT wglChoosePixelFormatEXT = (ptr_wglChoosePixelFormatEXT) wglGetProcAddress("wglChoosePixelFormatEXT");
		if (wglChoosePixelFormatEXT == 0)
			wglChoosePixelFormatEXT = (ptr_wglChoosePixelFormatEXT) wglGetProcAddress("wglChoosePixelFormatARB");
		reset_active();

		if (wglChoosePixelFormatEXT)
		{
			std::vector<FLOAT> float_attributes;
			std::vector<int> int_attributes;

			int_attributes.push_back(WGL_DRAW_TO_WINDOW);
			int_attributes.push_back(GL_TRUE);
			int_attributes.push_back(WGL_ACCELERATION);
			int_attributes.push_back(WGL_FULL_ACCELERATION);

			if (gldesc.get_doublebuffer())
			{
				int_attributes.push_back(WGL_DOUBLE_BUFFER);
				int_attributes.push_back(GL_TRUE);
			}
			if (gldesc.get_stereo())
			{
				int_attributes.push_back(WGL_STEREO);
				int_attributes.push_back(GL_TRUE);
			}

			int_attributes.push_back(WGL_COLOR_BITS);
			int_attributes.push_back(gldesc.get_red_size() + gldesc.get_green_size() + gldesc.get_blue_size());

			int_attributes.push_back(WGL_ALPHA_BITS);
			int_attributes.push_back(gldesc.get_alpha_size());

			int_attributes.push_back(WGL_DEPTH_BITS);
			int_attributes.push_back(gldesc.get_depth_size());

			int_attributes.push_back(WGL_STENCIL_BITS);
			int_attributes.push_back(gldesc.get_stencil_size());

			int_attributes.push_back(WGL_SAMPLE_BUFFERS);
			int_attributes.push_back(GL_TRUE);
			int_attributes.push_back(WGL_SAMPLES);
			int_attributes.push_back(gldesc.get_multisampling());

			float_attributes.push_back(0.0f);
			float_attributes.push_back(0.0f);
			int_attributes.push_back(0);
			int_attributes.push_back(0);
			int new_pixelformat = pixelformat;
			UINT num_formats = 0;
			BOOL result = wglChoosePixelFormatEXT(hdc, &int_attributes[0], &float_attributes[0], 1, &new_pixelformat, &num_formats);
			if (result == TRUE && num_formats > 0)
				pixelformat = new_pixelformat;
		}

		SetPixelFormat(hdc, pixelformat, &pfd);
	}
}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:90,代码来源:gl1_creation_helper.cpp


示例3: switch

void Body2DSW::set_state(Physics2DServer::BodyState p_state, const Variant& p_variant) {

	switch(p_state)	{
		case Physics2DServer::BODY_STATE_TRANSFORM: {


			if (mode==Physics2DServer::BODY_MODE_KINEMATIC) {

				new_transform=p_variant;				
				//wakeup_neighbours();
				set_active(true);
				if (first_time_kinematic) {
					_set_transform(p_variant);
					_set_inv_transform(get_transform().affine_inverse());
					first_time_kinematic=false;
				}
			} else if (mode==Physics2DServer::BODY_MODE_STATIC) {
				_set_transform(p_variant);
				_set_inv_transform(get_transform().affine_inverse());
				wakeup_neighbours();
			} else {
				Matrix32 t = p_variant;
				t.orthonormalize();
				new_transform=get_transform(); //used as old to compute motion
				if (t==new_transform)
					break;
				_set_transform(t);
				_set_inv_transform(get_transform().inverse());

			}
			wakeup();

		} break;
		case Physics2DServer::BODY_STATE_LINEAR_VELOCITY: {

			//if (mode==Physics2DServer::BODY_MODE_STATIC)
			//	break;
			linear_velocity=p_variant;
			wakeup();

		} break;
		case Physics2DServer::BODY_STATE_ANGULAR_VELOCITY: {
			//if (mode!=Physics2DServer::BODY_MODE_RIGID)
			//	break;
			angular_velocity=p_variant;
			wakeup();

		} break;
		case Physics2DServer::BODY_STATE_SLEEPING: {
			//?
			if (mode==Physics2DServer::BODY_MODE_STATIC || mode==Physics2DServer::BODY_MODE_KINEMATIC)
				break;
			bool do_sleep=p_variant;
			if (do_sleep) {
				linear_velocity=Vector2();
				//biased_linear_velocity=Vector3();
				angular_velocity=0;
				//biased_angular_velocity=Vector3();
				set_active(false);
			} else {
				if (mode!=Physics2DServer::BODY_MODE_STATIC)
					set_active(true);
			}
		} break;
		case Physics2DServer::BODY_STATE_CAN_SLEEP: {
			can_sleep=p_variant;
			if (mode==Physics2DServer::BODY_MODE_RIGID && !active && !can_sleep)
				set_active(true);

		} break;
	}

}
开发者ID:TierraDelFuego,项目名称:godot,代码行数:73,代码来源:body_2d_sw.cpp


示例4: set_active

void Data_Elise_Gra_Win::set_fill_style(Data_Fill_St * dfst)
{
     set_active();
     set_col(dfst->dcp());
}
开发者ID:jakexie,项目名称:micmac-archeos,代码行数:5,代码来源:gen_win.cpp


示例5: garbage_collected_copy

void Renderer::draw_single_threaded(std::vector<SceneGraph const*> const& scene_graphs) {
  for (auto graph : scene_graphs) {
    graph->update_cache();
  }

  auto sgs = garbage_collected_copy(scene_graphs);

  for (auto graph : scene_graphs) {
    for (auto& cam : graph->get_camera_nodes()) {
      auto window_name(cam->config.get_output_window_name());
      auto serialized_cam(cam->serialize());

      if (window_name != "") {
        auto window = WindowDatabase::instance()->lookup(window_name);

        if (window && !window->get_is_open()) {
          window->open();
        }
        // update window if one is assigned
        if (window && window->get_is_open()) {
          window->set_active(true);
          window->start_frame();

          if (window->get_context()->framecount == 0) {
            display_loading_screen(*window);
          }


          // make sure pipeline was created
          std::shared_ptr<Pipeline> pipe = nullptr;
          auto pipe_iter = window->get_context()->render_pipelines.find(
              serialized_cam.uuid);

          if (pipe_iter == window->get_context()->render_pipelines.end()) {
            pipe = std::make_shared<Pipeline>(
                *window->get_context(),
                serialized_cam.config.get_resolution());
            window->get_context()->render_pipelines.insert(
                std::make_pair(serialized_cam.uuid, pipe));
          } else {
            pipe = pipe_iter->second;
          }

          window->rendering_fps = application_fps_.fps;

          if (serialized_cam.config.get_enable_stereo()) {

            if (window->config.get_stereo_mode() == StereoMode::NVIDIA_3D_VISION) {
              #ifdef GUACAMOLE_ENABLE_NVIDIA_3D_VISION
              if ((window->get_context()->framecount % 2) == 0) {
                auto img(pipe->render_scene(CameraMode::LEFT, serialized_cam, *sgs));
                if (img) window->display(img, true);
              } else {
                auto img(pipe->render_scene(CameraMode::RIGHT, serialized_cam, *sgs));
                if (img) window->display(img, false);
              }
              #else
              Logger::LOG_WARNING << "guacamole has not been compiled with NVIDIA 3D Vision support!" << std::endl;
              #endif
            } else {
              auto img(pipe->render_scene(CameraMode::LEFT, serialized_cam, *sgs));
              if (img) window->display(img, true);
              img = pipe->render_scene(CameraMode::RIGHT, serialized_cam, *sgs);
              if (img) window->display(img, false);
            }
          } else {
            auto img(pipe->render_scene(serialized_cam.config.get_mono_mode(),
                     serialized_cam, *sgs));
            if (img) window->display(img, serialized_cam.config.get_mono_mode() != CameraMode::RIGHT);
          }

          pipe->clear_frame_cache();

          // swap buffers
          window->finish_frame();
          ++(window->get_context()->framecount);

        }
      }
    }
  }
  application_fps_.step();
}
开发者ID:AnimationInVR,项目名称:guacamole,代码行数:83,代码来源:Renderer.cpp


示例6: maxflow_init

  Graph::flowtype Graph::maxflow()
  {
    node *i, *j, *current_node = NULL;
    arc *a;
    nodeptr *np, *np_next;

    maxflow_init();
    nodeptr_block = new DBlock<nodeptr>(NODEPTR_BLOCK_SIZE, error_function);

    while (1)
    {
      if ((i = current_node))
      {
        i->next = NULL; /* remove active flag */
        if (!i->parent) i = NULL;
      }
      if (!i)
      {
        if (!(i = next_active())) break;
      }

      /* growth */
      if (!i->is_sink)
      {
        /* grow source tree */
        for (a = i->first; a; a = a->next)
          if (a->r_cap)
          {
          j = a->head;
          if (!j->parent)
          {
            j->is_sink = 0;
            j->parent = a->sister;
            j->TS = i->TS;
            j->DIST = i->DIST + 1;
            set_active(j);
          }
          else if (j->is_sink) break;
          else if (j->TS <= i->TS &&
            j->DIST > i->DIST)
          {
            /* heuristic - trying to make the distance from j to the source shorter */
            j->parent = a->sister;
            j->TS = i->TS;
            j->DIST = i->DIST + 1;
          }
          }
      }
      else
      {
        /* grow sink tree */
        for (a = i->first; a; a = a->next)
          if (a->sister->r_cap)
          {
          j = a->head;
          if (!j->parent)
          {
            j->is_sink = 1;
            j->parent = a->sister;
            j->TS = i->TS;
            j->DIST = i->DIST + 1;
            set_active(j);
          }
          else if (!j->is_sink) { a = a->sister; break; }
          else if (j->TS <= i->TS &&
            j->DIST > i->DIST)
          {
            /* heuristic - trying to make the distance from j to the sink shorter */
            j->parent = a->sister;
            j->TS = i->TS;
            j->DIST = i->DIST + 1;
          }
          }
      }

      TIME++;

      if (a)
      {
        i->next = i; /* set active flag */
        current_node = i;

        /* augmentation */
        augment(a);
        /* augmentation end */

        /* adoption */
        while ((np = orphan_first))
        {
          np_next = np->next;
          np->next = NULL;

          while ((np = orphan_first))
          {
            orphan_first = np->next;
            i = np->ptr;
            nodeptr_block->Delete(np);
            if (!orphan_first) orphan_last = NULL;
            if (i->is_sink) process_sink_orphan(i);
            else            process_source_orphan(i);
//.........这里部分代码省略.........
开发者ID:2php,项目名称:ShadowDetection,代码行数:101,代码来源:maxflow.cpp


示例7: set_active

iface::~iface()
{
	set_active(false);
	glXDestroyContext(gui::g_display, context_);
}
开发者ID:aspectron,项目名称:hydrogen,代码行数:5,代码来源:gl.iface.glx.cpp


示例8: set_active

void OptionMenu::enter(char untilExitFlag)
{
	if( is_active() )
		return;

	int bx = (VGA_WIDTH - PAGE_WIDTH) / 2;
	int by = (VGA_HEIGHT - PAGE_HEIGHT) / 2;

	int i;
	refresh_flag = IGOPTION_ALL;
	update_flag = 0;
	// active_flag = 1;
	set_active();

	info.save_game_scr();

	Config& tempConfig = config;
	old_config = config;

	// -------- initialize sound effect volume --------//
//	se_vol_slide.init_slide(264, 123, 420, 123+SLIDE_BUTTON_HEIGHT-1, 
//		SLIDE_BUTTON_WIDTH, disp_slide_bar);
	se_vol_slide.init_slide(bx+140, by+118, bx+140+10*SLIDE_BUTTON_WIDTH+9*2, by+118+SLIDE_BUTTON_HEIGHT-1, 
		SLIDE_BUTTON_WIDTH, disp_slide_bar);
	se_vol_slide.set(0, 100, tempConfig.sound_effect_flag ? tempConfig.sound_effect_volume : 0);

	// -------- initialize music volume --------//
//	music_vol_slide.init_slide(566, 123, 722, 123+SLIDE_BUTTON_HEIGHT-1, 
//		SLIDE_BUTTON_WIDTH, disp_slide_bar);
//	music_vol_slide.init_slide(bx+140, by+173, bx+140+10*SLIDE_BUTTON_WIDTH+9*2, by+173+SLIDE_BUTTON_HEIGHT-1, 
//		SLIDE_BUTTON_WIDTH, disp_slide_bar);
//	music_vol_slide.set(0, 100, tempConfig.music_flag ? tempConfig.wav_music_volume : 0);

	int cx = bx + 124;
	int cy = by + 173;
	for( i = 0; i < 2; ++i )
	{
		int cx2 = cx + font_thin_black.text_width(text_game_menu.str_no_yes(i)) + 9;
		music_group[i].create(cx, cy, cx2, cy + font_thin_black.max_font_height+3,
			disp_text_button, ButtonCustomPara(text_game_menu.str_no_yes(i), i), 0, 0);
		cx = cx2 + 5;
	}

	// -------- initialize frame speed volume --------//
//	frame_speed_slide.init_slide(196, 410, 352, 410+SLIDE_BUTTON_HEIGHT-1, 
//		SLIDE_BUTTON_WIDTH, disp_slide_bar);
	frame_speed_slide.init_slide(bx+140, by+338, bx+140+10*SLIDE_BUTTON_WIDTH+9*2, by+338+SLIDE_BUTTON_HEIGHT-1, 
		SLIDE_BUTTON_WIDTH, disp_slide_bar);
	frame_speed_slide.set(0, 31, tempConfig.frame_speed <= 30 ? tempConfig.frame_speed: 31);
	// use frame 31 to represent full speed (i.e. 99)

	// -------- initialize scroll speed volume --------//
//	scroll_speed_slide.init_slide(196, 454, 352, 454+SLIDE_BUTTON_HEIGHT-1, 
//		SLIDE_BUTTON_WIDTH, disp_slide_bar);
	scroll_speed_slide.init_slide(bx+140, by+398, bx+140+10*SLIDE_BUTTON_WIDTH+9*2, by+398+SLIDE_BUTTON_HEIGHT-1, 
		SLIDE_BUTTON_WIDTH, disp_slide_bar);
	scroll_speed_slide.set(0, 10, tempConfig.scroll_speed );

	// --------- initialize race buttons ---------- //

//	for( i = 0; i < MAX_RACE; ++i )
//	{
//		race_button[i].create(181+i*BASIC_OPTION_X_SPACE, 162,
//			181+(i+1)*BASIC_OPTION_X_SPACE-1, 162+BASIC_OPTION_HEIGHT-1,
//			disp_virtual_button, ButtonCustomPara(NULL, race_table[i]));
//	}

	// --------- initialize help button group ---------- //

	cx = bx + 124;
	cy = by + 226;
	for( i = 0; i < 3; ++i )
	{
		int cx2 = cx + font_thin_black.text_width(text_game_menu.str_help_options(i)) + 9;
		help_group[i].create(cx, cy, cx2, cy + font_thin_black.max_font_height+3,
			disp_text_button, ButtonCustomPara(text_game_menu.str_help_options(i), i), 0, 0);
		cx = cx2 + 5;
	}

	// --------- initialize news button group ---------- //

	cx = bx + 124;
	cy = by + 281;
	for( i = 0; i < 2; ++i )
	{
		int cx2 = cx + font_thin_black.text_width(text_game_menu.str_news_options(i)) + 9;
		news_group[i].create(cx, cy, cx2, cy + font_thin_black.max_font_height+3,
			disp_text_button, ButtonCustomPara(text_game_menu.str_news_options(i), i), 0, 0);
		cx = cx2 + 5;
	}

	// --------- initialize report button group ---------- //

	cx = bx + 417;
	cy = by + 116;
	for( i = 0; i < 2; ++i )
	{
		int cx2 = cx + font_thin_black.text_width( text_game_menu.str_report_options(i) ) + 9;
		report_group[i].create( cx, cy, cx2, cy + font_thin_black.max_font_height+3,
			disp_text_button, ButtonCustomPara(text_game_menu.str_report_options(i), i), 0, 0);
//.........这里部分代码省略.........
开发者ID:112212,项目名称:7k2,代码行数:101,代码来源:ooptmenu.cpp


示例9: while

	void QPBO<REAL>::maxflow_reuse_trees_init()
{
	Node* i;
	Node* j;
	Node* queue = queue_first[1];
	Arc* a;
	nodeptr* np;

	queue_first[0] = queue_last[0] = NULL;
	queue_first[1] = queue_last[1] = NULL;
	orphan_first = orphan_last = NULL;

	TIME ++;

	while ((i=queue))
	{
		queue = i->next;
		if (queue == i) queue = NULL;
		if (IsNode0(i))
		{
			if (i->is_removed) continue;
		}
		else
		{
			if (GetMate1(i)->is_removed) continue;
		}
		i->next = NULL;
		i->is_marked = 0;
		set_active(i);

		if (i->tr_cap == 0)
		{
			if (i->parent) set_orphan_rear(i);
			continue;
		}

		if (i->tr_cap > 0)
		{
			if (!i->parent || i->is_sink)
			{
				i->is_sink = 0;
				for (a=i->first; a; a=a->next)
				{
					j = a->head;
					if (!j->is_marked)
					{
						if (j->parent == a->sister) set_orphan_rear(j);
						if (j->parent && j->is_sink && a->r_cap > 0) set_active(j);
					}
				}
				add_to_changed_list(i);
			}
		}
		else
		{
			if (!i->parent || !i->is_sink)
			{
				i->is_sink = 1;
				for (a=i->first; a; a=a->next)
				{
					j = a->head;
					if (!j->is_marked)
					{
						if (j->parent == a->sister) set_orphan_rear(j);
						if (j->parent && !j->is_sink && a->sister->r_cap > 0) set_active(j);
					}
				}
				add_to_changed_list(i);
			}
		}
		i->parent = QPBO_MAXFLOW_TERMINAL;
		i -> TS = TIME;
		i -> DIST = 1;
	}

	code_assert(stage == 1);
	//test_consistency();

	/* adoption */
	while ((np=orphan_first))
	{
		orphan_first = np -> next;
		i = np -> ptr;
		nodeptr_block -> Delete(np);
		if (!orphan_first) orphan_last = NULL;
		if (i->is_sink) process_sink_orphan(i);
		else            process_source_orphan(i);
	}
	/* adoption end */

	//test_consistency();
}
开发者ID:fjug,项目名称:ZIBAmiraLocal,代码行数:92,代码来源:QPBO_maxflow.cpp


示例10: prepare_graph

Graph::flowtype Graph::maxflow()
{
    node *i, *j, *current_node = NULL, *s_start, *t_start = NULL;
    captype *cap_middle = NULL, *rev_cap_middle = NULL;
    arc_forward *a_for, *a_for_first, *a_for_last;
    arc_reverse *a_rev, *a_rev_first, *a_rev_last;
    nodeptr *np, *np_next;

    prepare_graph();
    maxflow_init();
    nodeptr_block = new DBlock<nodeptr>(NODEPTR_BLOCK_SIZE, error_function);

    while ( 1 )
    {
        if ((i=current_node))
        {
            i -> next = NULL; /* remove active flag */
            if (!i->parent) i = NULL;
        }
        if (!i)
        {
            if (!(i = next_active())) break;
        }

        /* growth */
        s_start = NULL;

        a_for_first = i -> first_out;
        if (IS_ODD(a_for_first))
        {
            a_for_first = (arc_forward *) (((char *)a_for_first) + 1);
            a_for_last = (arc_forward *) ((a_for_first ++) -> shift);
        }
        else a_for_last = (i + 1) -> first_out;
        a_rev_first = i -> first_in;
        if (IS_ODD(a_rev_first))
        {
            a_rev_first = (arc_reverse *) (((char *)a_rev_first) + 1);
            a_rev_last = (arc_reverse *) ((a_rev_first ++) -> sister);
        }
        else a_rev_last = (i + 1) -> first_in;

        if (!i->is_sink)
        {
            /* grow source tree */
            for (a_for=a_for_first; a_for<a_for_last; a_for++)
            if (a_for->r_cap)
            {
                j = NEIGHBOR_NODE(i, a_for -> shift);
                if (!j->parent)
                {
                    j -> is_sink = 0;
                    j -> parent = MAKE_ODD(a_for);
                    j -> TS = i -> TS;
                    j -> DIST = i -> DIST + 1;
                    set_active(j);
                }
                else if (j->is_sink)
                {
                    s_start = i;
                    t_start = j;
                    cap_middle     = & ( a_for -> r_cap );
                    rev_cap_middle = & ( a_for -> r_rev_cap );
                    break;
                }
                else if (j->TS <= i->TS &&
                         j->DIST > i->DIST)
                {
                    /* heuristic - trying to make the distance from j to the source shorter */
                    j -> parent = MAKE_ODD(a_for);
                    j -> TS = i -> TS;
                    j -> DIST = i -> DIST + 1;
                }
            }
            if (!s_start)
            for (a_rev=a_rev_first; a_rev<a_rev_last; a_rev++)
            {
                a_for = a_rev -> sister;
                if (a_for->r_rev_cap)
                {
                    j = NEIGHBOR_NODE_REV(i, a_for -> shift);
                    if (!j->parent)
                    {
                        j -> is_sink = 0;
                        j -> parent = a_for;
                        j -> TS = i -> TS;
                        j -> DIST = i -> DIST + 1;
                        set_active(j);
                    }
                    else if (j->is_sink)
                    {
                        s_start = i;
                        t_start = j;
                        cap_middle     = & ( a_for -> r_rev_cap );
                        rev_cap_middle = & ( a_for -> r_cap );
                        break;
                    }
                    else if (j->TS <= i->TS &&
                             j->DIST > i->DIST)
                    {
//.........这里部分代码省略.........
开发者ID:ChrisYang,项目名称:CRFdet,代码行数:101,代码来源:maxflow.cpp


示例11: render_background

void MENUS::on_render()
{
	/*
	// text rendering test stuff
	render_background();

	TEXT_CURSOR cursor;
	gfx_text_set_cursor(&cursor, 10, 10, 20, TEXTFLAG_RENDER);
	gfx_text_ex(&cursor, "ようこそ - ガイド", -1);

	gfx_text_set_cursor(&cursor, 10, 30, 15, TEXTFLAG_RENDER);
	gfx_text_ex(&cursor, "ようこそ - ガイド", -1);
	
	//gfx_texture_set(-1);
	gfx_quads_begin();
	gfx_quads_drawTL(60, 60, 5000, 5000);
	gfx_quads_end();
	return;*/
	
	if(client_state() != CLIENTSTATE_ONLINE && client_state() != CLIENTSTATE_DEMOPLAYBACK)
		set_active(true);

	if(client_state() == CLIENTSTATE_DEMOPLAYBACK)
	{
		RECT screen = *ui_screen();
		gfx_mapscreen(screen.x, screen.y, screen.w, screen.h);
		render_demoplayer(screen);
	}
	
	if(client_state() == CLIENTSTATE_ONLINE && gameclient.servermode == gameclient.SERVERMODE_PUREMOD)
	{
		client_disconnect();
		set_active(true);
		popup = POPUP_PURE;
	}
	
	if(!is_active())
	{
		escape_pressed = false;
		enter_pressed = false;
		num_inputevents = 0;
		return;
	}
	
	// update colors
	vec3 rgb = hsl_to_rgb(vec3(config.ui_color_hue/255.0f, config.ui_color_sat/255.0f, config.ui_color_lht/255.0f));
	gui_color = vec4(rgb.r, rgb.g, rgb.b, config.ui_color_alpha/255.0f);

	color_tabbar_inactive_outgame = vec4(0,0,0,0.25f);
	color_tabbar_active_outgame = vec4(0,0,0,0.5f);

	float color_ingame_scale_i = 0.5f;
	float color_ingame_scale_a = 0.2f;
	color_tabbar_inactive_ingame = vec4(
		gui_color.r*color_ingame_scale_i,
		gui_color.g*color_ingame_scale_i,
		gui_color.b*color_ingame_scale_i,
		gui_color.a*0.8f);
	
	color_tabbar_active_ingame = vec4(
		gui_color.r*color_ingame_scale_a,
		gui_color.g*color_ingame_scale_a,
		gui_color.b*color_ingame_scale_a,
		gui_color.a);
    
	// update the ui
	RECT *screen = ui_screen();
	float mx = (mouse_pos.x/(float)gfx_screenwidth())*screen->w;
	float my = (mouse_pos.y/(float)gfx_screenheight())*screen->h;
		
	int buttons = 0;
	if(inp_key_pressed(KEY_MOUSE_1)) buttons |= 1;
	if(inp_key_pressed(KEY_MOUSE_2)) buttons |= 2;
	if(inp_key_pressed(KEY_MOUSE_3)) buttons |= 4;
		
	ui_update(mx,my,mx*3.0f,my*3.0f,buttons);
    
	// render
	if(client_state() != CLIENTSTATE_DEMOPLAYBACK)
		render();

	// render cursor
	gfx_texture_set(data->images[IMAGE_CURSOR].id);
	gfx_quads_begin();
	gfx_setcolor(1,1,1,1);
	gfx_quads_drawTL(mx,my,24,24);
	gfx_quads_end();

	// render debug information
	if(config.debug)
	{
		RECT screen = *ui_screen();
		gfx_mapscreen(screen.x, screen.y, screen.w, screen.h);

		char buf[512];
		str_format(buf, sizeof(buf), "%p %p %p", ui_hot_item(), ui_active_item(), ui_last_active_item());
		TEXT_CURSOR cursor;
		gfx_text_set_cursor(&cursor, 10, 10, 10, TEXTFLAG_RENDER);
		gfx_text_ex(&cursor, buf, -1);
	}
//.........这里部分代码省略.........
开发者ID:wixur,项目名称:teeworlds-ng,代码行数:101,代码来源:menus.cpp


示例12: NEIGHBOR_NODE


//.........这里部分代码省略.........
            if (j->is_sink && (a=j->parent))
            {
                /* checking the origin of j */
                d = 0;
                while ( 1 )
                {
                    if (j->TS == TIME)
                    {
                        d += j -> DIST;
                        break;
                    }
                    a = j -> parent;
                    d ++;
                    if (a==TERMINAL)
                    {
                        j -> TS = TIME;
                        j -> DIST = 1;
                        break;
                    }
                    if (a==ORPHAN) { d = INFINITE_D; break; }
                    if (IS_ODD(a))
                        j = NEIGHBOR_NODE_REV(j, MAKE_EVEN(a) -> shift);
                    else
                        j = NEIGHBOR_NODE(j, a -> shift);
                }
                if (d<INFINITE_D) /* j originates from the sink - done */
                {
                    if (d<d_min)
                    {
                        a0_min = MAKE_ODD(a0_for);
                        d_min = d;
                    }
                    /* set marks along the path */
                    for (j=NEIGHBOR_NODE_REV(i,a0_for->shift); j->TS!=TIME; )
                    {
                        j -> TS = TIME;
                        j -> DIST = d --;
                        a = j->parent;
                        if (IS_ODD(a))
                            j = NEIGHBOR_NODE_REV(j, MAKE_EVEN(a) -> shift);
                        else
                            j = NEIGHBOR_NODE(j, a -> shift);
                    }
                }
            }
        }
    }

    if ((i->parent = a0_min))
    {
        i -> TS = TIME;
        i -> DIST = d_min + 1;
    }
    else
    {
        /* no parent is found */
        i -> TS = 0;

        /* process neighbors */
        for (a0_for=a0_for_first; a0_for<a0_for_last; a0_for++)
        {
            j = NEIGHBOR_NODE(i, a0_for -> shift);
            if (j->is_sink && (a=j->parent))
            {
                if (a0_for->r_cap) set_active(j);
                if (a!=TERMINAL && a!=ORPHAN && IS_ODD(a) && NEIGHBOR_NODE_REV(j, MAKE_EVEN(a)->shift)==i)
                {
                    /* add j to the adoption list */
                    j -> parent = ORPHAN;
                    np = nodeptr_block -> New();
                    np -> ptr = j;
                    if (orphan_last) orphan_last -> next = np;
                    else             orphan_first        = np;
                    orphan_last = np;
                    np -> next = NULL;
                }
            }
        }
        for (a0_rev=a0_rev_first; a0_rev<a0_rev_last; a0_rev++)
        {
            a0_for = a0_rev -> sister;
            j = NEIGHBOR_NODE_REV(i, a0_for -> shift);
            if (j->is_sink && (a=j->parent))
            {
                if (a0_for->r_rev_cap) set_active(j);
                if (a!=TERMINAL && a!=ORPHAN && !IS_ODD(a) && NEIGHBOR_NODE(j, a->shift)==i)
                {
                    /* add j to the adoption list */
                    j -> parent = ORPHAN;
                    np = nodeptr_block -> New();
                    np -> ptr = j;
                    if (orphan_last) orphan_last -> next = np;
                    else             orphan_first        = np;
                    orphan_last = np;
                    np -> next = NULL;
                }
            }
        }
    }
}
开发者ID:ChrisYang,项目名称:CRFdet,代码行数:101,代码来源:maxflow.cpp


示例13: set_label

HGTalkRempassButton::HGTalkRempassButton()
{
	set_label(HGTALK_REMPASS);
	set_active(g_pHGTalkApp->get_config()->get_rempass());
}
开发者ID:kaleka,项目名称:hgtalk,代码行数:5,代码来源:HGTalkRempassButton.cpp


示例14: ui_menu_item_set_active

int
ui_menu_item_set_active( const char *path, int active )
{
  return set_active( widget_menu, path, active );
}
开发者ID:CiaranG,项目名称:ZXdroid,代码行数:5,代码来源:menu.c


示例15: set_active

 void UnderlineMenuItem::menu_shown()
 {
   m_event_freeze = true;
   set_active(m_note_addin->get_buffer()->is_active_tag ("underline"));
   m_event_freeze = false;
 }
开发者ID:mjfrancis,项目名称:GnoteOSX,代码行数:6,代码来源:underlinemenuitem.cpp


示例16: maxflow_init

	void QPBO<REAL>::maxflow(bool reuse_trees, bool _keep_changed_list)
{
	Node *i, *j, *current_node = NULL;
	Arc *a;
	nodeptr *np, *np_next;

	if (!nodeptr_block)
	{
		nodeptr_block = new DBlock<nodeptr>(NODEPTR_BLOCK_SIZE, error_function);
	}

	if (maxflow_iteration == 0)
	{
		reuse_trees = false;
		_keep_changed_list = false;
	}

	keep_changed_list = _keep_changed_list;
	if (keep_changed_list)
	{
		if (!changed_list) changed_list = new Block<Node*>(NODEPTR_BLOCK_SIZE, error_function);
	}

	if (reuse_trees) maxflow_reuse_trees_init();
	else             maxflow_init();

	// main loop
	while ( 1 )
	{
		// test_consistency(current_node);

		if ((i=current_node))
		{
			i -> next = NULL; /* remove active flag */
			if (!i->parent) i = NULL;
		}
		if (!i)
		{
			if (!(i = next_active())) break;
		}

		/* growth */
		if (!i->is_sink)
		{
			/* grow source tree */
			for (a=i->first; a; a=a->next)
			if (a->r_cap)
			{
				j = a -> head;
				if (!j->parent)
				{
					j -> is_sink = 0;
					j -> parent = a -> sister;
					j -> TS = i -> TS;
					j -> DIST = i -> DIST + 1;
					set_active(j);
					add_to_changed_list(j);
				}
				else if (j->is_sink) break;
				else if (j->TS <= i->TS &&
				         j->DIST > i->DIST)
				{
					/* heuristic - trying to make the distance from j to the source shorter */
					j -> parent = a -> sister;
					j -> TS = i -> TS;
					j -> DIST = i -> DIST + 1;
				}
			}
		}
		else
		{
			/* grow sink tree */
			for (a=i->first; a; a=a->next)
			if (a->sister->r_cap)
			{
				j = a -> head;
				if (!j->parent)
				{
					j -> is_sink = 1;
					j -> parent = a -> sister;
					j -> TS = i -> TS;
					j -> DIST = i -> DIST + 1;
					set_active(j);
					add_to_changed_list(j);
				}
				else if (!j->is_sink) { a = a -> sister; break; }
				else if (j->TS <= i->TS &&
				         j->DIST > i->DIST)
				{
					/* heuristic - trying to make the distance from j to the sink shorter */
					j -> parent = a -> sister;
					j -> TS = i -> TS;
					j -> DIST = i -> DIST + 1;
				}
			}
		}

		TIME ++;

		if (a)
//.........这里部分代码省略.........
开发者ID:fjug,项目名称:ZIBAmiraLocal,代码行数:101,代码来源:QPBO_maxflow.cpp


示例17: do_input


//.........这里部分代码省略.........
        //part2
        if (last_ib2 != b2) {
            if (input.key_l2) uinput_send(fd, EV_KEY, input.key_l2, b2 & 0x01 ? 1 : 0);
            if (input.key_r2) uinput_send(fd, EV_KEY, input.key_r2, b2 & 0x02 ? 1 : 0);
            if (input.key_l1) uinput_send(fd, EV_KEY, input.key_l1, b2 & 0x04 ? 1 : 0);
            if (input.key_r1) uinput_send(fd, EV_KEY, input.key_r1, b2 & 0x08 ? 1 : 0);
            if (input.key_tri) uinput_send(fd, EV_KEY, input.key_tri, b2 & 0x10 ? 1 : 0);
            if (input.key_cir) uinput_send(fd, EV_KEY, input.key_cir, b2 & 0x20 ? 1 : 0);
            if (input.key_cro) uinput_send(fd, EV_KEY, input.key_cro, b2 & 0x40 ? 1 : 0);
            if (input.key_squ) uinput_send(fd, EV_KEY, input.key_squ, b2 & 0x80 ? 1 : 0);
        }
        //part3
        if (last_ib3 != b3) {
            if (input.key_ps) uinput_send(fd, EV_KEY, input.key_ps, b3 & 0x01 ? 1 : 0);
        }
    }

    //axis
    if (!input.use_lr3 || (input.use_lr3 && lr3_axis)) {
      int rel;
      bool rw_do;

      if (rw_timer%(input.axis_speed*2) == 0)
        rw_do = true;
      else
        rw_do = false;

      if (input.axis_l_type == INPUT_TYPE_KEYS)
      {
          uinput_send(fd, EV_KEY, input.axis_l_right, (lx > 100));
          uinput_send(fd, EV_KEY, input.axis_l_left, (lx < -100));
          uinput_send(fd, EV_KEY, input.axis_l_up, (ly > 100));
          uinput_send(fd, EV_KEY, input.axis_l_down, (ly < -100));
      }
      else if (input.axis_l_type == INPUT_TYPE_MOUSE)
      {
          rel = input.axis_l_right;
          if (rel == REL_X || rel == REL_Y) {
            uinput_send(fd, EV_REL, rel, lx/4/input.axis_speed);
          } else if (rw_do && (rel == REL_WHEEL || rel == REL_HWHEEL)) {
            lx = lx/20;
            if (rel == REL_WHEEL) lx = -lx; //Inverted
            uinput_send(fd, EV_REL, rel, lx);
          }

          rel = input.axis_l_up;
          if (rel == REL_X || rel == REL_Y) {
            uinput_send(fd, EV_REL, rel, ly/4/input.axis_speed);
          } else if (rw_do && (rel == REL_WHEEL || rel == REL_HWHEEL)) {
            ly = ly/20;
            if (rel == REL_WHEEL) ly = -ly; //Inverted
            uinput_send(fd, EV_REL, rel, ly);
          }
      }

      if (input.axis_r_type == INPUT_TYPE_KEYS)
      {
          uinput_send(fd, EV_KEY, input.axis_r_right, (rx > 100));
          uinput_send(fd, EV_KEY, input.axis_r_left, (rx < -100));
          uinput_send(fd, EV_KEY, input.axis_r_up, (ry > 100));
          uinput_send(fd, EV_KEY, input.axis_r_down, (ry < -100));
      }
      else if (input.axis_r_type == INPUT_TYPE_MOUSE)
      {
          rel = input.axis_r_right;
          if (rel == REL_X || rel == REL_Y) {
            uinput_send(fd, EV_REL, rel, rx/4/input.axis_speed);
          } else if (rw_do && (rel == REL_WHEEL || rel == REL_HWHEEL)) {
            rx = rx/20;
            if (rel == REL_WHEEL) rx = -rx; //Inverted
            uinput_send(fd, EV_REL, rel, rx);
          }

          rel = input.axis_r_up;
          if (rel == REL_X || rel == REL_Y) {
            uinput_send(fd, EV_REL, rel, ry/4/input.axis_speed);
          } else if (rw_do && (rel == REL_WHEEL || rel == REL_HWHEEL)) {
            ry = ry/20;
            if (rel == REL_WHEEL) ry = -ry; //Inverted
            uinput_send(fd, EV_REL, rel, ry);
          }
      }
    }

    if (b1 > 0 || b2 > 0 || b3 > 0 || lx != 0 || ly != 0 || rx != 0 || ry != 0) {
      set_active(true);
    }

    last_ib1 = b1;
    last_ib2 = b2;
    last_ib3 = b3;

    uinput_send(fd, EV_SYN, SYN_REPORT, 0);

    if (rw_timer > 0xff)
      rw_timer = 0;
    else
      rw_timer += 1;

}
开发者ID:embasoft,项目名称:qtsixa,代码行数:101,代码来源:sixaxis.cpp


示例18: do_joystick


//.........这里部分代码省略.........
    if (velX > -30 && velX < 30) velX = 0;
    if (velY > -30 && velY < 30) velY = 0;
    if (velZ > -30 && velZ < 30) velZ = 0;

    if (joystick.buttons) {
        //part1
        if (last_jb1 != b1) {
            uinput_send(fd, EV_KEY, BTN_JOYSTICK + 0, b1 & 0x01 ? 1 : 0);
            uinput_send(fd, EV_KEY, BTN_JOYSTICK + 1, b1 & 0x02 ? 1 : 0);
            uinput_send(fd, EV_KEY, BTN_JOYSTICK + 2, b1 & 0x04 ? 1 : 0);
            uinput_send(fd, EV_KEY, BTN_JOYSTICK + 3, b1 & 0x08 ? 1 : 0);
            uinput_send(fd, EV_KEY, BTN_JOYSTICK + 4, b1 & 0x10 ? 1 : 0);
            uinput_send(fd, EV_KEY, BTN_JOYSTICK + 5, b1 & 0x20 ? 1 : 0);
            uinput_send(fd, EV_KEY, BTN_JOYSTICK + 6, b1 & 0x40 ? 1 : 0);
            uinput_send(fd, EV_KEY, BTN_JOYSTICK + 7, b1 & 0x80 ? 1 : 0);
        }
        //part2
        if (last_jb2 != b2) {
            uinput_send(fd, EV_KEY, BTN_JOYSTICK +  8, b2 & 0x01 ? 1 : 0);
            uinput_send(fd, EV_KEY, BTN_JOYSTICK +  9, b2 & 0x02 ? 1 : 0);
            uinput_send(fd, EV_KEY, BTN_JOYSTICK + 10, b2 & 0x04 ? 1 : 0);
            uinput_send(fd, EV_KEY, BTN_JOYSTICK + 11, b2 & 0x08 ? 1 : 0);
            uinput_send(fd, EV_KEY, BTN_JOYSTICK + 12, b2 & 0x10 ? 1 : 0);
            uinput_send(fd, EV_KEY, BTN_JOYSTICK + 13, b2 & 0x20 ? 1 : 0);
            uinput_send(fd, EV_KEY, BTN_JOYSTICK + 14, b2 & 0x40 ? 1 : 0);
            uinput_send(fd, EV_KEY, BTN_JOYSTICK + 15, b2 & 0x80 ? 1 : 0);
        }
        //part3
        if (last_jb3 != b3) {
            uinput_send(fd, EV_KEY, BTN_JOYSTICK + 16, b3 & 0x01 ? 1 : 0);
        }

        if (b1 > 0 || b2 > 0 || b3 > 0) {
          set_active(true);
        }
    }

    //axis
    if (joystick.axis) {
        uinput_send(fd, EV_ABS, 0, lx);
        uinput_send(fd, EV_ABS, 1, ly);
        uinput_send(fd, EV_ABS, 2, rx);
        uinput_send(fd, EV_ABS, 3, ry);

        if (lx != 0 || ly != 0 || rx != 0 || ry != 0) {
          set_active(true);
        }
    }

    //accelerometer RAW
    if (joystick.accel) {
        uinput_send(fd, EV_ABS, 4, acx);
        uinput_send(fd, EV_ABS, 5, acy);
        uinput_send(fd, EV_ABS, 6, acz);
        uinput_send(fd, EV_ABS, 7, gyro);
    }

    //buttons (sensible, as axis)
    if (joystick.sbuttons) {
        uinput_send(fd, EV_ABS, 8, up);
        uinput_send(fd, EV_ABS, 9, right);
        uinput_send(fd, EV_ABS, 10, down);
        uinput_send(fd, EV_ABS, 11, left);
        uinput_send(fd, EV_ABS, 12, l2);
        uinput_send(fd, EV_ABS, 13, r2);
        uinput_send(fd, EV_ABS, 14, l1);
开发者ID:embasoft,项目名称:qtsixa,代码行数:67,代码来源:sixaxis.cpp


示例19: set_active

bool Tween::start() {

	set_active(true);
	_set_process(true);
	return true;
}
开发者ID:03050903,项目名称:godot,代码行数:6,代码来源:tween.cpp


示例20: log_info

bool
Xbox360WirelessController::parse(uint8_t* data, int len, XboxGenericMsg* msg_out)
{
  if (len == 0)
  {
    return false;
  }
  else
  {
    if (len == 2 && data[0] == 0x08)
    { // Connection Status Message
      if (data[1] == 0x00) 
      {
        log_info("connection status: nothing");

        // reset the controller into neutral position on disconnect
        memset(msg_out, 0, sizeof(*msg_out));
        set_ 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ set_active_framebuffer函数代码示例发布时间:2022-05-30
下一篇:
C++ set_action函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap