Project

General

Profile

Revision 189

fixed drawing

View differences:

proj/src/graph.c
280 280
        //printf("%s: invalid pixel.\n", __func__);
281 281
        return OUT_OF_RANGE;
282 282
    }
283
    //printf("COLOR= %X, ALPHA = %X\n", color, alpha);
284 283
    unsigned int pos = (x + y * vbe_mem_info.XResolution) * graph_get_bytes_pixel();
285 284
    uint32_t color_;
286 285
    memcpy(&color_, video_buf + pos, graph_get_bytes_pixel());
proj/src/proj.c
10 10
#include "timer.h"
11 11
#include "keyboard.h"
12 12
#include "mouse.h"
13
#include "graph.h"
13 14
#include "interrupts_func.h"
14 15

  
15 16
#include "graph.h"
......
32 33

  
33 34
    //lcf_trace_calls("/home/lcom/labs/proj/trace.txt");
34 35

  
35
    //lcf_log_output("/home/lcom/labs/proj/output.txt");
36
    lcf_log_output("/home/lcom/labs/proj/output.txt");
36 37

  
37 38
    if (lcf_start(argc, argv)) return 1;
38 39

  
......
97 98
    #ifdef TELMO
98 99
        sprite_t *crosshair = get_crosshair();
99 100
        sprite_t *shooter1 = get_shooter();
100
        sprite_set_pos(shooter1, 100, 100);
101
        sprite_set_pos(shooter1, graph_get_XRes()/2, graph_get_YRes()/2);
101 102
        graph_clear_screen();
102 103
        sprite_draw(crosshair);
103 104
        sprite_draw(shooter1);
......
147 148
                    if (counter_mouse_ih >= 3) {
148 149
                        struct packet pp = mouse_parse_packet(packet_mouse_ih);
149 150
                        update_mouse_position(&pp);
151
                        //printf("X: %d Y: %d\n", get_mouse_X(), get_mouse_Y());
150 152
                        counter_mouse_ih = 0;
151 153
                    }
152 154
                    #endif
proj/src/sprite.c
69 69
            sprite_src2pic(p, x, y, &u, &v);
70 70
            if(0 <= u && u < p->w && 0 <= v && v < p->h){
71 71
                uint32_t c = *(uint32_t*)(p->map + (v*p->w + u)*4);
72
                graph_set_pixel_alpha(p->x + x, p->y + y, GET_COLOR(c), GET_ALP(c));
72
                graph_set_pixel_alpha(x, y, GET_COLOR(c), GET_ALP(c));
73 73
            }
74 74
        }
75 75
    }

Also available in: Unified diff