#6497 - OrangyTang - Tue May 27, 2003 9:46 pm
If I use TEXTBG_SIZE_256x256 for a mode 0 background, is this 256x256 pixels, or 256x256 tiles?
Assuming that its pixels, and so i'm using 8x8 tiles, whats wrong with this code snippit?:
Where the Bg object is borrowed from GBA Junkies tutorials:
The result i'm aiming for is to get all the tiles loaded displayed, so just running though the tile indices and resetting on 255. The actual result is black lines every other collumn (mistake with writing two at the same time?) and the bottom quater of the screen is still showing the 0 tile, as if my loop isn't long enough.
Any pointers? Thanks.
Assuming that its pixels, and so i'm using 8x8 tiles, whats wrong with this code snippit?:
Code: |
// Load level tile map (256x256 tile, 2 bytes at a time)
count = 0; for(u16 loop=0; loop < 32*32/2; loop++) { u16 mapTile = (count << 8) + (count+1); layer0.mapData[loop] = mapTile;// index into 0-255 tile images.x2 count += 2; if (count >= 255) count = 0; } |
Where the Bg object is borrowed from GBA Junkies tutorials:
Code: |
#ifndef BG_H
#define BG_H ///BGCNT defines /// #define BG_MOSAIC_ENABLE 0x40 #define BG_COLOR_256 0x80 #define BG_COLOR_16 0x0 #define CharBaseBlock(n) (((n)*0x4000)+0x6000000) #define ScreenBaseBlock(n) (((n)*0x800)+0x6000000) #define CHAR_SHIFT 2 #define SCREEN_SHIFT 8 #define TEXTBG_SIZE_256x256 0x0 #define TEXTBG_SIZE_256x512 0x8000 #define TEXTBG_SIZE_512x256 0x4000 #define TEXTBG_SIZE_512x512 0xC000 #define ROTBG_SIZE_128x128 0x0 #define ROTBG_SIZE_256x256 0x4000 #define ROTBG_SIZE_512x512 0x8000 #define ROTBG_SIZE_1024x1024 0xC000 #define WRAPAROUND 0x1 typedef struct Bg { u16* tileData; u16* mapData; u8 mosaic; u8 colorMode; u8 number; u16 size; u8 charBaseBlock; u8 screenBaseBlock; u8 wraparound; s16 x_scroll,y_scroll; s32 DX,DY; s16 PA,PB,PC,PD; }Bg; #ifndef BG_C extern void EnableBackground(Bg* bg); extern void RotateBackground(Bg* bg, int angle, int center_x, int center_y, FIXED zoom); extern void UpdateBackground(Bg* bg); #endif #endif// BG_H defined |
The result i'm aiming for is to get all the tiles loaded displayed, so just running though the tile indices and resetting on 255. The actual result is black lines every other collumn (mistake with writing two at the same time?) and the bottom quater of the screen is still showing the 0 tile, as if my loop isn't long enough.
Any pointers? Thanks.