- [FIX] ficava el color incorrecte de background
- [NEW] el fondo no usat ara pinta el color de borde
This commit is contained in:
@@ -40,7 +40,7 @@ void loadRoom(std::string room_file)
|
|||||||
}
|
}
|
||||||
tilemap::set(tiles);
|
tilemap::set(tiles);
|
||||||
tilemap::setBackground(aux::getColorByName(room["room"]["bgColor"].get_value<std::string>()));
|
tilemap::setBackground(aux::getColorByName(room["room"]["bgColor"].get_value<std::string>()));
|
||||||
|
tilemap::setBorder(aux::getColorByName(room["room"]["border"].get_value<std::string>()));
|
||||||
//fkyaml::node name_node = room["room"]["name"];
|
//fkyaml::node name_node = room["room"]["name"];
|
||||||
//printf("%s\n", name_node.get_value<std::string>().c_str());
|
//printf("%s\n", name_node.get_value<std::string>().c_str());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ namespace tilemap
|
|||||||
{
|
{
|
||||||
uint16_t tiles[16*32];
|
uint16_t tiles[16*32];
|
||||||
uint32_t back_color = 0xff000000;
|
uint32_t back_color = 0xff000000;
|
||||||
|
uint32_t border_color = 0xff000000;
|
||||||
SDL_Texture *tileset;
|
SDL_Texture *tileset;
|
||||||
SDL_Texture *map;
|
SDL_Texture *map;
|
||||||
uint32_t paleta[16] = {
|
uint32_t paleta[16] = {
|
||||||
@@ -23,7 +24,7 @@ namespace tilemap
|
|||||||
void start()
|
void start()
|
||||||
{
|
{
|
||||||
draw::setClip(200,48,draw::getWindowSize().x-400, draw::getWindowSize().y-48);
|
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);
|
draw::fillrect(200,48,draw::getWindowSize().x-400, draw::getWindowSize().y-48);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,9 +43,8 @@ namespace tilemap
|
|||||||
draw::resetClip();
|
draw::resetClip();
|
||||||
}
|
}
|
||||||
|
|
||||||
void set(uint16_t *tiles)
|
void rebuild()
|
||||||
{
|
{
|
||||||
memcpy(tilemap::tiles, tiles, 32*16*2);
|
|
||||||
draw::setDestination(map);
|
draw::setDestination(map);
|
||||||
draw::setSource(tileset);
|
draw::setSource(tileset);
|
||||||
draw::cls(back_color);
|
draw::cls(back_color);
|
||||||
@@ -58,9 +58,22 @@ namespace tilemap
|
|||||||
draw::setDestination(nullptr);
|
draw::setDestination(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set(uint16_t *tiles)
|
||||||
|
{
|
||||||
|
memcpy(tilemap::tiles, tiles, 32*16*2);
|
||||||
|
rebuild();
|
||||||
|
}
|
||||||
|
|
||||||
void setBackground(int color)
|
void setBackground(int color)
|
||||||
{
|
{
|
||||||
back_color = paleta[color];
|
back_color = paleta[color];
|
||||||
|
rebuild();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setBorder(int color)
|
||||||
|
{
|
||||||
|
border_color = paleta[color];
|
||||||
|
rebuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,4 +11,5 @@ namespace tilemap
|
|||||||
|
|
||||||
void set(uint16_t *tiles);
|
void set(uint16_t *tiles);
|
||||||
void setBackground(int color);
|
void setBackground(int color);
|
||||||
|
void setBorder(int color);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user