| 1 |
#include <stdlib.h> |
| 2 |
#include <glib.h> |
| 3 |
#include <gmodule.h> |
| 4 |
#include <clutter/clutter.h> |
| 5 |
|
| 6 |
G_MODULE_EXPORT int |
| 7 |
test_texture_material_main (int argc, char *argv[]) |
| 8 |
{ |
| 9 |
ClutterActor *stage, *box; |
| 10 |
ClutterLayoutManager *manager; |
| 11 |
int i; |
| 12 |
|
| 13 |
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) |
| 14 |
return 1; |
| 15 |
|
| 16 |
stage = clutter_stage_new (); |
| 17 |
clutter_stage_set_title (CLUTTER_STAGE (stage), "Texture Material"); |
| 18 |
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); |
| 19 |
|
| 20 |
manager = clutter_flow_layout_new (CLUTTER_FLOW_HORIZONTAL); |
| 21 |
box = clutter_box_new (manager); |
| 22 |
clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_WIDTH, -25.0)); |
| 23 |
clutter_actor_add_constraint (box, clutter_bind_constraint_new (stage, CLUTTER_BIND_HEIGHT, -25.0)); |
| 24 |
clutter_actor_set_position (box, 25.0, 25.0); |
| 25 |
clutter_container_add_actor (CLUTTER_CONTAINER (stage), box); |
| 26 |
|
| 27 |
for (i = 0; i < 48; i++) |
| 28 |
{ |
| 29 |
ClutterActor *texture = clutter_texture_new (); |
| 30 |
|
| 31 |
clutter_texture_set_load_data_async (CLUTTER_TEXTURE (texture), TRUE); |
| 32 |
clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (texture), TRUE); |
| 33 |
clutter_texture_set_from_file (CLUTTER_TEXTURE (texture), |
| 34 |
TESTS_DATADIR "/redhand.png", |
| 35 |
NULL); |
| 36 |
clutter_actor_set_width (texture, 96); |
| 37 |
|
| 38 |
clutter_container_add_actor (CLUTTER_CONTAINER (box), texture); |
| 39 |
} |
| 40 |
|
| 41 |
clutter_actor_show (stage); |
| 42 |
|
| 43 |
clutter_main (); |
| 44 |
|
| 45 |
return EXIT_SUCCESS; |
| 46 |
} |