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 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
#!/usr/bin/env nickle
autoimport ParseArgs;
string ricochet_lib = String::dirname(argv[0]);
string target_file;
argdesc argd = {
args = {
{
.var = (arg_var.arg_string) &ricochet_lib,
.name = "libdir",
.desc = "Directory containing Ricochet nickle files"
}
},
posn_args = {
{
.var = (arg_var.arg_string) &target_file,
.name = "targetfile",
}
}
};
parseargs(&argd, &argv)
Command::nickle_path = ricochet_lib + ":" + Command::nickle_path;
autoload Cairo;
autoload Client;
autoload Client::Svg;
autoload RR;
autoload Client::Draw;
void main ()
{
Cairo::cairo_t cr;
if (!is_uninit(&target_file))
cr = Cairo::new_svg(target_file, 32, 32);
else
cr = Cairo::new();
RR::RobotOrNone robot = (RR::RobotOrNone) {
.robot = (RR::Robot) {
.color = RR::Color.Blue
}
};
RR::RobotOrNone robot_none = (RR::RobotOrNone) {
.none = ◊
};
RR::TargetOrNone target = (RR::TargetOrNone) {
.target = (RR::Target) {
.color = RR::Color.Blue,
.shape = RR::Shape.Triangle,
.active = true
}
};
RR::Object object = (RR::Object) {
.target = target,
.robot = robot_none
};
Client::Draw::transform_t transform = (Client::Draw::transform_t) {
.xoff = 0,
.yoff = 0,
.xscale = 1,
.yscale = 1
};
Client::Draw::background(cr, 0, 0, object, &transform);
Client::Draw::contents(cr, 0, 0, object, target, robot, &transform);
if (dim(argv) <= 1)
sleep(10000);
else
Cairo::destroy(cr);
}
main();
|