~ubuntu-branches/ubuntu/utopic/ricochet/utopic-proposed

« back to all changes in this revision

Viewing changes to make-icon.5c

  • Committer: Package Import Robot
  • Author(s): Keith Packard
  • Date: 2014-02-10 00:14:52 UTC
  • Revision ID: package-import@ubuntu.com-20140210001452-4xzpkm2n5ojei1i7
Tags: 0.4
* Bring up the host chooser UI when the server connection fails
* Add .desktop file and application icon. Closes #738017.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env nickle
 
2
 
 
3
autoimport ParseArgs;
 
4
 
 
5
string ricochet_lib = String::dirname(argv[0]);
 
6
string target_file;
 
7
 
 
8
argdesc argd = {
 
9
        args = {
 
10
                {
 
11
                        .var = (arg_var.arg_string) &ricochet_lib,
 
12
                        .name = "libdir",
 
13
                        .desc = "Directory containing Ricochet nickle files"
 
14
                }
 
15
        },
 
16
        posn_args = {
 
17
                {
 
18
                        .var = (arg_var.arg_string) &target_file,
 
19
                        .name = "targetfile",
 
20
                }
 
21
        }
 
22
};
 
23
 
 
24
parseargs(&argd, &argv)
 
25
 
 
26
Command::nickle_path = ricochet_lib + ":" + Command::nickle_path;
 
27
 
 
28
autoload Cairo;
 
29
 
 
30
autoload Client;
 
31
autoload Client::Svg;
 
32
autoload RR;
 
33
autoload Client::Draw;
 
34
 
 
35
void main ()
 
36
{
 
37
        Cairo::cairo_t cr;
 
38
 
 
39
        if (!is_uninit(&target_file))
 
40
                cr = Cairo::new_svg(target_file, 32, 32);
 
41
        else
 
42
                cr = Cairo::new();
 
43
        
 
44
        RR::RobotOrNone robot = (RR::RobotOrNone) {
 
45
                .robot = (RR::Robot) {
 
46
                        .color = RR::Color.Blue
 
47
                }
 
48
        };
 
49
 
 
50
        RR::RobotOrNone robot_none = (RR::RobotOrNone) {
 
51
                .none = ◊
 
52
        };
 
53
 
 
54
        RR::TargetOrNone target = (RR::TargetOrNone) {
 
55
                .target = (RR::Target) { 
 
56
                        .color = RR::Color.Blue,
 
57
                        .shape = RR::Shape.Triangle,
 
58
                        .active = true
 
59
                }
 
60
        };
 
61
 
 
62
        RR::Object object = (RR::Object) {
 
63
                .target = target,
 
64
                .robot = robot_none
 
65
        };
 
66
 
 
67
        Client::Draw::transform_t transform = (Client::Draw::transform_t) {
 
68
                .xoff = 0,
 
69
                .yoff = 0,
 
70
                .xscale = 1,
 
71
                .yscale = 1
 
72
        };
 
73
 
 
74
        Client::Draw::background(cr, 0, 0, object, &transform);
 
75
 
 
76
        Client::Draw::contents(cr, 0, 0, object, target, robot, &transform);
 
77
 
 
78
        if (dim(argv) <= 1)
 
79
                sleep(10000);
 
80
        else
 
81
                Cairo::destroy(cr);
 
82
}
 
83
 
 
84
main();