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);
|
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 {
|
struct dtfree : dtshape {
|
||||||
|
|
||||||
|
@ -189,6 +221,19 @@ EX namespace mapeditor {
|
||||||
dt_add(b, l);
|
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) {
|
dtshape *load_shape(hstream& hs) {
|
||||||
char type = hs.get<char>();
|
char type = hs.get<char>();
|
||||||
switch(type) {
|
switch(type) {
|
||||||
|
|
Loading…
Reference in New Issue