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

C++ window类代码示例

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

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



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

示例1: update_tod_display

void custom_tod::update_tod_display(window& window)
{
	::image::set_color_adjustment(tod_red_field_->get_value(),
								tod_green_field_->get_value(),
								tod_blue_field_->get_value());

	// Prevent a floating slice of window appearing alone over the
	// theme UI sidebar after redrawing tiles and before we have a
	// chance to redraw the rest of this window.
	window.undraw();

	// NOTE: We only really want to re-render the gamemap tiles here.
	// Redrawing everything is a significantly more expensive task.
	// At this time, tiles are the only elements on which ToD tint is
	// meant to have a visible effect. This is very strongly tied to
	// the image caching mechanism.
	//
	// If this ceases to be the case in the future, you'll need to call
	// redraw_everything() instead.

	// invalidate all tiles so they are redrawn with the new ToD tint next
	display_.invalidate_all();

	// redraw tiles
	display_.draw(false);

	window.invalidate_layout();
}
开发者ID:Wedge009,项目名称:wesnoth,代码行数:28,代码来源:custom_tod.cpp


示例2: assert

void custom_tod::update_tod_display(window& window)
{
	display* disp = display::get_singleton();
	assert(disp && "Display pointer is null!");

	// Prevent a floating slice of window appearing alone over the
	// theme UI sidebar after redrawing tiles and before we have a
	// chance to redraw the rest of this window.
	window.undraw();

	// NOTE: We only really want to re-render the gamemap tiles here.
	// Redrawing everything is a significantly more expensive task.
	// At this time, tiles are the only elements on which ToD tint is
	// meant to have a visible effect. This is very strongly tied to
	// the image caching mechanism.
	//
	// If this ceases to be the case in the future, you'll need to call
	// redraw_everything() instead.

	disp->update_tod(&get_selected_tod());

	// invalidate all tiles so they are redrawn with the new ToD tint next
	disp->invalidate_all();

	// redraw tiles
	disp->draw(false);

	// NOTE: revert to invalidate_layout if necessary to display the ToD mask image.
	window.set_is_dirty(true);
}
开发者ID:fluffbeast,项目名称:wesnoth-old,代码行数:30,代码来源:custom_tod.cpp


示例3: WindowProcedure

/*  This function is called by the Windows function DispatchMessage()  */
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
  static window wnd;

  switch (message)  /* handle the messages */
  {
  case WM_CREATE:
    wnd.WMCreate(hwnd, message, wParam, lParam);
    break;
  case WM_PAINT:
    wnd.WMPaint(hwnd, message, wParam, lParam);
    break;
  case WM_SIZE:
    wnd.WMSize(hwnd, message, wParam, lParam);
    break;
  case WM_COMMAND:
    wnd.WMCommand(hwnd, message, wParam, lParam);
    break;
  case WM_VSCROLL:
    wnd.WMVScroll(hwnd, message, wParam, lParam);
    break;
  case WM_HSCROLL:
    wnd.WMHScroll(hwnd, message, wParam, lParam);
    break;
  case WM_KEYDOWN:
    wnd.WMKeydown(hwnd, message, wParam, lParam);
    break;
  case WM_DESTROY:
    wnd.WMDestroy(hwnd, message, wParam, lParam);
    break;
  default:
    return DefWindowProc(hwnd, message, wParam, lParam);
  }
  return 0;
} /* End of 'WindowProcedure' function */
开发者ID:Igopin,项目名称:TextPad,代码行数:36,代码来源:wingdi.cpp


示例4: show_preferences_button_callback

void lobby_main::post_build(window& win)
{
	/** @todo Should become a global hotkey after 1.8, then remove it here. */
	win.register_hotkey(hotkey::HOTKEY_FULLSCREEN, std::bind(fullscreen, std::ref(win.video())));

	/*** Local hotkeys. ***/
	win.register_hotkey(hotkey::HOTKEY_PREFERENCES, [this](event::dispatcher& w, hotkey::HOTKEY_COMMAND)->bool {
		show_preferences_button_callback(dynamic_cast<window&>(w));
		return true;
	});
}
开发者ID:doofus-01,项目名称:wesnoth,代码行数:11,代码来源:lobby.cpp


