本文整理汇总了C++中VisualServer::viewport_set_size方法的典型用法代码示例。如果您正苦于以下问题:C++ VisualServer::viewport_set_size方法的具体用法?C++ VisualServer::viewport_set_size怎么用?C++ VisualServer::viewport_set_size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VisualServer
的用法示例。
在下文中一共展示了VisualServer::viewport_set_size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
virtual void init() {
VisualServer *vs = VisualServer::get_singleton();
Physics2DServer *ps = Physics2DServer::get_singleton();
space = ps->space_create();
ps->space_set_active(space, true);
ps->set_active(true);
ps->area_set_param(space, Physics2DServer::AREA_PARAM_GRAVITY_VECTOR, Vector2(0, 1));
ps->area_set_param(space, Physics2DServer::AREA_PARAM_GRAVITY, 98);
{
RID vp = vs->viewport_create();
canvas = vs->canvas_create();
Size2i screen_size = OS::get_singleton()->get_window_size();
vs->viewport_attach_canvas(vp, canvas);
vs->viewport_set_size(vp, screen_size.x, screen_size.y);
vs->viewport_attach_to_screen(vp, Rect2(Vector2(), screen_size));
vs->viewport_set_active(vp, true);
Transform2D smaller;
//smaller.scale(Vector2(0.6,0.6));
//smaller.elements[2]=Vector2(100,0);
//view_xform = smaller;
vs->viewport_set_canvas_transform(vp, canvas, view_xform);
}
ray = vs->canvas_item_create();
vs->canvas_item_set_parent(ray, canvas);
//ray_query = ps->query_create(this,"_ray_query_callback",Variant());
//ps->query_intersection(ray_query,space);
_create_body_shape_data();
for (int i = 0; i < 32; i++) {
Physics2DServer::ShapeType types[4] = {
Physics2DServer::SHAPE_CIRCLE,
Physics2DServer::SHAPE_CAPSULE,
Physics2DServer::SHAPE_RECTANGLE,
Physics2DServer::SHAPE_CONVEX_POLYGON,
};
Physics2DServer::ShapeType type = types[i % 4];
//type=Physics2DServer::SHAPE_SEGMENT;
_add_body(type, Transform2D(i * 0.8, Point2(152 + i * 40, 100 - 40 * i)));
/*
if (i==0)
ps->body_set_mode(b,Physics2DServer::BODY_MODE_STATIC);
*/
}
//RID b= _add_body(Physics2DServer::SHAPE_CIRCLE,Transform2D(0,Point2(101,140)));
//ps->body_set_mode(b,Physics2DServer::BODY_MODE_STATIC);
Point2 prev;
Vector<Point2> parr;
for (int i = 0; i < 30; i++) {
Point2 p(i * 60, Math::randf() * 70 + 340);
if (i > 0) {
parr.push_back(prev);
parr.push_back(p);
}
prev = p;
}
_add_concave(parr);
//_add_plane(Vector2(0.0,-1).normalized(),-300);
//_add_plane(Vector2(1,0).normalized(),50);
//_add_plane(Vector2(-1,0).normalized(),-600);
}