Project

General

Profile

Revision 188

many changes

View differences:

proj.c
55 55
        return 1;
56 56
    }
57 57

  
58
    font_t *consolas = font_ctor("/home/lcom/labs/proj/font/xpm2");
59

  
60
    /// Load stuff
61
    {
62
        graph_clear_screen();
63
        text_t *txt = text_ctor(consolas, "Loading...");
64
        text_draw(txt);
65
        text_dtor(txt);
66
        graph_draw();
67
    }
58 68
    #ifdef DIOGO
59
        //printf("%d\n", 1000000-(int)(1000000*fm_sin(0.5*M_PI)));
60
        //printf("%d\n", (int)(1000000*fm_cos(0.5*M_PI)));
61
        /*
62
        rectangle_t *rect = rectangle_ctor(0,0,graph_get_XRes(), graph_get_YRes());
63
        rectangle_set_fill_color(rect, WHITE);
69
        graph_clear_screen();
64 70

  
65
        clock_t t = clock();
66
        sprite_t *shooter1 = get_shooter(); sprite_set_pos(shooter1, 100, 100);
67
        for(double angle = 0; angle <= 6.283185; angle += 0.006283185){
68
             sprite_set_angle(shooter1, angle);
69
             graph_clear_screen();
70
             rectangle_draw(rect);
71
             sprite_draw(shooter1);
72
             graph_draw();
73
        }
74
        t = clock() - t;
75
        printf("Time taken: %d/%d \n", t, CLOCKS_PER_SEC);
76
        sprite_dtor(shooter1);
77
        */
78
        /*
79
        rectangle_t *rect = rectangle_ctor(100, 100, 100, 100);
80
        rectangle_set_fill_color   (rect, 0x0000FF);
81
        rectangle_set_outline_color(rect, 0xFF0000);
82
        rectangle_set_outline_width(rect, 0);
83
        rectangle_draw(rect);
84
        rectangle_set_pos(rect, 205, 100);
85
        rectangle_set_outline_width(rect, 1);
86
        rectangle_draw(rect);
87
        rectangle_set_pos(rect, 310, 100);
71
        rectangle_t *rect = rectangle_ctor(0,0,400,100);
72
        rectangle_set_pos(rect,
73
                          graph_get_XRes()/2    - rectangle_get_w(rect)/2,
74
                          graph_get_YRes()*0.25 - rectangle_get_h(rect)/2);
75
        rectangle_set_fill_color(rect, BLACK);
88 76
        rectangle_set_outline_width(rect, 2);
77
        rectangle_set_outline_color(rect, WHITE);
89 78
        rectangle_draw(rect);
90
        rectangle_set_pos(rect, 415, 100);
91
        rectangle_set_outline_width(rect, 3);
92
        rectangle_draw(rect);
93 79

  
94
        graph_draw();
95
        */
80
        text_t *txt  = text_ctor(consolas, "Hello world!");
81
        text_set_color(txt, 0x888888);
96 82

  
97
        font_t      *fnt  = font_ctor("/home/lcom/labs/proj/font/xpm2");
98

  
99

  
100
        rectangle_t *rect = rectangle_ctor(100,100,100, 100);
101
        rectangle_set_fill_color(rect, WHITE);
102
        rectangle_draw(rect);
103
        rectangle_dtor(rect);
104

  
105
        text_t      *txt  = text_ctor(fnt, "Hello world!");
106
        text_set_color(txt, 0x00FF00);
107
        text_set_pos(txt, 100, 100);
83
        text_set_pos(txt, rectangle_get_x(rect)+rectangle_get_w(rect)/2,
84
                          rectangle_get_y(rect)+rectangle_get_h(rect)/2);
85
        text_set_valign(txt, text_valign_center);
86
        text_set_halign(txt, text_halign_center);
108 87
        text_draw(txt);
109 88
        text_dtor(txt);
110 89

  
111 90
        graph_draw();
91
        rectangle_dtor(rect);
112 92

  
113
        font_dtor(fnt);
114

  
115 93
        tickdelay(micros_to_ticks(1000000));
116 94

  
117 95
    #endif
......
200 178
        #endif
201 179
    }
202 180

  
181
    font_dtor(consolas);
182

  
203 183
    // Unsubscribe interrupts
204 184
    if (unsubscribe_all()) {
205 185
        if (cleanup())

Also available in: Unified diff