samples/ios/hello/hello/main.cpp in reflexion-0.1.7 vs samples/ios/hello/hello/main.cpp in reflexion-0.1.8
- old
+ new
@@ -19,11 +19,10 @@
redraw();
}
void on_draw (DrawEvent* e)
{
- Super::on_draw(e);
e->painter->text(stringf("%f", e->fps), 10, 10);
}
};// Window
@@ -38,26 +37,36 @@
Window* win = new Win();
win->set_title(app()->name());
win->set_frame(100, 100, 500, 500);
win->show();
+ win->root()->set_gravity(0, 9.8);
+
Image image(32, 32);
Painter painter = image.painter();
painter.begin();
painter.no_stroke();
painter.set_fill(1, 1, 1);
painter.rect(0, 0, image.width(), image.height());
painter.set_fill(1, 0, 0);
painter.ellipse(0, 0, image.width(), image.height());
painter.end();
- for (int i = 0; i < 2000; ++i)
+ for (int y = 0; y < 3; ++y)
+ for (int x = 0; x < 10; ++x)
{
ImageView* view = new ImageView();
view->set_image(image);
- view->set_frame(0, 0, image.width(), image.height());
+ view->set_frame(
+ x * (image.width() + 10),
+ y * (image.height() + 10),
+ image.width(),
+ image.height());
win->root()->add_child(view);
+
+ view->body()->set_dynamic(true);
+ view->body()->set_density(1);
}
}
};// App