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


C++ VisualServer::texture_get_height方法代码示例

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


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

示例1: _add_body

	RID _add_body(Physics2DServer::ShapeType p_shape, const Matrix32& p_xform) {

		VisualServer *vs = VisualServer::get_singleton();
		Physics2DServer *ps = Physics2DServer::get_singleton();

		RID body = ps->body_create();
		ps->body_add_shape(body,body_shape_data[p_shape].shape);
		ps->body_set_space(body,space);
		ps->body_set_continuous_collision_detection_mode(body,Physics2DServer::CCD_MODE_CAST_SHAPE);
		ps->body_set_state(body,Physics2DServer::BODY_STATE_TRANSFORM,p_xform);

//		print_line("add body with xform: "+p_xform);
		RID sprite = vs->canvas_item_create();
		vs->canvas_item_set_parent(sprite,canvas);
		vs->canvas_item_set_transform(sprite,p_xform);
		Size2 imgsize( vs->texture_get_width(body_shape_data[p_shape].image),vs->texture_get_height(body_shape_data[p_shape].image) );
		vs->canvas_item_add_texture_rect(sprite,Rect2(-imgsize/2.0,imgsize),body_shape_data[p_shape].image);

		ps->body_set_force_integration_callback(body,this,"_body_moved",sprite);
//		RID q = ps->query_create(this,"_body_moved",sprite);
//		ps->query_body_state(q,body);

		return body;
	}
开发者ID:lonesurvivor,项目名称:godot,代码行数:24,代码来源:test_physics_2d.cpp


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