TempleOSCD_140715.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:46:09 +02:00
1 parent 7ef616a20e
commit 64f679eeb9
1095 files changed
+24814 -221011

No files matched your search

+18 -17
View File
@@ -1,28 +1,29 @@
//See $LK,"ExtScreenCodes",A="FA:::/Adam/Gr/GrScreen.CPP,ExtScreenCodes"$
//See $LK,"TextBase Layer",A="HI:TextBase Layer"$.
#define ATTR (BLACK<<12+WHITE<<8)
U32 text[TEXT_ROWS][TEXT_COLS];
U0 DrawIt(CTask *task,CDC *)
{
MemCpy(gr_text_base+TEXT_COLS,text,(TEXT_ROWS-1)*TEXT_COLS*sizeof(U32));
{ //$LK,"gr.text_base",A="MN:CGrGlbls"$ gets clear 60fps, so we must use our own permanent text array.
MemCpy(gr.text_base+TEXT_COLS,text,(TEXT_ROWS-1)*TEXT_COLS*sizeof(U32));
// You can copy it this way, if you like:
// I64 i,j;
// for (j=0;j<TEXT_ROWS;j++)
// for (i=0;i<TEXT_COLS;i++)
// PlotWinU8(task,text[j][i],i,j);
// TextChar(task,,i,j,text[j][i]);
PlotWinStr(task,"Draw a maze with left button.",ATTR>>8,0,0);
PlotWinStr(task,"Solve maze starting at right click.",ATTR>>8,0,1);
TextPrint(task,0,0,ATTR>>8,"Draw a maze with left button.");
TextPrint(task,0,1,ATTR>>8,"Solve maze starting at right click.");
}
#define STK_SIZE 2048
//We would put these as local vars
//In SolveMaze() except the system stk size
//is limited. The heap is the normal TempleOS
//technique, but it's a pain in this case.
//in SolveMaze() but the system stk size
//is limited, so it's a bad habit. The heap
//is the normal TempleOS technique, but
//it's a pain in this case.
I64 stk_ptr,
stk_x [STK_SIZE],
stk_y [STK_SIZE],
@@ -50,7 +51,7 @@ U0 SolveMaze(I64 x,I64 y)
text[y][x]='.'+ATTR;
x+=dir_x[dir];
y+=dir_y[dir];
//u8.[0] is the ASCII
//u8.[0] is the ASCII
if (text[y][x].u8[0]) {
x-=dir_x[dir];
y-=dir_y[dir];
@@ -68,7 +69,7 @@ U0 SolveMaze(I64 x,I64 y)
if (stk_ptr==STK_SIZE) return;
Sleep(100);
if (ScanChar)
ThrowBreak; //CTRL-ALT-C
ThrowBreak; //<CTRL-ALT-c>
}
}
}
@@ -84,18 +85,18 @@ U0 Maze()
DocCursor;
DocClear;
Fs->draw_it=&DrawIt;
Fs->win_inhibit=WIG_TASK_DFT-WIF_FOCUS-WIF_BORDER;
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS-WIF_SELF_BORDER;
try
do {
MemSet(text,0,sizeof(text));
while (!(ch=ScanChar)) {
//Input Ptr (mouse) text x,y coordinates.
x=iptx-Fs->win_left-Fs->scroll_x/FONT_WIDTH;
y=ipty-Fs->win_top-Fs->scroll_y/FONT_HEIGHT;
if (ip_lb&&!win_grab_scroll)
//Input Ptr (mouse) text x,y coordinates.
x=ip.pos_text.x-Fs->win_left-Fs->scroll_x/FONT_WIDTH;
y=ip.pos_text.y-Fs->win_top-Fs->scroll_y/FONT_HEIGHT;
if (ip.lb&&!winmgr.grab_scroll)
text[y][x]=CH_SPACE+ATTRF_INVERT+ATTR;
if (ip_rb&&!win_grab_scroll) {
if (ip.rb&&!winmgr.grab_scroll) {
text[y][x]='*'+ATTR;
SolveMaze(x,y);
ch=GetChar;