当前位置: 首页>>代码示例>>C++>>正文


C++ set_active函数代码示例

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


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


注:本文中的set_active函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。