A cool application. But there was one thing that disturb me.
No Touch Control like zoom or move.
So I've looked in the source code and modified it a little.
Ad the top add this:
after
Code:
fcolor,clist,reclist;
Now first the g3D_keys().
Code:
g3D_keys()
begin
local key, run=1, m;
local m1, mx1=0, mxa=0, mz1=0, mza=0;
local m2, mx2=0, mz2=0;
LOCAL leng2=100, leng1;
LOCAL x, y, siz=zoom3D, res, sizz;
g3D_draw();
while run do
leng1:=leng2;
key:=wait(-1);
case
if TYPE(key)==6 then // Touch
case
if tmode then g3D_draw(); g3D_trace(); end;
m:=MOUSE;
if SIZE(m(1))>0 then
mxa:=m(1,2);
mza:=m(1,1);
end;
repeat
m:=MOUSE;
if Size(m(2))>0 AND Size(m(1))>0 then
mx1:=m(1,1);
mx2:=m(2,1);
end;
//Touch and Zoom
While (mx1>0) AND (mx2>0) Do
mz1:=m(1,2);
mz2:=m(2,2);
leng2:=approx(sqrt((mx2-mx1)^2+(mz2-mz1)^2));
if z=0 then
// Save Settings and Screen G0 in G2
leng1:=leng2;
z:=1;
dimgrob_p(G2,360,240);
blit_p(G2,G0);
end;
// Calculate Zoom and redraw Screen from G2 to G1 (no flicker) to G0 (main Screen)
sizz:=leng2/leng1*160;
RECT(G1);
blit_p(G1,160-sizz,120-sizz*0.75, 160+sizz, 120+(sizz*0.75),G2,0,0,320,240);
blit_p(G0, G1);
m:=MOUSE;
mx1:=-1;
mx2:=-1;
if Size(m(2))>0 AND Size(m(1))>0 then
mx1:=m(1,1);
mx2:=m(2,1);
end;
end;
//Touch and Move
if SIZE(m(1))>0 then
m1:=m(1);
end;
if m1(5)==#2d then
mx1:=m1(2)-mxa;
mz1:=m1(1)-mza;
mxa:=m1(2);
mza:=m1(1);
rotx:=(rotx+mx1) MOD 360;
rotz:=(rotz+mz1) MOD 360;
g3D_rotmatrix();
g3D_draw();
end;
UNTIL NOT SIZE(m(1))>0;
siz:=leng2/leng1*siz;
end;
end;
if key==-1 then run:=0; end;
if key==9 then g3D_getangles(); g3D_rotmatrix(); g3D_draw(); end;
if key==27 then g3D_recolor(1); g3D_draw(); end;
if (key==48 AND contour==0) then tmode:=1; fsel:=flist(tracefunc); g3D_draw(); g3D_trace(); end;
// default
repeat
case
if key==2 then rotx:=(rotx-5) MOD 360; end;
if key==12 then rotx:=(rotx+5) MOD 360; end;
if key==4 then run:=0; end;
if key==7 then rotz:=(rotz-5) MOD 360; end;
if key==8 then rotz:=(rotz+5) MOD 360; end;
if key==1 then roty:=(roty+5) MOD 360; end;
if key==3 then roty:=(roty-5) MOD 360; end;
if key==37 then winx:=winx+5; end;
if key==39 then winx:=winx-5; end;
if key==33 then winy:=winy+5; end;
if key==43 then winy:=winy-5; end;
if key==38 then winx:=-160; winy:=-120; end;
if key==45 then zoom3D:=max(zoom3D/1.05,.01); end;
if key==50 then zoom3D:=zoom3D*1.05; end;
end;
g3D_rotmatrix();
g3D_draw();
until NOT iskeydown(key);
end;
if z=1 then
// redraw screen with right zoom
zoom3D:=siz;
g3D_rotmatrix();
g3D_draw();
z:=0;
end;
end; // end while
freeze;
end;
!Not a must have!
And for a better trace mode. Even the trace mode control. It have some problems, like that in the movement the trace is not rendered. But somebody could solve it.
Code:
g3D_trace()
begin
local key, run=1, m;
local m1, mx1=0, mxa=0, mz1=0, mza=0;
g3D_drawtrace();
while run do
key:=wait(-1);
case
if TYPE(key)==6 then
if TYPE(key)==6 then // Touch
m:=MOUSE;
if SIZE(m(1))>0 then
mxa:=m(1,2);
mza:=m(1,1);
end;
repeat
m:=MOUSE;
//Touch and Move
if SIZE(m(1))>0 then
m1:=m(1);
end;
if m1(5)==#2d then
mx1:=m1(2)-mxa;
mz1:=m1(1)-mza;
mxa:=m1(2);
mza:=m1(1);
rotx:=(rotx+mx1) MOD 360;
rotz:=(rotz+mz1) MOD 360;
g3D_rotmatrix();
g3D_draw();
end;
UNTIL NOT SIZE(m(1))>0;
end;
g3D_drawtrace();
end;
if key==-1 then tmode:=0; run:=0; end;
if key==9 then g3D_getangles(); g3D_rotmatrix(); g3D_draw(); g3D_drawtrace(); end;
if key==27 then g3D_recolor(1); g3D_draw(); g3D_drawtrace(); end;
if key==45 then
tracefunc:=tracefunc-1;
if tracefunc<1 then tracefunc:=size(flist); end;
fsel:=flist(tracefunc);
g3D_draw(); g3D_drawtrace();
end;
if key==50 then
tracefunc:=tracefunc+1;
if tracefunc>size(flist) then tracefunc:=1; end;
fsel:=flist(tracefunc);
g3D_draw(); g3D_drawtrace();
end;
repeat
case
if key==4 then tmode:=0; run:=0; end;
if key==48 then tmode:=0; run:=0; end;
if key==2 then ytrace:=ytrace+1; wait(.1); end;
if key==12 then ytrace:=ytrace-1; wait(.1); end;
if key==7 then xtrace:=xtrace-1; wait(.1); end;
if key==8 then xtrace:=xtrace+1; wait(.1); end;
if key==37 then winx:=winx+5; g3D_draw(); end;
if key==39 then winx:=winx-5; g3D_draw(); end;
if key==33 then winy:=winy+5; g3D_draw(); end;
if key==43 then winy:=winy-5; g3D_draw(); end;
if key==38 then winx:=-160; winy:=-120; g3D_draw(); end;
end;
g3D_drawtrace();
until NOT iskeydown(key);
end;
end; // end while
g3D_draw();
end;
Interesting are only the variable definitions at the top of a function, all the code in
Code:
if TYPE(key)==6 then
and the variable
at the top.
In this code the style icons can't be displayed.
I've tried to implement this, but the actual version can't handle a single click. So every time you touch the screen, this popup would be displayed. Sorry :'(.
In a old version I have created a full dialog for all settings (even the secrets), but I didn't added this in the new one. Because there is a dialog on the view button in the main screen.
So here is the full code.
HPPrime_touch_v2.412.txt (Size: 53.85 KB / Downloads: 119)
Have fun with it ;-)
I wait for replies and critic.