Project

General

Profile

Revision 173

fixed crosshair

View differences:

proj/graph.c
212 212

  
213 213
int (graph_set_pixel)(uint16_t x, uint16_t y, uint32_t color) {
214 214
    if (x >= vbe_mem_info.XResolution || y >= vbe_mem_info.YResolution) {
215
        printf("%s: invalid pixel.\n", __func__);
215
        //printf("%s: invalid pixel.\n", __func__);
216 216
        return OUT_OF_RANGE;
217 217
    }
218 218
    unsigned int pos = (x + y * vbe_mem_info.XResolution) * graph_get_bytes_pixel();
......
220 220
    return SUCCESS;
221 221
}
222 222
int (graph_set_pixel_alpha)(uint16_t x, uint16_t y, uint32_t color, uint8_t alpha){
223
    if (x >= vbe_mem_info.XResolution || y >= vbe_mem_info.YResolution) {
224
        //printf("%s: invalid pixel.\n", __func__);
225
        return OUT_OF_RANGE;
226
    }
223 227
    unsigned int pos = (x + y * vbe_mem_info.XResolution) * graph_get_bytes_pixel();
224 228
    uint32_t color_;
225 229
    memcpy(&color_, video_buf + pos, graph_get_bytes_pixel());
proj/proj.c
115 115
                                struct packet pp = mouse_parse_packet(packet_mouse_ih);
116 116
                                update_mouse_position(&pp);
117 117
                                sprite_set_pos(crosshair, get_mouse_X(), get_mouse_Y());
118
                                printf("X: %d | Y: %d | XRES: %d | YRES: %d\n", get_mouse_X(), get_mouse_Y(), graph_get_XRes(), graph_get_YRes());
118 119
                                graph_clear_screen();
119 120
                                sprite_draw(crosshair);
120 121
                                graph_draw();
122
                                counter_mouse_ih = 0;
121 123
                            }
122 124
                            #endif
123 125
                        }
proj/proj_func.c
49 49
    mouse_x = max(0, mouse_x + p->delta_x);
50 50
    mouse_x = min(mouse_x, graph_get_XRes() - 1);
51 51

  
52
    mouse_y = max(0, mouse_y + p->delta_y);
52
    mouse_y = max(0, mouse_y - p->delta_y);
53 53
    mouse_y = min(mouse_y, graph_get_YRes() - 1);
54 54
}
55 55

  

Also available in: Unified diff