Re: To Insolor and those interested in dos rescue programme

new topic     » goto parent     » topic index » view thread      » older message » newer message
Selgor said...

Hello. Selgor here. Insolor, I think you were instrumental in getting dos rescue running "again".

I was able to salvage my euphoria folder from a part disc "crash". In the folder, I found a programme I "hashed up" from the original polygon programme. It is two distinct polygons moving around the screen. The background and each polygon change colours. Each colour is distinct i.e all colours different. Written 10 years ago.

I thought you might like to include it in your dos rescue package.

All I did was place it in the downloaded dos rescue folder.

Works on win xp .

Hallo Selgor i rewrote your code for using it with my tinEWG (and it should also work with EuWInGui and Eu3.1,but i did not test it). i will kindly ask for the permission to put it in the demo section of the next release (if there will be any ;)) It's just a quick hack... See code below

----------  Done in early 2001 ??  Selgor  
----------  Background , each polygon change colour  
----------  Each colour is different  
----------  Can have more figures  
------------------------------------------------------  
  
----------  Added necessary includes for dos-rescue October 2012 -----------  
  
----------------------------------------------------------------------------  
  
 
include tinewg.exw 
 
enum VC_COLOR,VC_MODE,VC_LINES,VC_COLUMNS,VC_XPIXELS,VC_YPIXELS,VC_NCOLORS,VC_PAGES 
constant X = 1, Y = 2  
sequence config 
atom npoly,nlines, npoints, spacing, solid 
sequence deltas,history,poly,colpoly  
sequence rect 
 
WindowType=NoBorderWin 
--WindowType=StandardWin 
--Window("Mistify",0,0,800,600) 
Window("",0,0,ScreenWidth(),ScreenHeight()) 
rect=GetClientRect(WinHwnd) 
atom xmax=rect[3] 
atom ymax=rect[4] 
constant blackback=NewMB(xmax,ymax) 
constant canvas=NewMB(xmax,ymax) 
atom backpic=Control(Picture,"",0,0,xmax,ymax) 
SetPic(backpic,Picture,blackback) 
  
nlines = 6  npoints = 4 spacing = 15    solid=0 npoly=5 
       
     config = video_config()  
     poly=repeat(0,npoly) 
     deltas=repeat(0,npoly) 
     history=repeat(0,npoly) 
     colpoly=repeat(0,npoly) 
     colour()  
 
for i=1 to length(poly) do 
    poly[i]=rand(repeat(config[VC_XPIXELS..VC_YPIXELS],npoints))+2  
    deltas[i]=rand(repeat({2*spacing-1, 2*spacing-1}, npoints)) - spacing 
    history[i]={}  
end for 
 
 
 
procedure filled_polygon(atom col,atom fillflag,sequence points) 
sequence flat={} 
    for i=1 to length(points)  do 
        flat=flat&points[i] 
    end for 
    SetDrawingMB(canvas) 
    SetPenColor(col) 
    DrawPolygon(flat,fillflag) 
end procedure 
 
procedure polygon(atom col,atom fillflag,sequence points) 
sequence flat={} 
    if fillflag then 
        filled_polygon(col,fillflag,points) 
    else 
        for i= 1 to length(points)-1 do 
            flat=append(flat,points[i]&points[i+1]) 
        end for 
        flat=append(flat,points[1]&points[$]) 
        SetDrawingMB(canvas) 
        SetPenColor(col) 
        DrawMultiLine(flat) 
    end if 
end procedure 
 
function video_config() 
sequence ret_s ={0,0,0,0,0,0,0,0,0} 
    ret_s[VC_XPIXELS]=xmax 
    ret_s[VC_YPIXELS]=ymax 
    return ret_s 
end function 
 
procedure colour()  
    for i=1 to length(colpoly)  do 
        colpoly[i]=rand(#FFFFFF)   
    end for 
 
    for x=1 to length(colpoly)-1 do 
        if equal(colpoly[x],colpoly[x+1]) then 
            colour() 
        end if 
    end for   
end procedure  
   
procedure poly_pattern()  
     
    for i=1 to length(history) do 
        if length(history[i]) >= nlines then  
            polygon(0, solid, history[i][1])  
            history[i] = history[i][2..nlines]  
 
        end if  
    end for 
         
    for i=1  to length(history) do 
        history[i] = append(history[i], poly[i])  
        poly[i] += deltas[i]  
    end for 
     
    for i=1  to length(poly) do 
        polygon(colpoly[i], solid, poly[i])  
        for j = 1 to npoints do  
            if poly[i][j][X] <= 0 or poly[i][j][X] >= config[VC_XPIXELS] then  
        deltas[i][j][X] = -deltas[i][j][X]  
            end if  
  
            if poly[i][j][Y] <= 0 or poly[i][j][Y] >= config[VC_YPIXELS] then  
                deltas[i][j][Y] = -deltas[i][j][Y]  
            end if  
  
        end for  
    end for 
        if rand(101) = 1 then  
            colour()     
             
        end if  
        rect=GetClientRect(WinHwnd) 
        CopyMBToControl(canvas,0,0,xmax,ymax,backpic,0,0,rect[3],rect[4]) 
end procedure  
       
 
SetWinTimer(25) 
while WaitEvent() do 
    if Event=Click then 
        CloseApp() 
    end if 
    if Event=Key then 
        if EventItem=KEY_ESCAPE then 
            CloseApp() 
        end if 
         
    end if 
    if Event=Time then 
        SetCur(Null) 
        poly_pattern() 
    end if 
    if Event=Move then 
        SetCur(Null) 
    end if 
end while 
CloseApp()  

Andreas

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu