Project

General

Profile

Revision 250

in-game timer

View differences:

graph.c
245 245

  
246 246
/// PIXEL DRAWING
247 247
int (graph_set_pixel)(uint16_t x, uint16_t y, uint32_t color) {
248
    if (x < 0 || vbe_mem_info.XResolution <= x || y < 0 || vbe_mem_info.YResolution <= y) {
248
    //pixels are certain to be inside can reduce lag
249
    /*if (x < 0 || vbe_mem_info.XResolution <= x || y < 0 || vbe_mem_info.YResolution <= y) {
249 250
        //printf("%s: invalid pixel.\n", __func__);
250 251
        return OUT_OF_RANGE;
251
    }
252
    unsigned int pos = (x + y * vbe_mem_info.XResolution) * graph_get_bytes_pixel();
253
    memcpy(video_buf + pos, &color, graph_get_bytes_pixel());
252
    }*/
253
    unsigned int pos = (x + y * vbe_mem_info.XResolution) * 3/*graph_get_bytes_pixel()*/;
254
    memcpy(video_buf + pos, &color, 3/*graph_get_bytes_pixel()*/);
254 255
    return SUCCESS;
255 256
}
256 257
void (graph_set_pixel_pos)(unsigned pos, uint32_t color){
......
399 400
        ymin = max(ymin-(int16_t)p->scale-2, 0); ymax = min(ymax+(int16_t)p->scale+2, graph_get_YRes());
400 401
    }
401 402
    const uint8_t *map = basic_sprite_get_map(p->bsp);
402
    const uint16_t bytes_pixel = graph_get_bytes_pixel();
403
    const uint16_t bytes_pixel = 3/*graph_get_bytes_pixel()*/;
403 404
    for(int16_t u, v, y = ymin; y < ymax; ++y){
404 405
        uint8_t *place = video_buf + (xmin + y*graph_get_XRes())*bytes_pixel;
405 406
        for(int16_t x = xmin; x < xmax; ++x, place += bytes_pixel){

Also available in: Unified diff