Project

General

Profile

Statistics
| Revision:

root / branches / simulator / projects / simulator / simulator / gui / draw_funcs.c @ 978

History | View | Annotate | Download (505 Bytes)

1
#include "draw_funcs.h"
2
#include <stdio.h>
3
#include <math.h>
4

    
5
void draw_robot(GdkDrawable* drawable, GdkGC* gc, int x, int y, int angle) 
6
{
7
        if (!drawable || !gc)
8
                return;
9
        double ang_rad = angle * PI / 180;
10
        int x_c = x - ROBOT_DIAMETER / 2;
11
        int y_c = y - ROBOT_DIAMETER / 2;
12

    
13
        gdk_draw_arc(drawable, gc, FALSE, x_c, y_c, 
14
                  ROBOT_DIAMETER, ROBOT_DIAMETER, 0, FULL_CIR);
15

    
16
        gdk_draw_line(drawable, gc, x, y, 
17
                x + (ROBOT_DIAMETER - 10) * cos(ang_rad),
18
                y - (ROBOT_DIAMETER - 10) * sin(ang_rad));
19
}
20