68 lines
1.6 KiB
C++
68 lines
1.6 KiB
C++
#include "background.h"
|
|
#include <azur/azur.h>
|
|
#include <azur/gint/render.h>
|
|
|
|
#include <cstdint>
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
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 u=0; u<map_Level1.nblayers;u++)
|
|
for(int i=0; i<=25; i++)
|
|
{
|
|
for(int j=0; j<14; j++)
|
|
{
|
|
uint16_t index = j * map_Level1.w + (x0+i) % map_Level1.w;
|
|
uint16_t currentTile = map_Level1.layers[u][ index ];
|
|
if (currentTile!=0)
|
|
{
|
|
uint16_t xtile = ((currentTile % map_Level1.tileset_size)-1) * 16;
|
|
uint16_t ytile = (currentTile / map_Level1.tileset_size) * 16;
|
|
azrp_subimage_p8( i*16-shifttile, j*16, map_Level1.tileset, xtile, ytile, 16, 16, DIMAGE_NONE );
|
|
}
|
|
}
|
|
}
|
|
*/
|
|
|
|
int x0 = (int) xlevel;
|
|
int shifttile = (int) (16*xlevel.frac());
|
|
|
|
uint16_t tilemap[25*14]={0};
|
|
|
|
for(int u=0; u<map_Level1.nblayers;u++)
|
|
{
|
|
for(int j=0; j<14; j++)
|
|
{
|
|
for(int i=0; i<=25; i++)
|
|
{
|
|
uint16_t index = j * map_Level1.w + (x0+i) % map_Level1.w;
|
|
tilemap[25*j+i]= cmap_Level1.layers[u][ index ];
|
|
}
|
|
}
|
|
azrp_tilesmap( shifttile, tilemap, map_Level1.tileset, map_Level1.tileset_size);
|
|
}
|
|
}
|
|
|
|
void Background::Update( float dt )
|
|
{
|
|
libnum::num a = libnum::num( dt / 90000.0f); //18000.0f );
|
|
xlevel += a;
|
|
} |