diff --git a/source/japi/font.cpp b/source/japi/font.cpp index dee4baa..f0d3c30 100644 --- a/source/japi/font.cpp +++ b/source/japi/font.cpp @@ -49,8 +49,9 @@ namespace font draw::draw({sx, sy, spaces[c], h}, {x, y, spaces[c], h}); } - void print(const char* text, int x, int y) + void print(const char* text, int x, int y, uint32_t color) { + SDL_SetTextureColorMod(surf, (color>>16)&0xff, (color>>8)&0xff, color&0xff); draw::setSource(surf); while(*text) { printChar(*text, x, y); diff --git a/source/japi/font.h b/source/japi/font.h index 2721246..6417110 100644 --- a/source/japi/font.h +++ b/source/japi/font.h @@ -1,8 +1,9 @@ #pragma once +#include namespace font { void load(const char* filename); - void print(const char* text, int x, int y); + void print(const char* text, int x, int y, uint32_t color = 0xffffffff); const int len(const char *text); } diff --git a/source/main.cpp b/source/main.cpp index d0ecf53..abb7214 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -124,6 +124,8 @@ bool loop() tilemap::draw(); propertygrid::start(); + propertygrid::stringProperty("Peiv", "Teib"); + propertygrid::stringProperty("Peiv", "Teib"); propertygrid::end(); /*x1 += 6; x2 = x1 + font::len("FILE")+6; diff --git a/source/propertygrid.cpp b/source/propertygrid.cpp index 0707c33..f31435e 100644 --- a/source/propertygrid.cpp +++ b/source/propertygrid.cpp @@ -31,7 +31,18 @@ namespace propertygrid std::string stringProperty(std::string label, std::string value) { - + const SDL_Point win_size = draw::getWindowSize(); + const int x = win_size.x-propertygrid::width; + const int y = 48+line*24; + draw::setClip(x,y,propertygrid::width, 24); + draw::setColor(0xffffffff); + draw::fillrect(x,y,propertygrid::width, 24); + draw::setColor(0xffa0a0a0); + draw::line(x,71+line*24,win_size.x, y+23); + draw::line(x+propertygrid::width/2,y,x+propertygrid::width/2, y+23); + font::print(label.c_str(), x+8, y+9, 0xff000000); + line++; + return ""; } void end()