Deleted
Deleted Member
Posts: 0
|
JAPI
May 18, 2013 22:31:29 GMT 1
Post by Deleted on May 18, 2013 22:31:29 GMT 1
I thought I would share another option to Graphics for Bacon that seems easy to use. JAPI reminds me of GTK-Server for Java. I didn't have any problems compiling the library/extension module (.so) under Ubuntu 12.04 LTS 64 bit. The generic C version should work fine with BaCon. SB JAPI Examples
|
|
Deleted
Deleted Member
Posts: 0
|
JAPI
May 20, 2013 5:44:06 GMT 1
Post by Deleted on May 20, 2013 5:44:06 GMT 1
|
|
Deleted
Deleted Member
Posts: 0
|
JAPI
May 22, 2013 20:14:03 GMT 1
Post by Deleted on May 22, 2013 20:14:03 GMT 1
Good News! I was able to compile the Swing version of JAPI for Linux which is a big improvement on the visual front. Not all the examples work but most seem to be compatible with the AWT original JAPI.jar. I need to do more testing before trying this on Windows.
|
|
|
JAPI
May 26, 2013 9:07:32 GMT 1
Post by Pjot on May 26, 2013 9:07:32 GMT 1
JRS, I already know the JAPI project, but unfortunately I do not like Java Or do you mean this JAPI project? Next time, if you find some project, can you refer to the original homepage? Also, do you have an example program for BaCon? Thanks, Peter
|
|
Deleted
Deleted Member
Posts: 0
|
JAPI
May 26, 2013 16:53:31 GMT 1
Post by Deleted on May 26, 2013 16:53:31 GMT 1
The link on the first post about JAPI on the ScriptBasic forum points to the same link you have given. I don't know of any other site for JAPI.
I planned to show some BaCon examples but the 64 bit version of JRE/IceTea doesn't look like it supports the deprecated code of JAPI and is unusable in it's current form on 64 bit Linux. The Windows 32 bit version seems to work fine with the latest JRE on that platform.
Swing examples I have downloaded work fine on both Windows and Linux and I assume the Mac using current syntax Java. I have asked Marcus that has a Java programming background to update the JAPI Java code to current release levels. I'll let you know if that happens or not.
|
|
Deleted
Deleted Member
Posts: 0
|
JAPI
Jun 8, 2013 5:26:54 GMT 1
Post by Deleted on Jun 8, 2013 5:26:54 GMT 1
I thought I would post an update on where things are with the JAPI 2.0 project. I'm able to run all the demo provided with the distribution on both Windows 32 and Linux 64 bit using the original AWT build. The SWING version has theming (LaF) issues and breaks things. Marcus of the Naalaa project is trying to fix the issues. I made over 270 deprecation upgrades to the SWING version before passing it on to Marcus. Here is something to look at until my next update. import japi.bas
j_start win = j_frame("Lorenz Butterfly") can = j_canvas(win, 640, 480) j_pack(win) j_show(win)
x = 0.0 y = 20.0 z = 20.0
j_setnamedcolorbg(can, J_BLACK) while obj <> win xx = x + 0.01 * ( -10.0 * x + 10.0 * y) yy = y + 0.01 * ( 28.0 * x - y - x * z ) zz = z + 0.01 * ( -8.0 * z / 3.0 + x * y ) j_setcolor(can, Rnd(), Rnd(), Rnd()) j_drawline(can, x*10+320, -z*10+500, xx*10+320, -zz*10+500) x = xX y = yY z = zZ obj = j_getaction() j_sleep(20) wend j_quit
|
|
|
JAPI
Jun 8, 2013 15:30:44 GMT 1
Post by Pjot on Jun 8, 2013 15:30:44 GMT 1
I am looking forward to a genuine BaCon example!
Thanks, Peter
|
|
Deleted
Deleted Member
Posts: 0
|
JAPI
Jun 8, 2013 22:33:14 GMT 1
Post by Deleted on Jun 8, 2013 22:33:14 GMT 1
The JAPI llbjapi.a and japi.h are attached. (nothing other than JRE is required) PRAGMA INCLUDE japi.h PRAGMA LDFLAGS japi PROTO j_start, j_frame, j_canvas, j_pack, j_show, j_setnamedcolorbg, j_setcolor, j_drawline, j_getaction, j_sleep, j_quit
DECLARE x, y, z, xx, yy, zz TYPE float DECLARE win, can, obj TYPE int
j_start() win = j_frame("BaCon JAPI Butterfly") can = j_canvas(win, 640, 480) j_pack(win) j_show(win)
x = 0.0 y = 20.0 z = 20.0
j_setnamedcolorbg(can, J_BLACK) WHILE obj <> win xx = x + 0.01 * ( -10.0 * x + 10.0 * y) yy = y + 0.01 * ( 28.0 * x - y - x * z ) zz = z + 0.01 * ( -8.0 * z / 3.0 + x * y ) SEED NOW j_setcolor(can, RANDOM(255), RANDOM(255), RANDOM(255)) j_drawline(can, x*10+320, -z*10+500, xx*10+320, -zz*10+500) x = xx y = yy z = zz obj = j_getaction() j_sleep(20) WEND j_quit()
Attachments:
|
|
Deleted
Deleted Member
Posts: 0
|
JAPI
Jun 9, 2013 1:12:39 GMT 1
Post by Deleted on Jun 9, 2013 1:12:39 GMT 1
' JAPI Graphic Primatives
PRAGMA INCLUDE japi.h PRAGMA LDFLAGS japi PROTO j_start, j_frame, j_canvas, j_setsize, j_setpos, j_pack, j_show, j_getaction, j_nextaction, j_sleep, j_quit PROTO j_setnamedcolor, j_translate, j_drawstring PROTO j_drawline, j_drawpolygon, j_drawrect, j_drawroundrect, j_drawcircle, j_drawoval, j_drawarc PROTO j_drawpolyline, j_fillpolygon, j_fillrect, j_fillroundrect, j_fillcircle, j_filloval, j_fillarc
DECLARE frame, canvas TYPE int DECLARE x[10] = {10,20,30,40,50,60,70,80,90,100} TYPE int DECLARE y[10] = {10,90,10,90,10,90,10,90,10,90} TYPE int
IF j_start() = J_FALSE THEN PRINT "JAPI unable to start." END END IF
jframe = j_frame("Graphic Primitives") j_setsize(jframe,720,260)
canvas = j_canvas(jframe,700,230) j_setpos(canvas,10,30)
j_show(jframe) j_pack(jframe)
j_setnamedcolor(canvas,J_BLUE)
' Normal
j_translate(canvas,10,10) j_drawline(canvas,10,10,90,90) j_drawstring(canvas,0,105,"Line")
j_translate(canvas,100,0) j_drawpolygon(canvas,10,x,y) j_drawstring(canvas,0,105,"Polygon")
j_translate(canvas,100,0) j_drawrect(canvas,10,10,80,80) j_drawstring(canvas,0,105,"Rectangle")
j_translate(canvas,100,0) j_drawroundrect(canvas,10,10,80,80,20,20) j_drawstring(canvas,0,105,"RoundRect")
j_translate(canvas,100,0) j_drawcircle(canvas,50,50,40) j_drawstring(canvas,0,105,"Circle")
j_translate(canvas,100,0) j_drawoval(canvas,50,50,40,20) j_drawstring(canvas,0,105,"Oval")
j_translate(canvas,100,0) j_drawarc(canvas,50,50,40,30,113,210) j_drawstring(canvas,0,105,"Arc")
' Filled
j_translate(canvas,-600,100) j_drawpolyline(canvas,10,x,y) j_drawstring(canvas,0,105,"Polyline")
j_translate(canvas,100,0) j_fillpolygon(canvas,10,x,y) j_drawstring(canvas,0,105,"FillPolygon")
j_translate(canvas,100,0) j_fillrect(canvas,10,10,80,80) j_drawstring(canvas,0,105,"FillRectangle")
j_translate(canvas,100,0) j_fillroundrect(canvas,10,10,80,80,20,20) j_drawstring(canvas,0,105,"FillRoundRect")
j_translate(canvas,100,0) j_fillcircle(canvas,50,50,40) j_drawstring(canvas,0,105,"FillCircle")
j_translate(canvas,100,0) j_filloval(canvas,50,50,40,20) j_drawstring(canvas,0,105,"FillOval")
j_translate(canvas,100,0) j_fillarc(canvas,50,50,40,30,113,210) j_drawstring(canvas,0,105,"FillArc")
WHILE j_nextaction() <> jframe WEND
j_quit()
|
|
Deleted
Deleted Member
Posts: 0
|
JAPI
Jun 9, 2013 5:19:27 GMT 1
Post by Deleted on Jun 9, 2013 5:19:27 GMT 1
' JAPI Meter
PRAGMA INCLUDE japi.h PRAGMA LDFLAGS japi PROTO j_start, j_frame, j_setborderlayout, j_show, j_setinsets, j_getinsets, j_setvgap PROTO j_progressbar, j_setborderpos, j_meter, j_setsize, j_show, j_getaction, j_random PROTO j_setvalue, j_sync, j_sleep, j_quit
DECLARE jframe, progress, meter, value TYPE int
IF j_start() = J_FALSE THEN PRINT "JAPI unable to start." END END IF
jframe = j_frame("BaCon") j_setborderlayout(jframe) j_setinsets(jframe,j_getinsets(jframe,J_TOP)+10,10,10,10) j_setvgap(jframe,10)
progress = j_progressbar(jframe,J_HORIZONTAL) j_setborderpos(progress,J_BOTTOM) meter = j_meter(jframe,"Volts")
j_setsize(jframe,150,170) j_show(jframe)
value = 50 WHILE j_getaction() <> jframe value = value - 1 IF j_random() > J_RANDMAX / 2 THEN value = value + 2 END IF j_setvalue(meter,value) j_setvalue(progress,value) j_sync() j_sleep(50) WEND
j_quit()
|
|
Deleted
Deleted Member
Posts: 0
|
JAPI
Jun 9, 2013 7:41:14 GMT 1
Post by Deleted on Jun 9, 2013 7:41:14 GMT 1
Click on the red light LEDs (Binary Value) to change the green digit LED. ' LED digit and light
PRAGMA INCLUDE japi.h PRAGMA LDFLAGS japi PROTO j_start, j_frame, j_setborderlayout, j_show, j_setinsets, j_getinsets, j_setvgap PROTO j_panel, j_setborderpos, j_setflowlayout, j_sethgap, j_led, j_mouselistener, j_sevensegment PROTO j_setsize, j_show, j_nextaction, j_setstate, j_getstate, j_setvalue, j_quit
DECLARE frame, seven, led[4], mouse[4], panel, obj, i, v TYPE int
IF j_start() = J_FALSE THEN PRINT "JAPI unable to start." END END IF
jframe = j_frame("BaCon") j_setborderlayout(jframe) j_setinsets(jframe,j_getinsets(jframe,J_TOP)+10,10,10,10) j_setvgap(jframe,10)
panel = j_panel(jframe) j_setborderpos(panel,J_BOTTOM) j_setflowlayout(panel,J_HORIZONTAL) j_sethgap(panel,10) FOR i=4 TO 1 STEP -1 led[i] = j_led(panel,J_ROUND,J_RED) mouse[i] = j_mouselistener(led[i],J_RELEASED) NEXT i
seven = j_sevensegment(jframe,J_GREEN)
j_setsize(jframe,150,250) j_show(jframe)
obj = 0
WHILE obj <> jframe obj = j_getaction() FOR i = 1 TO 4 IF obj = mouse[i] THEN j_setstate(led[i], j_getstate(led[i]) - 1) END IF NEXT i v = 0 IF j_getstate(led[4]) THEN v = v + 8 IF j_getstate(led[3]) THEN v = v + 4 IF j_getstate(led[2]) THEN v = v + 2 IF j_getstate(led[1]) THEN v = v + 1 j_setvalue(seven, v) WEND
j_quit()
|
|
|
JAPI
Jun 9, 2013 13:23:00 GMT 1
Post by Pjot on Jun 9, 2013 13:23:00 GMT 1
Hi jrs, Very nice! All your examples work out-of-the-box on my 64bit Linux Mint. The API does not look so complicated either. The last update of the JAPI website is from Feb 2003, so more than 10 years ago. Looks it is not maintained anymore? Do you know its current status? Thanks for this contribution, next to GTK and IUPS it is another valuable way of realizing GUI programs! BR, Peter
|
|
Deleted
Deleted Member
Posts: 0
|
JAPI
Jun 9, 2013 17:14:14 GMT 1
Post by Deleted on Jun 9, 2013 17:14:14 GMT 1
I e-mailed the author but no response. I have picked up the project and calling it JAPI 2.0 going forward. The nice thing is that we have multiple BASIC (like) language developers with interest in getting it going. (Naalaa, EGSL, ...) I registered JAPI2.com and plan to use that site for ongoing efforts. I'm still overwhelmed getting SB 2.2 released but like SB I couldn't let this project die.
I will keep you in the loop if you have interest in this for BaCon.
|
|
|
JAPI
Jun 9, 2013 20:39:56 GMT 1
Post by vovchik on Jun 9, 2013 20:39:56 GMT 1
Dear jrs,
Do you know where a 32-bit-enabled libjapi.a might be available? I am using Lucid, and ATW is simply too ugly too look at. Swing is so much nicer.
With kind regards, vovchik
|
|
Deleted
Deleted Member
Posts: 0
|
JAPI
Jun 9, 2013 21:19:54 GMT 1
Post by Deleted on Jun 9, 2013 21:19:54 GMT 1
You wouldn't happen to have a Java background by any chance? Marcus is happy with AWT and wants to put his effort in that direction. If JAPI 2.0 has any hope of rebirth, SWING is the only way to get there. Finding a Java programmer (Peter Verhas seems busy) to contribute is really the next step moving forward.
I'm planning on building both .so and .a libraries for both 32/64 bit Linux. (using current .java code)
|
|