示例5: window

      //
      // For a child window. 'w' is its parent.
      //
      window ( window& w  ) 
	: m_display ( w.get_event_dispatcher().get_display() ),
	m_background ( m_display, 213, 206, 189 ),
	m_event_dispatcher ( w.get_event_dispatcher() ),
	m_border ( m_display, 255, 255, 255 ),
	m_is_child ( true ),
	m_rect ( w.get_rect() ),
	m_parent ( w.id() )
	{
	  m_window = 0;
	  m_atom[0] = 0;
	  show();
	}
开发者ID:8l,项目名称:x11,代码行数:16,代码来源:window.hpp


示例6: make_window_hierarchy_id_string

	std::string make_window_hierarchy_id_string(const window& w) {
		if (!w.has_parent()) {
			return w.get_id();
		}
		else {
			std::string s = w.get_id();
			const window* cw = &w;
			while (cw->has_parent()) {
				cw = &cw->get_parent();
				s.insert(0, ".");
				s.insert(0, cw->get_id());
			}
			return s;
		}
	}
开发者ID:jseward,项目名称:solar,代码行数:15,代码来源:window_helpers.cpp


示例7: image

hologram hologram_reconstructor::reconstruct(const hologram& h, const window& hw, vec3 light_direction, float_t light_distance) {
    hologram image(width, height);
    boost::timer timer;
    vec3 direction = normalize(output_window.direction());
    std::complex<float_t> ilambda(0, wavelength);
#pragma omp parallel for schedule(dynamic, 1)
    for (std::size_t y = 0; y < height; ++y) {
        for (std::size_t x = 0; x < width; ++x) {
            vec3 op = output_window.unproj(vec2(float_t(x) / h.width(), float_t(y) / h.height()));
            std::complex<float_t> wave(0);
            for (std::size_t hy = 0; hy < h.height(); ++hy) {
                for (std::size_t hx = 0; hx < h.width(); ++hx) {
                    vec3 hp = hw.unproj(vec2(float_t(hx) / width, float_t(hy) / height));
                    //float_t hp_to_light = dot(hp, light_direction) + light_distance;
                    vec3 op_to_hp = hp - op;
                    float_t op_to_hp_len2 = cml::length_squared(op_to_hp);
                    float_t op_to_hp_len = std::sqrt(op_to_hp_len2);
                    wave += std::polar(h(hx, hy) / op_to_hp_len2, wavenumber * op_to_hp_len) / ilambda * dot(direction, op_to_hp);
                }
            }
            image(x, y) = std::abs(wave);
        }
        std::clog << (y + 1) << "/" << height << " " << int(timer.elapsed() / (y + 1) * (height - y - 1)) << " s left" << std::endl;
    }
    return image;
}
开发者ID:rozz666,项目名称:HoloLOD,代码行数:26,代码来源:hologram_reconstructor.cpp


示例8: dialog_title

void unit_recall::rename_unit(window& window)
{
	listbox& list = find_widget<listbox>(&window, "recall_list", false);

	const int index = list.get_selected_row();
	unit& selected_unit = const_cast<unit&>(*recall_list_[index].get());

	std::string name = selected_unit.name();
	const std::string dialog_title(_("Rename Unit"));
	const std::string dialog_label(_("Name:"));

	if(gui2::dialogs::edit_text::execute(dialog_title, dialog_label, name)) {
		selected_unit.rename(name);

		find_widget<label>(list.get_row_grid(index), "unit_name", false).set_label(name);

		filter_options_.erase(filter_options_.begin() + index);
		std::ostringstream filter_text;
		filter_text << selected_unit.type_name() << " " << name << " " << std::to_string(selected_unit.level());
		for(const std::string& trait : selected_unit.trait_names()) {
			filter_text << " " << trait;
		}
		filter_options_.insert(filter_options_.begin() + index, filter_text.str());

		list_item_clicked(window);
		window.invalidate_layout();
	}
}
开发者ID:GregoryLundberg,项目名称:wesnoth,代码行数:28,代码来源:unit_recall.cpp


