-
Notifications
You must be signed in to change notification settings - Fork 0
/
c01.c
66 lines (54 loc) · 1.46 KB
/
c01.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <clutter/clutter.h>
#include <stdlib.h>
#define errlog g_error
#define dbglog g_debug
/*
Wrapper for clutter_init()
clutter_init()のラッパー関数
log result of clutter_init()
clutter_init()の結果を出力する。
*/
static ClutterInitError my_clutter_init( int argc, char *argv[] )
{
ClutterInitError ret = clutter_init( &argc, &argv );
switch( ret ) {
case CLUTTER_INIT_SUCCESS:
dbglog( "Initialisation successful\n" );
break;
case CLUTTER_INIT_ERROR_UNKNOWN:
errlog( "Unknown error\n" );
break;
case CLUTTER_INIT_ERROR_THREADS:
errlog( "Thread initialisation failed\n" );
break;
case CLUTTER_INIT_ERROR_BACKEND:
errlog( "Backend initialisation failed\n" );
break;
case CLUTTER_INIT_ERROR_INTERNAL:
errlog( "Internal error\n" );
break;
default:
errlog( "Other error\n" );
break;
}
return ret;
}
int main(int argc, char *argv[])
{
ClutterInitError ret = my_clutter_init( argc, argv );
if( ret != CLUTTER_INIT_SUCCESS ) {
return EXIT_FAILURE;
}
ClutterColor stage_color = { 0, 0, 0, 255 };
ClutterActor *stage = clutter_stage_new();
if( stage == NULL ) {
errlog( "clutter_stage_new() failed\n" );
return EXIT_FAILURE;
}
clutter_actor_set_size( stage, 512, 512 );
clutter_actor_set_background_color( stage, &stage_color );
g_signal_connect( stage, "destroy", clutter_main_quit, NULL );
clutter_actor_show( stage );
clutter_main();
return EXIT_SUCCESS;
}