本文整理汇总了C++中HBoxContainer::set_area_as_parent_rect方法的典型用法代码示例。如果您正苦于以下问题:C++ HBoxContainer::set_area_as_parent_rect方法的具体用法?C++ HBoxContainer::set_area_as_parent_rect怎么用?C++ HBoxContainer::set_area_as_parent_rect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HBoxContainer
的用法示例。
在下文中一共展示了HBoxContainer::set_area_as_parent_rect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: memnew
MeshEditor::MeshEditor() {
viewport = memnew( Viewport );
Ref<World> world;
world.instance();
viewport->set_world(world); //use own world
add_child(viewport);
viewport->set_process_input(false);
camera = memnew( Camera );
camera->set_transform(Transform(Matrix3(),Vector3(0,0,3)));
camera->set_perspective(45,0.1,10);
viewport->add_child(camera);
light1 = memnew( DirectionalLight );
light1->set_transform(Transform().looking_at(Vector3(-1,-1,-1),Vector3(0,1,0)));
viewport->add_child(light1);
light2 = memnew( DirectionalLight );
light2->set_transform(Transform().looking_at(Vector3(0,1,0),Vector3(0,0,1)));
light2->set_color(Light::COLOR_DIFFUSE,Color(0.7,0.7,0.7));
light2->set_color(Light::COLOR_SPECULAR,Color(0.7,0.7,0.7));
viewport->add_child(light2);
mesh_instance = memnew( MeshInstance );
viewport->add_child(mesh_instance);
set_custom_minimum_size(Size2(1,150));
HBoxContainer *hb = memnew( HBoxContainer );
add_child(hb);
hb->set_area_as_parent_rect(2);
hb->add_spacer();
VBoxContainer *vb_light = memnew( VBoxContainer );
hb->add_child(vb_light);
light_1_switch = memnew( TextureButton );
light_1_switch->set_toggle_mode(true);
vb_light->add_child(light_1_switch);
light_1_switch->connect("pressed",this,"_button_pressed",varray(light_1_switch));
light_2_switch = memnew( TextureButton );
light_2_switch->set_toggle_mode(true);
vb_light->add_child(light_2_switch);
light_2_switch->connect("pressed",this,"_button_pressed",varray(light_2_switch));
first_enter=true;
rot_x=0;
rot_y=0;
}
示例2: memnew
//.........这里部分代码省略.........
vtx_idx++;\
for (int i=0;i<6;i++) {
Vector3 face_points[4];
Vector3 normal_points[4];
float uv_points[8]={0,0,0,1,1,1,1,0};
for (int j=0;j<4;j++) {
float v[3];
v[0]=1.0;
v[1]=1-2*((j>>1)&1);
v[2]=v[1]*(1-2*(j&1));
for (int k=0;k<3;k++) {
if (i<3)
face_points[j][(i+k)%3]=v[k]*(i>=3?-1:1);
else
face_points[3-j][(i+k)%3]=v[k]*(i>=3?-1:1);
}
normal_points[j]=Vector3();
normal_points[j][i%3]=(i>=3?-1:1);
}
//tri 1
ADD_VTX(0);
ADD_VTX(1);
ADD_VTX(2);
//tri 2
ADD_VTX(2);
ADD_VTX(3);
ADD_VTX(0);
}
Array d;
d.resize(VS::ARRAY_MAX);
d[VisualServer::ARRAY_NORMAL]= normals ;
d[VisualServer::ARRAY_TANGENT]= tangents ;
d[VisualServer::ARRAY_TEX_UV]= uvs ;
d[VisualServer::ARRAY_VERTEX]= vertices ;
PoolVector<int> indices;
indices.resize(vertices.size());
for(int i=0;i<vertices.size();i++)
indices.set(i,i);
d[VisualServer::ARRAY_INDEX]=indices;
box_mesh->add_surface(Mesh::PRIMITIVE_TRIANGLES,d);
box_instance->set_mesh(box_mesh);
box_instance->hide();
}
set_custom_minimum_size(Size2(1,150)*EDSCALE);
HBoxContainer *hb = memnew( HBoxContainer );
add_child(hb);
hb->set_area_as_parent_rect(2);
VBoxContainer *vb_shape = memnew( VBoxContainer );
hb->add_child(vb_shape);
sphere_switch = memnew( TextureButton );
sphere_switch->set_toggle_mode(true);
sphere_switch->set_pressed(true);
vb_shape->add_child(sphere_switch);
sphere_switch->connect("pressed",this,"_button_pressed",varray(sphere_switch));
box_switch = memnew( TextureButton );
box_switch->set_toggle_mode(true);
box_switch->set_pressed(false);
vb_shape->add_child(box_switch);
box_switch->connect("pressed",this,"_button_pressed",varray(box_switch));
hb->add_spacer();
VBoxContainer *vb_light = memnew( VBoxContainer );
hb->add_child(vb_light);
light_1_switch = memnew( TextureButton );
light_1_switch->set_toggle_mode(true);
vb_light->add_child(light_1_switch);
light_1_switch->connect("pressed",this,"_button_pressed",varray(light_1_switch));
light_2_switch = memnew( TextureButton );
light_2_switch->set_toggle_mode(true);
vb_light->add_child(light_2_switch);
light_2_switch->connect("pressed",this,"_button_pressed",varray(light_2_switch));
first_enter=true;
}