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


C++ SpinBox::set_position方法代码示例

本文整理汇总了C++中SpinBox::set_position方法的典型用法代码示例。如果您正苦于以下问题:C++ SpinBox::set_position方法的具体用法?C++ SpinBox::set_position怎么用?C++ SpinBox::set_position使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SpinBox的用法示例。


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

示例1: init

	virtual void init() {

		SceneTree::init();

		Panel *frame = memnew(Panel);
		frame->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END);
		frame->set_anchor(MARGIN_BOTTOM, Control::ANCHOR_END);
		frame->set_end(Point2(0, 0));

		Ref<Theme> t = memnew(Theme);
		frame->set_theme(t);

		get_root()->add_child(frame);

		Label *label = memnew(Label);

		label->set_position(Point2(80, 90));
		label->set_size(Point2(170, 80));
		label->set_align(Label::ALIGN_FILL);
		label->set_text("There was once upon a time a beautiful unicorn that loved to play with little girls...");

		frame->add_child(label);

		Button *button = memnew(Button);

		button->set_position(Point2(20, 20));
		button->set_size(Point2(1, 1));
		button->set_text("This is a biggie button");

		frame->add_child(button);

		Tree *tree = memnew(Tree);
		tree->set_columns(2);

		tree->set_position(Point2(230, 210));
		tree->set_size(Point2(150, 250));

		TreeItem *item = tree->create_item();
		item->set_editable(0, true);
		item->set_text(0, "root");
		item = tree->create_item(tree->get_root());
		item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
		item->set_editable(0, true);
		item->set_text(0, "check");
		item->set_cell_mode(1, TreeItem::CELL_MODE_CHECK);
		item->set_editable(1, true);
		item->set_text(1, "check2");
		item = tree->create_item(tree->get_root());
		item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
		item->set_editable(0, true);
		item->set_range_config(0, 0, 20, 0.1);
		item->set_range(0, 2);
		item->add_button(0, Theme::get_default()->get_icon("folder", "FileDialog"));
		item->set_cell_mode(1, TreeItem::CELL_MODE_RANGE);
		item->set_editable(1, true);
		item->set_range_config(1, 0, 20, 0.1);
		item->set_range(1, 3);

		item = tree->create_item(tree->get_root());
		item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
		item->set_editable(0, true);
		item->set_text(0, "Have,Many,Several,Options!");
		item->set_range(0, 2);

		item = tree->create_item(item);
		item->set_editable(0, true);
		item->set_text(0, "Gershwin!");

		frame->add_child(tree);

		LineEdit *line_edit = memnew(LineEdit);

		line_edit->set_position(Point2(30, 190));
		line_edit->set_size(Point2(180, 1));

		frame->add_child(line_edit);

		HScrollBar *hscroll = memnew(HScrollBar);

		hscroll->set_position(Point2(30, 290));
		hscroll->set_size(Point2(180, 1));
		hscroll->set_max(10);
		hscroll->set_page(4);

		frame->add_child(hscroll);

		SpinBox *spin = memnew(SpinBox);

		spin->set_position(Point2(30, 260));
		spin->set_size(Point2(120, 1));

		frame->add_child(spin);
		hscroll->share(spin);

		ProgressBar *progress = memnew(ProgressBar);

		progress->set_position(Point2(30, 330));
		progress->set_size(Point2(120, 1));

		frame->add_child(progress);
//.........这里部分代码省略.........
开发者ID:Paulloz,项目名称:godot,代码行数:101,代码来源:test_gui.cpp

示例2: init

	virtual void init() {

		SceneTree::init();

#if 0


		Viewport *vp = memnew( Viewport );
		vp->set_world( Ref<World>( memnew( World )));
		get_root()->add_child(vp);

		vp->set_rect(Rect2(0,0,256,256));
		vp->set_as_render_target(true);
		vp->set_render_target_update_mode(Viewport::RENDER_TARGET_UPDATE_ALWAYS);


		Camera *camera = memnew( Camera );
		vp->add_child(camera);
		camera->make_current();

		TestCube *testcube = memnew( TestCube );
		vp->add_child(testcube);
		testcube->set_transform(Transform( Basis().rotated(Vector3(0,1,0),Math_PI*0.25), Vector3(0,0,-8)));

		Sprite *sp = memnew( Sprite );
		sp->set_texture( vp->get_render_target_texture() );
		//sp->set_texture( ResourceLoader::load("res://ball.png") );
		sp->set_position(Point2(300,300));
		get_root()->add_child(sp);


		return;
#endif

		Panel *frame = memnew(Panel);
		frame->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END);
		frame->set_anchor(MARGIN_BOTTOM, Control::ANCHOR_END);
		frame->set_end(Point2(0, 0));

		Ref<Theme> t = memnew(Theme);
		frame->set_theme(t);

		get_root()->add_child(frame);

		Label *label = memnew(Label);

		label->set_position(Point2(80, 90));
		label->set_size(Point2(170, 80));
		label->set_align(Label::ALIGN_FILL);
		//label->set_text("There");
		label->set_text("There was once upon a time a beautiful unicorn that loved to play with little girls...");

		frame->add_child(label);

		Button *button = memnew(Button);

		button->set_position(Point2(20, 20));
		button->set_size(Point2(1, 1));
		button->set_text("This is a biggie button");

		frame->add_child(button);

#if 0
		Sprite *tf = memnew( Sprite );
		frame->add_child(tf);
		Image img;
		ImageLoader::load_image("LarvoClub.png",&img);

		img.resize(512,512);
		img.generate_mipmaps();
		img.compress(Image::COMPRESS_PVRTC4);
		Ref<ImageTexture> tt = memnew( ImageTexture );
		tt->create_from_image(img);
		tf->set_texture(tt);
		tf->set_position(Point2(50,50));
		//tf->set_scale(Point2(0.3,0.3));


		return;
#endif

		Tree *tree = memnew(Tree);
		tree->set_columns(2);

		tree->set_position(Point2(230, 210));
		tree->set_size(Point2(150, 250));

		TreeItem *item = tree->create_item();
		item->set_editable(0, true);
		item->set_text(0, "root");
		item = tree->create_item(tree->get_root());
		item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
		item->set_editable(0, true);
		item->set_text(0, "check");
		item->set_cell_mode(1, TreeItem::CELL_MODE_CHECK);
		item->set_editable(1, true);
		item->set_text(1, "check2");
		item = tree->create_item(tree->get_root());
		item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
		item->set_editable(0, true);
//.........这里部分代码省略.........
开发者ID:Alex-doc,项目名称:godot,代码行数:101,代码来源:test_gui.cpp


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