#46414 - funkaster - Fri Jun 24, 2005 11:48 am
If I remember correcly, mode5 is 160x128... so I'm trying to display a 160x128 image (a TGA file, wich is loaded fine). But for some reason, the file is displayed like if the screen where 240x160 (its in the upper left corner), this is the code I'm using:
Any idea why this could be happening?
Code: |
if ((img = load_tga (foot, &ll)) != NULL) { SetMode(MODE_5 | BG2_ENABLE); if (ll == 0) { int x, y; for (y = SCREEN_HEIGHT-1; y >= 0; y--) for (x=0; x < SCREEN_WIDTH; x++) { /* TGA is 24 bit */ unsigned char r = *img++; unsigned char g = *img++; unsigned char b = *img++; VB[x+y*SCREEN_WIDTH] = RGB8(r,g,b); } } else { for (i=0; i < SCREEN_WIDTH*SCREEN_HEIGHT; i++) { /* 16 bits tga: GGGBBBBB ARRRRRGG */ unsigned char r = *img++; unsigned char g = *img++; unsigned char b = *img++; VB[i] = RGB8(r,g,b); } } while (1) {} } return 0; |
Any idea why this could be happening?