TempleOSCDV4.12.ISO
This commit is contained in:
1 parent
93ca216483
commit
b84bbff6db
381 files changed
+18356
-18798
No files matched your search
@@ -101,7 +101,7 @@ U0 Main()
|
||||
poly[3].z=0;
|
||||
GrFillPoly3(dc,4,poly);
|
||||
|
||||
WinMgrSync;
|
||||
Refresh;
|
||||
DCFill;
|
||||
é+=2.1*ă/180.0;
|
||||
č+=1.1*ă/180.0;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#define MAX_PTS 16
|
||||
|
||||
U0 BSplineDemo()
|
||||
{
|
||||
CDC *dc=DCAlias;
|
||||
I64 a1,a2,i=0,msg_code;
|
||||
CD3I32 c[64];
|
||||
CD3I32 c[MAX_PTS];
|
||||
|
||||
SettingsPush;
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
|
||||
@@ -18,7 +20,7 @@ U0 BSplineDemo()
|
||||
GrCircle(dc,a1,a2,10);
|
||||
i++;
|
||||
}
|
||||
} while (msg_code!=MSG_IP_R_UP);
|
||||
} while (i<MAX_PTS && msg_code!=MSG_IP_R_UP);
|
||||
dc->color=RED;
|
||||
Gr2BSpline(dc,c,i,TRUE);
|
||||
dc->color=BLUE;
|
||||
|
||||
@@ -23,14 +23,14 @@ GrRect(img2,256-20,256-20,40,40);
|
||||
|
||||
I64 i;
|
||||
for (i=0;i<256;i+=4) {
|
||||
WinMgrSync;
|
||||
Refresh;
|
||||
DCFill;
|
||||
GrBlot(dc,i-256,i-256,img2);
|
||||
Sleep(10);
|
||||
}
|
||||
U8 *tempg=DC2Sprite(img1);
|
||||
Sprite(tempg);
|
||||
Free(tempg);
|
||||
U8 *tmpg=DC2Sprite(img1);
|
||||
Sprite(tmpg);
|
||||
Free(tmpg);
|
||||
"%h9c",'\n';
|
||||
|
||||
DCDel(img1);
|
||||
|
||||
+14
-17
@@ -1,10 +1,14 @@
|
||||
CDC *dc;
|
||||
I64 glbl_r[4][4];
|
||||
|
||||
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"$.
|
||||
U0 DrawIt(CTask *,CDC *dc)
|
||||
{
|
||||
I64 *old_r=dc->r;
|
||||
dc->pen_width=2;
|
||||
dc->color=RED;
|
||||
dc->x=200;
|
||||
dc->y=200;
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
DCMat4x4Set(dc,glbl_r); //This assigns to dc->r and sets r_norm.
|
||||
GrLine3(dc,-100,-100,-100, -100, 100,-100);
|
||||
GrLine3(dc,-100, 100,-100, 100, 100,-100);
|
||||
GrLine3(dc, 100, 100,-100, 100,-100,-100);
|
||||
@@ -17,27 +21,21 @@ U0 DrawIt(CTask *,CDC *)
|
||||
GrLine3(dc,-100, 100, 100, -100, 100,-100);
|
||||
GrLine3(dc, 100, 100, 100, 100, 100,-100);
|
||||
GrLine3(dc, 100,-100, 100, 100,-100,-100);
|
||||
dc->r=old_r;
|
||||
}
|
||||
|
||||
U0 Box()
|
||||
{
|
||||
F64 é=0,è=0,ê=0,s=1,s1=1.05;
|
||||
dc=DCAlias(gr.dc2,Fs);
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
DocClear;
|
||||
Fs->draw_it=&DrawIt;
|
||||
|
||||
dc->x=200;
|
||||
dc->y=200;
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
while (!ScanChar) {
|
||||
Mat4x4IdentEqu(dc->r);
|
||||
Mat4x4RotZ(dc->r,é);
|
||||
Mat4x4RotX(dc->r,è);
|
||||
Mat4x4RotZ(dc->r,ê);
|
||||
Mat4x4Scale(dc->r,s);
|
||||
DCMat4x4Set(dc,dc->r);
|
||||
Mat4x4IdentEqu(glbl_r);
|
||||
Mat4x4RotZ(glbl_r,é);
|
||||
Mat4x4RotX(glbl_r,è);
|
||||
Mat4x4RotZ(glbl_r,ê);
|
||||
Mat4x4Scale(glbl_r,s);
|
||||
|
||||
Sleep(20);
|
||||
é+=2*ã/70;
|
||||
@@ -47,7 +45,6 @@ U0 Box()
|
||||
if ( !(0.2<s<1.4) ) s1=1/s1;
|
||||
}
|
||||
SettingsPop;
|
||||
DCDel(dc);
|
||||
}
|
||||
|
||||
Box;
|
||||
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
U8 *old_font=text.font;
|
||||
|
||||
// See $LK,"::/Kernel/FontStd.HC"$, $LK,"::/Demo/ScreenCodes.HC"$,
|
||||
// See $LK,"::/Kernel/FontStd.HC"$, $LK,"::/Demo/ScrnCodes.HC"$,
|
||||
//$LK,"::/Demo/ExtChars.HC"$, and $LK,"::/Demo/Graphics/FontEd.HC"$.
|
||||
|
||||
U64 waves[4]={
|
||||
|
||||
@@ -13,32 +13,32 @@ Node *root;
|
||||
#define Y_SPACING 45
|
||||
#define ARROW_SPACING 3
|
||||
|
||||
U0 ShowTree(CDC *dc,Node *tempn,I64 *_node_x,I64 *_tree_x,I64 y)
|
||||
U0 ShowTree(CDC *dc,Node *tmpn,I64 *_node_x,I64 *_tree_x,I64 y)
|
||||
{
|
||||
I64 node_x;
|
||||
if (tempn) {
|
||||
if (tempn->left) {
|
||||
ShowTree(dc,tempn->left,&node_x,_tree_x,y+Y_SPACING);
|
||||
if (tmpn) {
|
||||
if (tmpn->left) {
|
||||
ShowTree(dc,tmpn->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);
|
||||
}
|
||||
if (tempn->n==n1 || tempn->n==n2) {
|
||||
if (tempn->n==common_ancestor)
|
||||
if (tmpn->n==n1 || tmpn->n==n2) {
|
||||
if (tmpn->n==common_ancestor)
|
||||
dc->color=YELLOW;
|
||||
else
|
||||
dc->color=RED;
|
||||
} else if (tempn->n==common_ancestor)
|
||||
} else if (tmpn->n==common_ancestor)
|
||||
dc->color=GREEN;
|
||||
else
|
||||
dc->color=BLUE;
|
||||
|
||||
*_node_x=*_tree_x;
|
||||
GrPrint(dc,*_node_x,y,"%d",tempn->n);
|
||||
GrPrint(dc,*_node_x,y,"%d",tmpn->n);
|
||||
*_tree_x+=X_SPACING;
|
||||
|
||||
if (tempn->right) {
|
||||
ShowTree(dc,tempn->right,&node_x,_tree_x,y+Y_SPACING);
|
||||
if (tmpn->right) {
|
||||
ShowTree(dc,tmpn->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);
|
||||
@@ -52,33 +52,33 @@ U0 DrawIt(CTask *,CDC *dc)
|
||||
ShowTree(dc,root,&node_x,&tree_x,20);
|
||||
}
|
||||
|
||||
U0 TreeAdd(Node **_root,Node *tempn)
|
||||
U0 TreeAdd(Node **_root,Node *tmpn)
|
||||
{
|
||||
Node *root=*_root;
|
||||
if (!root)
|
||||
*_root=tempn;
|
||||
else if (tempn->n==root->n)
|
||||
Free(tempn);
|
||||
else if (tempn->n<root->n)
|
||||
TreeAdd(&root->left,tempn);
|
||||
*_root=tmpn;
|
||||
else if (tmpn->n==root->n)
|
||||
Free(tmpn);
|
||||
else if (tmpn->n<root->n)
|
||||
TreeAdd(&root->left,tmpn);
|
||||
else
|
||||
TreeAdd(&root->right,tempn);
|
||||
TreeAdd(&root->right,tmpn);
|
||||
}
|
||||
|
||||
U0 TreeNew()
|
||||
{
|
||||
I64 i;
|
||||
Node *tempn;
|
||||
Node *tmpn;
|
||||
for (i=0;i<N;i++) {
|
||||
tempn=CAlloc(sizeof(Node));
|
||||
tempn->n=RandU16%N;
|
||||
tmpn=CAlloc(sizeof(Node));
|
||||
tmpn->n=RandU16%N;
|
||||
|
||||
if (i==N-1)
|
||||
n1=tempn->n;
|
||||
n1=tmpn->n;
|
||||
else if (i==N-2)
|
||||
n2=tempn->n;
|
||||
n2=tmpn->n;
|
||||
|
||||
TreeAdd(&root,tempn);
|
||||
TreeAdd(&root,tmpn);
|
||||
Sleep(50);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,7 @@ U0 Doodle()
|
||||
DocClear;
|
||||
DCFill;
|
||||
do {
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+
|
||||
1<<MSG_IP_R_UP);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+1<<MSG_IP_R_UP);
|
||||
switch (msg_code) {
|
||||
case MSG_IP_R_UP:
|
||||
i=PopUpColor;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -15,7 +15,7 @@ and cut and paste the code into $LK,"::/Kernel/FontStd.HC"$.
|
||||
You will need to recompile Kernel by calling $LK,"BootHDIns",A="MN:BootHDIns"$().
|
||||
|
||||
See $LK,"::/Demo/ExtChars.HC"$, $LK,"::/Demo/Games/CharDemo.HC"$,
|
||||
$LK,"::/Demo/Graphics/CharAnimation.HC"$ and $LK,"::/Demo/ScreenCodes.HC"$.
|
||||
$LK,"::/Demo/Graphics/CharAnimation.HC"$ and $LK,"::/Demo/ScrnCodes.HC"$.
|
||||
*/
|
||||
|
||||
#define BLOW_UP_CHAR_X (18*FONT_WIDTH)
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
U0 InputPointer()
|
||||
{
|
||||
"Press left mouse button to exit.\n";
|
||||
while (!ip.lb) //Left button to exit.
|
||||
while (!ip.lb) { //Left button to exit.
|
||||
GrPlot(,ip.pos.x,ip.pos.y);
|
||||
Refresh;
|
||||
}
|
||||
DCFill;
|
||||
}
|
||||
|
||||
|
||||
@@ -114,21 +114,21 @@ U0 SetMenu()
|
||||
{
|
||||
I64 i;
|
||||
U8 buf[STR_LEN];
|
||||
CMenuEntry *tempse;
|
||||
CMenuEntry *tmpse;
|
||||
for (i=0;i<=9;i++) {
|
||||
StrPrint(buf,"Settings/Layer%d",i);
|
||||
if (tempse=MenuEntryFind(Fs->cur_menu,buf)) {
|
||||
if (tmpse=MenuEntryFind(Fs->cur_menu,buf)) {
|
||||
if (i==tt.z)
|
||||
tempse->checked=TRUE;
|
||||
tmpse->checked=TRUE;
|
||||
else
|
||||
tempse->checked=FALSE;
|
||||
tmpse->checked=FALSE;
|
||||
}
|
||||
}
|
||||
if (tempse=MenuEntryFind(Fs->cur_menu,"Settings/Ends")) {
|
||||
if (tmpse=MenuEntryFind(Fs->cur_menu,"Settings/Ends")) {
|
||||
if (tt.ends)
|
||||
tempse->checked=TRUE;
|
||||
tmpse->checked=TRUE;
|
||||
else
|
||||
tempse->checked=FALSE;
|
||||
tmpse->checked=FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+14
-14
@@ -65,16 +65,16 @@ F64 MPDraw(CTask *task)
|
||||
|
||||
U0 Draw()
|
||||
{
|
||||
CSrvCmd *tempm[MP_MAX_PROCESSORS];
|
||||
CSrvCmd *tmpm[MP_MAX_PROCESSORS];
|
||||
F64 y_total,old_y_total=MAX_F64;
|
||||
I64 i,w=Fs->pix_width,h=Fs->pix_height,cx=w/2,cy=h/2;
|
||||
CDC *dc=DCAlias;
|
||||
while (TRUE) {
|
||||
for (i=0;i<mp_cnt;i++)
|
||||
tempm[i]=JobQue(&MPDraw,Fs,i,0);
|
||||
tmpm[i]=JobQue(&MPDraw,Fs,i,0);
|
||||
y_total=0;
|
||||
for (i=0;i<mp_cnt;i++)
|
||||
y_total+=JobResGet(tempm[i])(F64);
|
||||
y_total+=JobResGet(tmpm[i])(F64);
|
||||
|
||||
if (!y_total) break;
|
||||
scale*=7*GR_WIDTH*GR_HEIGHT/y_total;
|
||||
@@ -95,13 +95,13 @@ U0 Draw()
|
||||
U0 PoleZeros()
|
||||
{
|
||||
I64 msg_code,a1,a2,p11,p22,cx,cy;
|
||||
Complex *tempc=NULL;
|
||||
Complex *tmpc=NULL;
|
||||
|
||||
PopUpOk(
|
||||
"Drag the poles and zeros with left mouse.\n"
|
||||
"Hold right mouse for phase plot.\n"
|
||||
);
|
||||
WinMgrSync;
|
||||
Refresh;
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
|
||||
@@ -125,10 +125,10 @@ pz_msg:
|
||||
cy=Fs->pix_height/2;
|
||||
switch (msg_code) {
|
||||
case MSG_IP_L_DOWN:
|
||||
tempc=PoleZeroFind(a1-cx,cy-a2);
|
||||
tmpc=PoleZeroFind(a1-cx,cy-a2);
|
||||
break;
|
||||
case MSG_IP_MOVE:
|
||||
if (tempc) {
|
||||
if (tmpc) {
|
||||
p11=a1;p22=a2;
|
||||
//get to last mouse move
|
||||
while (msg_code=ScanMsg(&a1,&a2,1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+
|
||||
@@ -139,16 +139,16 @@ pz_msg:
|
||||
} else
|
||||
goto pz_msg;
|
||||
|
||||
tempc->x=p11-cx;
|
||||
tempc->y=cy-p22;
|
||||
tmpc->x=p11-cx;
|
||||
tmpc->y=cy-p22;
|
||||
Draw;
|
||||
}
|
||||
break;
|
||||
case MSG_IP_L_UP:
|
||||
if (tempc) {
|
||||
tempc->x=a1-cx;
|
||||
tempc->y=cy-a2;
|
||||
tempc=NULL;
|
||||
if (tmpc) {
|
||||
tmpc->x=a1-cx;
|
||||
tmpc->y=cy-a2;
|
||||
tmpc=NULL;
|
||||
Draw;
|
||||
}
|
||||
break;
|
||||
@@ -160,7 +160,7 @@ pz_msg:
|
||||
if (a1==CH_SHIFT_ESC||a1==CH_ESC)
|
||||
goto pz_done;
|
||||
}
|
||||
WinMgrSync;
|
||||
Refresh;
|
||||
}
|
||||
pz_done:
|
||||
GetMsg(,,1<<MSG_KEY_UP);
|
||||
|
||||
@@ -59,7 +59,7 @@ U0 PredatorPrey()
|
||||
WinBorder;
|
||||
WinMax;
|
||||
DocClear;
|
||||
WinMgrSync;
|
||||
Refresh;
|
||||
|
||||
dc->color=BLACK;
|
||||
GrLine(dc,OX,0,OX,GR_HEIGHT-FONT_HEIGHT-1);
|
||||
|
||||
Binary file not shown.
@@ -1,9 +1,9 @@
|
||||
//See $LK,"::/Demo/Games/Stadium/StadiumGen.HC"$.
|
||||
|
||||
U0 ViewScreenCapture(U8 *filename)
|
||||
U0 ViewScrnCapture(U8 *filename)
|
||||
{
|
||||
CDC *dc=DCAlias(,Fs),
|
||||
*dc2=GRARead(filename);
|
||||
*dc2=GRRead(filename);
|
||||
GrBlot(dc,0,0,dc2);
|
||||
DCDel(dc2);
|
||||
DCDel(dc);
|
||||
@@ -11,13 +11,13 @@ U0 ViewScreenCapture(U8 *filename)
|
||||
|
||||
U0 Main()
|
||||
{
|
||||
"Capture screen...\n";
|
||||
"Capture scrn...\n";
|
||||
PressAKey;
|
||||
GRAScreenCapture("~/DemoScreenShot");
|
||||
GRScrnCapture("~/DemoScrnShot");
|
||||
|
||||
"View captured screen...\n";
|
||||
"View captured scrn...\n";
|
||||
PressAKey;
|
||||
ViewScreenCapture("~/DemoScreenShot");
|
||||
ViewScrnCapture("~/DemoScrnShot");
|
||||
|
||||
PressAKey;
|
||||
DCFill;
|
||||
Binary file not shown.
@@ -15,9 +15,7 @@ public U0 SpeedLineDemo()
|
||||
DocClear;
|
||||
DCFill;
|
||||
do {
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+
|
||||
1<<MSG_IP_R_UP);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_KEY_DOWN+1<<MSG_IP_L_DOWN+1<<MSG_IP_R_UP);
|
||||
switch (msg_code) {
|
||||
case MSG_IP_R_UP:
|
||||
color=PopUpColor;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -5,7 +5,7 @@ $$IB,"<1>",BI=1,BP="::/Demo/Graphics/SpritePut.HC,2"$$
|
||||
That imports an external sprite. It's
|
||||
called a $LK,"DOCEF_BIN_PTR_LINK",A="MN:DOCEF_BIN_PTR_LINK"$. See $LK,"BP=\"\"",A="FF:::/Doc/DolDocOverview.DD,BP=\"\""$.
|
||||
|
||||
Press <CTRL-r> and "pointer to sprite".
|
||||
Press <CTRL-r> and "Ptr to Sprite".
|
||||
Then, enter a file and the number of
|
||||
the sprite in the file. Note: the
|
||||
number can get messed-up if you change
|
||||
@@ -19,7 +19,7 @@ U0 SpritePutExt()
|
||||
for (i=0;i<3;i++) {
|
||||
"US Map:";
|
||||
Sprite($IB,"<1>",BI=1,BP="::/Demo/Graphics/SpritePut.HC,2"$);
|
||||
"%h12c",'\n';
|
||||
"%h12c",'\n'; //"h" is a secondary arg. $LK,"Print",A="FI:::/Doc/Print.DD"$ 12 newline chars.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@@ -33,7 +33,7 @@ U0 SunMoon()
|
||||
gr.dc->dither_probability_u16=2*i; //U16 can be [0,65535]
|
||||
GrFloodFill(gr.dc,x-0.75*radius,y);
|
||||
|
||||
WinMgrSync; //Typically 30 fps
|
||||
Refresh; //Typically 30 fps
|
||||
DCFill;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user