示例9: update_tip

void title_screen::update_tip(window& win, const bool previous)
{
	multi_page& tips = find_widget<multi_page>(&win, "tips", false);
	if(tips.get_page_count() == 0) {
		return;
	}

	int page = tips.get_selected_page();
	if(previous) {
		if(page <= 0) {
			page = tips.get_page_count();
		}
		--page;
	} else {
		++page;
		if(static_cast<unsigned>(page) >= tips.get_page_count()) {
			page = 0;
		}
	}

	tips.select_page(page);

	/**
	 * @todo Look for a proper fix.
	 *
	 * This dirtying is required to avoid the blurring to be rendered wrong.
	 * Not entirely sure why, but since we plan to move to SDL2 that change
	 * will probably fix this issue automatically.
	 */
	win.set_is_dirty(true);
}
开发者ID:,项目名称:,代码行数:31,代码来源:


示例10: m_preferences

level_editor::layers_control::layers_control(window& win, preferences& prefs)
: Gtk::HBox(false, 4), m_preferences(prefs), m_window(win),
  m_button_new_layer("+"), m_button_delete_layer("-") {
  // Layer selection
  m_spin_layer.signal_changed().connect_notify(
    sigc::mem_fun(this, &layers_control::on_layer_changed));

  Gtk::Label& layer_label = *Gtk::manage(new Gtk::Label("Layer:"));
  pack_start(layer_label, Gtk::PACK_SHRINK);
  pack_start(m_spin_layer, Gtk::PACK_SHRINK);

  //Gtk::Label& layer_visiblity_label = *Gtk::manage(new Gtk::Label("Visible:"));
  //pack_start(layer_visiblity_label, Gtk::PACK_SHRINK);

  m_layer_visible.signal_toggled().connect_notify(
    sigc::mem_fun(this, &layers_control::on_layer_visible_toggled));

  pack_start(m_layer_visible, Gtk::PACK_SHRINK);

  m_button_new_layer.signal_clicked().connect_notify(
    sigc::mem_fun(this, &layers_control::on_add_layer));
  pack_start(m_button_new_layer, Gtk::PACK_SHRINK);

  m_button_delete_layer.signal_clicked().connect_notify(
    sigc::mem_fun(this, &layers_control::on_delete_layer));
  pack_start(m_button_delete_layer, Gtk::PACK_SHRINK);


  win.signal_switch_level_display().connect(
    sigc::mem_fun(this, &layers_control::on_switch_level_display));
}
开发者ID:fry,项目名称:graal-gonstruct,代码行数:31,代码来源:layers_control.cpp


示例11: window

 /// @brief Construct a window.
 ///
 /// @param[in] parent The parent window.
 ///
 ///
 window(window & parent,
        size_type width, size_type height,
        size_type x_position, size_type y_position) :
     underlying_window_(
         ::subwin(parent.underlying_window(),
                  height, width, y_position, x_position))
 {};
开发者ID:rdingwall,项目名称:foofxp,代码行数:12,代码来源:window.hpp


示例12: window_select

// Make wind the front window
void window_select(window &wind)
{
	window *prev = window_get_front();
	d_event event;
	if (&wind == FrontWindow)
		return;
	if (&wind == FirstWindow && wind.next)
		FirstWindow = FirstWindow->next;

	if (wind.next)
		wind.next->prev = wind.prev;
	if (wind.prev)
		wind.prev->next = wind.next;
	wind.prev = FrontWindow;
	FrontWindow->next = &wind;
	wind.next = nullptr;
	FrontWindow = &wind;
	
	if (wind.is_visible())
	{
		if (prev)
			WINDOW_SEND_EVENT(prev, EVENT_WINDOW_DEACTIVATED);
		WINDOW_SEND_EVENT(&wind, EVENT_WINDOW_ACTIVATED);
	}
}
开发者ID:btb,项目名称:dxx-rebirth,代码行数:26,代码来源:window.cpp


示例13: update_leader_display

