- [NEW] fonts amb colorets
- [WIP] stringProperty
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user