|
Post by bigbass on Aug 6, 2013 20:27:15 GMT 1
Hey vovchik That's really beautiful work! I spent countless hours studying music and math nature and math so I really enjoy seeing it motion Joe
|
|
|
Post by alexfish on Aug 7, 2013 6:12:52 GMT 1
Hi @ All
Work in Progress
Alpha 0.1.0
Imp Table :
Improved Features and access for User Defined Widgets.
Target Widget List : As in G_widget : step in replacements to match similar GTK/HUG
G_BUTTON G_RADIO G_CHECK G_COMBO G_EDIT G_FRAME G_HSEPARATOR G_HSLIDER G_LIST G_MARK G_ENTRY/G_TEXTBOX G_PROGRESSBAR G_SPIN G_TOGGLE G_VSEPARATOR G_VSLIDER G_MESSAGE_DIALOG :: pop-up
late Addition
G_DESTROY : destroy widget or item As Composite :: G_COMBO , G_EDIT , G_LIST These widgets will have pop-up Button-Menu , pop-up Status
Standard Features: to Implement
LOAD SAVE SAVE-AS SUM-OF : LIST ONLY FONT-COLOR FONT-TYPE FONT-SIZE : EDIT ONLY PAGE-COLOR FIND REPLACE SCALE/ZOOM Question : Will the EDIT be as good as Hug EDIT Answer : No , it will provide traditional editor type function with cursor movement via the keyboard , also will lack Copy and Paste
Question : What Advantage will the G_widgets LIST COMBO EDIT have. Answer : All of the Standard Features:
Question : What Advantage will the other G_widgets have Answer : Customizing.....
Question : will hug type widgets remain a feature Answer : Yes
BR
ALEX
|
|
|
Post by vovchik on Aug 7, 2013 18:37:12 GMT 1
Dear Alex et al.,
All that sounds great. Here is another fractal demo (real time drawing) that is more standard in terms of shape but does things with shadings that are quite nice. Also, by changing canvas_w and canvas_h at the start, you can rescale the entire thing nicely, including all the GUI elements.
Have fun, vovchik
' ***************************************************** ' PROGRAM: mandel256a.bac ' PURPOSE: demo of mandebrot fractal using goo gfx ' AUTHOR: vovchik (Puppy Linux forum) ' NOTES: ported example from rosetta code ' DEPENDS: gcc, bacon, Alex's libgfx ' PLATFORM: Puppy Linux (actually, any *nix) ' DATE: 05-08-2013 ' *****************************************************
' *********************** ' INCLUDES ' ***********************
INCLUDE "libgfx_import.bac" INIT
' *********************** ' END INCLUDES ' ***********************
' *********************** ' INITIALIZATION ' ***********************
DECLARE canvas_w, canvas_h TYPE int canvas_w = 600 canvas_h = 600
' *********************** ' END INITIALIZATION ' ***********************
' *********************** ' SUBS & FUNCTIONS ' ***********************
' ------------------ SUB QUIT_PROG() ' ------------------ QUIT END SUB
' ------------------ SUB ADD_HEX_STOP(long item, double offset, STRING colour$, double alpha ) ' ------------------ LOCAL r, g, b TYPE double colour$ = UCASE$(colour$) r = (double)(DEC(MID$(colour$, 2, 2)) / 255.0) g = (double)(DEC(MID$(colour$, 4, 2)) / 255.0) b = (double)(DEC(MID$(colour$, 6, 2)) / 255.0) PRINT "rgb: ", (double)r, " ", (double)g, " ", (double)b ADD_COLOR_STOP(item, offset, r, g, b, alpha) END SUB
' ------------------ SUB DRAW_FRACTAL() ' ------------------ LOCAL jx, jy, xmax, ymax, xmin, ymin, dx, dy, wx, wy, tx, ty, r, m TYPE double LOCAL x, y, k, kt TYPE int LOCAL col$ TYPE STRING DISABLE(start_but) ' Information for user PRINT "Drawing fractal" TEXT(labl, "<span color='firebrick'><b>Please wait...</b></span>") SYNC kt = 50 m = 4.0 xmin = 2.1 xmax = -0.6 ymin = -1.5 ymax = 1.5 dx = (xmax-xmin)/canvas_w dy = (ymax-ymin)/canvas_h FOR x = 0 TO canvas_w jx = xmin + x * dx FOR y = 0 TO canvas_h jy = ymin + y * dy k = 0 wx = 0.0 wy = 0.0 LABEL MainCalculation tx = wx * wx - (wy * wy + jx) ty = 2.0 * wx * wy + jy wx = tx wy = ty r = wx * wx + wy * wy INCR k IF r <= m AND k < kt THEN GOTO MainCalculation END IF 'IF k > 5 THEN col$ = pink$ IF k > 10 THEN col$ = CONCAT$("#", \ RIGHT$("00" & HEX$(RANDOM(128)), 2), \ RIGHT$("00" & HEX$(RANDOM(256)), 2), \ RIGHT$("00" & HEX$(RANDOM(64)), 2)) END IF IF k > 15 THEN col$ = CONCAT$("#", \ RIGHT$("00" & HEX$(RANDOM(64)), 2), \ RIGHT$("00" & HEX$(RANDOM(128)), 2), \ RIGHT$("00" & HEX$(RANDOM(256)), 2)) END IF IF k > 20 THEN col$ = CONCAT$("#", \ RIGHT$("00" & HEX$(RANDOM(128)), 2), \ RIGHT$("00" & HEX$(RANDOM(64)), 2), \ RIGHT$("00" & HEX$(RANDOM(128)), 2)) END IF IF k > 25 THEN col$ = CONCAT$("#", \ RIGHT$("00" & HEX$(RANDOM(16)), 2), \ RIGHT$("00" & HEX$(RANDOM(32)), 2), \ RIGHT$("00" & HEX$(RANDOM(64)), 2)) END IF IF k > 30 THEN col$ = CONCAT$("#", \ RIGHT$("00" & HEX$(RANDOM(32)), 2), \ RIGHT$("00" & HEX$(RANDOM(64)), 2), \ RIGHT$("00" & HEX$(RANDOM(256)), 2)) END IF IF k > 35 THEN col$ = CONCAT$("#", \ RIGHT$("00" & HEX$(RANDOM(256)), 2), \ RIGHT$("00" & HEX$(RANDOM(256)), 2), \ RIGHT$("00" & HEX$(RANDOM(256)), 2)) END IF IF k > 35 THEN col$ = CONCAT$("#", \ RIGHT$("00" & HEX$(RANDOM(16)), 2), \ RIGHT$("00" & HEX$(RANDOM(128)), 2), \ RIGHT$("00" & HEX$(RANDOM(16)), 2)) END IF IF k > 40 THEN col$ = CONCAT$("#", \ RIGHT$("00" & HEX$(RANDOM(128)), 2), \ RIGHT$("00" & HEX$(RANDOM(64)), 2), \ RIGHT$("00" & HEX$(RANDOM(128)), 2)) END IF IF k > 45 THEN col$ = CONCAT$("#", \ RIGHT$("00" & HEX$(RANDOM(12)), 2), \ RIGHT$("00" & HEX$(RANDOM(12)), 2), \ RIGHT$("00" & HEX$(RANDOM(12)), 2)) END IF IF k > 10 THEN pixel = PIXEL(canvas, col$, x, y) SETPROPERTY(pixel, "antialias", 3) END IF NEXT y SYNC NEXT x PRINT "Indicate that fractal is ready" TEXT(labl, "<span color='firebrick'><b>Fractal ready.</b></span>") SYNC END SUB
' ------------------ SUB MK_GUI() ' ------------------ ' Create GUI root = WINDOW("Fractal Demo - Bacon GFX", canvas_w + 20, canvas_h + 55, 1.0) ' Get root of window win = GETROOT(root) fill_rad = LINEAR(0, 0, 0, canvas_h + 50) ' light gray at top ADD_HEX_STOP(fill_rad, 0.0, "#F0F0F0", 0.8) ' change colour of next one for tint ADD_HEX_STOP(fill_rad, 0.5, "#E98D8D", 0.8) ' black at bottom ADD_HEX_STOP(fill_rad, 0.9, "#1E1A16", 0.8) ADD_HEX_STOP(fill_rad, 0.95, "#000000", 0.8) ' Fill background with gradient bg = RECTANGLE(win, 1, 1, 1, 1, CLASS, ITEM_RECTANGLE, "can-focus", 1, \ "line-width", 0.0, "fill_pattern", fill_rad, "stroke-color", "none", \ "antialias", 3, 0) DRAW(win, bg, 0, 0, canvas_w + 20, canvas_h + 55) ' Make frame frame = FRAME(NULL) ATTACH (win, frame, 5, 5, canvas_w + 10, canvas_h + 10) PRINT "Frame created" ' Create canvas for drawing canvas = AREA(win, 10, 10, canvas_w, canvas_h) 'SCALE(canvas, 1, 1.5) PRINT "Canvas created" ' Create buttons and callbacks start_but = BUTTON("Go") SETPROPERTY(start_but, "tooltip-text", " Draw fractal. ") ATTACH(win, start_but, 5, canvas_h + 20, 80, 30) CALLBACK (start_but, DRAW_FRACTAL) labl = MARK("") SETPROPERTY(labl, "use-markup", TRUE) TEXT(labl, "<span color='firebrick'><b>GFX</b></span>") ATTACH(win, labl, ((canvas_w + 20)/2) - 75, canvas_h + 20, 150, 30) PRINT "Label created" quit_but = BUTTON("Quit") SETPROPERTY(quit_but, "tooltip-text", " Quit fractal program. ") ATTACH(win, quit_but, canvas_w - 65, canvas_h + 20, 80, 30) CALLBACK (quit_but, QUIT_PROG) PRINT "Buttons created" END SUB
' *********************** ' END SUBS & FUNCTIONS ' ***********************
' *********************** ' MAIN ' ***********************
MK_GUI DISPLAY
' *********************** ' END MAIN ' ***********************
|
|
|
Post by vovchik on Aug 7, 2013 22:16:00 GMT 1
Dear guys, Another little demo - this time with an animated rainbow. Have fun... With kind regards, vovchik PS. Alex found a very clever way of speeding it up.... ' ***************************************************** ' PROGRAM: rainbow.bac ' PURPOSE: demo of rainbow ellipse using goo gfx ' AUTHOR: vovchik (Puppy Linux forum) ' NOTES: ported example from somewhere ' DEPENDS: gcc, bacon, Alex's libgfx ' PLATFORM: Puppy Linux (actually, any *nix) ' DATE: 05-08-2013 ' *****************************************************
' *********************** ' INCLUDES ' ***********************
INCLUDE "libgfx_import.bac" INIT
' *********************** ' END INCLUDES ' ***********************
' *********************** ' INITIALIZATION ' ***********************
DECLARE canvas_w, canvas_h TYPE int canvas_w = 300 canvas_h = 300
' *********************** ' END INITIALIZATION ' ***********************
' *********************** ' SUBS & FUNCTIONS ' ***********************
' ------------------ SUB QUIT_PROG() ' ------------------ QUIT END SUB
' ------------------ SUB ADD_HEX_STOP(long item, double offset, STRING colour$, double alpha ) ' ------------------ LOCAL r, g, b TYPE double colour$ = UCASE$(colour$) r = (double)(DEC(MID$(colour$, 2, 2)) / 255.0) g = (double)(DEC(MID$(colour$, 4, 2)) / 255.0) b = (double)(DEC(MID$(colour$, 6, 2)) / 255.0) PRINT "rgb: ", (double)r, " ", (double)g, " ", (double)b ADD_COLOR_STOP(item, offset, r, g, b, alpha) END SUB
' ------------------ SUB DRAW_FRACTAL() ' ------------------ LOCAL m, q, x1, x2, x3, x4, x5, x6, x7, x8 TYPE double LOCAL y1, y2, y3, y4, y5, y6, y7, y8 TYPE double LOCAL e, mymod TYPE int LOCAL col$ TYPE STRING DISABLE(start_but) ' Information for user PRINT "Drawing..." TEXT(labl, "<span color='firebrick'><b>Please wait...</b></span>") SYNC m = -1.57 x1 = 1 y1 = 300 q = 0.00101 gx = 0.15 gy = 0.3 FOR e = 1 TO 3107 m = m + q x1 = x1 + gx * COS(m) y1 = y1 + gy * SIN(m) x2 = (x1 + 150) / 2 y2 = (y1 + 300) / 2 x3 = (x1 + x2) / 2 y3 = (y1 + y2) / 2 x4 = (x2 + 150) / 2 y4 = (y2 + 300) / 2 x5 = (x1 + x3) / 2 y5 = (y1 + y3) / 2 x6 = (x2 + x3) / 2 y6 = (y2 + y3) / 2 x7 = (x2 + x4) / 2 y7 = (y2 + y4) / 2 x8 = (x4 + 150) / 2 y8 = (y4 + 300) / 2 ' red col$ = "#F00000" l = LINE(canvas, col$, x1, y1, x5, y5) ' orange col$ = "#FFA500" l = LINE(canvas, col$, x5, y5, x3, y3) ' yellow col$ = "#FFFF00" l = LINE(canvas, col$, x3, y3, x6, y6) ' green col$ = "#00FF00" l = LINE(canvas, col$, x6, y6, x2, y2) ' blue col$ = "#0000FF" l = LINE(canvas, col$, x2, y2, x7, y7) ' darkblue col$ = "#00008B" l = LINE(canvas, col$, x7, y7, x4, y4) ' darkpurple col$ = "#551D78" l = LINE(canvas, col$, x4, y4, x8, y8) SETPROPERTY(l, "antialias", 3) mymod = MOD(e, 16) IF mymod = 15 THEN SYNC NEXT e PRINT "Indicate that drawing is ready" TEXT(labl, "<span color='firebrick'><b>Drawing ready.</b></span>") SYNC END SUB
' ------------------ SUB MK_GUI() ' ------------------ ' Create GUI root = WINDOW("Rainbow Demo - Bacon GFX", canvas_w + 20, canvas_h + 55, 1.0) ' Get root of window win = GETROOT(root) fill_rad = LINEAR(0, 0, 0, canvas_h + 50) ' light gray at top ADD_HEX_STOP(fill_rad, 0.0, "#F0F0F0", 0.8) ' change colour of next one for tint ADD_HEX_STOP(fill_rad, 0.5, "#68C2E7", 0.8) ' black at bottom ADD_HEX_STOP(fill_rad, 0.9, "#1E1A16", 0.8) ADD_HEX_STOP(fill_rad, 0.95, "#000000", 0.8) ' Fill background with gradient bg = RECTANGLE(win, 1, 1, 1, 1, CLASS, ITEM_RECTANGLE, "can-focus", 1, \ "line-width", 0.0, "fill_pattern", fill_rad, "stroke-color", "none", \ "antialias", 3, 0) DRAW(win, bg, 0, 0, canvas_w + 20, canvas_h + 55) ' Make frame frame = FRAME(NULL) ATTACH (win, frame, 5, 5, canvas_w + 10, canvas_h + 10) PRINT "Frame created" ' Create canvas for drawing canvas = AREA(win, 10, 10, canvas_w, canvas_h) 'SCALE(canvas, 1, 1.5) PRINT "Canvas created" ' Create buttons and callbacks start_but = BUTTON("Go") SETPROPERTY(start_but, "tooltip-text", " Draw fractal. ") ATTACH(win, start_but, 5, canvas_h + 20, 80, 30) CALLBACK (start_but, DRAW_FRACTAL) labl = MARK("") SETPROPERTY(labl, "use-markup", TRUE) TEXT(labl, "<span color='firebrick'><b>GFX</b></span>") ATTACH(win, labl, ((canvas_w + 20)/2) - 75, canvas_h + 20, 150, 30) PRINT "Label created" quit_but = BUTTON("Quit") SETPROPERTY(quit_but, "tooltip-text", " Quit fractal program. ") ATTACH(win, quit_but, canvas_w - 65, canvas_h + 20, 80, 30) CALLBACK (quit_but, QUIT_PROG) PRINT "Buttons created" END SUB
' *********************** ' END SUBS & FUNCTIONS ' ***********************
' *********************** ' MAIN ' ***********************
MK_GUI DISPLAY
' *********************** ' END MAIN ' ***********************
|
|
|
Post by alexfish on Aug 7, 2013 23:26:35 GMT 1
Hi @ VovchiK has PM awaiting.. New Idea.. reusable objects This will save Your Memory usage BR Alex
|
|
|
Post by vovchik on Aug 8, 2013 10:17:23 GMT 1
Dear All, Here is the rainbow with Alex's great mod.... Look at the source and see how he did it. With kind regards, vovchik @ Alex, Thanks ' ***************************************************** ' PROGRAM: rainbow-alex-mod.bac ' PURPOSE: demo of mandebrot fractal using goo gfx ' AUTHOR: vovchik (Puppy Linux forum) ' MODS: alexfish to save memory by using reusable g_objects ' NOTES: ported example from rosetta code ' DEPENDS: gcc, bacon, Alex's libgfx ' PLATFORM: Puppy Linux (actually, any *nix) ' DATE: 05-08-2013 ' *****************************************************
' *********************** ' INCLUDES ' ***********************
INCLUDE "libgfx_import.bac" INIT DECLARE canvas_w, canvas_h TYPE int DECLARE col$[10] DECLARE lines[3200][10] TYPE NUMBER canvas_w = 300 canvas_h = 300
' *********************** ' END INCLUDES ' ***********************
' *********************** ' SUBS & FUNCTIONS ' ***********************
' ------------------ SUB QUIT_PROG() ' ------------------ QUIT END SUB
' ------------------ SUB ADD_HEX_STOP(long item, double offset, STRING colour$, double alpha ) ' ------------------ LOCAL r, g, b TYPE double colour$ = UCASE$(colour$) r = (double)(DEC(MID$(colour$, 2, 2)) / 255.0) g = (double)(DEC(MID$(colour$, 4, 2)) / 255.0) b = (double)(DEC(MID$(colour$, 6, 2)) / 255.0) PRINT "rgb: ", (double)r, " ", (double)g, " ", (double)b ADD_COLOR_STOP(item, offset, r, g, b, alpha) END SUB
' ------------------ SUB DRAW_FRACTAL() ' ------------------ LOCAL e TYPE int DISABLE(start_but) ' Information for user PRINT "Drawing fractal" TEXT(labl, "<span color='firebrick'><b>Please wait...</b></span>") SYNC FOR e = 1 TO 3107 HIDE(lines[e][1]) HIDE(lines[e][2]) HIDE(lines[e][3]) HIDE(lines[e][4]) HIDE(lines[e][5]) HIDE(lines[e][6]) HIDE(lines[e][7]) NEXT e FOR e = 1 TO 3107 mymod=MOD(e,30) SHOW(lines[e][1]) SHOW(lines[e][2]) SHOW(lines[e][3]) SHOW(lines[e][4]) SHOW(lines[e][5]) SHOW(lines[e][6]) SHOW(lines[e][7]) IF mymod = 0 THEN SYNC NEXT e PRINT "Indicate that drawing is ready" TEXT(labl, "<span color='firebrick'><b>Drawing ready.</b></span>") SYNC ENABLE(start_but) END SUB
' ------------------ SUB DOLINES() ' ------------------ TEXT(labl, "<span color='firebrick'><b>GFX</b></span>") SYNC LOCAL m, q, x1, x2, x3, x4, x5, x6, x7, x8 TYPE double LOCAL y1, y2, y3, y4, y5, y6, y7, y8 TYPE double LOCAL e TYPE int LOCAL col$ TYPE STRING DISABLE(start_but) ' Information for user m = -1.57 x1 = 1 y1 = 300 q = 0.00101 gx = 0.15 gy = 0.3 FOR e = 1 TO 3107 m = m + q x1 = x1 + gx * COS(m) y1 = y1 + gy * SIN(m) x2 = (x1 + 150) / 2 y2 = (y1 + 300) / 2 x3 = (x1 + x2) / 2 y3 = (y1 + y2) / 2 x4 = (x2 + 150) / 2 y4 = (y2 + 300) / 2 x5 = (x1 + x3) / 2 y5 = (y1 + y3) / 2 x6 = (x2 + x3) / 2 y6 = (y2 + y3) / 2 x7 = (x2 + x4) / 2 y7 = (y2 + y4) / 2 x8 = (x4 + 150) / 2 y8 = (y4 + 300) / 2 ' red col$ = "#F00000" l = LINE(canvas, col$, x1, y1, x5, y5) lines[e][1] = l ' orange col$ = "#FFA500" l = LINE(canvas, col$, x5, y5, x3, y3) lines[e][2] = l ' yellow col$ = "#FFFF00" l = LINE(canvas, col$, x3, y3, x6, y6) lines[e][3] = l ' green col$ = "#00FF00" l = LINE(canvas, col$, x6, y6, x2, y2) lines[e][4] = l ' blue col$ = "#0000FF" l = LINE(canvas, col$, x2, y2, x7, y7) lines[e][5] = l ' darkblue col$ = "#00008B" l = LINE(canvas, col$, x7, y7, x4, y4) lines[e][6] = l ' darkpurple col$ = "#551D78" l = LINE(canvas, col$, x4, y4, x8, y8) lines[e][7] = l 'SETPROPERTY(l, "antialias", 3) HIDE(lines[e][1]) HIDE(lines[e][2]) HIDE(lines[e][3]) HIDE(lines[e][4]) HIDE(lines[e][5]) HIDE(lines[e][6]) HIDE(lines[e][7]) NEXT e TEXT(labl, "<span color='firebrick'><b>Drawing ready.</b></span>") ENABLE(start_but) END SUB
' ------------------ SUB MK_GUI() ' ------------------ ' Create GUI root = WINDOW("Rainbow Demo - Bacon GFX", canvas_w + 20, canvas_h + 55, 1.0) ' Get root of window win = GETROOT(root) fill_rad = LINEAR(0, 0, 0, canvas_h + 50) ' light gray at top ADD_HEX_STOP(fill_rad, 0.0, "#F0F0F0", 0.8) ' change colour of next one for tint ADD_HEX_STOP(fill_rad, 0.5, "#68C2E7", 0.8) ' black at bottom ADD_HEX_STOP(fill_rad, 0.9, "#1E1A16", 0.8) ADD_HEX_STOP(fill_rad, 0.95, "#000000", 0.8) ' Fill background with gradient bg = RECTANGLE(win, 1, 1, 1, 1, CLASS, ITEM_RECTANGLE, "can-focus", 1, \ "line-width", 0.0, "fill_pattern", fill_rad, "stroke-color", "none", \ "antialias", 3, 0) DRAW(win, bg, 0, 0, canvas_w + 20, canvas_h + 55) ' Make frame frame = FRAME(NULL) ATTACH (win, frame, 5, 5, canvas_w + 10, canvas_h + 10) PRINT "Frame created" ' Create canvas for drawing canvas = AREA(win, 10, 10, canvas_w, canvas_h) 'SCALE(canvas, 1, 1.5) PRINT "Canvas created" ' Create buttons and callbacks start_but = BUTTON("Go") SETPROPERTY(start_but, "tooltip-text", " Draw fractal. ") ATTACH(win, start_but, 5, canvas_h + 20, 80, 30) CALLBACK (start_but, DRAW_FRACTAL) labl = MARK("") SETPROPERTY(labl, "use-markup", TRUE) TEXT(labl, "<span color='firebrick'><b>GFX</b></span>") ATTACH(win, labl, ((canvas_w + 20)/2) - 75, canvas_h + 20, 150, 30) PRINT "Label created" quit_but = BUTTON("Quit") SETPROPERTY(quit_but, "tooltip-text", " Quit fractal program. ") ATTACH(win, quit_but, canvas_w - 65, canvas_h + 20, 80, 30) CALLBACK (quit_but, QUIT_PROG) PRINT "Buttons created" DOLINES() END SUB
' *********************** ' END SUBS & FUNCTIONS ' ***********************
' *********************** ' MAIN ' ***********************
MK_GUI DISPLAY
' *********************** ' END MAIN ' ***********************
|
|
|
Post by vovchik on Aug 8, 2013 17:02:06 GMT 1
Dear All, Here are two little demos of snowflakes.... With kind regards, vovchik Attachments:
|
|
|
Post by vovchik on Aug 10, 2013 0:43:41 GMT 1
Dear All,
Here is one of the snowflakes with rbga - opacity added - which is a fabulous feature. Compile and have a look....
With kind regards, vovchik
' ***************************************************** ' PROGRAM: snowflake1-rbga.bac ' PURPOSE: draw snowflake with alpha using goo gfx ' AUTHOR: vovchik (Puppy Linux forum) ' NOTES: ported example from rosetta code ' DEPENDS: gcc, bacon, Alex's libgfx ' PLATFORM: Puppy Linux (actually, any *nix) ' DATE: 05-08-2013 ' *****************************************************
' *********************** ' INCLUDES ' ***********************
INCLUDE "libgfx_import.bac" INIT
' *********************** ' END INCLUDES ' ***********************
' *********************** ' INITIALIZATION ' ***********************
DECLARE canvas_w, canvas_h, XCenter, YCenter TYPE double canvas_w = 640 canvas_h = 480 XCenter = (double)(canvas_w / 2.0) YCenter = (double)(canvas_h / 2.0) SEED NOW
' *********************** ' END INITIALIZATION ' ***********************
' *********************** ' SUBS & FUNCTIONS ' ***********************
' ------------------ SUB QUIT_PROG() ' ------------------ QUIT END SUB
' ------------------ SUB ADD_HEX_STOP(long item, double offset, STRING colour$, double alpha ) ' ------------------ LOCAL r, g, b TYPE double colour$ = UCASE$(colour$) r = (double)(DEC(MID$(colour$, 2, 2)) / 255.0) g = (double)(DEC(MID$(colour$, 4, 2)) / 255.0) b = (double)(DEC(MID$(colour$, 6, 2)) / 255.0) PRINT "rgb: ", (double)r, " ", (double)g, " ", (double)b ADD_COLOR_STOP(item, offset, r, g, b, alpha) END SUB
' ------------------ SUB POLAR_LINE(double r1, double t1, double r2, double t2) ' ------------------ LOCAL x1, x2, y1, y2 TYPE double LOCAL col$ TYPE STRING ' Draws a line between two points in polar coordinates. ' r1 - R for the first point ' t1 - Theta for the first point ' r2 - R for the second point ' t2 - Theta for the second point ' Convert to cartesian x1 = (double)(r1 * COS(t1)) y1 = (double)(r1 * SIN(t1)) x2 = (double)(r2 * COS(t2)) y2 = (double)(r2 * SIN(t2)) ' Draw the line with orange palette col$ = CONCAT$("#", \ RIGHT$("00" & HEX$(RANDOM(50) + 200), 2), \ RIGHT$("00" & HEX$(RANDOM(50) + 100), 2), \ RIGHT$("00" & HEX$(RANDOM(64) + 64), 2)) l = LINE(canvas, col$, x1 + XCenter, y1 + YCenter, x2 + XCenter, y2 + YCenter) SETPROPERTY(l, "antialias", 3, "line-width", 2.0, "stroke_color_rgba", DEC(MID$(col$, 2) & "3A")) END SUB
' ------------------ SUB DRAW_OBJECT() ' ------------------ LOCAL Pi3, RLimit TYPE double LOCAL Count, Total, I TYPE int LOCAL r1, r2, t1, t2, mt1, mt2 TYPE double DISABLE(start_but) ' Information for user PRINT "Drawing object" TEXT(labl, "<span color='firebrick'><b>Please wait...</b></span>") SYNC ' 60 degrees Pi3 = (double)(PI / 3.0) RLimit = YCenter ' Get the number of lines in the snowflake REPEAT Total = INT((RANDOM(1000) / 1000.0) * 200 + 5) UNTIL Total > 50 PRINT "Total interations: ", Total ' For each line FOR Count = 1 TO Total ' Pick two random points in polar coordinates r1 = (double)(RANDOM(1000) / 1000.0) * RLimit t1 = (double)(RANDOM(1000) / 1000.0) * Pi3 r2 = (double)(RANDOM(1000) / 1000.0) * RLimit t2 = (double)(RANDOM(1000) / 1000.0) * Pi3 ' Compute the mirror image of those points in the 60 degree sector mt1 = Pi3 - t1 mt2 = Pi3 - t2 ' For each 60 degree sector around the circle FOR I = 0 TO 5 ' Draw the line POLAR_LINE(r1, t1 + (I * Pi3), r2, t2 + (I * Pi3)) ' Draw the mirror image line within the 60 degree sector POLAR_LINE(r1, mt1 + (I * Pi3), r2, mt2 + (I * Pi3)) SYNC NEXT I NEXT Count PRINT "Indicate that drawing is ready" TEXT(labl, "<span color='firebrick'><b>Drawing ready.</b></span>") SYNC END SUB
' ------------------ SUB MK_GUI() ' ------------------ ' Create GUI root = WINDOW("Snowflake RGBA - Bacon GFX", canvas_w + 20, canvas_h + 55, 1.0) ' Get root of window win = GETROOT(root) fill_lin = LINEAR(0, 0, 0, canvas_h + 50) ' light gray at top ADD_HEX_STOP(fill_lin, 0.0, "#000000", 0.8) ADD_HEX_STOP(fill_lin, 0.2, "#1E1A16", 0.8) ' change colour of next one for tint: redorange ADD_HEX_STOP(fill_lin, 0.47, "#FF4500", 0.8) ' black at bottom ADD_HEX_STOP(fill_lin, 0.9, "#1E1A16", 0.8) ADD_HEX_STOP(fill_lin, 0.95, "#000000", 0.8) ' Fill background with gradient bg = RECTANGLE(win, 1, 1, 1, 1, CLASS, ITEM_RECTANGLE, "can-focus", 1, \ "line-width", 0.0, "fill_pattern", fill_lin, "stroke-color", "none", \ "antialias", 3, 0) DRAW(win, bg, 0, 0, canvas_w + 20, canvas_h + 55) ' Make frame frame = FRAME(NULL) ATTACH (win, frame, 5, 5, canvas_w + 10, canvas_h + 10) PRINT "Frame created" ' Create canvas for drawing canvas = AREA(win, 10, 10, canvas_w, canvas_h) PRINT "Canvas created" ' Create buttons and callbacks start_but = BUTTON("Go") SETPROPERTY(start_but, "tooltip-text", " Draw object. ") ATTACH(win, start_but, 5, canvas_h + 20, 80, 30) CALLBACK (start_but, DRAW_OBJECT) labl = MARK("") SETPROPERTY(labl, "use-markup", TRUE) TEXT(labl, "<span color='firebrick'><b>GFX</b></span>") ATTACH(win, labl, ((canvas_w + 20)/2) - 75, canvas_h + 20, 150, 30) PRINT "Label created" quit_but = BUTTON("Quit") SETPROPERTY(quit_but, "tooltip-text", " Quit this program. ") ATTACH(win, quit_but, canvas_w - 65, canvas_h + 20, 80, 30) CALLBACK (quit_but, QUIT_PROG) PRINT "Buttons created" END SUB
' *********************** ' END SUBS & FUNCTIONS ' ***********************
' *********************** ' MAIN ' ***********************
MK_GUI DISPLAY
' *********************** ' END MAIN ' ***********************
|
|
|
Post by vovchik on Aug 10, 2013 1:28:42 GMT 1
Dear All,
And a little fun with circles/ellipses....I think it looks good.... (also rgba stuff).
With kind regards, vovchik
' ***************************************************** ' PROGRAM: circles-rgba.bac ' PURPOSE: playing with ellipses using goo gfx ' AUTHOR: vovchik (Puppy Linux forum) ' NOTES: ' DEPENDS: gcc, bacon, Alex's libgfx ' PLATFORM: Puppy Linux (actually, any *nix) ' DATE: 05-08-2013 ' *****************************************************
' *********************** ' INCLUDES ' ***********************
INCLUDE "libgfx_import.bac" INIT
' *********************** ' END INCLUDES ' ***********************
' *********************** ' INITIALIZATION ' ***********************
DECLARE canvas_w, canvas_h TYPE double canvas_w = 640 canvas_h = 400 SEED NOW
' *********************** ' END INITIALIZATION ' ***********************
' *********************** ' SUBS & FUNCTIONS ' ***********************
' ------------------ SUB QUIT_PROG() ' ------------------ QUIT END SUB
' ------------------ SUB ADD_HEX_STOP(long item, double offset, STRING colour$, double alpha ) ' ------------------ LOCAL r, g, b TYPE double colour$ = UCASE$(colour$) r = (double)(DEC(MID$(colour$, 2, 2)) / 255.0) g = (double)(DEC(MID$(colour$, 4, 2)) / 255.0) b = (double)(DEC(MID$(colour$, 6, 2)) / 255.0) PRINT "rgb: ", (double)r, " ", (double)g, " ", (double)b ADD_COLOR_STOP(item, offset, r, g, b, alpha) END SUB
' ------------------ SUB DRAW_OBJECT() ' ------------------ DISABLE(start_but) ' Information for user PRINT "Drawing object" TEXT(labl, "<span color='firebrick'><b>Please wait...</b></span>") SYNC LOCAL col$ TYPE STRING ' draw routine DECLARE angle TYPE double DECLARE a, b, mymod TYPE int FOR b = 1 TO 200 STEP 5 FOR a = 1 TO 360 STEP 20 angle = (double)(a * PI / 180) col$ = CONCAT$("#", \ RIGHT$("00" & HEX$(RANDOM(50) + MOD(a, 200)), 2), \ RIGHT$("00" & HEX$(RANDOM(50) + 100), 2), \ RIGHT$("00" & HEX$(RANDOM(64) + 64), 2)) c1 = CIRCLE (canvas, col$, (b * SIN(angle) + 300) + 20, (b * COS(angle) + 225) - 90, b, b, 0) SETPROPERTY(c1, "antialias", 3, "stroke_color_rgba", DEC(MID$(col$, 2) & "3A"), "line-width", 1.5) SCALE(c1, 1.0, 1.5) NEXT a SYNC PRINT b, " "; NEXT b PRINT NL$, "Indicate that drawing is ready" TEXT(labl, "<span color='firebrick'><b>Drawing ready.</b></span>") SYNC END SUB
' ------------------ SUB MK_GUI() ' ------------------ ' Create GUI root = WINDOW("Circles RBGA - Bacon GFX", canvas_w + 20, canvas_h + 55, 1.0) ' Get root of window win = GETROOT(root) fill_lin = LINEAR(0, 0, 0, canvas_h + 50) ' light gray at top ADD_HEX_STOP(fill_lin, 0.0, "#000000", 0.8) ADD_HEX_STOP(fill_lin, 0.2, "#1E1A16", 0.8) ' change colour of next one for tint: redorange "#FF4500" ADD_HEX_STOP(fill_lin, 0.47, "#FFA500", 0.8) ' black at bottom ADD_HEX_STOP(fill_lin, 0.9, "#1E1A16", 0.8) ADD_HEX_STOP(fill_lin, 0.95, "#000000", 0.8) ' Fill background with gradient bg = RECTANGLE(win, 1, 1, 1, 1, CLASS, ITEM_RECTANGLE, "can-focus", 1, \ "line-width", 0.0, "fill_pattern", fill_lin, "stroke-color", "none", \ "antialias", 3, 0) DRAW(win, bg, 0, 0, canvas_w + 20, canvas_h + 55) ' Make frame frame = FRAME(NULL) ATTACH (win, frame, 5, 5, canvas_w + 10, canvas_h + 10) PRINT "Frame created" ' Create canvas for drawing canvas = AREA(win, 10, 10, canvas_w, canvas_h) PRINT "Canvas created" ' Create buttons and callbacks start_but = BUTTON("Go") SETPROPERTY(start_but, "tooltip-text", " Draw object. ") ATTACH(win, start_but, 5, canvas_h + 20, 80, 30) CALLBACK (start_but, DRAW_OBJECT) labl = MARK("") SETPROPERTY(labl, "use-markup", TRUE) TEXT(labl, "<span color='firebrick'><b>GFX</b></span>") ATTACH(win, labl, ((canvas_w + 20)/2) - 75, canvas_h + 20, 150, 30) PRINT "Label created" quit_but = BUTTON("Quit") SETPROPERTY(quit_but, "tooltip-text", " Quit this program. ") ATTACH(win, quit_but, canvas_w - 65, canvas_h + 20, 80, 30) CALLBACK (quit_but, QUIT_PROG) PRINT "Buttons created" END SUB
' *********************** ' END SUBS & FUNCTIONS ' ***********************
' *********************** ' MAIN ' ***********************
MK_GUI DISPLAY
' *********************** ' END MAIN ' ***********************
|
|
|
Post by vovchik on Aug 10, 2013 9:52:27 GMT 1
Dear all,
So as not to muddle the issue of how to use RBGA, this demo only draws four circles, two with standard RGB and two with RBGA (i.e. RGB but with alpha). You will see the difference...
With kind regards, vovchik
' ***************************************************** ' PROGRAM: rgbatest.bac ' PURPOSE: demo of transparency using goo gfx ' AUTHOR: vovchik (Puppy Linux forum) ' NOTES: ' DEPENDS: gcc, bacon, Alex's libgfx ' PLATFORM: Puppy Linux (actually, any *nix) ' DATE: 05-08-2013 ' *****************************************************
' *********************** ' INCLUDES ' ***********************
INCLUDE "libgfx_import.bac" INIT
' *********************** ' END INCLUDES ' ***********************
' *********************** ' INITIALIZATION ' ***********************
DECLARE canvas_w, canvas_h TYPE double canvas_w = 640 canvas_h = 400 SEED NOW
' *********************** ' END INITIALIZATION ' ***********************
' *********************** ' SUBS & FUNCTIONS ' ***********************
' ------------------ SUB QUIT_PROG() ' ------------------ QUIT END SUB
' ------------------ SUB ADD_HEX_STOP(long item, double offset, STRING colour$, double alpha ) ' ------------------ LOCAL r, g, b TYPE double colour$ = UCASE$(colour$) r = (double)(DEC(MID$(colour$, 2, 2)) / 255.0) g = (double)(DEC(MID$(colour$, 4, 2)) / 255.0) b = (double)(DEC(MID$(colour$, 6, 2)) / 255.0) PRINT "rgb: ", (double)r, " ", (double)g, " ", (double)b ADD_COLOR_STOP(item, offset, r, g, b, alpha) END SUB
' ------------------ SUB DRAW_OBJECT() ' ------------------ DISABLE(start_but) ' Information for user PRINT "Drawing object" TEXT(labl, "<span color='firebrick'><b>Please wait...</b></span>") SYNC LOCAL col$ TYPE STRING ' draw routine col$ = "#FF0000" c1 = CIRCLE (canvas, col$, 100, 100, 60, 60, 1) SETPROPERTY(c1, "antialias", 3, "line-width", 1.5) c2 = CIRCLE (canvas, col$, 200, 200, 60, 60, 1) SETPROPERTY(c2, "antialias", 3, "line-width", 1.5, "fill_color_rgba", DEC(MID$(col$, 2) & "3A")) col$ = "#FFFF00" c3 = CIRCLE (canvas, col$, 300, 100, 60, 60, 1) SETPROPERTY(c3, "antialias", 3, "line-width", 1.5) c4 = CIRCLE (canvas, col$, 400, 200, 60, 60, 1) SETPROPERTY(c4, "antialias", 3, "line-width", 1.5, "fill_color_rgba", DEC(MID$(col$, 2) & "3A")) PRINT NL$, "Indicate that drawing is ready" TEXT(labl, "<span color='firebrick'><b>Drawing ready.</b></span>") SYNC END SUB
' ------------------ SUB MK_GUI() ' ------------------ ' Create GUI root = WINDOW("RBGA Test - Bacon GFX", canvas_w + 20, canvas_h + 55, 1.0) ' Get root of window win = GETROOT(root) fill_lin = LINEAR(0, 0, 0, canvas_h + 50) ' light gray at top ADD_HEX_STOP(fill_lin, 0.0, "#000000", 0.8) ADD_HEX_STOP(fill_lin, 0.2, "#1E1A16", 0.8) ' change colour of next one for tint: redorange "#FF4500" ADD_HEX_STOP(fill_lin, 0.47, "#FFA500", 0.8) ' black at bottom ADD_HEX_STOP(fill_lin, 0.9, "#1E1A16", 0.8) ADD_HEX_STOP(fill_lin, 0.95, "#000000", 0.8) ' Fill background with gradient bg = RECTANGLE(win, 1, 1, 1, 1, CLASS, ITEM_RECTANGLE, "can-focus", 1, \ "line-width", 0.0, "fill_pattern", fill_lin, "stroke-color", "none", \ "antialias", 3, 0) DRAW(win, bg, 0, 0, canvas_w + 20, canvas_h + 55) ' Make frame frame = FRAME(NULL) ATTACH (win, frame, 5, 5, canvas_w + 10, canvas_h + 10) PRINT "Frame created" ' Create canvas for drawing canvas = AREA(win, 10, 10, canvas_w, canvas_h) PRINT "Canvas created" ' Create buttons and callbacks start_but = BUTTON("Go") SETPROPERTY(start_but, "tooltip-text", " Draw object. ") ATTACH(win, start_but, 5, canvas_h + 20, 80, 30) CALLBACK (start_but, DRAW_OBJECT) labl = MARK("") SETPROPERTY(labl, "use-markup", TRUE) TEXT(labl, "<span color='firebrick'><b>GFX</b></span>") ATTACH(win, labl, ((canvas_w + 20)/2) - 75, canvas_h + 20, 150, 30) PRINT "Label created" quit_but = BUTTON("Quit") SETPROPERTY(quit_but, "tooltip-text", " Quit this program. ") ATTACH(win, quit_but, canvas_w - 65, canvas_h + 20, 80, 30) CALLBACK (quit_but, QUIT_PROG) PRINT "Buttons created" END SUB
' *********************** ' END SUBS & FUNCTIONS ' ***********************
' *********************** ' MAIN ' ***********************
MK_GUI DISPLAY
' *********************** ' END MAIN ' ***********************
|
|
|
Post by vovchik on Aug 10, 2013 15:03:27 GMT 1
Dear all,
And our rainbow, now with alpha (RGBA)...
With kind regards, vovchik
' ***************************************************** ' PROGRAM: rainbow-fill-rgba.bac ' PURPOSE: demo of rainbow ellipse using goo gfx ' AUTHOR: vovchik (Puppy Linux forum) ' NOTES: ported example from somewhere ' DEPENDS: gcc, bacon, Alex's libgfx ' PLATFORM: Puppy Linux (actually, any *nix) ' DATE: 05-08-2013 ' *****************************************************
' *********************** ' INCLUDES ' ***********************
INCLUDE "libgfx_import.bac" INIT
' *********************** ' END INCLUDES ' ***********************
' *********************** ' INITIALIZATION ' ***********************
DECLARE canvas_w, canvas_h TYPE int canvas_w = 300 canvas_h = 300
' *********************** ' END INITIALIZATION ' ***********************
' *********************** ' SUBS & FUNCTIONS ' ***********************
' ------------------ SUB QUIT_PROG() ' ------------------ QUIT END SUB
' ------------------ SUB ADD_HEX_STOP(long item, double offset, STRING colour$, double alpha ) ' ------------------ LOCAL r, g, b TYPE double colour$ = UCASE$(colour$) r = (double)(DEC(MID$(colour$, 2, 2)) / 255.0) g = (double)(DEC(MID$(colour$, 4, 2)) / 255.0) b = (double)(DEC(MID$(colour$, 6, 2)) / 255.0) PRINT "rgb: ", (double)r, " ", (double)g, " ", (double)b ADD_COLOR_STOP(item, offset, r, g, b, alpha) END SUB
' ------------------ SUB DRAW_FRACTAL() ' ------------------ LOCAL m, q, x1, x2, x3, x4, x5, x6, x7, x8 TYPE double LOCAL y1, y2, y3, y4, y5, y6, y7, y8 TYPE double LOCAL e, mymod TYPE int LOCAL col$ TYPE STRING DISABLE(start_but) ' Information for user PRINT "Drawing..." TEXT(labl, "<span color='firebrick'><b>Please wait...</b></span>") SYNC m = -1.57 x1 = 1 y1 = 300 q = 0.00101 gx = 0.15 gy = 0.3 FOR e = 1 TO 3107 m = m + q x1 = x1 + gx * COS(m) y1 = y1 + gy * SIN(m) x2 = (x1 + 150) / 2 y2 = (y1 + 300) / 2 x3 = (x1 + x2) / 2 y3 = (y1 + y2) / 2 x4 = (x2 + 150) / 2 y4 = (y2 + 300) / 2 x5 = (x1 + x3) / 2 y5 = (y1 + y3) / 2 x6 = (x2 + x3) / 2 y6 = (y2 + y3) / 2 x7 = (x2 + x4) / 2 y7 = (y2 + y4) / 2 x8 = (x4 + 150) / 2 y8 = (y4 + 300) / 2 ' red col$ = "#F00000" l1 = LINE(canvas, col$, x1, y1, x5, y5) SETPROPERTY(l1, "antialias", 3, "line-width", 1.0, "stroke-color-rgba", \ DEC(MID$(col$, 2) & "0F"), "fill-color-rgba", DEC(MID$(col$, 2) & "0F")) ' orange col$ = "#FFA500" l2 = LINE(canvas, col$, x5, y5, x3, y3) SETPROPERTY(l2, "antialias", 3, "line-width", 1.0, "stroke-color-rgba", \ DEC(MID$(col$, 2) & "0F"), "fill-color-rgba", DEC(MID$(col$, 2) & "0F")) ' yellow col$ = "#FFFF00" l3 = LINE(canvas, col$, x3, y3, x6, y6) SETPROPERTY(l3, "antialias", 3, "line-width", 1.0, "stroke-color-rgba", \ DEC(MID$(col$, 2) & "0F"), "fill-color-rgba", DEC(MID$(col$, 2) & "0F")) ' green col$ = "#00FF00" l4 = LINE(canvas, col$, x6, y6, x2, y2) SETPROPERTY(l4, "antialias", 3, "line-width", 1.0, "stroke-color-rgba", \ DEC(MID$(col$, 2) & "0F"), "fill-color-rgba", DEC(MID$(col$, 2) & "0F")) ' blue col$ = "#0000FF" l5 = LINE(canvas, col$, x2, y2, x7, y7) SETPROPERTY(l5, "antialias", 3, "line-width", 1.0, "stroke-color-rgba", \ DEC(MID$(col$, 2) & "0F"), "fill-color-rgba", DEC(MID$(col$, 2) & "0F")) ' darkblue col$ = "#00008B" l6 = LINE(canvas, col$, x7, y7, x4, y4) SETPROPERTY(l6, "antialias", 3, "line-width", 1.0, "stroke-color-rgba", \ DEC(MID$(col$, 2) & "0F"), "fill-color-rgba", DEC(MID$(col$, 2) & "0F")) ' darkpurple col$ = "#551D78" l7 = LINE(canvas, col$, x4, y4, x8, y8) SETPROPERTY(l7, "antialias", 3, "line-width", 2.0, "stroke-color-rgba", \ DEC(MID$(col$, 2) & "0F"), "fill-color-rgba", DEC(MID$(col$, 2) & "0F")) mymod = MOD(e, 16) IF mymod = 15 THEN SYNC NEXT e PRINT "Indicate that drawing is ready" TEXT(labl, "<span color='firebrick'><b>Drawing ready.</b></span>") SYNC END SUB
' ------------------ SUB MK_GUI() ' ------------------ ' Create GUI root = WINDOW("Rainbow Demo - Bacon GFX", canvas_w + 20, canvas_h + 55, 1.0) ' Get root of window win = GETROOT(root) fill_lin = LINEAR(0, 0, 0, canvas_h + 50) ' light gray at top ADD_HEX_STOP(fill_lin, 0.0, "#000000", 0.8) ADD_HEX_STOP(fill_lin, 0.2, "#1E1A16", 0.8) ' change colour of next one for tint: redorange "#FF4500" ADD_HEX_STOP(fill_lin, 0.47, "#FFA500", 0.8) ' black at bottom ADD_HEX_STOP(fill_lin, 0.9, "#1E1A16", 0.8) ADD_HEX_STOP(fill_lin, 0.95, "#000000", 0.8) ' Fill background with gradient bg = RECTANGLE(win, 1, 1, 1, 1, CLASS, ITEM_RECTANGLE, "can-focus", 1, \ "line-width", 0.0, "fill_pattern", fill_lin, "stroke-color", "none", \ "antialias", 3, 0) ' Fill background with gradient bg = RECTANGLE(win, 1, 1, 1, 1, CLASS, ITEM_RECTANGLE, "can-focus", 1, \ "line-width", 0.0, "fill_pattern", fill_lin, "stroke-color", "none", \ "antialias", 3, 0) DRAW(win, bg, 0, 0, canvas_w + 20, canvas_h + 55) ' Make frame frame = FRAME(NULL) ATTACH (win, frame, 5, 5, canvas_w + 10, canvas_h + 10) PRINT "Frame created" ' Create canvas for drawing canvas = AREA(win, 10, 10, canvas_w, canvas_h) 'SCALE(canvas, 1, 1.5) PRINT "Canvas created" ' Create buttons and callbacks start_but = BUTTON("Go") SETPROPERTY(start_but, "tooltip-text", " Draw fractal. ") ATTACH(win, start_but, 5, canvas_h + 20, 80, 30) CALLBACK (start_but, DRAW_FRACTAL) labl = MARK("") SETPROPERTY(labl, "use-markup", TRUE) TEXT(labl, "<span color='firebrick'><b>GFX</b></span>") ATTACH(win, labl, ((canvas_w + 20)/2) - 75, canvas_h + 20, 150, 30) PRINT "Label created" quit_but = BUTTON("Quit") SETPROPERTY(quit_but, "tooltip-text", " Quit fractal program. ") ATTACH(win, quit_but, canvas_w - 65, canvas_h + 20, 80, 30) CALLBACK (quit_but, QUIT_PROG) PRINT "Buttons created" END SUB
' *********************** ' END SUBS & FUNCTIONS ' ***********************
' *********************** ' MAIN ' ***********************
MK_GUI DISPLAY
' *********************** ' END MAIN ' ***********************
|
|
|
Post by alexfish on Aug 10, 2013 20:47:46 GMT 1
Hi @ all & @ Joe have been working on the next Beta was going to be PATCH , was was due this evening , Now Not Now will be released as BETA 1.0.1 Reason the core for the all GFX goo looks stable , I think say's he Attached is binary of the G_LIST Have a play around with it , See what you think. the menu is not enabled. Question : How easy will it be to set up See The below Sample code Have Fun , as they say , this one is very much in the pink Alex SUB GET_LIST_1() LOCAL tx$ '@ the last text clicked is store : use GET_LIST(widget) tx$=GET_LIST(list_1) '@ send it to the textbox TEXT(get_list,tx$) END SUB
SUB SET_IT() '@ on edit text set the list , this is done by : SET_LIST_TEXT(G_LIST,text) . where the text is entered at the selected SET_LIST_TEXT(list_1,CHOP$(GRAB$(get_list))) PRINT " DONE"
END SUB
REM -------------------------------
root = WINDOW("Bacon GFX G-List *Rocks* ", 520, 460, 1.0) win = GETROOT(root) '@ add G_LIST : G_LIST(parent , title ,page color , x,y,width,height) list_1=G_LIST(win , "MY-LIST" ,"#83667D" , 10,10,500,415) '@ text some text , G_TEXT_LIST(G_LIST,text$ , text color) FOR t= 1 TO 100 text$= "BaCon GFX *Rocks* " & STR$(t) G_TEXT_LIST(list_1,text$ , "#DE23B6") NEXT
'@ TODO how to edit the list '@ in the lib is a FUNCTION called GET_LIST(NUMBER widget)
'@ make a textbox get_list = TEXTBOX() ATTACH(win,get_list,10,425,500,30) '@ make the callbacks CALLBACK(list_1,GET_LIST_1) CALLBACK(get_list ,SET_IT) TEXT(get_list, "Click top bar for menu , click list , click shaded below highlighted text , edit the text , Press RETURN") '@ Display for ever DISPLAY
Screen shot : Binary : in next post:
|
|
|
Post by alexfish on Aug 10, 2013 20:49:12 GMT 1
|
|
|
Post by vovchik on Aug 10, 2013 22:14:59 GMT 1
Dear Alex, I tried the binary - great list widget - and customizable..... Can't wait to try the rest. With kind regards, vovchik
|
|
|
Post by alexfish on Aug 10, 2013 22:58:25 GMT 1
Hi Vovchik As to the rest::: >>>> They be pretty much one of the same . what do not see is a con-fig bit Notice the the entry removes the new line / TRY pasting a paragraph into it and Press return // the demo has something Switched OFF Perhaps U may see GARBAGE , Can U remember the problem We had with certain CHR$ ,, well . now try it Have U look at the MEMORY usage of this little bit of Kit Have fun + BR Alex
|
|