mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-04-11 21:33:16 +00:00
text in drawing tool (not yet addable)
This commit is contained in:
parent
5b26fd0059
commit
38d668ee7c
@ -91,6 +91,38 @@ EX namespace mapeditor {
|
||||
return abs(hdist(s, h) - radius);
|
||||
}
|
||||
};
|
||||
|
||||
struct dttext : dtshape {
|
||||
hyperpoint where;
|
||||
ld size;
|
||||
string caption;
|
||||
|
||||
void rotate(const transmatrix& T) override {
|
||||
where = T * where;
|
||||
}
|
||||
|
||||
void save(hstream& hs) override {
|
||||
hs.write<char>(4);
|
||||
hs.write(where);
|
||||
hs.write(size);
|
||||
hs.write(caption);
|
||||
}
|
||||
|
||||
dtshape *load(hstream& hs) override {
|
||||
hs.read(where);
|
||||
hs.read(size);
|
||||
hs.read(caption);
|
||||
return this;
|
||||
}
|
||||
|
||||
void draw(const transmatrix& V) override {
|
||||
queuestr(V * rgpushxto0(where), size, caption, col);
|
||||
}
|
||||
|
||||
ld distance(hyperpoint h) override {
|
||||
return hdist(h, where);
|
||||
}
|
||||
};
|
||||
|
||||
struct dtfree : dtshape {
|
||||
|
||||
@ -189,6 +221,19 @@ EX namespace mapeditor {
|
||||
dt_add(b, l);
|
||||
}
|
||||
|
||||
EX void dt_add_text(hyperpoint h, ld size, string cap) {
|
||||
cell *b = centerover;
|
||||
|
||||
h = inverse(ggmatrix(b)) * h;
|
||||
virtualRebase(b, h);
|
||||
|
||||
auto l = new dttext;
|
||||
l->where = h;
|
||||
l->size = size;
|
||||
l->caption = cap;
|
||||
dt_add(b, l);
|
||||
}
|
||||
|
||||
dtshape *load_shape(hstream& hs) {
|
||||
char type = hs.get<char>();
|
||||
switch(type) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user