update demo programs to use new features

This commit is contained in:
Jim
2015-05-09 15:45:47 -07:00
parent 286f407c20
commit ebce2d1e38
7 changed files with 33 additions and 18 deletions

View File

@@ -26,7 +26,7 @@ can be found at www.yabasic.de
/* ------------- defines ---------------- */ /* ------------- defines ---------------- */
#define DONE {current=current->next;break;} /* reduces type-work */ #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 \ #define BANNER \
"\n yab is yabasic for Haiku. This is version " VERSION ",\n built on "\ "\n yab is yabasic for Haiku. This is version " VERSION ",\n built on "\
ARCHITECTURE " on " BUILD_TIME "\n\n " COPYRIGHT "\n\n" ARCHITECTURE " on " BUILD_TIME "\n\n " COPYRIGHT "\n\n"

View File

@@ -1,3 +1,4 @@
#!yab
doc Draw some nice 3D curves doc Draw some nice 3D curves
doc Original by Martin Lehmann for QBasic doc Original by Martin Lehmann for QBasic
doc doc
@@ -46,12 +47,12 @@ window close "Win"
// Choose one of the functions below, comment out all others // Choose one of the functions below, comment out all others
sub func(n) 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)
// return -abs(1/(n + j)) // return -abs(1/(n + j))
// return sin(n) + sin(2*n) +sin(5*n) // return sin(n) + sin(2*n) +sin(5*n)
// return cos(sin(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 sqrt(abs(0.5*(16 - n^2))) + 1/(n*4)
// return cos(4*n) + 20/(n^2 + 3) // return cos(4*n) + 20/(n^2 + 3)
// return cos(1/n) + cos(2/n) + cos(5/n) - 3 // return cos(1/n) + cos(2/n) + cos(5/n) - 3

View File

@@ -1,3 +1,7 @@
#!yab
dir$ = attribute get$ "", ""
dir$=dir$+"/"
// This example demonstrates all widgets // This example demonstrates all widgets
// open the window // open the window
@@ -26,7 +30,7 @@ button 10,10 to 100,30, "Button", "Button", "Box1"
tooltip "Button", "BUTTON" tooltip "Button", "BUTTON"
// button image // 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" tooltip "ButtonImage", "BUTTON IMAGE"
// checkbox // checkbox
@@ -34,7 +38,7 @@ checkbox 10,70, "Check", "Checkbox", true, "Box1"
tooltip "Check", "CHECKBOX" tooltip "Check", "CHECKBOX"
// checkbox image // 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" tooltip "CheckImage", "CHECKBOX IMAGE"
// radiobutton // radiobutton
@@ -59,9 +63,11 @@ tooltip "List", "LISTBOX"
columnbox 130,10 to 270,150, "Column", 1, "", "Box1" columnbox 130,10 to 270,150, "Column", 1, "", "Box1"
columnbox column "Column", " ", 1, 30,30,30, "align-center" columnbox column "Column", " ", 1, 30,30,30, "align-center"
columnbox column "Column", "Column", 2, 90,90,90, "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,1, 20, "Foo"
columnbox add "Column", 2,2, 20, "Bar" columnbox add "Column", 2,2, 20, "Bar"
columnbox add "Column", 2,3, 20, "Baz"
tooltip "Column", "COLUMNBOX" tooltip "Column", "COLUMNBOX"
// treebox // treebox
@@ -76,7 +82,7 @@ text 300,10, "Text", "Text (cannot be flushed)", "Box1"
tooltip "Text", "TEXT" tooltip "Text", "TEXT"
// texturl // 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" tooltip "TextURL", "TEXTURL"
// textcontrol // textcontrol

View File

@@ -19,8 +19,8 @@ bitmap get "BMP_icon", "mime32", "application/x-vnd.Be-MAIL"
draw bitmap 10, 90, "BMP_icon", "alpha", "Main" draw bitmap 10, 90, "BMP_icon", "alpha", "Main"
bitmap remove "BMP_icon" bitmap remove "BMP_icon"
draw text 70,150, "bitmap get 32, \"BMP_icon\", \"" + systempath$ + "\"", "Main" draw text 70,150, "bitmap get 62, \"BMP_icon\", \"" + systempath$ + "\"", "Main"
bitmap get 32, "BMP_icon", systempath$ bitmap get 62, "BMP_icon", systempath$
draw bitmap 10, 130, "BMP_icon", "alpha", "Main" draw bitmap 10, 130, "BMP_icon", "alpha", "Main"
bitmap remove "BMP_icon" bitmap remove "BMP_icon"

View File

@@ -1,9 +1,10 @@
#!yab #!yab
dir$=attribute get$ "", ""
dir$=dir$+"/"
window open 200,200 to 520,391, "MainView", "ImageWorld" window open 200,200 to 520,391, "MainView", "ImageWorld"
button 50,163 to 270,183, "Ok_", "Ok", "MainView" 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 if(err = 1) then
alert "Problem while loading image.png!", "Quit", "stop" alert "Problem while loading image.png!", "Quit", "stop"

View File

@@ -1,3 +1,9 @@
#!yab
dir$=attribute get$ "",""
dir$=dir$+"/"
doc Simple game example doc Simple game example
doc based on the popular Sokoban doc based on the popular Sokoban
doc graphics taken from Rocks'n'Diamonds 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" window set "Win", "flags", "not-zoomable, not-h-resizable, not-v-resizable"
bitmap 32,32, "wall" 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" 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" 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" 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" 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" bitmap 32,32, "background"
draw set "highcolor", 0,0,0, "background" draw set "highcolor", 0,0,0, "background"
draw rect 0,0 to 31,31, "background" draw rect 0,0 to 31,31, "background"

View File

@@ -1,10 +1,11 @@
#!yab #!yab
dir$=attribute get$ "" , ""
dir$=dir$+"/"
window open 100,100 to 500,160, "Win", "Walk" window open 100,100 to 500,160, "Win", "Walk"
window set "Win", "flags", "not-zoomable, not-h-resizable, not-v-resizable" window set "Win", "flags", "not-zoomable, not-h-resizable, not-v-resizable"
bitmap 1152,256, "player" 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 for i=15 to 405 step 65
bitmap get i,196 to i+30,252, str$((i+50)/65), "player" bitmap get i,196 to i+30,252, str$((i+50)/65), "player"
next i next i