1. Dumb mouse prog. SILLY.EX

Requires User.e 3.8. Here it is:
include graphics.e
include mouse.e
include user.e
if graphics_mode(3) then
end if
clear_screen()
titlebar("SILLY.EX - Hit x to end",15,0)
wrap(0)
text_color(15)
object ev,n,pic,fil,fn,clr,title,img
clr=15
n=-1
mouse_pointer(1)
procedure drawit()
position(25,1)
for z=1 to 15 do
    text_color(z)
    puts(1,219)
end for
wrap(0)
bk_color(0)
text_color(15)
end procedure
drawit()
while n!='x' do
        n=get_key()
        mouse_pointer(1)
        text_color(clr)
        if n='r' then
           titlebar("SILLY.EX - Hit x to end",15,0)
        end if
        if n='s' then
            img=save_text_image({3,1},{25,1})
            position(3,1)
            puts(1,"Output file: ")
            fil=input()
            display_text_image({3,1},img)
            fn=open(fil,"w")
            print(fn,img)
            close(fn)
        end if
        if n='l' then
           position(3,1)
           text_color(15)
           puts(1,"Enter filename: ")
           text_color(clr)
           fil=input()
           fn=open(fil,"r")
           pic=get(fn)
           if atom(pic) then
            puts(1,"Error")
            beep()
           else
            pic=pic[2]
            display_text_image({3,1},pic)
           end if
        end if
    ev=get_mouse()
    if sequence(ev) then
        if ev[1]=MOVE then
           position(ev[3]/8+1,ev[2]/8+1)
           position(2,1)
        text_color(15)
           printf(1,"Line: %2d  Column: %2d Color:
%2d",{ev[3]/8+1,ev[2]/8+1,clr})
        text_color(clr)
           position(ev[3]/8+1,ev[2]/8+1)
        end if
        if ev[3]/8+1=25 then
        if ev[1]=LEFT_DOWN then
            if ev[2]/8+1=1 then
            clr=1
        drawit()
            end if
            if ev[2]/8+1=2 then
            clr=2
        drawit()
            end if
            if ev[2]/8+1=3 then
            clr=3
        drawit()
            end if
            if ev[2]/8+1=4 then
            clr=4
        drawit()
            end if
            if ev[2]/8+1=5 then
            clr=5
        drawit()
            end if
            if ev[2]/8+1=6 then
            clr=6
        drawit()
            end if
            if ev[2]/8+1=7 then
            clr=7
        drawit()
            end if
            if ev[2]/8+1=8 then
            clr=8
        drawit()
            end if
            if ev[2]/8+1=9 then
            clr=9
        drawit()
            end if
            if ev[2]/8+1=10 then
            clr=10
        drawit()
            end if
            if ev[2]/8+1=11 then
            clr=11
        drawit()
            end if
            if ev[2]/8+1=12 then
            clr=12
        drawit()
            end if
            if ev[2]/8+1=13 then
            clr=13
        drawit()
            end if
            if ev[2]/8+1=14 then
            clr=14
        drawit()
            end if
            if ev[2]/8+1=15 then
            clr=15
        drawit()
            end if
            if clr=15 then
            clr=15
            end if
        drawit()
        end if
        end if
        if ev[1]=LEFT_DOWN and ev[3]/8+1=1 and ev[2]/8+1=2 then
            clear_screen()
            abort(0)
        end if
        if ev[1]=LEFT_DOWN then
        drawit()
           position(ev[3]/8+1,ev[2]/8+1)
        text_color(clr)
           puts(1,7)
        end if
        if ev[1]=RIGHT_DOWN and ev[3]/8+1=1 then
            titlebar("SILLY.EX - Hit x to end",15,0)
        end if
        if ev[1]=RIGHT_DOWN then
           if ev[3]/8+1!=1 then
           position(ev[3]/8+1,ev[2]/8+1)
           text_color(0)
           puts(1,7)
           text_color(clr)
           end if
        end if
    end if
end while
            clear_screen()
            puts(1,"What's your name? Oh well, time to go. Bye! Seeya
later!")
            talk("What's your name? Oh well, time to go. Bye! Seeya
later!")
            abort(0)


_________________
"When it comes to programming languages, Eu™ by RDS is a cut above" -
Matt1278 and SoftPrez
Webbers: <A HREF="mailto:softprez at juno.com">softprez at juno.com</A>,
president of SoftCo.® Uh, no slogan at the moment™
Seeya next week!

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu