You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2026-01-05 19:31:35 +00:00
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
This commit is contained in:
@@ -43,7 +43,6 @@ static const unsigned char convex_png[] = {
|
||||
};
|
||||
|
||||
class TestPhysics2DMainLoop : public MainLoop {
|
||||
|
||||
GDCLASS(TestPhysics2DMainLoop, MainLoop);
|
||||
|
||||
RID circle_img;
|
||||
@@ -57,7 +56,6 @@ class TestPhysics2DMainLoop : public MainLoop {
|
||||
Vector2 ray_from, ray_to;
|
||||
|
||||
struct BodyShapeData {
|
||||
|
||||
RID image;
|
||||
RID shape;
|
||||
};
|
||||
@@ -71,13 +69,10 @@ class TestPhysics2DMainLoop : public MainLoop {
|
||||
// SEGMENT
|
||||
|
||||
{
|
||||
|
||||
PoolVector<uint8_t> pixels;
|
||||
pixels.resize(32 * 2 * 2);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
|
||||
for (int j = 0; j < 32; j++) {
|
||||
|
||||
pixels.set(i * 32 * 2 + j * 2 + 0, (j == 0) ? 255 : 0);
|
||||
pixels.set(i * 32 * 2 + j * 2 + 1, 255);
|
||||
}
|
||||
@@ -96,13 +91,10 @@ class TestPhysics2DMainLoop : public MainLoop {
|
||||
// CIRCLE
|
||||
|
||||
{
|
||||
|
||||
PoolVector<uint8_t> pixels;
|
||||
pixels.resize(32 * 32 * 2);
|
||||
for (int i = 0; i < 32; i++) {
|
||||
|
||||
for (int j = 0; j < 32; j++) {
|
||||
|
||||
bool black = Vector2(i - 16, j - 16).length_squared() < 16 * 16;
|
||||
|
||||
pixels.set(i * 32 * 2 + j * 2 + 0, (i == 16 || j == 16) ? 255 : 0);
|
||||
@@ -123,13 +115,10 @@ class TestPhysics2DMainLoop : public MainLoop {
|
||||
// BOX
|
||||
|
||||
{
|
||||
|
||||
PoolVector<uint8_t> pixels;
|
||||
pixels.resize(32 * 32 * 2);
|
||||
for (int i = 0; i < 32; i++) {
|
||||
|
||||
for (int j = 0; j < 32; j++) {
|
||||
|
||||
bool black = i > 0 && i < 31 && j > 0 && j < 31;
|
||||
|
||||
pixels.set(i * 32 * 2 + j * 2 + 0, black ? 0 : 255);
|
||||
@@ -150,13 +139,10 @@ class TestPhysics2DMainLoop : public MainLoop {
|
||||
// CAPSULE
|
||||
|
||||
{
|
||||
|
||||
PoolVector<uint8_t> pixels;
|
||||
pixels.resize(32 * 64 * 2);
|
||||
for (int i = 0; i < 64; i++) {
|
||||
|
||||
for (int j = 0; j < 32; j++) {
|
||||
|
||||
int si = i > 48 ? i - 32 : (i < 16 ? i : 16);
|
||||
bool black = Vector2(si - 16, j - 16).length_squared() < 16 * 16;
|
||||
|
||||
@@ -178,7 +164,6 @@ class TestPhysics2DMainLoop : public MainLoop {
|
||||
// CONVEX
|
||||
|
||||
{
|
||||
|
||||
Ref<Image> image = memnew(Image(convex_png));
|
||||
|
||||
body_shape_data[Physics2DServer::SHAPE_CONVEX_POLYGON].image = vs->texture_create_from_image(image);
|
||||
@@ -201,7 +186,6 @@ class TestPhysics2DMainLoop : public MainLoop {
|
||||
}
|
||||
|
||||
void _do_ray_query() {
|
||||
|
||||
/*
|
||||
Physics2DServer *ps = Physics2DServer::get_singleton();
|
||||
ps->query_intersection_segment(ray_query,ray_from,ray_to);
|
||||
@@ -210,13 +194,10 @@ class TestPhysics2DMainLoop : public MainLoop {
|
||||
|
||||
protected:
|
||||
void input_event(const Ref<InputEvent> &p_event) {
|
||||
|
||||
Ref<InputEventMouseButton> mb = p_event;
|
||||
|
||||
if (mb.is_valid()) {
|
||||
|
||||
if (mb->is_pressed()) {
|
||||
|
||||
Point2 p(mb->get_position().x, mb->get_position().y);
|
||||
|
||||
if (mb->get_button_index() == 1) {
|
||||
@@ -232,7 +213,6 @@ protected:
|
||||
Ref<InputEventMouseMotion> mm = p_event;
|
||||
|
||||
if (mm.is_valid()) {
|
||||
|
||||
Point2 p = mm->get_position();
|
||||
|
||||
if (mm->get_button_mask() & BUTTON_MASK_LEFT) {
|
||||
@@ -246,7 +226,6 @@ protected:
|
||||
}
|
||||
|
||||
RID _add_body(Physics2DServer::ShapeType p_shape, const Transform2D &p_xform) {
|
||||
|
||||
VisualServer *vs = VisualServer::get_singleton();
|
||||
Physics2DServer *ps = Physics2DServer::get_singleton();
|
||||
|
||||
@@ -271,7 +250,6 @@ protected:
|
||||
}
|
||||
|
||||
void _add_plane(const Vector2 &p_normal, real_t p_d) {
|
||||
|
||||
Physics2DServer *ps = Physics2DServer::get_singleton();
|
||||
|
||||
Array arr;
|
||||
@@ -288,7 +266,6 @@ protected:
|
||||
}
|
||||
|
||||
void _add_concave(const Vector<Vector2> &p_points, const Transform2D &p_xform = Transform2D()) {
|
||||
|
||||
Physics2DServer *ps = Physics2DServer::get_singleton();
|
||||
VisualServer *vs = VisualServer::get_singleton();
|
||||
|
||||
@@ -314,7 +291,6 @@ protected:
|
||||
}
|
||||
|
||||
void _ray_query_callback(const RID &p_rid, ObjectID p_id, int p_shape, const Vector2 &p_point, const Vector2 &p_normal) {
|
||||
|
||||
Vector2 ray_end;
|
||||
|
||||
if (p_rid.is_valid()) {
|
||||
@@ -332,14 +308,12 @@ protected:
|
||||
}
|
||||
|
||||
static void _bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_body_moved"), &TestPhysics2DMainLoop::_body_moved);
|
||||
ClassDB::bind_method(D_METHOD("_ray_query_callback"), &TestPhysics2DMainLoop::_ray_query_callback);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void init() {
|
||||
|
||||
VisualServer *vs = VisualServer::get_singleton();
|
||||
Physics2DServer *ps = Physics2DServer::get_singleton();
|
||||
|
||||
@@ -350,7 +324,6 @@ public:
|
||||
ps->area_set_param(space, Physics2DServer::AREA_PARAM_GRAVITY, 98);
|
||||
|
||||
{
|
||||
|
||||
RID vp = vs->viewport_create();
|
||||
canvas = vs->canvas_create();
|
||||
|
||||
@@ -376,7 +349,6 @@ public:
|
||||
_create_body_shape_data();
|
||||
|
||||
for (int i = 0; i < 32; i++) {
|
||||
|
||||
Physics2DServer::ShapeType types[4] = {
|
||||
Physics2DServer::SHAPE_CIRCLE,
|
||||
Physics2DServer::SHAPE_CAPSULE,
|
||||
@@ -401,7 +373,6 @@ public:
|
||||
|
||||
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);
|
||||
@@ -417,7 +388,6 @@ public:
|
||||
}
|
||||
|
||||
virtual bool idle(float p_time) {
|
||||
|
||||
return false;
|
||||
}
|
||||
virtual void finish() {
|
||||
@@ -429,7 +399,6 @@ public:
|
||||
namespace TestPhysics2D {
|
||||
|
||||
MainLoop *test() {
|
||||
|
||||
return memnew(TestPhysics2DMainLoop);
|
||||
}
|
||||
} // namespace TestPhysics2D
|
||||
|
||||
Reference in New Issue
Block a user