TempleOSTS_130707.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:45:45 +02:00
1 parent 17b71f1a2d
commit 1343005a29
617 files changed
+14399 -25130

No files matched your search

+2 -1
View File
@@ -7,7 +7,8 @@ U0 BSplineDemo()
SettingsPush;
Fs->win_inhibit=WIF_ALL-WIF_BORDER;
"$$CL$$Select ctrl points with left mouse. Right when finished.\n";
DocClear;
"Select ctrl points with left mouse. Right when finished.\n";
DCFill;
do {
msg_code=GetMsg(&p1,&p2,1<<MSG_IP_L_UP+1<<MSG_IP_R_UP);
-241
View File
@@ -1,241 +0,0 @@
Bool chged;
#define DAWG_SETTINGS_SPACING 16
#define DAWG_SETTINGS_RANGE 60
#define DAWG_SETTINGS_BORDER 2
class DawgSettingsState
{
I64 cnt,n2_amp,color_scale;
} glbl_state;
U0 DrawDawgSettingsCtrl(CDC *dc,CCtrl *c)
{
DawgSettingsState *s=c->state;
dc->color=LTRED;
GrRect(dc, c->left,c->top,DAWG_SETTINGS_SPACING*4+3,DAWG_SETTINGS_SPACING*2+DAWG_SETTINGS_RANGE);
dc->color=BLUE;
GrRect(dc, c->left+DAWG_SETTINGS_BORDER,c->top+DAWG_SETTINGS_BORDER,
DAWG_SETTINGS_SPACING*4+3-2*DAWG_SETTINGS_BORDER,DAWG_SETTINGS_SPACING*2+DAWG_SETTINGS_RANGE-2*DAWG_SETTINGS_BORDER);
dc->color=BLACK;
GrLine(dc,c->left+DAWG_SETTINGS_SPACING,c->top+DAWG_SETTINGS_SPACING,
c->left+DAWG_SETTINGS_SPACING,c->top+DAWG_SETTINGS_SPACING+DAWG_SETTINGS_RANGE-1);
GrLine(dc,c->left+2*DAWG_SETTINGS_SPACING+1,c->top+DAWG_SETTINGS_SPACING,
c->left+2*DAWG_SETTINGS_SPACING+1,c->top+DAWG_SETTINGS_SPACING+DAWG_SETTINGS_RANGE-1);
GrLine(dc,c->left+3*DAWG_SETTINGS_SPACING+1,c->top+DAWG_SETTINGS_SPACING,
c->left+3*DAWG_SETTINGS_SPACING+1,c->top+DAWG_SETTINGS_SPACING+DAWG_SETTINGS_RANGE-1);
dc->color=LTRED;
GrPrintF(dc,c->left+DAWG_SETTINGS_SPACING-FONT_WIDTH/2,
c->top+DAWG_SETTINGS_SPACING+DAWG_SETTINGS_RANGE+3,
"%d",s->cnt*10/DAWG_SETTINGS_RANGE);
GrPrintF(dc,c->left+2*DAWG_SETTINGS_SPACING+1-FONT_WIDTH/2,
c->top+DAWG_SETTINGS_SPACING+DAWG_SETTINGS_RANGE+3,
"%d",s->n2_amp*10/DAWG_SETTINGS_RANGE);
GrPrintF(dc,c->left+3*DAWG_SETTINGS_SPACING+2-FONT_WIDTH/2,
c->top+DAWG_SETTINGS_SPACING+DAWG_SETTINGS_RANGE+3,
"%d",s->color_scale*10/DAWG_SETTINGS_RANGE);
GrRect(dc,c->left+DAWG_SETTINGS_SPACING-3, c->top+DAWG_SETTINGS_SPACING+DAWG_SETTINGS_RANGE-1-s->cnt-2 ,7,5);
GrRect(dc,c->left+2*DAWG_SETTINGS_SPACING+1-3,c->top+DAWG_SETTINGS_SPACING+DAWG_SETTINGS_RANGE-1-s->n2_amp-2,7,5);
GrRect(dc,c->left+3*DAWG_SETTINGS_SPACING+2-3,c->top+DAWG_SETTINGS_SPACING+DAWG_SETTINGS_RANGE-1-s->color_scale-2,7,5);
dc->color=YELLOW;
GrRect(dc,c->left+DAWG_SETTINGS_SPACING-2, c->top+DAWG_SETTINGS_SPACING+DAWG_SETTINGS_RANGE-1-s->cnt-1 ,5,3);
GrRect(dc,c->left+2*DAWG_SETTINGS_SPACING+1-2,c->top+DAWG_SETTINGS_SPACING+DAWG_SETTINGS_RANGE-1-s->n2_amp-1,5,3);
GrRect(dc,c->left+3*DAWG_SETTINGS_SPACING+2-2,c->top+DAWG_SETTINGS_SPACING+DAWG_SETTINGS_RANGE-1-s->color_scale-1,5,3);
}
U0 UpdateDerivedDawgSettingsCtrl(CCtrl *c)
{
DawgSettingsState *s=c->state;
c->left=c->win_task->win_pixel_width-(DAWG_SETTINGS_SPACING*4+3);
c->right=c->left+DAWG_SETTINGS_SPACING*4+3;
c->top=c->win_task->win_pixel_height-(DAWG_SETTINGS_SPACING*2+DAWG_SETTINGS_RANGE);
c->bottom=c->top+DAWG_SETTINGS_SPACING*2+DAWG_SETTINGS_RANGE;
s->cnt =LimitI64(s->cnt,0,DAWG_SETTINGS_RANGE-1);
s->n2_amp=LimitI64(s->n2_amp,0,DAWG_SETTINGS_RANGE-1);
s->color_scale=LimitI64(s->color_scale,0,DAWG_SETTINGS_RANGE-1);
}
U0 LeftClickDawgSettings(CCtrl *c,I64 x,I64 y,Bool down)
{
DawgSettingsState *s=c->state;
if (x<c->left+(c->right-c->left)/3)
s->cnt=DAWG_SETTINGS_RANGE-1-(y-(c->top+DAWG_SETTINGS_SPACING));
else if (x<c->left+2*(c->right-c->left)/3)
s->n2_amp=DAWG_SETTINGS_RANGE-1-(y-(c->top+DAWG_SETTINGS_SPACING));
else
s->color_scale=DAWG_SETTINGS_RANGE-1-(y-(c->top+DAWG_SETTINGS_SPACING));
if (c->update_derived_vals)
(*c->update_derived_vals)(c);
if (!down) chged=TRUE;
}
CCtrl *DawgSettingsNew()
{
Bool old_preempt;
CCtrl *c=CAlloc(sizeof(CCtrl));
c->win_task=Fs;
c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_IP;
c->type=CTRLT_GENERIC;
// c->state=CAlloc(sizeof(DawgSettingsState));
c->state=&glbl_state;
glbl_state.cnt=DAWG_SETTINGS_RANGE/2;
glbl_state.n2_amp=DAWG_SETTINGS_RANGE/2;
glbl_state.color_scale=DAWG_SETTINGS_RANGE/2;
c->draw_it=&DrawDawgSettingsCtrl;
c->left_click=&LeftClickDawgSettings;
c->update_derived_vals=&UpdateDerivedDawgSettingsCtrl;
old_preempt=Preempt(OFF);
QueIns(c,Fs->last_ctrl);
TaskDerivedValsUpdate;
Preempt(old_preempt);
return c;
}
U0 DawgSettingsDel(CCtrl *c)
{
Bool old_preempt=Preempt(OFF);
QueRem(c);
Preempt(old_preempt);
// Free(c->state);
Free(c);
}
//This program does a fractel-like thing with
//integer arithmetic.
class Simplex //This is something I made-up. It's not standard math.
{
I64 x,y;
};
I64 Norm(Simplex *n1)
{
return AbsI64(n1->x)+AbsI64(n1->y);
}
Simplex *CopySimplex(Simplex *dst, Simplex *src)
{
MemCpy(dst,src,sizeof(Simplex));
return dst;
}
Simplex *Mix(Simplex *result,Simplex *n1,Simplex *n2)
{ //This is something I made-up. It's not standard math.
result->x=n1->x*n2->x;
result->y=n1->y*n2->y;
return result;
}
Simplex *Mangle(Simplex *result,Simplex *n1,Simplex *n2)
{ //This is something I made-up. It's not standard math.
result->x=n1->x*n2->y;
result->y=n1->y*n2->x;
return result;
}
Simplex *Add(Simplex *result,Simplex *n1,Simplex *n2)
{
result->x=n1->x+n2->x;
result->y=n1->y+n2->y;
return result;
}
Simplex *Sub(Simplex *result,Simplex *n1,Simplex *n2)
{
result->x=n1->x-n2->x;
result->y=n1->y-n2->y;
return result;
}
U0 Bling()
{
I64 ch;
I64 x,y,cnt;
I64 d;
F64 color,color_scale;
Simplex n1,n2,n3,n4,n5,n6,n7,n8;
F64 timeout_time;
CCtrl *c=DawgSettingsNew;
CDC *dc=DCAlias;
F64 e=Exp(1);
SettingsPush; //See $LK,"SettingsPush","MN:SettingsPush"$
DocCursor;
DocClear;
Fs->win_inhibit=WIF_ALL-WIF_BORDER-WIF_CTRLS;
chged=FALSE;
WordStat;
WinMax;
while (TRUE) {
next_dotel:
ch=0;
cnt =2e9*(RandU32+0x1000)/MAX_U32*((Exp(ToF64(glbl_state.cnt +10)/DAWG_SETTINGS_RANGE)-1)/e);
n2.x=2e9*Sign(RandI32)*(RandU32+0x1000)/MAX_U32*((Exp(ToF64(glbl_state.n2_amp)/DAWG_SETTINGS_RANGE)-1)/e);
n2.y=2e9*Sign(RandI32)*(RandU32+0x1000)/MAX_U32*((Exp(ToF64(glbl_state.n2_amp)/DAWG_SETTINGS_RANGE)-1)/e);
n8.x=RandI32;
n8.y=RandI32;
color_scale=4.0*(glbl_state.color_scale+1.0)/DAWG_SETTINGS_RANGE+0.5;
timeout_time=tT+0.1;
for (y=0;y<GR_HEIGHT;y++) {
if (y<20)
if (tT>timeout_time)
goto next_dotel;
if (ScanKey(&ch))
goto next_dotel;
for (x=0;x<GR_WIDTH;x++) {
if (y<20)
if (tT>timeout_time)
goto next_dotel;
n1.x=x; n1.y=y;
CopySimplex(&n3,&n1);
color=0;
d=Norm(&n3);
//This doesn't make mathematical sense, but it makes nice results.
while (d.u32[0]<cnt && color<65536) {
if (y<20)
if (tT>timeout_time)
goto next_dotel;
Mangle(&n7,Mix(&n4,&n3,&n1),
Add(&n5,&n3,&n2));
color++;
d=Norm(Add(&n3,&n7,Mangle(&n6,&n3,&n8)));
}
color-=(cnt-d.u32[0])/cnt;
dc->color=ROP_EQU+
color=gr_rainbow_10[LimitI64(color_scale*(Ln(color)),0,9)];
GrPlot(dc,x,y);
}
}
dc->color=COLOR_TRANSPARENT;
GrRect(dc,c->left,c->top,c->right-c->left,c->bottom-c->top);
while (TRUE) {
if (chged) {
chged=FALSE;
break;
}
if (ch=ScanChar)
if (ch==CH_SPACE||ch=='\n')
break;
else
goto bling_done;
WinMgrSync;
}
}
bling_done:
SettingsPop;
DCDel(dc);
DCFill;
DawgSettingsDel(c);
}
Bling; //Start when included
+1 -1
View File
@@ -9,7 +9,7 @@ GrFloodFill3(img1,30,30,0,TRUE);
GrLine3(img1,60,0,0,0,60,0);
DCFill(img2);
img2->color=ROP_EQU+RED;
img2->color=RED;
img2->brush=img1;
GrCircle(img2,256-30,256-30,128,67);
img2->color=BLUE;
+4 -4
View File
@@ -21,7 +21,7 @@ U0 DrawIt(CTask *,CDC *)
U0 Box()
{
F64 é=0,è=0,ê=0,s=1,s1=1.05;
dc=DCAlias(gr_dc,Fs);
dc=DCAlias(gr_dc2,Fs);
SettingsPush; //See $LK,"SettingsPush","MN:SettingsPush"$
DocClear;
@@ -41,9 +41,9 @@ U0 Box()
Sleep(20);
é+=2*ã/70;
è +=2*ã/90;
ê +=2*ã/110;
s *=s1;
è+=2*ã/90;
ê+=2*ã/110;
s*=s1;
if ( !(0.2<s<1.4) ) s1=1/s1;
}
SettingsPop;
-64
View File
@@ -1,64 +0,0 @@
#define NUM_DATA_PTS 256
F64 CPU_idle[MP_MAX_PROCESSORS][NUM_DATA_PTS];
F64 mem[NUM_DATA_PTS];
F64 refresh[NUM_DATA_PTS];
U0 DrawIt(CTask *task,CDC *dc)
{
I64 i,j,x1,y1,x2,y2;
U8 buf[32];
for (i=1;i<NUM_DATA_PTS;i++) {
x1=(i-1)*task->win_pixel_width/(NUM_DATA_PTS-1);
x2=i*task->win_pixel_width/(NUM_DATA_PTS-1);
for (j=0;j<mp_cnt;j++) {
dc->color=gr_rainbow_10[j];
y1=task->win_pixel_height*CPU_idle[j][i-1];
y2=task->win_pixel_height*CPU_idle[j][i];
GrLine(dc,x1,y1,x2,y2);
}
dc->color=LTCYAN;
y1=task->win_pixel_height*mem[i-1];
y2=task->win_pixel_height*mem[i];
GrLine(dc,x1,y1,x2,y2);
dc->color=LTPURPLE;
y1=task->win_pixel_height*refresh[i-1];
y2=task->win_pixel_height*refresh[i];
GrLine(dc,x1,y1,x2,y2);
}
for (j=0;j<mp_cnt;j++) {
SPrintF(buf,"CPU%d",j);
PlotWinStr(task,buf,gr_rainbow_10[j]+WHITE<<4,0,task->win_height-4-j);
}
PlotWinStr(task,"Mem %",LTCYAN+WHITE<<4,0,task->win_height-3);
PlotWinStr(task,"Refresh Hz",LTPURPLE+WHITE<<4,0,task->win_height-2);
}
U0 CPUPlot()
{
I64 cur_pt=0,j;
MemSet(CPU_idle,0,sizeof(CPU_idle));
MemSet(mem,0,sizeof(F64)*NUM_DATA_PTS);
MemSet(refresh,0,sizeof(F64)*NUM_DATA_PTS);
SettingsPush; //See $LK,"SettingsPush","MN:SettingsPush"$
DocCursor;
DocClear;
Fs->draw_it=&DrawIt;
while (!ScanChar) {
for (j=0;j<mp_cnt;j++)
CPU_idle[j][cur_pt]=cpu_structs[j].idle_factor;
mem[cur_pt]=ToF64(UnusedSysMem)/(sys_heap_limit-sys_heap_base+1);
refresh[cur_pt]=1.0-win_actual_refresh/100.0; //This plots on a scale of 0-100 Hz
Sleep(25);
cur_pt= ++cur_pt % NUM_DATA_PTS;
}
SettingsPop;
}
CPUPlot; //start when #included
//Study $LK-A,"::/TempleOS/Adam/MemRep.CPP"$ and $LK,"WallPaper","MN:WallPaper"$() to learn more about
//how the system resources are put together.
Binary file not shown.
+2 -2
View File
@@ -1,8 +1,8 @@
//See $LK-A,"::/TempleOS/Demo/GameStarters/Stadium/StadiumGen.CPP"$.
//See $LK-A,"::/TempleOS/Demo/Games/Stadium/StadiumGen.CPP"$.
U0 ViewScreenCapture(U8 *filename)
{
CDC *dc=DCAlias(gr_dc2,Fs),
CDC *dc=DCAlias(gr_dc,Fs),
*dc2=GRARead(filename);
GrBlot(dc,0,0,dc2);
DCDel(dc2);
+1 -1
View File
@@ -31,5 +31,5 @@ U0 AnimateTask(I64)
}
Spawn(&AnimateTask,NULL,"Animate",Fs);
Spawn(&AnimateTask,NULL,"Animate",,Fs);
TaskRep;
File diff suppressed because it is too large. Load diff
+2 -1
View File
@@ -12,7 +12,7 @@ U0 Doodle()
WordStat;
DCFill;
"$$CL$$"; //$LK,"DocClear","MN:DocClear"$() is better
DocClear;
do {
msg_code=GetMsg(&p1,&p2,
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+
@@ -40,6 +40,7 @@ U0 Doodle()
break;
}
} while (msg_code!=MSG_KEY_DOWN || !p1);
GetMsg(,,1<<MSG_KEY_UP);
DCFill;
DCDel(dc);
SettingsPop;
+2
View File
@@ -1,3 +1,5 @@
//Press F5 to compile and run
U0 DotNet()
{
I64 i;
Binary file not shown.
Binary file not shown.
+1
View File
@@ -133,6 +133,7 @@ U0 FontEd()
}
}
fe_done:
GetMsg(,,1<<MSG_KEY_UP);
} catch
CatchAll;
MenuPop;
Binary file not shown.
+1 -1
View File
@@ -134,8 +134,8 @@ U0 Hanoi()
PressAKey;
} catch
CatchAll;
SettingsPop;
DocClear;
SettingsPop;
}
Hanoi;
+4 -3
View File
@@ -56,9 +56,9 @@ public U0 Life()
SettingsPush; //See $LK,"SettingsPush","MN:SettingsPush"$
WinMax;
DCFill;
"$$CL$$";
DocClear;
Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",Fs);
Fs->animate_task=Spawn(&AnimateTask,NULL,"Animate",,Fs);
WordStat;
Fs->draw_it=&DrawIt;
Fs->win_inhibit=WIF_ALL-WIF_BORDER;
@@ -73,7 +73,7 @@ public U0 Life()
cnt=0;
while (msg_code!=MSG_IP_L_UP) {
restart=TRUE;
dc[cur_dc]->color=ROP_EQU+GREEN;
dc[cur_dc]->color=GREEN;
dc[cur_dc]->pen_width=0.04*ip_speed;
GrLine3(dc[cur_dc],x1,y1,0,x2,y2,0);
restart=TRUE;
@@ -88,6 +88,7 @@ public U0 Life()
break;
}
} while (msg_code!=MSG_KEY_DOWN || !p1);
GetMsg(,,1<<MSG_KEY_UP);
SettingsPop;
DCFill;
DCDel(dc[0]);
Binary file not shown.
Binary file not shown.
-21
View File
@@ -1,21 +0,0 @@
U0 DrawIt(CTask *task,CDC *)
{
if (win_updates&1)
PlotWinStr(task,"test",RED+WHITE*16,10,3);
else
PlotWinStr(task,"test",PURPLE+WHITE*16,10,3);
PlotWinStr(task,"test",RED+WHITE*16,10,2);
PlotWinStr(task,"test",PURPLE+WHITE*16,10,4);
}
U0 Main()
{
SettingsPush; //See $LK,"SettingsPush","MN:SettingsPush"$
DocClear;
Fs->draw_it=&DrawIt;
GetChar;
SettingsPop;
}
Main;
-101
View File
@@ -1,101 +0,0 @@
U0 Convert()
{
I64 *ptr;
//Normally, allocate large objects on the heap
//because stk size can't grow. 256 bytes, however,
//is not that bad.
U8 byte_bit_cnts[256];
I64 i,j,row,col,ch,best_ch,score,best_score,cur_char_image,diff_image;
CDC *dc=DCAlias;
//Set-up a table telling how many 1 bits in a val.
MemSet(byte_bit_cnts,0,sizeof(byte_bit_cnts));
for (i=0;i<256;i++)
for (j=0;j<7;j++)
if (Bt(&i,j))
byte_bit_cnts[i]++;
for (row=0;row<Fs->win_height;row++) {
for (col=0;col<Fs->win_width;col++) {
//The size of one character is 8x8 pixels
//which fits in a 64-bit var. We'll
//fetch the pixels from the screen using $LK,"GrPeek","MN:GrPeek"$().
cur_char_image=0;
for (i=0;i<FONT_HEIGHT;i++)
for (j=0;j<FONT_WIDTH;j++)
//$LK,"GrPeek","MN:GrPeek"$() returns color or -1 if covered or off-screen.
if (GrPeek(dc,col*FONT_WIDTH+j,row*FONT_HEIGHT+i)!=COLOR_TRANSPARENT)
LBts(&cur_char_image,i*8+j);
best_score=MAX_I64;
best_ch=0;
ptr=&gr_font[32*FONT_HEIGHT];
for (ch=32;ch<127;ch++) {
diff_image=*ptr++ ^ cur_char_image;
score=0;
for (i=0;i<8;i++)
score+=byte_bit_cnts[diff_image.u8[i]];
if (score<best_score) {
best_score=score;
best_ch=ch;
}
}
if (best_ch=='$$')
"$$$$";
else
'' best_ch;
}
NewLine;
}
DCDel(dc);
}
public U0 Pic2ASCII()
{
I64 msg_code,cnt,x1,y1,x2,y2,p1,p2;
CDC *dc=DCAlias;
dc->color=ROP_EQU+BLACK;
SettingsPush; //See $LK,"SettingsPush","MN:SettingsPush"$
Fs->win_inhibit=WIF_ALL-WIF_BORDER;
WinMax;
DCFill;
"$$CL$$Draw a picture and hit\na key to convert to ASCII.\n";
do {
msg_code=GetMsg(&p1,&p2,
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN);
switch (msg_code) {
case MSG_IP_L_DOWN:
x1=p1; y1=p2;
x2=p1; y2=p2;
cnt=0;
while (msg_code!=MSG_IP_L_UP) {
dc->pen_width=0.04*ip_speed;
GrLine3(dc,x1,y1,0,x2,y2,0);
msg_code=GetMsg(&p1,&p2,
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
x1=x2; y1=y2;
x2=p1; y2=p2;
}
GrLine3(dc,x1,y1,0,x2,y2,0);
break;
case MSG_KEY_DOWN:
break;
}
} while (msg_code!=MSG_KEY_DOWN || !p1);
//We clear the screen text and turn-off word-wrap
"$$CL$$$$WW,0$$";
Convert;
DCFill;
DCDel(dc);
SettingsPop;
}
Pic2ASCII; //Execute when #included
Binary file not shown.
Binary file not shown.
Binary file not shown.
+8 -8
View File
@@ -49,7 +49,7 @@ F64 MPDraw(CTask *task)
I64 x,y,w=task->win_pixel_width,h=task->win_pixel_height,cx=w/2,cy=h/2,
lo=Gs->num*h/mp_cnt,hi=(Gs->num+1)*h/mp_cnt;
F64 yy,y_total=0;
CDC *dc=DCAlias(gr_dc2,task);
CDC *dc=DCAlias(gr_dc,task);
for (y=lo;y<hi;y++) {
for (x=0;x<w;x++) {
CEqu(&xx,x-cx,cy-y);
@@ -65,17 +65,16 @@ F64 MPDraw(CTask *task)
U0 Draw()
{
CMPCmd *tempm[MP_MAX_PROCESSORS];
CSrvCmd *tempm[MP_MAX_PROCESSORS];
F64 y_total,old_y_total=MAX_F64;
I64 i,w=Fs->win_pixel_width,h=Fs->win_pixel_height,cx=w/2,cy=h/2;
CDC *dc=DCAlias;
while (TRUE) {
for (i=1;i<mp_cnt;i++)
tempm[i]=MPJob(&MPDraw,Fs,i,0);
y_total=MPDraw(Fs);
for (i=1;i<mp_cnt;i++)
y_total+=MPJobResult(tempm[i])(F64);
for (i=0;i<mp_cnt;i++)
tempm[i]=JobQue(&MPDraw,Fs,i,0);
y_total=0;
for (i=0;i<mp_cnt;i++)
y_total+=GetResult(tempm[i])(F64);
if (!y_total) break;
scale*=7*GR_WIDTH*GR_HEIGHT/y_total;
@@ -162,6 +161,7 @@ pz_msg:
WinMgrSync;
}
pz_done:
GetMsg(,,1<<MSG_KEY_UP);
} catch
CatchAll;
SettingsPop;
+7 -8
View File
@@ -1,6 +1,6 @@
//This is a classic 2nd order nonlinear ordinary differential equation
I64 mp_done_flags;
I64 mp_not_done_flags;
#define OX 10
#define OY GR_HEIGHT/2-FONT_HEIGHT
@@ -27,7 +27,7 @@ U0 Steps(State *s)
U0 PlotTrajectory(CTask *parent)
{
I64 i;
CDC *dc=DCAlias(gr_dc2,parent);
CDC *dc=DCAlias(gr_dc,parent);
State s;
MemSet(&s,0,sizeof(State));
@@ -42,7 +42,7 @@ U0 PlotTrajectory(CTask *parent)
Steps(&s);
}
DCDel(dc);
LBts(&mp_done_flags,Gs->num);
LBtr(&mp_not_done_flags,Gs->num);
}
U0 PredatorPrey()
@@ -65,12 +65,11 @@ U0 PredatorPrey()
GrLine(dc,OX,0,OX,GR_HEIGHT-FONT_HEIGHT-1);
GrLine(dc,0,OY,GR_WIDTH-1,OY);
while (!ScanChar) {
mp_done_flags=0;
for (i=1;i<mp_cnt;i++)
MPJob(&PlotTrajectory,Fs,i);
PlotTrajectory(Fs);
mp_not_done_flags=1<<mp_cnt-1;
for (i=0;i<mp_cnt;i++)
JobQue(&PlotTrajectory,Fs,i);
do Yield;
while (mp_done_flags!=1<<mp_cnt-1);
while (mp_not_done_flags);
}
} catch
CatchAll;
Binary file not shown.
+1 -1
View File
@@ -172,8 +172,8 @@ U0 Main()
PressAKey;
} catch
CatchAll;
SettingsPop;
DocClear;
SettingsPop;
ViewAnglesDel;
}
Binary file not shown.
+4 -3
View File
@@ -4,7 +4,7 @@ public U0 SpeedLineDemo()
{
I64 msg_code,cnt,x1,y1,x2,y2,p1,p2,color=BLACK;
CDC *dc=DCAlias;
dc->color=ROP_EQU+color;
dc->color=color;
SettingsPush; //See $LK,"SettingsPush","MN:SettingsPush"$
Fs->win_inhibit=WIF_ALL-WIF_BORDER;
@@ -12,7 +12,7 @@ public U0 SpeedLineDemo()
WinMax;
WordStat;
DCFill;
"$$CL$$";
DocClear;
do {
msg_code=GetMsg(&p1,&p2,
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+
@@ -21,7 +21,7 @@ public U0 SpeedLineDemo()
case MSG_IP_R_UP:
color=PopUpColor;
if (color>=0)
dc->color=ROP_EQU+color;
dc->color=color;
break;
case MSG_IP_L_DOWN:
x1=p1; y1=p2;
@@ -41,6 +41,7 @@ public U0 SpeedLineDemo()
break;
}
} while (msg_code!=MSG_KEY_DOWN || !p1);
GetMsg(,,1<<MSG_KEY_UP);
DCFill;
DCDel(dc);
SettingsPop;
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -1
View File
@@ -12,7 +12,7 @@ U0 SymmetryDemo()
WinMax;
DCFill;
"$$CL$$";
DocClear;
dc->flags|=DCF_SYMMETRY;
GrSetSymmetry(dc,Fs->win_pixel_width/2,0,Fs->win_pixel_width/2,1);
do {
@@ -53,6 +53,7 @@ U0 SymmetryDemo()
break;
}
} while (msg_code!=MSG_KEY_DOWN || !p1);
GetMsg(,,1<<MSG_KEY_UP);
DCFill;
DCDel(dc);
SettingsPop;
Binary file not shown.
Binary file not shown.
+2 -1
View File
@@ -14,8 +14,9 @@ U0 DrawIt(CTask *,CDC *dc)
U0 ScrollBars()
{
SettingsPush; //See $LK,"SettingsPush","MN:SettingsPush"$
DocClear;
Fs->draw_it=&DrawIt;
GetChar(NULL,FALSE);
GetChar(,FALSE);
SettingsPop;
}