From ebce2d1e389c73cd02f4329bd5f4d8a901e9a02c Mon Sep 17 00:00:00 2001 From: Jim Date: Sat, 9 May 2015 15:45:47 -0700 Subject: [PATCH] update demo programs to use new features --- src/main.c | 2 +- yab-IDE/Programs/Examples/3D-Curve.yab | 5 +++-- yab-IDE/Programs/Examples/AllInOne.yab | 14 ++++++++++---- yab-IDE/Programs/Examples/IconWorld.yab | 4 ++-- yab-IDE/Programs/Examples/ImageWorld.yab | 5 +++-- yab-IDE/Programs/Examples/Sokoban.yab | 16 +++++++++++----- yab-IDE/Programs/Examples/Walk.yab | 5 +++-- 7 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/main.c b/src/main.c index ba15a1c..8c03c8f 100644 --- a/src/main.c +++ b/src/main.c @@ -26,7 +26,7 @@ can be found at www.yabasic.de /* ------------- defines ---------------- */ #define DONE {current=current->next;break;} /* reduces type-work */ -#define COPYRIGHT "original yabasic Copyright 1995-2006 by Marc-Oliver Ihm\n\tyab improvements Copyright 2006-2014 by Jan Bungeroth\n\tyab improvements Copyright 2013-2015 by Jim Saxton\n" +#define COPYRIGHT "Original yabasic Copyright 1995-2006 by Marc-Oliver Ihm\n\tyab improvements Copyright 2006-2014 by Jan Bungeroth\n\tyab improvements Copyright 2013-2015 by Jim Saxton\n" #define BANNER \ "\n yab is yabasic for Haiku. This is version " VERSION ",\n built on "\ ARCHITECTURE " on " BUILD_TIME "\n\n " COPYRIGHT "\n\n" diff --git a/yab-IDE/Programs/Examples/3D-Curve.yab b/yab-IDE/Programs/Examples/3D-Curve.yab index ef95ba2..52778dd 100755 --- a/yab-IDE/Programs/Examples/3D-Curve.yab +++ b/yab-IDE/Programs/Examples/3D-Curve.yab @@ -1,3 +1,4 @@ +#!yab doc Draw some nice 3D curves doc Original by Martin Lehmann for QBasic doc @@ -46,12 +47,12 @@ window close "Win" // Choose one of the functions below, comment out all others sub func(n) - return cos(n) + cos(2*n) +cos(5*n) +// return cos(n) + cos(2*n) +cos(5*n) // return -abs(1/n) // return -abs(1/(n + j)) // return sin(n) + sin(2*n) +sin(5*n) // return cos(sin(n)) -// return cos(2*n) + cos((n+j)/16) + return cos(2*n) + cos((n+j)/16) // return sqrt(abs(0.5*(16 - n^2))) + 1/(n*4) // return cos(4*n) + 20/(n^2 + 3) // return cos(1/n) + cos(2/n) + cos(5/n) - 3 diff --git a/yab-IDE/Programs/Examples/AllInOne.yab b/yab-IDE/Programs/Examples/AllInOne.yab index cfc7719..17ab906 100755 --- a/yab-IDE/Programs/Examples/AllInOne.yab +++ b/yab-IDE/Programs/Examples/AllInOne.yab @@ -1,3 +1,7 @@ +#!yab +dir$ = attribute get$ "", "" +dir$=dir$+"/" + // This example demonstrates all widgets // open the window @@ -26,7 +30,7 @@ button 10,10 to 100,30, "Button", "Button", "Box1" tooltip "Button", "BUTTON" // button image -button image 10,40, "ButtonImage", "img/button_pressed.png", "img/button_norm.png", "", "Box1" +button image 10,40, "ButtonImage", dir$+"img/button_pressed.png", dir$+"img/button_norm.png", "", "Box1" tooltip "ButtonImage", "BUTTON IMAGE" // checkbox @@ -34,7 +38,7 @@ checkbox 10,70, "Check", "Checkbox", true, "Box1" tooltip "Check", "CHECKBOX" // checkbox image -checkbox image 10,92, "CheckImage", "img/checkbutton_enabledOn.png", "img/checkbutton_enabledOff.png", "", "", true, "Box1" +checkbox image 10,92, "CheckImage", dir$+"img/checkbutton_enabledOn.png", dir$+"img/checkbutton_enabledOff.png", "", "", true, "Box1" tooltip "CheckImage", "CHECKBOX IMAGE" // radiobutton @@ -59,9 +63,11 @@ tooltip "List", "LISTBOX" columnbox 130,10 to 270,150, "Column", 1, "", "Box1" columnbox column "Column", " ", 1, 30,30,30, "align-center" columnbox column "Column", "Column", 2, 90,90,90, "align-center" -columnbox add "Column", 1,1, 20, "__Icon__=img/yab.png" +columnbox add "Column", 1,1, 20, "__Mime__=application/x-vnd.yab-app" +columnbox add "Column", 1,2, 20, "__Mime__=application/x-vnd.Be-elfexecutable" columnbox add "Column", 2,1, 20, "Foo" columnbox add "Column", 2,2, 20, "Bar" +columnbox add "Column", 2,3, 20, "Baz" tooltip "Column", "COLUMNBOX" // treebox @@ -76,7 +82,7 @@ text 300,10, "Text", "Text (cannot be flushed)", "Box1" tooltip "Text", "TEXT" // texturl -texturl 300,30, "TextURL", "Team MAUI", "http://www.team-maui.de", "Box1" +texturl 300,30, "TextURL", "Team MAUI", "http://www.team-maui.org", "Box1" tooltip "TextURL", "TEXTURL" // textcontrol diff --git a/yab-IDE/Programs/Examples/IconWorld.yab b/yab-IDE/Programs/Examples/IconWorld.yab index be67013..3cb733c 100755 --- a/yab-IDE/Programs/Examples/IconWorld.yab +++ b/yab-IDE/Programs/Examples/IconWorld.yab @@ -19,8 +19,8 @@ bitmap get "BMP_icon", "mime32", "application/x-vnd.Be-MAIL" draw bitmap 10, 90, "BMP_icon", "alpha", "Main" bitmap remove "BMP_icon" -draw text 70,150, "bitmap get 32, \"BMP_icon\", \"" + systempath$ + "\"", "Main" -bitmap get 32, "BMP_icon", systempath$ +draw text 70,150, "bitmap get 62, \"BMP_icon\", \"" + systempath$ + "\"", "Main" +bitmap get 62, "BMP_icon", systempath$ draw bitmap 10, 130, "BMP_icon", "alpha", "Main" bitmap remove "BMP_icon" diff --git a/yab-IDE/Programs/Examples/ImageWorld.yab b/yab-IDE/Programs/Examples/ImageWorld.yab index 52bd5de..f5b7f6f 100755 --- a/yab-IDE/Programs/Examples/ImageWorld.yab +++ b/yab-IDE/Programs/Examples/ImageWorld.yab @@ -1,9 +1,10 @@ #!yab - +dir$=attribute get$ "", "" +dir$=dir$+"/" window open 200,200 to 520,391, "MainView", "ImageWorld" button 50,163 to 270,183, "Ok_", "Ok", "MainView" -err = draw image 0,0, "img/image.png", "MainView" +err = draw image 0,0, dir$+"img/image.png", "MainView" if(err = 1) then alert "Problem while loading image.png!", "Quit", "stop" diff --git a/yab-IDE/Programs/Examples/Sokoban.yab b/yab-IDE/Programs/Examples/Sokoban.yab index cf74212..3d1331e 100755 --- a/yab-IDE/Programs/Examples/Sokoban.yab +++ b/yab-IDE/Programs/Examples/Sokoban.yab @@ -1,3 +1,9 @@ +#!yab + +dir$=attribute get$ "","" +dir$=dir$+"/" + + doc Simple game example doc based on the popular Sokoban doc graphics taken from Rocks'n'Diamonds @@ -8,15 +14,15 @@ window open 100,100 to 484,484, "Win", "Simple Sokoban Example" window set "Win", "flags", "not-zoomable, not-h-resizable, not-v-resizable" bitmap 32,32, "wall" -err = draw image 0,0 to 31,31, "img/wall.png", "wall" +err = draw image 0,0 to 31,31, dir$+"img/wall.png", "wall" bitmap 32,32, "front1" -err = err + draw image 0,0 to 31,31, "img/front.png", "front1" +err = err + draw image 0,0 to 31,31, dir$+"img/front.png", "front1" bitmap 32,32, "bulb" -err = err + draw image 0,0 to 31,31, "img/bulb.png", "bulb" +err = err + draw image 0,0 to 31,31, dir$+"img/bulb.png", "bulb" bitmap 32,32, "target" -err = err + draw image 0,0 to 31,31, "img/target.png", "target" +err = err + draw image 0,0 to 31,31, dir$+"img/target.png", "target" bitmap 32,32, "final" -err = err + draw image 0,0 to 31,31, "img/final.png", "final" +err = err + draw image 0,0 to 31,31, dir$+"img/final.png", "final" bitmap 32,32, "background" draw set "highcolor", 0,0,0, "background" draw rect 0,0 to 31,31, "background" diff --git a/yab-IDE/Programs/Examples/Walk.yab b/yab-IDE/Programs/Examples/Walk.yab index 1e337c1..c1b0192 100755 --- a/yab-IDE/Programs/Examples/Walk.yab +++ b/yab-IDE/Programs/Examples/Walk.yab @@ -1,10 +1,11 @@ #!yab - +dir$=attribute get$ "" , "" +dir$=dir$+"/" window open 100,100 to 500,160, "Win", "Walk" window set "Win", "flags", "not-zoomable, not-h-resizable, not-v-resizable" bitmap 1152,256, "player" -err = draw image 0,0 to 1152,256, "img/player.png", "player" +err = draw image 0,0 to 1152,256, dir$+"img/player.png", "player" for i=15 to 405 step 65 bitmap get i,196 to i+30,252, str$((i+50)/65), "player" next i