1 // D version of example from
2 // http://www.openismus.com/documents/clutter_tutorial/1.0/docs/tutorial/html/sec-stage.html
4 // Link with: "gtk2/glib2.o gtk2/gobject2.o gtk2/clutter.o `pkg-config --libs clutter-1.0`"
7 import clut
= gtk2
.clutter
;
9 int on_stage_button_press(clut
.Actor
* stage
, clut
.Event
* event
, void* data
)
12 event
.get_coords(&x
, &y
);
13 writef("Stage clicked at (%f, %f)\n", x
, y
);
14 return true; /* Stop further handling of this event. */
17 int main(string argv
[]) {
18 clut
.Color stage_color
= { 0x00, 0x00, 0x00, 0xff }; /* Black */
20 argv
= clut
.init(argv
);
22 /* Get the stage and set its size and color: */
23 auto stage
= clut
.Stage
.get_default();
24 stage
.set_size(200, 200);
25 stage
.set_color(&stage_color
);
30 /* Connect a signal handler to handle mouse clicks and key presses on the stage: */
31 stage
.signal_connect
!"button-press-event"(&on_stage_button_press
);
33 /* Start the main loop, so we can respond to events: */