void mp_staging::network_handler(window& window)
{
	// First, send off any changes if they've been accumulated
	if(state_changed_) {
		connect_engine_.update_and_send_diff();
	}

	// Next, check for any incoming changes
	config data;
	if(!state_changed_ && (!network_connection_ || !network_connection_->receive_data(data))) {
		return;
	}

	// Update chat
	find_widget<chatbox>(&window, "chat", false).process_network_data(data);

	// TODO: why is this needed...
	const bool was_able_to_start = connect_engine_.can_start_game();

	bool quit_signal_received;
	std::tie(quit_signal_received, std::ignore) = connect_engine_.process_network_data(data);

	if(quit_signal_received) {
		window.set_retval(retval::CANCEL);
	}

	// Update side leader displays
	// This is basically only needed when a new player joins and selects their faction
	for(auto& tree_entry : side_tree_map_) {
		ng::side_engine_ptr side = tree_entry.first;

		grid& row_grid = tree_entry.second->get_grid();

		update_leader_display(side, row_grid);

		std::vector<config> controller_names;
		for(const auto& controller : side->controller_options()) {
			controller_names.emplace_back("label", controller.second);
		}

		menu_button& controller_selection = find_widget<menu_button>(&row_grid, "controller", false);

		controller_selection.set_values(controller_names, side->current_controller_index());
		controller_selection.set_active(controller_names.size() > 1);
	}

	// Update player list
	if(data.has_child("user")) {
		player_list_->update_list(data.child_range("user"));
	}

	// Update status label and buttons
	update_status_label_and_buttons(window);

	if(!was_able_to_start && connect_engine_.can_start_game()) {
		mp_ui_alerts::ready_for_start();
	}

	state_changed_ = false;
}
开发者ID:Pentarctagon,项目名称:wesnoth,代码行数:60,代码来源:mp_staging.cpp


示例14: bullet

color bullet(window &w, color skycolor, tank &left, tank &right, bool &leftTurn) { // goes through bullets path. returns color of what is hit.
    setBrushAndPenColor(w, skycolor); // erasing up top to make sure it doesnt count hitting the text
    w.DrawRectangle(0, 0, w.GetWidth(), 200, FILLED);
    double dtime = 0.007;
    int bulletRadius = 4;
    int bulletX, bulletY;
    double radianAngle;
    tank &currentTank = leftTurn ? left : right;
    int angle = currentTank.getAngle();
    if (leftTurn) {
        radianAngle = angle * cdPi / 180;
        bulletX = currentTank.getXend() + 3;
    } else {
        radianAngle = ((180 - angle) * cdPi / 180);
        bulletX = currentTank.getXend() - 3;
    }
    int velocity = currentTank.getSpeed();
    bulletY = currentTank.getYend() - 3;
    leftTurn = !leftTurn;
    double xVel = cos(radianAngle) * velocity;
    double yVel = sin(radianAngle) * velocity;
    double time = 0;
    while (w.GetColor(bulletX, bulletY) == skycolor) {
        setBrushAndPenColor(w, BLACK);
        w.DrawCircle(bulletX, bulletY, bulletRadius, FILLED);
        w.UpdateBuffer();
        Sleep(1);
        setBrushAndPenColor(w, skycolor);
        w.DrawCircle(bulletX, bulletY, bulletRadius + 1, FILLED);
        time += dtime;
        bulletX += xVel * time;
        bulletY += -yVel * time + 40 * time * time;
    }
    return w.GetColor(bulletX, bulletY);
}
开发者ID:PatMyron,项目名称:HighSchool,代码行数:35,代码来源:tankMain.cpp


示例15: drawLandscape

void drawLandscape(window &w, color skycolor, color groundcolor) { // creates landscape. only called once
    setBrushAndPenColor(w, skycolor);
    w.DrawRectangle(0, 0, w.GetWidth(), w.GetHeight(), FILLED);
    RandGen r;
    int ystart = r.RandInt((double) w.GetHeight() * 0.666, (double) w.GetHeight() * 0.75); // semi random height of ground near bottom of screen
    setBrushAndPenColor(w, groundcolor);
    for (double x = 0; x < w.GetWidth(); x++) {
        int yval = ystart + sin((double) (x / 60)) * 15; // ground will be sin curve
        w.DrawLine(x, yval, x, w.GetHeight());    // draws line from ground level to bottom of screen
    }
}
开发者ID:PatMyron,项目名称:HighSchool,代码行数:11,代码来源:tankMain.cpp


