TempleOSCD_150720.ISO
This commit is contained in:
1 parent
401601816c
commit
f8c05f98f4
554 files changed
+26046
-24853
No files matched your search
+13
-13
@@ -3,29 +3,29 @@ U0 Main()
|
||||
F64 é=0,č=0,ę=0;
|
||||
CD3I32 poly[4];
|
||||
CDC *dc=DCAlias;
|
||||
DCAllocDepthBuf(dc);
|
||||
DCDepthBufAlloc(dc);
|
||||
dc->flags|=DCF_TRANSFORMATION|DCF_SYMMETRY;
|
||||
try {
|
||||
while (!ScanChar) {
|
||||
DCDepthBufRst(dc);
|
||||
GrSetSymmetry(dc,Fs->pix_width/2,Fs->pix_height/2,
|
||||
ip.pos.x-Fs->pix_left-Fs->scroll_x,
|
||||
ip.pos.y-Fs->pix_top-Fs->scroll_y);
|
||||
DCSymmetrySet(dc,Fs->pix_width/2,Fs->pix_height/2,
|
||||
ip.pos.x-Fs->pix_left-Fs->scroll_x,
|
||||
ip.pos.y-Fs->pix_top-Fs->scroll_y);
|
||||
dc->color=LTBLUE;
|
||||
GrLine(dc,Fs->pix_width/2,Fs->pix_height/2,
|
||||
ip.pos.x-Fs->pix_left-Fs->scroll_x,
|
||||
ip.pos.y-Fs->pix_top-Fs->scroll_y);
|
||||
|
||||
GrIdentEqu(dc->r);
|
||||
GrRotXEqu(dc->r,ę);
|
||||
GrRotYEqu(dc->r,č);
|
||||
GrRotZEqu(dc->r,é);
|
||||
GrSetRotMat(dc,dc->r);
|
||||
ip.pos.x-Fs->pix_left-Fs->scroll_x,
|
||||
ip.pos.y-Fs->pix_top-Fs->scroll_y);
|
||||
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
Mat4x4RotX(dc->r,ę);
|
||||
Mat4x4RotY(dc->r,č);
|
||||
Mat4x4RotZ(dc->r,é);
|
||||
DCMat4x4Set(dc,dc->r);
|
||||
|
||||
dc->x=Fs->pix_width/2;
|
||||
dc->y=Fs->pix_height/2;
|
||||
dc->z=500;
|
||||
|
||||
|
||||
dc->color=GREEN;
|
||||
poly[0].x=50;
|
||||
poly[0].y=150;
|
||||
|
||||
+14
-14
@@ -12,24 +12,24 @@ U0 Balloon()
|
||||
|
||||
CLI
|
||||
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,0xF);
|
||||
MemSetI64(0xA0000,0,640*480/64);
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,0xF);
|
||||
MemSetI64(0xA0000,0,640*480/64);
|
||||
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,RED+GREEN+8);
|
||||
for (k=100;k<150;k++) {
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,RED+GREEN+8);
|
||||
for (k=100;k<150;k++) {
|
||||
|
||||
for (i=0;i<20;i++)
|
||||
for (j=0;j<3;j++)
|
||||
*(0xA0000+0x1000+(i+k)*640/8+j)(U8 *)=a[i*3+j];
|
||||
for (i=0;i<20;i++)
|
||||
for (j=0;j<3;j++)
|
||||
*(0xA0000+0x1000+(i+k)*640/8+j)(U8 *)=a[i*3+j];
|
||||
|
||||
BusyWait(40000);
|
||||
BusyWait(40000);
|
||||
|
||||
for (i=0;i<20;i++)
|
||||
for (j=0;j<3;j++)
|
||||
*(0xA0000+0x1000+(i+k)*640/8+j)(U8 *)=0;
|
||||
}
|
||||
for (i=0;i<20;i++)
|
||||
for (j=0;j<3;j++)
|
||||
*(0xA0000+0x1000+(i+k)*640/8+j)(U8 *)=0;
|
||||
}
|
||||
|
||||
STI
|
||||
VGAFlush;
|
||||
|
||||
@@ -2,7 +2,7 @@ CDC *dc;
|
||||
|
||||
U0 DrawIt(CTask *,CDC *)
|
||||
{//This technique is weird, but clever. In Box() we
|
||||
//created an alias of the system $LK,"gr.dc2",A="MN:CGrGlbls"$.
|
||||
//created an alias of the system $LK,"gr.dc2",A="MN:CGrGlbls"$.
|
||||
dc->pen_width=2;
|
||||
dc->color=RED;
|
||||
GrLine3(dc,-100,-100,-100, -100, 100,-100);
|
||||
@@ -27,18 +27,18 @@ U0 Box()
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
DocClear;
|
||||
Fs->draw_it=&DrawIt;
|
||||
Preempt(OFF); //We don't want matrix used while we're changing it.
|
||||
Preempt; //We don't want matrix used while we're changing it.
|
||||
|
||||
dc->x=200;
|
||||
dc->y=200;
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
while (!ScanChar) {
|
||||
GrIdentEqu(dc->r);
|
||||
GrRotZEqu(dc->r,é);
|
||||
GrRotXEqu(dc->r,è);
|
||||
GrRotZEqu(dc->r,ê);
|
||||
GrScaleEqu(dc->r,s);
|
||||
GrSetRotMat(dc,dc->r);
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
Mat4x4RotZ(dc->r,é);
|
||||
Mat4x4RotX(dc->r,è);
|
||||
Mat4x4RotZ(dc->r,ê);
|
||||
Mat4x4Scale(dc->r,s);
|
||||
DCMat4x4Set(dc,dc->r);
|
||||
|
||||
Sleep(20);
|
||||
é+=2*ã/70;
|
||||
|
||||
Binary file not shown.
@@ -12,8 +12,8 @@ U0 Cartesian()
|
||||
do {
|
||||
DocClear;
|
||||
"Enter algebraic equation to graph.\n"
|
||||
"Example: y=2*x\n"
|
||||
"y=";
|
||||
"Example: y=2*x\n"
|
||||
"y=";
|
||||
if (st=GetStr) {
|
||||
if (*st) {
|
||||
h=Fs->pix_width/2;
|
||||
@@ -35,7 +35,7 @@ U0 Cartesian()
|
||||
ch=CH_SHIFT_ESC;
|
||||
Free(st);
|
||||
} else
|
||||
ch=CH_SHIFT_ESC;
|
||||
ch=CH_SHIFT_ESC;
|
||||
DCFill;
|
||||
} while (ch!=CH_SHIFT_ESC && ch!=CH_ESC);
|
||||
DCDel(dc);
|
||||
|
||||
Binary file not shown.
@@ -20,7 +20,8 @@ U0 ShowTree(CDC *dc,Node *tempn,I64 *_node_x,I64 *_tree_x,I64 y)
|
||||
if (tempn->left) {
|
||||
ShowTree(dc,tempn->left,&node_x,_tree_x,y+Y_SPACING);
|
||||
dc->color=BLUE;
|
||||
GrArrow3(dc,*_tree_x,y,0,node_x+ARROW_SPACING,y+Y_SPACING-ARROW_SPACING,0);
|
||||
GrArrow3(dc,*_tree_x,y,0,
|
||||
node_x+ARROW_SPACING,y+Y_SPACING-ARROW_SPACING,0);
|
||||
}
|
||||
if (tempn->n==n1 || tempn->n==n2) {
|
||||
if (tempn->n==common_ancestor)
|
||||
@@ -31,15 +32,16 @@ U0 ShowTree(CDC *dc,Node *tempn,I64 *_node_x,I64 *_tree_x,I64 y)
|
||||
dc->color=GREEN;
|
||||
else
|
||||
dc->color=BLUE;
|
||||
|
||||
|
||||
*_node_x=*_tree_x;
|
||||
GrPrint(dc,*_node_x,y,"%d",tempn->n);
|
||||
*_tree_x+=X_SPACING;
|
||||
|
||||
|
||||
if (tempn->right) {
|
||||
ShowTree(dc,tempn->right,&node_x,_tree_x,y+Y_SPACING);
|
||||
dc->color=BLUE;
|
||||
GrArrow3(dc,*_node_x,y,0,node_x-ARROW_SPACING,y+Y_SPACING-ARROW_SPACING,0);
|
||||
GrArrow3(dc,*_node_x,y,0,
|
||||
node_x-ARROW_SPACING,y+Y_SPACING-ARROW_SPACING,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,12 +72,12 @@ U0 TreeNew()
|
||||
for (i=0;i<N;i++) {
|
||||
tempn=CAlloc(sizeof(Node));
|
||||
tempn->n=RandU16%N;
|
||||
|
||||
|
||||
if (i==N-1)
|
||||
n1=tempn->n;
|
||||
else if (i==N-2)
|
||||
n2=tempn->n;
|
||||
|
||||
|
||||
TreeAdd(&root,tempn);
|
||||
Sleep(50);
|
||||
}
|
||||
@@ -96,7 +98,7 @@ U0 TreeCommonAncestor()
|
||||
{//Make tree and find common ancestor to n1 & n2.
|
||||
root=NULL;
|
||||
n1=n2=common_ancestor=0;
|
||||
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
Fs->draw_it=&DrawIt;
|
||||
DocClear;
|
||||
|
||||
@@ -4,7 +4,7 @@ U0 Doodle()
|
||||
{
|
||||
I64 msg_code,i,x1,y1,x2,y2,a1,a2,color=BLACK;
|
||||
CDC *dc=DCAlias;
|
||||
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
|
||||
|
||||
@@ -15,8 +15,8 @@ U0 Doodle()
|
||||
DocClear;
|
||||
do {
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+
|
||||
1<<MSG_IP_R_UP);
|
||||
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+
|
||||
1<<MSG_IP_R_UP);
|
||||
switch (msg_code) {
|
||||
case MSG_IP_R_UP:
|
||||
i=PopUpColor;
|
||||
@@ -30,7 +30,7 @@ U0 Doodle()
|
||||
while (msg_code!=MSG_IP_L_UP) {
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
x2=a1; y2=a2;
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+21
-19
@@ -1,9 +1,11 @@
|
||||
/*After making a font, you can save it as a binary
|
||||
file with:
|
||||
/*After making a font...
|
||||
|
||||
You can save it as a binary file with:
|
||||
FileWrite("filename.BIN.Z",text.font,256*FONT_HEIGHT);
|
||||
|
||||
You can load it with:
|
||||
U8 *myfont=FileRead("filename.BIN");
|
||||
text.font=myfont; //preserve text.font if you want to go back.
|
||||
U64 *my_font=FileRead("filename.BIN.Z");
|
||||
text.font=my_font; //preserve text.font if you want to go back.
|
||||
|
||||
If you want to change the system font permanently,
|
||||
save to a file with this font editor program
|
||||
@@ -33,7 +35,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
c=(BLUE<<4+WHITE)<<8 + k++;
|
||||
TextChar(task,,j,i,c);
|
||||
}
|
||||
|
||||
|
||||
k=0;
|
||||
for (i=0;i<FONT_HEIGHT;i++)
|
||||
for (j=0;j<FONT_WIDTH;j++) {
|
||||
@@ -42,8 +44,8 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
else
|
||||
dc->color=BLUE;
|
||||
GrRect(dc,BLOW_UP_CHAR_X+j*FONT_WIDTH,
|
||||
BLOW_UP_CHAR_Y+i*FONT_HEIGHT,
|
||||
FONT_WIDTH,FONT_HEIGHT);
|
||||
BLOW_UP_CHAR_Y+i*FONT_HEIGHT,
|
||||
FONT_WIDTH,FONT_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,11 +53,10 @@ U0 FESave(Bool pmt)
|
||||
{
|
||||
U8 old_draw_it=Fs->draw_it;
|
||||
CDoc *doc=DocNew;
|
||||
I64 i,j,k=0;
|
||||
I64 i;
|
||||
for (i=0;i<256;i++) {
|
||||
for (j=0;j<FONT_HEIGHT;j++)
|
||||
DocPrint(doc,"0x%02X,",text.font(U8 *)[k++]);
|
||||
if (Bt(chars_bitmap_safe_dollar,i))
|
||||
DocPrint(doc,"0x%016X,",text.font[i]);
|
||||
if (Bt(chars_bmp_safe_dollar,i))
|
||||
DocPrint(doc,"//%c",i);
|
||||
else if (i=='$$')
|
||||
DocPrint(doc,"//$$$$",i);
|
||||
@@ -72,11 +73,11 @@ U0 FontEd()
|
||||
I64 msg_code,a1,a2,k;
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
MenuPush(
|
||||
"File {"
|
||||
" SaveAs(,CH_CTRLA);"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}");
|
||||
"File {"
|
||||
" SaveAs(,CH_CTRLA);"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}");
|
||||
AutoComplete;
|
||||
DocClear;
|
||||
DocCursor;
|
||||
@@ -85,7 +86,8 @@ U0 FontEd()
|
||||
try {
|
||||
Fs->draw_it=&DrawIt;
|
||||
while (TRUE) {
|
||||
switch (msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_L_DOWN|1<<MSG_IP_R_DOWN|1<<MSG_IP_MOVE)) {
|
||||
switch (msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_KEY_DOWN|1<<MSG_IP_L_DOWN|1<<MSG_IP_R_DOWN|1<<MSG_IP_MOVE)) {
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
case 0:
|
||||
@@ -120,13 +122,13 @@ U0 FontEd()
|
||||
case MSG_IP_L_DOWN:
|
||||
case MSG_IP_R_DOWN:
|
||||
if (0<=a1<FONT_WIDTH*16 &&
|
||||
0<=a2<FONT_HEIGHT*16) {
|
||||
0<=a2<FONT_HEIGHT*16) {
|
||||
cur_ch=(a2/FONT_HEIGHT)*16+a1/FONT_WIDTH;
|
||||
break;
|
||||
} //fall through
|
||||
case MSG_IP_MOVE:
|
||||
k=((a2-BLOW_UP_CHAR_Y)/FONT_HEIGHT)*FONT_WIDTH+
|
||||
(a1-BLOW_UP_CHAR_X)/FONT_WIDTH;
|
||||
(a1-BLOW_UP_CHAR_X)/FONT_WIDTH;
|
||||
if (0<=k<FONT_WIDTH*FONT_HEIGHT) {
|
||||
if (ip.lb||msg_code==MSG_IP_L_DOWN)
|
||||
Bts(&text.font[cur_ch],k);
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#define GRID 5
|
||||
|
||||
U0 DrawMyInputPtr(CDC *dc,I64 x,I64 y)
|
||||
{
|
||||
dc->pen_width=1;
|
||||
dc->flags&=~(DCF_TRANSFORMATION|DCF_SYMMETRY);
|
||||
GrRect(dc,x,y,GRID,GRID);
|
||||
}
|
||||
|
||||
U0 GridDemo()
|
||||
{
|
||||
CGridGlbls old_grid;
|
||||
U0 (*old_draw_input_ptr)(CDC *dc,I64 x,I64 y); //Can't init this type of var.
|
||||
MemCpy(&old_grid,&ip_grid,sizeof(CGridGlbls));
|
||||
GridInit;
|
||||
ip_grid.snap=TRUE; //You can set other $LK,"stuff",A="MN:CGridGlbls"$.
|
||||
ip_grid.x=GRID;
|
||||
ip_grid.y=GRID;
|
||||
old_draw_input_ptr=gr.fp_draw_input_ptr;
|
||||
gr.fp_draw_input_ptr=&DrawMyInputPtr;
|
||||
while (!ip.lb) //Left button to exit.
|
||||
GrPlot(,ip.pos.x,ip.pos.y);
|
||||
DCFill;
|
||||
gr.fp_draw_input_ptr=old_draw_input_ptr;
|
||||
MemCpy(&ip_grid,&old_grid,sizeof(CGridGlbls));
|
||||
}
|
||||
|
||||
GridDemo;
|
||||
+26
-13
@@ -34,7 +34,8 @@ U0 SetDisksRestXY()
|
||||
I64 i;
|
||||
for (i=0;i<NUM_DISKS;i++) {
|
||||
disks_x[i]=poles_x[disks_pole[i]];
|
||||
disks_y[i]=Fs->pix_height-PEDESTAL_HEIGHT-(DISK_HEIGHT+1)/2-1-(DISK_HEIGHT+1)*PosInStk(disks_pole[i],i);
|
||||
disks_y[i]=Fs->pix_height-PEDESTAL_HEIGHT
|
||||
-(DISK_HEIGHT+1)/2-1-(DISK_HEIGHT+1)*PosInStk(disks_pole[i],i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,22 +47,30 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
poles_x[i]=(1+i)*task->pix_width/4;
|
||||
|
||||
dc->color=BLACK;
|
||||
GrRect(dc,poles_x[0]-50,task->pix_height-PEDESTAL_HEIGHT,poles_x[2]-poles_x[0]+100,PEDESTAL_HEIGHT-FONT_HEIGHT);
|
||||
GrRect(dc,poles_x[0]-50,task->pix_height-PEDESTAL_HEIGHT,
|
||||
poles_x[2]-poles_x[0]+100,PEDESTAL_HEIGHT-FONT_HEIGHT);
|
||||
dc->color=DKGRAY;
|
||||
GrRect(dc,poles_x[0]-49,task->pix_height-PEDESTAL_HEIGHT+1,poles_x[2]-poles_x[0]+98,PEDESTAL_HEIGHT-FONT_HEIGHT-2);
|
||||
GrRect(dc,poles_x[0]-49,task->pix_height-PEDESTAL_HEIGHT+1,
|
||||
poles_x[2]-poles_x[0]+98,PEDESTAL_HEIGHT-FONT_HEIGHT-2);
|
||||
|
||||
for (i=0;i<3;i++) {
|
||||
dc->color=BLACK;
|
||||
GrRect(dc,poles_x[i]-3,task->pix_height-PEDESTAL_HEIGHT-(NUM_DISKS+1)*(DISK_HEIGHT+1),7,(NUM_DISKS+1)*(DISK_HEIGHT+1));
|
||||
GrRect(dc,poles_x[i]-3,
|
||||
task->pix_height-PEDESTAL_HEIGHT-(NUM_DISKS+1)*(DISK_HEIGHT+1),
|
||||
7,(NUM_DISKS+1)*(DISK_HEIGHT+1));
|
||||
dc->color=YELLOW;
|
||||
GrRect(dc,poles_x[i]-2,task->pix_height-PEDESTAL_HEIGHT+1-(NUM_DISKS+1)*(DISK_HEIGHT+1),5,(NUM_DISKS+1)*(DISK_HEIGHT+1)-1);
|
||||
GrRect(dc,poles_x[i]-2,
|
||||
task->pix_height-PEDESTAL_HEIGHT+1-(NUM_DISKS+1)*(DISK_HEIGHT+1),
|
||||
5,(NUM_DISKS+1)*(DISK_HEIGHT+1)-1);
|
||||
}
|
||||
|
||||
for (i=0;i<NUM_DISKS;i++) {
|
||||
dc->color=BLACK;
|
||||
GrRect(dc,disks_x[i]-(i+1)*DISK_UNIT_WIDTH,disks_y[i]-DISK_HEIGHT/2,(i+1)*(DISK_UNIT_WIDTH*2)+1,DISK_HEIGHT);
|
||||
GrRect(dc,disks_x[i]-(i+1)*DISK_UNIT_WIDTH,
|
||||
disks_y[i]-DISK_HEIGHT/2,(i+1)*(DISK_UNIT_WIDTH*2)+1,DISK_HEIGHT);
|
||||
dc->color=gr_rainbow_10[i];
|
||||
GrRect(dc,disks_x[i]-(i+1)*DISK_UNIT_WIDTH+1,disks_y[i]-DISK_HEIGHT/2+1,(i+1)*(DISK_UNIT_WIDTH*2)-1,DISK_HEIGHT-2);
|
||||
GrRect(dc,disks_x[i]-(i+1)*DISK_UNIT_WIDTH+1,
|
||||
disks_y[i]-DISK_HEIGHT/2+1,(i+1)*(DISK_UNIT_WIDTH*2)-1,DISK_HEIGHT-2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,23 +90,27 @@ U0 MoveDisks(I64 src_pole,I64 dst_pole,I64 num)
|
||||
"$$CM+BY,0,0$$Disk:%d from %d to %d\n",TopDisk(src_pole),src_pole,dst_pole;
|
||||
|
||||
top=TopDisk(src_pole);
|
||||
for (y=disks_y[top];y>Fs->pix_height-PEDESTAL_HEIGHT-(DISK_HEIGHT+1)/2-(DISK_HEIGHT+1)*(NUM_DISKS+2);y--) {
|
||||
for (y=disks_y[top];
|
||||
y>Fs->pix_height-PEDESTAL_HEIGHT-(DISK_HEIGHT+1)/2
|
||||
-(DISK_HEIGHT+1)*(NUM_DISKS+2);y--) {
|
||||
disks_y[top]=y;
|
||||
MySleep;
|
||||
}
|
||||
if (src_pole<dst_pole)
|
||||
for (x=poles_x[src_pole];x<=poles_x[dst_pole];x++) {
|
||||
disks_x[top]=x;
|
||||
MySleep;
|
||||
disks_x[top]=x;
|
||||
MySleep;
|
||||
}
|
||||
else
|
||||
for (x=poles_x[src_pole];x>=poles_x[dst_pole];x--) {
|
||||
disks_x[top]=x;
|
||||
MySleep;
|
||||
disks_x[top]=x;
|
||||
MySleep;
|
||||
}
|
||||
|
||||
disks_pole[top]=dst_pole;
|
||||
for (y=disks_y[top];y<Fs->pix_height-PEDESTAL_HEIGHT-(DISK_HEIGHT+1)/2-1-(DISK_HEIGHT+1)*PosInStk(dst_pole,top);y++) {
|
||||
for (y=disks_y[top];
|
||||
y<Fs->pix_height-PEDESTAL_HEIGHT-(DISK_HEIGHT+1)/2-1
|
||||
-(DISK_HEIGHT+1)*PosInStk(dst_pole,top);y++) {
|
||||
disks_y[top]=y;
|
||||
MySleep;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
U0 InputPointer()
|
||||
{
|
||||
while (!ip.lb) //Left Button
|
||||
"Press left mouse button to exit.\n";
|
||||
while (!ip.lb) //Left button to exit.
|
||||
GrPlot(,ip.pos.x,ip.pos.y);
|
||||
DCFill;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ U0 TurtlePlot(CDC *dc,Turtle *t,CColorROPU16 edge,CColorROPU16 middle)
|
||||
if (w<0) w=0;
|
||||
dc->color=middle;
|
||||
GrLine3(dc,t->x+w*Cos(t->é+ã/2),t->y+w*Sin(t->é+ã/2),t->z,
|
||||
t->x+w*Cos(t->é-ã/2),t->y+w*Sin(t->é-ã/2),t->z);
|
||||
t->x+w*Cos(t->é-ã/2),t->y+w*Sin(t->é-ã/2),t->z);
|
||||
w=t->w/2.0;
|
||||
dc->color=edge;
|
||||
GrPlot3(dc,t->x+w*Cos(t->é+ã/2),t->y+w*Sin(t->é+ã/2),t->z);
|
||||
@@ -113,7 +113,7 @@ U0 DrawIt(CTask *,CDC *dc)
|
||||
U0 SetMenu()
|
||||
{
|
||||
I64 i;
|
||||
U8 buf[64];
|
||||
U8 buf[STR_LEN];
|
||||
CMenuEntry *tempse;
|
||||
for (i=0;i<=9;i++) {
|
||||
StrPrint(buf,"Settings/Layer%d",i);
|
||||
@@ -137,7 +137,7 @@ U0 Lattice()
|
||||
Bool aim=FALSE;
|
||||
I64 a1,a2;
|
||||
CDC *dc=DCAlias;
|
||||
DCAllocDepthBuf(dc);
|
||||
DCDepthBufAlloc(dc);
|
||||
MenuPush(
|
||||
"File {"
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
@@ -169,7 +169,7 @@ U0 Lattice()
|
||||
"}"
|
||||
);
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
Preempt(OFF);
|
||||
Preempt;
|
||||
WinMax;
|
||||
AutoComplete;
|
||||
WinBorder;
|
||||
@@ -177,7 +177,8 @@ U0 Lattice()
|
||||
DocCursor;
|
||||
TurtleInit(&tt);
|
||||
SetMenu;
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_FOCUS_TASK_MENU-WIF_SELF_FOCUS-WIF_SELF_GRAB_SCROLL;
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_FOCUS_TASK_MENU
|
||||
-WIF_SELF_FOCUS-WIF_SELF_GRAB_SCROLL;
|
||||
Fs->draw_it=&DrawIt;
|
||||
try {
|
||||
while (TRUE) {
|
||||
|
||||
@@ -6,8 +6,8 @@ Bool restart;
|
||||
|
||||
U0 DrawIt(CTask *,CDC *dc2)
|
||||
{
|
||||
dc[cur_dc]->flags|=DCF_NO_TRANSPARENTS;
|
||||
GrBlot(dc2,0,0,dc[cur_dc]);
|
||||
dc[cur_dc]->flags|=DCF_NO_TRANSPARENTS;
|
||||
GrBlot(dc2,0,0,dc[cur_dc]);
|
||||
}
|
||||
|
||||
U0 AnimateTask(I64)
|
||||
|
||||
@@ -13,7 +13,8 @@ U0 FunDraw1(CDC *dc,F64 (*f)(F64 t))
|
||||
I64 i,w=Fs->pix_width,h=Fs->pix_height;
|
||||
F64 scale=h/5.0;
|
||||
for (i=-w/2;i<=w/2;i++)
|
||||
GrLine(dc,w/2+i,h/2-scale*f(i/scale*2*ã),w/2+i+1,h/2-scale*f((i+1)/scale*2*ã));
|
||||
GrLine(dc,w/2+i,h/2-scale*f(i/scale*2*ã),
|
||||
w/2+i+1,h/2-scale*f((i+1)/scale*2*ã));
|
||||
}
|
||||
|
||||
U0 FunDraw2(CDC *dc,F64 (*f)(F64 t,F64 p),F64 T)
|
||||
@@ -46,7 +47,8 @@ U0 Init(CDC *dc)
|
||||
GrLine(dc,w/2+scale*i,h/2-3,w/2+scale*i,h/2+3);
|
||||
if (i) {
|
||||
dc->color=DKGRAY;
|
||||
GrPrint(dc,w/2+scale*i-7*FONT_WIDTH/2,h/2+5+FONT_HEIGHT,"%5.1f*T",ToF64(i));
|
||||
GrPrint(dc,
|
||||
w/2+scale*i-7*FONT_WIDTH/2,h/2+5+FONT_HEIGHT,"%5.1f*T",ToF64(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
U0 PaletteDemo()
|
||||
{
|
||||
I64 i,j;
|
||||
CBGR bgr;
|
||||
for (i=0;i<16;i++)
|
||||
CBGR48 bgr;
|
||||
for (i=0;i<NUM_COLORS;i++)
|
||||
"$$BLACK$$$$BG,%d$$__%-8Z__$$FG$$$$BG$$\n",i,i,"ST_COLORS";
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
//Alternatively, use $LK,"SetVGAPalette4",A="MN:SetVGAPalette4"$(vga_palette4_gray);
|
||||
for (i=0;i<16;i++) {
|
||||
j=0xFF*i/15;
|
||||
//Alternatively, use $LK,"GrPaletteSet",A="MN:GrPaletteSet"$(gr_palette_gray);
|
||||
for (i=0;i<NUM_COLORS;i++) {
|
||||
j=0xFFFF*i/(NUM_COLORS-1);
|
||||
bgr.b=j;
|
||||
bgr.g=j;
|
||||
bgr.r=j;
|
||||
SetVGAPaletteColor(i,bgr);
|
||||
GrPaletteColorSet(i,bgr);
|
||||
}
|
||||
PressAKey;
|
||||
|
||||
//You can do it this way, too.
|
||||
SetVGAPaletteColor(WHITE,0xFFFF00);
|
||||
GrPaletteColorSet(WHITE,0xFFFFFFFF0000);
|
||||
PressAKey;
|
||||
|
||||
//$LK,"SettingsPop",A="MN:SettingsPop"$() restores original palette
|
||||
//$LK,"SettingsPop",A="MN:SettingsPop"$() restores original palette
|
||||
SettingsPop;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+13
-10
@@ -35,7 +35,7 @@ F64 F(Complex *x)
|
||||
CPoly(&num, x,zeros,NUM_ZEROS);
|
||||
CPoly(&denom,x,poles,NUM_POLES);
|
||||
CDiv(&num,&denom,&n1);
|
||||
|
||||
|
||||
R2P(&m,&a,n1.x,n1.y);
|
||||
if (ip.rb)
|
||||
return ã+a;
|
||||
@@ -47,7 +47,7 @@ F64 MPDraw(CTask *task)
|
||||
{
|
||||
Complex xx;
|
||||
I64 x,y,w=task->pix_width,h=task->pix_height,cx=w/2,cy=h/2,
|
||||
lo=Gs->num*h/mp_cnt,hi=(Gs->num+1)*h/mp_cnt;
|
||||
lo=Gs->num*h/mp_cnt,hi=(Gs->num+1)*h/mp_cnt;
|
||||
F64 yy,y_total=0;
|
||||
CDC *dc=DCAlias(,task);
|
||||
for (y=lo;y<hi;y++) {
|
||||
@@ -58,7 +58,7 @@ F64 MPDraw(CTask *task)
|
||||
y_total+=Clamp(yy,-14,14);
|
||||
GrPlot(dc,x,y);
|
||||
}
|
||||
}
|
||||
}
|
||||
DCDel(dc);
|
||||
return y_total;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ U0 Draw()
|
||||
tempm[i]=JobQue(&MPDraw,Fs,i,0);
|
||||
y_total=0;
|
||||
for (i=0;i<mp_cnt;i++)
|
||||
y_total+=GetResult(tempm[i])(F64);
|
||||
y_total+=JobResultGet(tempm[i])(F64);
|
||||
|
||||
if (!y_total) break;
|
||||
scale*=7*GR_WIDTH*GR_HEIGHT/y_total;
|
||||
@@ -100,13 +100,13 @@ U0 PoleZeros()
|
||||
PopUpOk(
|
||||
"Drag the poles and zeros with left mouse.\n"
|
||||
"Hold right mouse for phase plot.\n"
|
||||
);
|
||||
);
|
||||
WinMgrSync;
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
|
||||
SetVGAPalette4(vga_palette4_gray);
|
||||
SetVGAPaletteColor(15,0xFF0000); //White is red
|
||||
GrPaletteSet(gr_palette_gray);
|
||||
GrPaletteColorSet(15,0xFFFF00000000); //White is red
|
||||
|
||||
WinMax;
|
||||
AutoComplete;
|
||||
@@ -119,7 +119,8 @@ U0 PoleZeros()
|
||||
try {
|
||||
Draw;
|
||||
while (TRUE) {
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+1<<MSG_IP_L_UP+1<<MSG_IP_R_DOWN+1<<MSG_IP_R_UP+1<<MSG_IP_MOVE);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_R_DOWN+1<<MSG_IP_R_UP+1<<MSG_IP_MOVE);
|
||||
pz_msg:
|
||||
cx=Fs->pix_width/2;
|
||||
cy=Fs->pix_height/2;
|
||||
@@ -130,8 +131,10 @@ pz_msg:
|
||||
case MSG_IP_MOVE:
|
||||
if (tempc) {
|
||||
p11=a1;p22=a2;
|
||||
//get to last mouse move
|
||||
while (msg_code=ScanMsg(&a1,&a2,1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+1<<MSG_IP_L_UP+1<<MSG_IP_R_DOWN+1<<MSG_IP_R_UP+1<<MSG_IP_MOVE))
|
||||
//get to last mouse move
|
||||
while (msg_code=ScanMsg(&a1,&a2,1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_R_DOWN+
|
||||
1<<MSG_IP_R_UP+1<<MSG_IP_MOVE))
|
||||
if (msg_code==MSG_IP_MOVE) {
|
||||
p11=a1;p22=a2;
|
||||
} else
|
||||
|
||||
@@ -10,7 +10,7 @@ I64 mp_not_done_flags;
|
||||
class State
|
||||
{
|
||||
F64 wabbits,hawks,
|
||||
d_wabbits,d_hawks; //Technically, these are not part of the state.
|
||||
d_wabbits,d_hawks; //Technically, these are not part of the state.
|
||||
};
|
||||
|
||||
U0 Steps(State *s)
|
||||
|
||||
Binary file not shown.
@@ -13,7 +13,7 @@ U0 Main()
|
||||
{
|
||||
"Capture screen...\n";
|
||||
PressAKey;
|
||||
GRACaptureScreen("::/Home/ScreenShot");
|
||||
GRAScreenCapture("::/Home/ScreenShot");
|
||||
|
||||
"View captured screen...\n";
|
||||
PressAKey;
|
||||
Binary file not shown.
+20
-20
@@ -14,8 +14,8 @@ U0 Lighting(CDC *dc,CD3I32 *ls,CD3I32 *poly,I64 color)
|
||||
v2.y=poly[2].y-poly[1].y;
|
||||
v2.z=poly[2].z-poly[1].z;
|
||||
|
||||
//V1 and V2 are vects along two sides
|
||||
//of the polygon joined at point[1].
|
||||
//V1 and V2 are vects along two sides
|
||||
//of the polygon joined at point[1].
|
||||
|
||||
vn_x=v1.y*v2.z-v1.z*v2.y;
|
||||
vn_y=v1.z*v2.x-v1.x*v2.z;
|
||||
@@ -27,19 +27,19 @@ U0 Lighting(CDC *dc,CD3I32 *ls,CD3I32 *poly,I64 color)
|
||||
vn_y*=d;
|
||||
vn_z*=d;
|
||||
//Vn is the cross product of V1 and V3
|
||||
//which means it is perpendicular. It
|
||||
//is the normal vect to the surface.
|
||||
//It has been scaled to length 65536.
|
||||
GrRot(r,&vn_x,&vn_y,&vn_z);
|
||||
//which means it is perpendicular. It
|
||||
//is the normal vect to the surface.
|
||||
//It has been scaled to length 65536.
|
||||
Mat4x4MulXYZ(r,&vn_x,&vn_y,&vn_z);
|
||||
i=(vn_x*ls->x+vn_y*ls->y+vn_z*ls->z)>>16;
|
||||
//The dot product of the light source
|
||||
//vect and the surface normal
|
||||
//gives an illumination number.
|
||||
//vect and the surface normal
|
||||
//gives an illumination number.
|
||||
|
||||
//TempleOS will generate a random U16
|
||||
//and compare to dither_probability_u16 and
|
||||
//will pick from two colors.
|
||||
//Probability dithering does not work with pen_width>1 at this time.
|
||||
//TempleOS will generate a random U16
|
||||
//and compare to dither_probability_u16 and
|
||||
//will pick from two colors.
|
||||
//Probability dithering does not work with pen_width>1 at this time.
|
||||
if (i<0) {
|
||||
dc->color=ROPF_PROBABILITY_DITHER+BLACK<<16+color;
|
||||
dc->dither_probability_u16=-i;
|
||||
@@ -58,19 +58,19 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
CCtrl *c=CtrlFindUnique(task,CTRLT_VIEWING_ANGLES);
|
||||
CViewAngles *s=c->state;
|
||||
F64 tt=0.5*(Sin(ã*2*(tS%10.0)/10.0)+2.0),
|
||||
é,é2,è,è2,radius,d;
|
||||
é,é2,è,è2,radius,d;
|
||||
I64 i,j,cx=task->pix_width/2,cy=task->pix_height/2;
|
||||
CD3I32 poly[3],ls;
|
||||
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
DCAllocDepthBuf(dc);
|
||||
DCDepthBufAlloc(dc);
|
||||
|
||||
GrIdentEqu(dc->r);
|
||||
GrRotZEqu(dc->r,s->az);
|
||||
GrRotYEqu(dc->r,s->ay);
|
||||
GrRotXEqu(dc->r,s->ax+ã);
|
||||
GrScaleEqu(dc->r,tt);
|
||||
GrSetRotMat(dc,dc->r);
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
Mat4x4RotZ(dc->r,s->az);
|
||||
Mat4x4RotY(dc->r,s->ay);
|
||||
Mat4x4RotX(dc->r,s->ax+ã);
|
||||
Mat4x4Scale(dc->r,tt);
|
||||
DCMat4x4Set(dc,dc->r);
|
||||
|
||||
ls.x=-(ip.pos.x-task->pix_left-task->scroll_x-cx);
|
||||
ls.y=-(ip.pos.y-task->pix_top-task->scroll_y-cy);
|
||||
|
||||
Binary file not shown.
+20
-15
@@ -24,24 +24,29 @@ U0 DrawCtrlSlider(CDC *dc,CCtrl *c)
|
||||
GrRect(dc, c->left,c->top,SLIDER_SPACING*3+2,SLIDER_SPACING*2+SLIDER_RANGE);
|
||||
dc->color=BLUE;
|
||||
GrRect(dc, c->left+SLIDER_BORDER,c->top+SLIDER_BORDER,
|
||||
SLIDER_SPACING*3+2-2*SLIDER_BORDER,SLIDER_SPACING*2+SLIDER_RANGE-2*SLIDER_BORDER);
|
||||
SLIDER_SPACING*3+2-2*SLIDER_BORDER,
|
||||
SLIDER_SPACING*2+SLIDER_RANGE-2*SLIDER_BORDER);
|
||||
dc->color=BLACK;
|
||||
GrLine(dc,c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING,
|
||||
c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
|
||||
c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
|
||||
GrLine(dc,c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING,
|
||||
c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
|
||||
c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
|
||||
dc->color=LTRED;
|
||||
GrPrint(dc,c->left+1*SLIDER_SPACING+0-FONT_WIDTH/2,
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE+3,
|
||||
"%d",s->left_pos*10/SLIDER_RANGE);
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE+3,
|
||||
"%d",s->left_pos*10/SLIDER_RANGE);
|
||||
GrPrint(dc,c->left+2*SLIDER_SPACING+1-FONT_WIDTH/2,
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE+3,
|
||||
"%d",s->right_pos*10/SLIDER_RANGE);
|
||||
GrRect(dc,c->left+1*SLIDER_SPACING+0-3,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-2,7,5);
|
||||
GrRect(dc,c->left+2*SLIDER_SPACING+1-3,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-2,7,5);
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE+3,
|
||||
"%d",s->right_pos*10/SLIDER_RANGE);
|
||||
GrRect(dc,c->left+1*SLIDER_SPACING+0-3,
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-2,7,5);
|
||||
GrRect(dc,c->left+2*SLIDER_SPACING+1-3,
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-2,7,5);
|
||||
dc->color=YELLOW;
|
||||
GrRect(dc,c->left+1*SLIDER_SPACING+0-2,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-1,5,3);
|
||||
GrRect(dc,c->left+2*SLIDER_SPACING+1-2,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-1,5,3);
|
||||
GrRect(dc,c->left+1*SLIDER_SPACING+0-2,
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-1,5,3);
|
||||
GrRect(dc,c->left+2*SLIDER_SPACING+1-2,
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-1,5,3);
|
||||
}
|
||||
|
||||
U0 UpdateDerivedCtrlSlider(CCtrl *c)
|
||||
@@ -78,7 +83,7 @@ CCtrl *SliderNew()
|
||||
c->draw_it=&DrawCtrlSlider;
|
||||
c->left_click=&LeftClickSlider;
|
||||
c->update_derived_vals=&UpdateDerivedCtrlSlider;
|
||||
old_preempt=Preempt(OFF);
|
||||
old_preempt=Preempt;
|
||||
QueIns(c,Fs->last_ctrl);
|
||||
TaskDerivedValsUpdate;
|
||||
Preempt(old_preempt);
|
||||
@@ -87,7 +92,7 @@ CCtrl *SliderNew()
|
||||
|
||||
U0 SliderDel(CCtrl *c)
|
||||
{
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
QueRem(c);
|
||||
Preempt(old_preempt);
|
||||
Free(c);
|
||||
@@ -101,8 +106,8 @@ U0 Main()
|
||||
CCtrl *c=SliderNew;
|
||||
PressAKey;
|
||||
"Left: %d Right: %d\n",
|
||||
sld.left_pos*10/SLIDER_RANGE,
|
||||
sld.right_pos*10/SLIDER_RANGE;
|
||||
sld.left_pos*10/SLIDER_RANGE,
|
||||
sld.right_pos*10/SLIDER_RANGE;
|
||||
SliderDel(c);
|
||||
DocBottom;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ public U0 SpeedLineDemo()
|
||||
DocClear;
|
||||
do {
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+
|
||||
1<<MSG_IP_R_UP);
|
||||
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+
|
||||
1<<MSG_IP_R_UP);
|
||||
switch (msg_code) {
|
||||
case MSG_IP_R_UP:
|
||||
color=PopUpColor;
|
||||
@@ -32,7 +32,7 @@ public U0 SpeedLineDemo()
|
||||
dc->pen_width=0.04*ip.speed;
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
x1=x2; y1=y2;
|
||||
x2=a1; y2=a2;
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -14,7 +14,7 @@ U0 SunMoon()
|
||||
Fs->text_attr=BLACK<<4+WHITE; //Current $LK,"CTask",A="MN:CTask"$ is Fs segment register.
|
||||
|
||||
for (i=0;i<0x8000;i+=0x200) {
|
||||
//Sun
|
||||
//Sun
|
||||
x=0.2*GR_WIDTH; y=0.5*GR_HEIGHT; radius=120;
|
||||
gr.dc->color=DKGRAY;
|
||||
GrCircle(gr.dc,x,y,radius);
|
||||
@@ -25,7 +25,7 @@ U0 SunMoon()
|
||||
x=0.8*GR_WIDTH-i/0x200; y=0.5*GR_HEIGHT; radius=75;
|
||||
gr.dc->color=DKGRAY;
|
||||
GrCircle(gr.dc,x,y,radius);
|
||||
//<CTRL-ALT-a> for the "ã" character.
|
||||
//<CTRL-ALT-a> for the "ã" character.
|
||||
GrCircle(gr.dc,x+0.5*radius,y,1.2*radius,,ã-.31*ã,0.62*ã);
|
||||
gr.dc->color=ROPF_PROBABILITY_DITHER+LTGRAY<<16+BLACK;
|
||||
gr.dc->dither_probability_u16=i; //U16 can be [0,65535]
|
||||
|
||||
@@ -15,11 +15,11 @@ U0 SymmetryDemo()
|
||||
DCFill;
|
||||
DocClear;
|
||||
dc->flags|=DCF_SYMMETRY;
|
||||
GrSetSymmetry(dc,Fs->pix_width/2,0,Fs->pix_width/2,1);
|
||||
DCSymmetrySet(dc,Fs->pix_width/2,0,Fs->pix_width/2,1);
|
||||
do {
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+
|
||||
1<<MSG_IP_R_DOWN);
|
||||
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+
|
||||
1<<MSG_IP_R_DOWN);
|
||||
switch (msg_code) {
|
||||
case MSG_IP_R_DOWN:
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
@@ -29,12 +29,12 @@ U0 SymmetryDemo()
|
||||
while (msg_code!=MSG_IP_R_UP) {
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_R_UP+1<<MSG_IP_MOVE);
|
||||
1<<MSG_IP_R_UP+1<<MSG_IP_MOVE);
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
x2=a1; y2=a2;
|
||||
}
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
if (GrSetSymmetry3(dc,x1,y1,0,x2,y2,0,x2,y2,1))
|
||||
if (DCSymmetry3Set(dc,x1,y1,0,x2,y2,0,x2,y2,1))
|
||||
dc->flags|=DCF_SYMMETRY;
|
||||
break;
|
||||
case MSG_IP_L_DOWN:
|
||||
@@ -44,7 +44,7 @@ U0 SymmetryDemo()
|
||||
while (msg_code!=MSG_IP_L_UP) {
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
x2=a1; y2=a2;
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -30,24 +30,29 @@ U0 DrawCtrlSlider(CDC *dc,CCtrl *c)
|
||||
GrRect(dc, c->left,c->top,SLIDER_SPACING*3+2,SLIDER_SPACING*2+SLIDER_RANGE);
|
||||
dc->color=BLUE;
|
||||
GrRect(dc, c->left+SLIDER_BORDER,c->top+SLIDER_BORDER,
|
||||
SLIDER_SPACING*3+2-2*SLIDER_BORDER,SLIDER_SPACING*2+SLIDER_RANGE-2*SLIDER_BORDER);
|
||||
SLIDER_SPACING*3+2-2*SLIDER_BORDER,
|
||||
SLIDER_SPACING*2+SLIDER_RANGE-2*SLIDER_BORDER);
|
||||
dc->color=BLACK;
|
||||
GrLine(dc,c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING,
|
||||
c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
|
||||
c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
|
||||
GrLine(dc,c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING,
|
||||
c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
|
||||
c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
|
||||
dc->color=LTRED;
|
||||
GrPrint(dc,c->left+1*SLIDER_SPACING+0-FONT_WIDTH/2,
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE+3,
|
||||
"%d",s->left_pos*10/SLIDER_RANGE);
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE+3,
|
||||
"%d",s->left_pos*10/SLIDER_RANGE);
|
||||
GrPrint(dc,c->left+2*SLIDER_SPACING+1-FONT_WIDTH/2,
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE+3,
|
||||
"%d",s->right_pos*10/SLIDER_RANGE);
|
||||
GrRect(dc,c->left+1*SLIDER_SPACING+0-3,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-2,7,5);
|
||||
GrRect(dc,c->left+2*SLIDER_SPACING+1-3,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-2,7,5);
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE+3,
|
||||
"%d",s->right_pos*10/SLIDER_RANGE);
|
||||
GrRect(dc,c->left+1*SLIDER_SPACING+0-3,
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-2,7,5);
|
||||
GrRect(dc,c->left+2*SLIDER_SPACING+1-3,
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-2,7,5);
|
||||
dc->color=YELLOW;
|
||||
GrRect(dc,c->left+1*SLIDER_SPACING+0-2,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-1,5,3);
|
||||
GrRect(dc,c->left+2*SLIDER_SPACING+1-2,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-1,5,3);
|
||||
GrRect(dc,c->left+1*SLIDER_SPACING+0-2,
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-1,5,3);
|
||||
GrRect(dc,c->left+2*SLIDER_SPACING+1-2,
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-1,5,3);
|
||||
}
|
||||
|
||||
U0 UpdateDerivedCtrlSlider(CCtrl *c)
|
||||
@@ -78,7 +83,7 @@ CCtrl *SliderNew()
|
||||
CCtrl *c;
|
||||
if (Fs!=adam_task) {
|
||||
"Must be Adam Included with SHIFT-F5.\n"
|
||||
"(Would crash when code mem was freed.)\n";
|
||||
"(Would crash when code mem was freed.)\n";
|
||||
return NULL;
|
||||
}
|
||||
c=ACAlloc(sizeof(CCtrl));
|
||||
@@ -89,7 +94,7 @@ CCtrl *SliderNew()
|
||||
c->draw_it=&DrawCtrlSlider;
|
||||
c->left_click=&LeftClickSlider;
|
||||
c->update_derived_vals=&UpdateDerivedCtrlSlider;
|
||||
old_preempt=Preempt(OFF);
|
||||
old_preempt=Preempt;
|
||||
QueIns(c,sys_winmgr_task->last_ctrl);
|
||||
TaskDerivedValsUpdate;
|
||||
Preempt(old_preempt);
|
||||
@@ -98,7 +103,7 @@ CCtrl *SliderNew()
|
||||
|
||||
U0 SliderDel(CCtrl *c)
|
||||
{
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
QueRem(c);
|
||||
Preempt(old_preempt);
|
||||
Free(c->state);
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user