aboutsummaryrefslogtreecommitdiff
path: root/vmodeled
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2022-06-20 21:29:22 +0000
committerrodri <rgl@antares-labs.eu>2022-06-20 21:29:22 +0000
commit77d8f3844311c9c43d25b31a91bc1a6ee69d1122 (patch)
tree133a910d70976179a732332c89bbdb1e4ee0d507 /vmodeled
parentc6cf604ae9113b5384c253f46bbdd34b0db0bbb5 (diff)
downloadmusw-77d8f3844311c9c43d25b31a91bc1a6ee69d1122.tar.gz
musw-77d8f3844311c9c43d25b31a91bc1a6ee69d1122.tar.bz2
musw-77d8f3844311c9c43d25b31a91bc1a6ee69d1122.zip
added zoom.
Diffstat (limited to 'vmodeled')
-rw-r--r--vmodeled/main.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/vmodeled/main.c b/vmodeled/main.c
index 0dc01aa..4384b02 100644
--- a/vmodeled/main.c
+++ b/vmodeled/main.c
@@ -24,6 +24,7 @@ struct VModel
RFrame worldrf;
VModel *model;
+int scale = 1;
void resized(void);
@@ -126,17 +127,22 @@ drawvmodel(Image *dst, VModel *mdl)
char *s;
Point pts[3];
Point2 *p;
+ Matrix S = {
+ scale, 0, 1,
+ 0, scale, 1,
+ 0, 0, 1,
+ };
p = mdl->pts;
for(s = mdl->strokefmt; s != 0 && p-mdl->pts < mdl->npts; s++)
switch(*s){
case 'l':
- line(dst, toscreen(p[0]), toscreen(p[1]), 0, 0, 0, display->white, ZP);
+ line(dst, toscreen(xform(p[0], S)), toscreen(xform(p[1], S)), 0, 0, 0, display->white, ZP);
p += 2;
break;
case 'c':
for(i = 0; i < nelem(pts); i++)
- pts[i] = toscreen(p[i]);
+ pts[i] = toscreen(xform(p[i], S));
bezspline(dst, pts, nelem(pts), 0, 0, 0, display->white, ZP);
p += 3;
break;
@@ -176,12 +182,30 @@ lmb(Mousectl *mc, Keyboardctl *)
}
void
+zoomin(void)
+{
+ scale++;
+ fprint(2, "scale %d\n", scale);
+}
+
+void
+zoomout(void)
+{
+ scale--;
+ fprint(2, "scale %d\n", scale);
+}
+
+void
mouse(Mousectl *mc, Keyboardctl *kc)
{
if((mc->buttons&1) != 0)
lmb(mc, kc);
if((mc->buttons&4) != 0)
rmb(mc, kc);
+ if((mc->buttons&8) != 0)
+ zoomin();
+ if((mc->buttons&16) != 0)
+ zoomout();
}
void