示例16: add_timer

void outro::draw_callback(window& window)
{
	if(SDL_GetTicks() < next_draw_) {
		return;
	}

	/* If we've faded fully in...
	 *
	 * NOTE: we want fading to take around half a second. Given this function runs about every 3 frames, we
	 * limit ourselves to a reasonable 10 fade steps with an alpha difference (rounded up) of 25.5 each cycle.
	 * The actual calculation for alpha is done in the window definition in WFL.
	 */
	if(fading_in_ && fade_step_ > 10) {
		// Schedule the fadeout after the provided delay.
		if(timer_id_ == 0) {
			timer_id_ = add_timer(duration_, [this](size_t) { fading_in_ = false; });
		}

		return;
	}

	// If we've faded fully out...
	if(!fading_in_ && fade_step_ < 0) {
		window.close();
		return;
	}

	canvas& window_canvas = window.get_canvas(0);

	window_canvas.set_variable("fade_step", wfl::variant(fade_step_));
	window_canvas.set_is_dirty(true);

	window.set_is_dirty(true);

	if(fading_in_) {
		fade_step_ ++;
	} else {
		fade_step_ --;
	}

	set_next_draw();
}
开发者ID:fluffbeast,项目名称:wesnoth-old,代码行数:42,代码来源:outro.cpp


示例17: dlg

void mp_staging::select_leader_callback(window& window, ng::side_engine_ptr side, grid& row_grid)
{
	gui2::dialogs::faction_select dlg(side->flg(), std::to_string(side->color() + 1), side->index() + 1);
	dlg.show(window.video());

	if(dlg.get_retval() == window::OK) {
		update_leader_display(side, row_grid);

		set_state_changed();
	}
}
开发者ID:doofus-01,项目名称:wesnoth,代码行数:11,代码来源:mp_staging.cpp


示例18: debug_tooltip

/*
 * This function is used to test the tooltip placement algorithms as
 * described in the »Tooltip placement« section in the GUI2 design
 * document.
 *
 * Use a 1024 x 768 screen size, set the maximum loop iteration to:
 * - 0   to test with a normal tooltip placement.
 * - 30  to test with a larger normal tooltip placement.
 * - 60  to test with a huge tooltip placement.
 * - 150 to test with a borderline to insanely huge tooltip placement.
 * - 180 to test with an insanely huge tooltip placement.
 */
static void debug_tooltip(window& window, bool& handled, const point& coordinate)
{
	std::string message = "Hello world.";

	for(int i = 0; i < 0; ++i) {
		message += " More greetings.";
	}

	gui2::tip::remove();
	gui2::tip::show(window.video(), "tooltip", message, coordinate);

	handled = true;
}
开发者ID:,项目名称:,代码行数:25,代码来源:


示例19: create_child_window

    // create_child_window
    window create_child_window(int x, int y, int cx, int cy, window const& parent)
    {
        // create impl_type
        boost::shared_ptr<window::impl_type> pimpl(new window::impl_type());

        // create window
        pimpl->win = khaos::create_child_window(x, y, cx, cy, parent.khaos_window());

        // create/set event handler
        pimpl->win->handler = detail::event_handler(window(pimpl), pimpl);

        return window(pimpl);
    }
开发者ID:diosmosis,项目名称:iris,代码行数:14,代码来源:window.cpp


示例20: post_show

void mp_change_control::post_show(window& window)
{
	if(window.get_retval() == window::OK) {
		DBG_GUI << "Main: changing control of side "
		        << sides_[selected_side_] << " to nick "
		        << nicks_[selected_nick_] << std::endl;

		menu_handler_.request_control_change(
			sides_[selected_side_],
			nicks_[selected_nick_]
		);
	}
}
开发者ID:fluffbeast,项目名称:wesnoth-old,代码行数:13,代码来源:mp_change_control.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ word类代码示例发布时间:2022-05-31
下一篇:
C++ win_data类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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