- [FIX] ficava el color incorrecte de background
- [NEW] el fondo no usat ara pinta el color de borde
This commit is contained in:
@@ -6,6 +6,7 @@ namespace tilemap
|
||||
{
|
||||
uint16_t tiles[16*32];
|
||||
uint32_t back_color = 0xff000000;
|
||||
uint32_t border_color = 0xff000000;
|
||||
SDL_Texture *tileset;
|
||||
SDL_Texture *map;
|
||||
uint32_t paleta[16] = {
|
||||
@@ -23,7 +24,7 @@ namespace tilemap
|
||||
void start()
|
||||
{
|
||||
draw::setClip(200,48,draw::getWindowSize().x-400, draw::getWindowSize().y-48);
|
||||
draw::setColor(0xff000000);
|
||||
draw::setColor(border_color);
|
||||
draw::fillrect(200,48,draw::getWindowSize().x-400, draw::getWindowSize().y-48);
|
||||
}
|
||||
|
||||
@@ -42,9 +43,8 @@ namespace tilemap
|
||||
draw::resetClip();
|
||||
}
|
||||
|
||||
void set(uint16_t *tiles)
|
||||
void rebuild()
|
||||
{
|
||||
memcpy(tilemap::tiles, tiles, 32*16*2);
|
||||
draw::setDestination(map);
|
||||
draw::setSource(tileset);
|
||||
draw::cls(back_color);
|
||||
@@ -58,9 +58,22 @@ namespace tilemap
|
||||
draw::setDestination(nullptr);
|
||||
}
|
||||
|
||||
void set(uint16_t *tiles)
|
||||
{
|
||||
memcpy(tilemap::tiles, tiles, 32*16*2);
|
||||
rebuild();
|
||||
}
|
||||
|
||||
void setBackground(int color)
|
||||
{
|
||||
back_color = paleta[color];
|
||||
rebuild();
|
||||
}
|
||||
|
||||
void setBorder(int color)
|
||||
{
|
||||
border_color = paleta[color];
|
||||
rebuild();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user