#include "background.h" #include #include #include #include extern struct Map map_Level1; Background::Background( ) { } Background::~Background( ) { } void Background::Render( void ) { int x0 = (int) xlevel; int shifttile = (int) (16*xlevel.frac()); for(int i=0; i<=25; i++) { for(int j=0; j<14; j++) { uint16_t index = j * map_Level1.w + (x0+i)%25; uint16_t currentTile = map_Level1.layers[ index ]; if (currentTile!=0) { uint16_t xtile = ((currentTile % 9)-1) * 16; uint16_t ytile = (currentTile / 9) * 16; azrp_subimage_p8( i*16-shifttile, j*16, map_Level1.tileset, xtile, ytile, 16, 16, DIMAGE_NONE ); } } } } void Background::Update( float dt ) { libnum::num a = libnum::num( dt / 18000.0f ); xlevel += a; }