Sha256: e87a8e2f2233d269f519200b6e5fc947c3dc9933a77b24136a90b37ee8ff512c

Contents?: true

Size: 1.63 KB

Versions: 53

Compression:

Stored size: 1.63 KB

Contents

#include <xot.h>
#include <rays.h>
#include <reflex.h>

using namespace Xot;
using namespace Rays;
using namespace Reflex;


class Win : public Window
{

	typedef Window Super;

	public:

		void on_update (UpdateEvent* e)
		{
			redraw();
		}

		void on_draw (DrawEvent* e)
		{
			e->painter->text(stringf("%f", e->fps), 10, 10);
		}

};// Window


class App : public Application
{

	public:

		void on_start (Event* e)
		{
			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 * win->root()->meter2pixel());
			win->root()->set_debug(true);

			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 y = 0; y < 3; ++y)
			for (int x = 0; x < 10; ++x)
			{
				ImageView* view = new ImageView();
				view->set_image(image);
				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);
			}

			View* ground = new View();
			ground->set_frame(10, 400, 300, 10);
			win->root()->add_child(ground);
			ground->body()->set_static(true);
		}

};// App


int main(int argc, const char** argv)
{
	Rays::init();
	Reflex::init();

	Application* app = new App();
	app->set_name("Hello Xcode!");
	app->start();

	Reflex::fin();
	Rays::fin();

	return 0;
}

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
reflexion-0.3.3 samples/osx/hello/hello/main.cpp
reflexion-0.3.2 samples/osx/hello/hello/main.cpp
reflexion-0.3.1 samples/osx/hello/hello/main.cpp
reflexion-0.3 samples/osx/hello/hello/main.cpp
reflexion-0.2.1 samples/osx/hello/hello/main.cpp
reflexion-0.2 samples/osx/hello/hello/main.cpp
reflexion-0.1.57 samples/osx/hello/hello/main.cpp
reflexion-0.1.56 samples/osx/hello/hello/main.cpp
reflexion-0.1.55 samples/osx/hello/hello/main.cpp
reflexion-0.1.54 samples/osx/hello/hello/main.cpp
reflexion-0.1.53 samples/osx/hello/hello/main.cpp
reflexion-0.1.52 samples/osx/hello/hello/main.cpp
reflexion-0.1.51 samples/osx/hello/hello/main.cpp
reflexion-0.1.50 samples/osx/hello/hello/main.cpp
reflexion-0.1.49 samples/osx/hello/hello/main.cpp
reflexion-0.1.48 samples/osx/hello/hello/main.cpp
reflexion-0.1.47 samples/osx/hello/hello/main.cpp
reflexion-0.1.46 samples/osx/hello/hello/main.cpp
reflexion-0.1.45 samples/osx/hello/hello/main.cpp
reflexion-0.1.44 samples/osx/hello/hello/main.cpp