Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Support

Pages: 1 2 [3] 4 5 ... 12
31
COM / SB COM - Excel
« on: July 24, 2014, 08:51:36 PM »
Here is an example of using the Script BASIC COM/OLE extension module with Microsoft Excel.



' Jerry's Excel Example - Script BASIC COM

IMPORT com.inc

CONST XlHAlign_xlHAlignCenter = -4108
CONST XlBorderWeight_xlMedium = -4138

' create Excel worksheet
filename = "c:\\SB22\\sbcom\\excel\\warehouse.xls"
oExcelApp = CreateObject("Excel.Application")
oWorkBook = CallByName(oExcelApp, "Workbooks", vbGet)
oExcelWorkbook = CallByName(oWorkBook, "Add")
oExcelSheet = CallByName(oExcelWorkbook, "Worksheets", vbGet, 1)

' change interior color of cells "B1:B5" rose (solid)
oRange =  CallByName(oExcelSheet, "Range", vbGet, "B1:B5")
oInterior = CallByName(oRange, "Interior", vbGet)
CallByName oInterior, "ColorIndex", vbLet, 38
CallByName oInterior, "Pattern", vbLet, "xlSolid"
ReleaseObject oRange
ReleaseObject oInterior

' put data in cell G3
oRange =  CallByName(oExcelSheet, "Range", vbGet, "G3")
CallByName oRange, "Value", vbLet, 123

' center the data in cell G3
CallByName oRange, "HorizontalAlignment", vbLet, XlHAlign_xlHAlignCenter

' Set the font attribute to BOLD in G3
oFont = CallByName(oRange, "Font", vbGet)
CallByName oFont, "Bold", vbLet, TRUE

' Change font in G3 to purple
CallByName oFont, "Color", vbLet, 0xFF00FF

' Change font in G3 to 20 pt Courier New
CallByName oFont, "Name", vbLet, "Courier New"
CallByName oFont, "Size", vbLet, 20

' Place BOLD border around cell G3
CallByName oRange, "BorderAround", vbMethod, 1, XlBorderWeight_xlMedium, 3
ReleaseObject oFont
ReleaseObject oRange

' Add long string to cell E2, short number to C1
oRange = CallByName(oExcelSheet, "Range", vbGet, "C1")
CallByName oRange, "Value", vbLet, 2
ReleaseObject oRange
oRange = CallByName(oExcelSheet, "Range", vbGet, "E2")
CallByName oRange, "Value", vbLet, "Testing long string"
ReleaseObject oRange

' Save worksheet and release Excel worksheet memory
CallByName oExcelWorkbook, "SaveAs", vbMethod, filename
CallByName oExcelWorkbook, "Close"
CallByName oExcelApp, "Quit"
ReleaseObject oExcelSheet
ReleaseObject oExcelWorkbook
ReleaseObject oWorkBook
ReleaseObject oExcelApp

32
COM / VB6 Makeover
« on: July 19, 2014, 11:40:19 PM »
There seems to be an ongoing effort to keep VB6 and COM alive. I was able to get the VB6 IDE XP themed with a manifest file. This is suppose to work on Win7 as well. There are a few things you need to add to your VB project to getting theming to work in your compiled VB application. I have also notice there are current Windows libraries that can replace outdated VB standards safely. I'm curious if there are others willing to chip in and get it tested, documented and example written?

I will keep forging ahead but some help would be appreciated.

Here is a screen shot of what a VB6 application looks like themed on Windows 7.


33
COM / Windows Web Services Functions
« on: June 26, 2014, 11:15:20 AM »
Hi Dave,

I don't mean to distract you from what you have going on but José Roca posted a link on his forum that looks interesting and something I might be able to try with your new COM interface for Script BASIC. Your thoughts?

John


34
COM / ActiveX with VB.NET
« on: June 22, 2014, 12:57:23 AM »
I was curious if Visual BASIC .NET could create controls Dave could use with his Script BASIC COM extension module. From my initial research, it looks like it can.

Create ActiveX in .NET Step by Step

How to generate an OCX activex control using VB.NET


35
Download / Script BASIC 2.2 Windows 64 bit beta release 3
« on: May 12, 2014, 12:02:59 AM »
Code: [Select]
ScriptBasic v2.2
Variation >>Win7_64_VC12<< build 3
Magic value 859001648
Node size is 16
Extension interface version is 11
Compilation: May 10 2014 18:09:25
Executable: C:\sb22_64\bin\sb64.exe

This should be the easiest Script BASIC beta install yet with everything you need from this post. Create a C:\sb22_64 directory and unzip the Script BASIC 2.2 Windows 64 bit beta (attached) within it. You will find in the bin directory a file named SCRIBA.INI. Copy that to your C:\Windows directory. From the control panel -> System -> Advanced Settings -> Environmental Settings -> System Path add C:\sb22_64\bin to it. That should be all that is needed to install the core Script BASIC environment.

In the bin directory there are two versions of Script BASIC. sb64.exe is the console mode interpreter. sbw64.exe is the Windows GUI only (used with IUP or background tasks) scripts. You will find some example scripts in the test directory. You should be able to run any of the SB scripts I have posted here on the forum.

The following steps are to install the dependences for the Script BASIC extension modules.

GFX - This is the SDL_gfx extension module. In the lib directory of the Script BASIC directory you will find a SDL_gfx.dll file that needs to go into your C:\Windows\System32 directory. (64 bit libraries) You will also need to download HERE and copy the SDL.dll file to the same directory.

IUP - This is the IUP (Portable User Interface) extension module. I have provided a subset of the IUP & CD downloads to include only the needed DLLs. These need to be copied into your C:\Windows\System32 directory.  IUP and CD DLL files.

MySQL - This is a complete MySQL (server/client) install without the install. You can unzip THIS into your root directory and follow the setup and getting started guide.

cURL - This is the cURL internet protocol interface extension module. Extract and copy the DLLs to the C:\Windows\System32 directory. The file can be downloaded HERE.

Note - You may need to rename sb64.exe back to scriba.exe as Microsoft VC12 doesn't like renaming executables.   :-\  I was getting exception errors exiting GFX examples. Renaming sb64.exe back to scriba.exe elevated the problem. MinGW doesn't seem to have this issue.


36
What's New / Script BASIC adapts C BASIC
« on: March 10, 2014, 12:30:00 PM »
I have been working on a project called C BASIC which is a set of C preprocessor #defines to make C look more like BASIC. The concept has worked out really well and compliments the macro and defines Peter Verhas initiated with the extension module API. I have merged the C BASIC defines into the basext.h (Script BASIC extension module include file) and it's now a standard extension to the Script BASIC API. The Script BASIC GFX and BBC extension modules were created using the C BASIC extension. If you would like to have a peek, the source is located on the C BASIC Bitbucket repository / project site. Creating Script BASIC extensions to the language has never been easier.

37
What's New / Script BASIC project site upgrade
« on: March 10, 2014, 12:14:39 AM »
I'm getting close to a Script BASIC 2.2 release. As part of that milestone, I'm doing a makeover of the site. I would like to clean up the documentation and tidy up the source before the release. I'm also going though the member list and will be removing folks that haven't posted anything in the first round. This forum is for active Script BASIC users that wish to participate in the open source project. There is nothing being held back from non-members. You just can't participate with the other users here on the forum.

I would like to do a head count of current Script BASIC users. Please post a reply before the end of March to this thread indicating your interest in the project. This will assure that your account is not removed. It would be great if you could also let the rest of the members know how you use Script BASIC.


38
What's New / ScriptBasic GFX
« on: February 25, 2014, 03:26:29 PM »
I have created a ScriptBasic extension module from the SDL_gfx library. Attached are the binary and examples for Ubuntu 64 bit and Windows 32 bit. This version is primary for testing the SDL_gfx interface. It only supports the main screen surface at this time. The next installment will have a surface management system which any function can act upon. This will be the lead-in to sprites. The current source to the ScriptBasic GFX extension module is on the C BASIC Bitbucket Repository and can be built using the ScriptBasic 2.1 header files. SDL 1.2 installed is a prerequisite.



Code: Script BASIC
  1. ' ScriptBasic GFX - Alpha Circles
  2.  
  3. IMPORT gfx.inc
  4.  
  5. scrn = gfx::Window(640, 480, "ScriptBasic GFX - Alpha Circles")
  6. ' Random Value Arrays
  7. RANDOMIZE(gfx::Time())
  8. FOR i = 0 TO 512
  9.   rx[i] = RND() % 640
  10.   ry[i] = 60 + RND() % 480 - 80
  11.   rz[i] = RND() % 64
  12.   rr[i] = RND() AND  255
  13.   rg[i] = RND() AND  255
  14.   rb[i] = RND() AND  255
  15.   af = rx[i] / 640
  16.   ra[i] = INT(255 * af)
  17. NEXT
  18.  
  19. ts = gfx::Time()
  20. FOR i = 0 TO 512
  21.   gfx::filledCircleRGBA scrn, rx[i], ry[i], rz[i], rr[i], rg[i], rb[i], ra[i]
  22. NEXT
  23. te = gfx::Time()
  24. gfx::stringColor scrn, 20, 15, "Time: " & FORMAT("%.4f",(te-ts)/1000) & " Seconds." & CHR(0), 0xffffffff
  25. gfx::Update
  26. WHILE gfx::KeyName(1) <> "+escape"
  27. WEND
  28. gfx::Close
  29.  



Code: Script BASIC
  1. ' ScriptBasic GFX - Alpha Thick Line
  2.  
  3. IMPORT gfx.inc
  4.  
  5. scrn = gfx::Window(640, 480, "ScriptBasic GFX - Alpha Thick Line")
  6. ' Random Value Arrays
  7. RANDOMIZE(gfx::Time())
  8. FOR i = 0 TO 512
  9.   rx[i] = RND() % 640
  10.   ry[i] = 60 + RND() % 480 - 80
  11.   lw[i] = 2 + RND() % 7
  12.   rr[i] = RND() AND  255
  13.   rg[i] = RND() AND  255
  14.   rb[i] = RND() AND  255
  15.   af = rx[i] / 640
  16.   ra[i] = INT(255 * af)
  17. NEXT
  18. ts = gfx::Time()
  19. FOR i = 0 TO 512 STEP 5
  20.   gfx::thickLineRGBA scrn, rx[i], ry[i], rx[i+1], ry[i+1], lw[i], rr[i], rg[i], rb[i], ra[i]
  21. NEXT
  22. te = gfx::Time()
  23. gfx::stringColor scrn, 20, 15,"Time: " & FORMAT("%.4f",(te-ts)/1000) & " Seconds." & CHR(0), 0xffffffff
  24. gfx::Update
  25. WHILE gfx::KeyName(1) <> "+escape"
  26. WEND
  27. gfx::Close
  28.  




Code: Script BASIC
  1. ' ScriptBasic GFX - Alpha Bezier Curve
  2.  
  3. IMPORT gfx.inc
  4.  
  5. ' Random Value Arrays
  6. scrn = gfx::Window(640, 480, "ScriptBasic GFX - Alpha Bezier")
  7. RANDOMIZE(gfx::Time())
  8. FOR i = 0 TO 512
  9.   rx[i] = RND() % 640/2
  10.   rxx[i] = 640/2 + rx[i]  
  11.   ry[i] = 60 + RND() % 480 - 80
  12.   lw[i] = 2 + RND() % 7
  13.   rr[i] = RND() AND  255
  14.   rg[i] = RND() AND  255
  15.   rb[i] = RND() AND  255
  16.   af = rx[i] / 640
  17.   ra[i] = INT(255 * af)
  18. NEXT
  19. ts = gfx::Time()
  20. FOR i = 0 TO 512-3 STEP 3
  21.   a1[0] = rxx[i]
  22.   a1[1] = rxx[i + 1]
  23.   a1[2] = rxx[i + 2]
  24.   a2[0] = ry[i]
  25.   a2[1] = ry[i + 1]
  26.   a2[2] = ry[i + 2]
  27.   gfx::bezierRGBA scrn, a1, a2, 3, 100, rr[i], rg[i], rb[i], ra[i]
  28. NEXT
  29. te = gfx::Time()
  30. gfx::stringColor scrn, 20, 15,"Time: " & FORMAT("%.4f",(te-ts)/1000) & " Seconds." & CHR(0), 0xffffffff
  31. gfx::Update
  32. WHILE gfx::KeyName(1) <> "+escape"
  33. WEND
  34. gfx::Close
  35.  



Code: Script BASIC
  1. ' ScriptBasic GFX - Alpha Polygon
  2.  
  3. IMPORT gfx.inc
  4.  
  5. ' Random Value Arrays
  6. scrn = gfx::Window(640, 480, "ScriptBasic GFX - Alpha Polygon")
  7. RANDOMIZE(gfx::Time())
  8. FOR i = 0 TO 512
  9.   rx[i] = RND() % 640/2
  10.   rxx[i] = 640/2 + rx[i]  
  11.   ry[i] = 60 + RND() % 480 - 80
  12.   lw[i] = 2 + RND() % 7
  13.   rr[i] = RND() AND  255
  14.   rg[i] = RND() AND  255
  15.   rb[i] = RND() AND  255
  16.   af = rx[i] / 640
  17.   ra[i] = INT(255 * af)
  18. NEXT
  19. ts = gfx::Time()
  20. FOR i = 0 TO 128-5 STEP 5
  21.   a1[0] = rxx[i]
  22.   a1[1] = rxx[i + 1]
  23.   a1[2] = rxx[i + 2]
  24.   a1[3] = rxx[i + 3]
  25.   a1[4] = rxx[i + 4]    
  26.   a2[0] = ry[i]
  27.   a2[1] = ry[i + 1]
  28.   a2[2] = ry[i + 2]
  29.   a2[3] = ry[i + 3]
  30.   a2[4] = ry[i + 4]    
  31.   gfx::polygonRGBA scrn, a1, a2, 5, rr[i], rg[i], rb[i], 255
  32. NEXT
  33. te = gfx::Time()
  34. gfx::stringColor scrn, 20, 15,"Time: " & FORMAT("%.4f",(te-ts)/1000) & " Seconds." & CHR(0), 0xffffffff
  35. gfx::Update
  36. WHILE gfx::KeyName(1) <> "-escape"
  37. WEND
  38. gfx::Close
  39.  



Code: Script BASIC
  1. ' ScriptBasic GFX - Textured Polygon
  2.  
  3. IMPORT gfx.inc
  4.  
  5. scrn = gfx::Window(640, 480, "ScriptBasic GFX - Texured Polygon")
  6. a1[0] = 640/4
  7. a1[1] = 640/2
  8. a1[2] = a1[0] + a1[1]
  9. a2[0] = 480/4*3
  10. a2[1] = 480/4
  11. a2[2] = a2[0]
  12. gfx::texturedPolygon scrn, a1, a2, 3, "texture.bmp", 0, 0
  13. gfx::Update
  14. WHILE gfx::KeyName(1) <> "+escape"
  15. WEND
  16. gfx::Close
  17.  



Code: Script BASIC
  1. ' ScriptBasic GFX - Fonts & Rotation
  2.  
  3. IMPORT gfx.inc
  4. DECLARE SUB LoadFont ALIAS "loadstring" LIB "t"
  5.  
  6. font_5x7 = LoadFont("Fonts/5x7.fnt")
  7. font_6x10 = LoadFont("Fonts/6x10.fnt")
  8. font_7x13 = LoadFont("Fonts/7x13.fnt")
  9. font_9x15 = LoadFont("Fonts/9x15.fnt")
  10. font_10x20 = LoadFont("Fonts/10x20.fnt")
  11.  
  12. scrn = gfx::Window(640, 480, "ScriptBasic GFX - Font & Rotation")
  13. gfx::FontRotation 0
  14. gfx::SetFont font_5x7, 5, 7
  15. gfx::stringColor scrn, 20, 20,"Font 5x7" & CHR(0), 0xffffffff
  16. gfx::SetFont font_6x10, 6, 10
  17. gfx::stringColor scrn, 20, 30,"Font 6x10" & CHR(0), 0xffffffff
  18. gfx::SetFont font_7x13, 7, 13
  19. gfx::stringColor scrn, 20, 40,"Font 7x13" & CHR(0), 0xffffffff
  20. gfx::SetFont font_9x15, 9, 15
  21. gfx::stringColor scrn, 20, 55,"Font 9x15" & CHR(0), 0xffffffff
  22. gfx::SetFont font_10x20, 10, 20
  23. gfx::FontRotation 2
  24. gfx::stringColor scrn, 110, 70,"Font 10x20" & CHR(0), 0xffffffff
  25. gfx::Update
  26. WHILE gfx::KeyName(1) <> "+escape"
  27. WEND
  28. gfx::Close
  29.  



Code: Script BASIC
  1. ' ScriptBasic GFX - Frame rate controlled circles
  2.  
  3. IMPORT gfx.inc
  4.  
  5. scrn = gfx::Window(640, 480, "ScriptBasic GFX - FPS Circles")
  6. ' Random Value Arrays
  7. RANDOMIZE(gfx::Time())
  8. FOR i = 0 TO 512
  9.   rx[i] = RND() % 640
  10.   ry[i] = 60 + RND() % 480 - 80
  11.   rz[i] = RND() % 64
  12.   rr[i] = RND() AND  255
  13.   rg[i] = RND() AND  255
  14.   rb[i] = RND() AND  255
  15.   af = rx[i] / 640
  16.   ra[i] = INT(255 * af)
  17. NEXT
  18. gfx::SDL_initFramerate
  19. i = 0
  20. REPEAT
  21.   gfx::filledCircleRGBA scrn, rx[i], ry[i], rz[i], rr[i], rg[i], rb[i], 255
  22.   i += 1
  23.   IF i > 512 THEN i = 0
  24.   gfx::Update
  25.   gfx::SDL_framerateDelay
  26.   gfx::stringColor scrn, 20, 15,"FPS: " & gfx::SDL_getFramerate() & CHR(0), 0xffffffff  
  27. UNTIL gfx::KeyName(0) = "+escape"
  28. gfx::Close
  29.  



Code: Script BASIC
  1. ' ScriptBasic GFX - Alpha Pie
  2.  
  3. IMPORT gfx.inc
  4.  
  5. scrn = gfx::Window(640, 480, "ScriptBasic GFX - Alpha Pie")
  6. ' Random Value Arrays
  7. RANDOMIZE(gfx::Time())
  8. FOR i = 0 TO 512
  9.   rx[i] = RND() % 640
  10.   ry[i] = 60 + RND() % 480 - 80
  11.   rz[i] = RND() % 100
  12.   a1[i] = RND() % 360
  13.   a2[i] = RND() % 360
  14.   rr[i] = RND() AND  255
  15.   rg[i] = RND() AND  255
  16.   rb[i] = RND() AND  255
  17.   af = rx[i] / 640
  18.   ra[i] = INT(255 * af)
  19. NEXT
  20. ts = gfx::Time()
  21. FOR i = 0 TO 512 STEP 2
  22.   gfx::filledPieRGBA scrn, rx[i], ry[i], rz[i], a1[i], a2[i], rr[i], rg[i], rb[i], ra[i]
  23. NEXT  
  24. te = gfx::Time()
  25. gfx::stringColor scrn, 20, 15,"Time: " & FORMAT("%.4f",(te-ts)/1000) & " Seconds." & CHR(0), 0xffffffff
  26. gfx::Update scrn
  27. WHILE gfx::KeyName(1) <> "+escape"
  28. WEND
  29. gfx::Close
  30.  

I created a gfx.inc module IMPORT file for the ScriptBasic GFX extension module.

Code: Script BASIC
  1. MODULE GFX
  2.  
  3. DECLARE SUB    ::Window                    ALIAS     "gfx_Window"                    LIB  "gfx"
  4. DECLARE SUB    ::Close                     ALIAS     "gfx_Close"                     LIB  "gfx"
  5. DECLARE SUB    ::Update                    ALIAS     "gfx_Update"                    LIB  "gfx"
  6. DECLARE SUB    ::ClearScreen               ALIAS     "gfx_ClearScreen"               LIB  "gfx"
  7. DECLARE SUB    ::SDL_SetClipRect           ALIAS     "gfx_SDL_SetClipRect"           LIB  "gfx"
  8. DECLARE SUB    ::Time                      ALIAS     "gfx_Time"                      LIB  "gfx"
  9. DECLARE SUB    ::Shift                     ALIAS     "gfx_Shift"                     LIB  "gfx"
  10. DECLARE SUB    ::Rotate                    ALIAS     "gfx_Rotate"                    LIB  "gfx"
  11. DECLARE SUB    ::GetKey                    ALIAS     "gfx_GetKey"                    LIB  "gfx"
  12. DECLARE SUB    ::WaitKey                   ALIAS     "gfx_WaitKey"                   LIB  "gfx"
  13. DECLARE SUB    ::KeyName                   ALIAS     "gfx_KeyName"                   LIB  "gfx"
  14. DECLARE SUB    ::Mouse                     ALIAS     "gfx_Mouse"                     LIB  "gfx"
  15. DECLARE SUB    ::pixelColor                ALIAS     "gfx_pixelColor"                LIB  "gfx"
  16. DECLARE SUB    ::pixelRGBA                 ALIAS     "gfx_pixelRGBA"                 LIB  "gfx"
  17. DECLARE SUB    ::hlineColor                ALIAS     "gfx_hlineColor"                LIB  "gfx"
  18. DECLARE SUB    ::hlineRGBA                 ALIAS     "gfx_hlineRGBA"                 LIB  "gfx"
  19. DECLARE SUB    ::vlineColor                ALIAS     "gfx_vlineColor"                LIB  "gfx"
  20. DECLARE SUB    ::vlineRGBA                 ALIAS     "gfx_vlineRGBA"                 LIB  "gfx"
  21. DECLARE SUB    ::rectangleColor            ALIAS     "gfx_rectangleColor"            LIB  "gfx"
  22. DECLARE SUB    ::rectangleRGBA             ALIAS     "gfx_rectangleRGBA"             LIB  "gfx"
  23. DECLARE SUB    ::roundedRectangleColor     ALIAS     "gfx_roundedRectangleColor"     LIB  "gfx"
  24. DECLARE SUB    ::roundedRectangleRGBA      ALIAS     "gfx_roundedRectangleRGBA"      LIB  "gfx"
  25. DECLARE SUB    ::boxColor                  ALIAS     "gfx_boxColor"                  LIB  "gfx"
  26. DECLARE SUB    ::boxRGBA                   ALIAS     "gfx_boxRGBA"                   LIB  "gfx"
  27. DECLARE SUB    ::roundedBoxColor           ALIAS     "gfx_roundedBoxColor"           LIB  "gfx"
  28. DECLARE SUB    ::roundedBoxRGBA            ALIAS     "gfx_roundedBoxRGBA"            LIB  "gfx"
  29. DECLARE SUB    ::lineColor                 ALIAS     "gfx_lineColor"                 LIB  "gfx"
  30. DECLARE SUB    ::lineRGBA                  ALIAS     "gfx_lineRGBA"                  LIB  "gfx"
  31. DECLARE SUB    ::aalineColor               ALIAS     "gfx_aalineColor"               LIB  "gfx"
  32. DECLARE SUB    ::aalineRGBA                ALIAS     "gfx_aalineRGBA"                LIB  "gfx"
  33. DECLARE SUB    ::thickLineColor            ALIAS     "gfx_thickLineColor"            LIB  "gfx"
  34. DECLARE SUB    ::thickLineRGBA             ALIAS     "gfx_thickLineRGBA"             LIB  "gfx"
  35. DECLARE SUB    ::circleColor               ALIAS     "gfx_circleColor"               LIB  "gfx"
  36. DECLARE SUB    ::circleRGBA                ALIAS     "gfx_circleRGBA"                LIB  "gfx"
  37. DECLARE SUB    ::arcColor                  ALIAS     "gfx_arcColor"                  LIB  "gfx"
  38. DECLARE SUB    ::arcRGBA                   ALIAS     "gfx_arcRGBA"                   LIB  "gfx"
  39. DECLARE SUB    ::aacircleColor             ALIAS     "gfx_aacircleColor"             LIB  "gfx"
  40. DECLARE SUB    ::aacircleRGBA              ALIAS     "gfx_aacircleRGBA"              LIB  "gfx"
  41. DECLARE SUB    ::filledCircleColor         ALIAS     "gfx_filledCircleColor"         LIB  "gfx"
  42. DECLARE SUB    ::filledCircleRGBA          ALIAS     "gfx_filledCircleRGBA"          LIB  "gfx"
  43. DECLARE SUB    ::ellipseColor              ALIAS     "gfx_ellipseColor"              LIB  "gfx"
  44. DECLARE SUB    ::ellipseRGBA               ALIAS     "gfx_ellipseRGBA"               LIB  "gfx"
  45. DECLARE SUB    ::aaellipseColor            ALIAS     "gfx_aaellipseColor"            LIB  "gfx"
  46. DECLARE SUB    ::aaellipseRGBA             ALIAS     "gfx_aaellipseRGBA"             LIB  "gfx"
  47. DECLARE SUB    ::filledEllipseColor        ALIAS     "gfx_filledEllipseColor"        LIB  "gfx"
  48. DECLARE SUB    ::filledEllipseRGBA         ALIAS     "gfx_filledEllipseRGBA"         LIB  "gfx"
  49. DECLARE SUB    ::pieColor                  ALIAS     "gfx_pieColor"                  LIB  "gfx"
  50. DECLARE SUB    ::pieRGBA                   ALIAS     "gfx_pieRGBA"                   LIB  "gfx"
  51. DECLARE SUB    ::filledPieColor            ALIAS     "gfx_filledPieColor"            LIB  "gfx"
  52. DECLARE SUB    ::filledPieRGBA             ALIAS     "gfx_filledPieRGBA"             LIB  "gfx"
  53. DECLARE SUB    ::trigonColor               ALIAS     "gfx_trigonColor"               LIB  "gfx"
  54. DECLARE SUB    ::trigonRGBA                ALIAS     "gfx_trigonRGBA"                LIB  "gfx"
  55. DECLARE SUB    ::aatrigonColor             ALIAS     "gfx_aatrigonColor"             LIB  "gfx"
  56. DECLARE SUB    ::aatrigonRGBA              ALIAS     "gfx_aatrigonRGBA"              LIB  "gfx"
  57. DECLARE SUB    ::filledTrigonColor         ALIAS     "gfx_filledTrigonColor"         LIB  "gfx"
  58. DECLARE SUB    ::filledTrigonRGBA          ALIAS     "gfx_filledTrigonRGBA"          LIB  "gfx"
  59. DECLARE SUB    ::polygonColor              ALIAS     "gfx_polygonColor"              LIB  "gfx"
  60. DECLARE SUB    ::polygonRGBA               ALIAS     "gfx_polygonRGBA"               LIB  "gfx"
  61. DECLARE SUB    ::aapolygonColor            ALIAS     "gfx_aapolygonColor"            LIB  "gfx"
  62. DECLARE SUB    ::aapolygonRGBA             ALIAS     "gfx_aapolygonRGBA"             LIB  "gfx"
  63. DECLARE SUB    ::filledPolygonColor        ALIAS     "gfx_filledPolygonColor"        LIB  "gfx"
  64. DECLARE SUB    ::filledPolygonRGBA         ALIAS     "gfx_filledPolygonRGBA"         LIB  "gfx"
  65. DECLARE SUB    ::texturedPolygon           ALIAS     "gfx_texturedPolygon"           LIB  "gfx"
  66. DECLARE SUB    ::bezierColor               ALIAS     "gfx_bezierColor"               LIB  "gfx"
  67. DECLARE SUB    ::bezierRGBA                ALIAS     "gfx_bezierRGBA"                LIB  "gfx"
  68. DECLARE SUB    ::SetFont                   ALIAS     "gfx_SetFont"                   LIB  "gfx"
  69. DECLARE SUB    ::FontRotation              ALIAS     "gfx_FontRotation"              LIB  "gfx"
  70. DECLARE SUB    ::characterColor            ALIAS     "gfx_characterColor"            LIB  "gfx"
  71. DECLARE SUB    ::characterRGBA             ALIAS     "gfx_characterRGBA"             LIB  "gfx"
  72. DECLARE SUB    ::stringColor               ALIAS     "gfx_stringColor"               LIB  "gfx"
  73. DECLARE SUB    ::stringRGBA                ALIAS     "gfx_stringRGBA"                LIB  "gfx"
  74. DECLARE SUB    ::SDL_initFramerate         ALIAS     "gfx_SDL_initFramerate"         LIB  "gfx"
  75. DECLARE SUB    ::SDL_getFramerate          ALIAS     "gfx_SDL_getFramerate"          LIB  "gfx"
  76. DECLARE SUB    ::SDL_setFramerate          ALIAS     "gfx_SDL_setFramerate"          LIB  "gfx"
  77. DECLARE SUB    ::SDL_framerateDelay        ALIAS     "gfx_SDL_framerateDelay"        LIB  "gfx"
  78. DECLARE SUB    ::CreateSurface             ALIAS     "gfx_CreateSurface"             LIB  "gfx"
  79. DECLARE SUB    ::FreeSurface               ALIAS     "gfx_FreeSurface"               LIB  "gfx"
  80. DECLARE SUB    ::BlitSurface               ALIAS     "gfx_BlitSurface"               LIB  "gfx"
  81. DECLARE SUB    ::LoadBMP                   ALIAS     "gfx_LoadBMP"                   LIB  "gfx"
  82.  
  83. END MODULE
  84.  

The following keyboard and mouse functions are available for polling and waiting for events.

  • gfx_Mouse(0) - Waits for mouse movement and returns X position.
  • gfx_Mouse(1) - Waits for mouse movement and returns Y position.
  • gfx_Mouse(2) - Polls for a mouse button press event and returns.
  • gfx_Mouse(3) - Waits for a mouse button to be pressed then returns.
  • gfx_GetKey(0) - Polls for a key press event and returns a unicode value
  • gfx_GetKey(1) - Waits for a key to be pressed then returns a unicode value
  • gfx_GetKey(2) - Polls for a key press event and returns a keycode value
  • gfx_GetKey(3) - Waits for a key to be pressed then returns a keycode value
  • gfx_GetKey(4) - Polls for a key press event and returns a scancode value
  • gfx_GetKey(5) - Waits for a key to be pressed then returns a scancode value
  • gfx_KeyName(0) - (not new) Polls for key up/down events and returns the key name with a +=dn / -=up prefix
  • gfx_KeyName(1) - (not new) Waits for a key up/down event and returns the key name with a +=dn / -=up prefix
  • gfx_ClearScreen(n) - Clears the screen with the passed (n) color value in the format of 0xRRGGBB



Here is an example of typing abc<left shift hold>ABC<ESC> for each of the gfx_GetKey(n) modes.

UNICODE
jrs@laptop:~/sb/sb22/sdl$ scriba getkey.sb
Unicode: 97 Character: a
Unicode: 98 Character: b
Unicode: 99 Character: c
Unicode: 0 Character:
Unicode: 65 Character: A
Unicode: 66 Character: B
Unicode: 67 Character: C
Unicode: 27 Character: 
jrs@laptop:~/sb/sb22/sdl$

KeyCode
jrs@laptop:~/sb/sb22/sdl$ scriba getkey.sb
Keycode: 97 Character: a
Keycode: 98 Character: b
Keycode: 99 Character: c
Keycode: 304 Character: 0
Keycode: 97 Character: a
Keycode: 98 Character: b
Keycode: 99 Character: c
Keycode: 27 Character: 
jrs@laptop:~/sb/sb22/sdl$

ScanCode
jrs@laptop:~/sb/sb22/sdl$ scriba getkey.sb
Scancode: 38 Character: &
Scancode: 56 Character: 8
Scancode: 54 Character: 6
Scancode: 50 Character: 2
Scancode: 38 Character: &
Scancode: 56 Character: 8
Scancode: 54 Character: 6
Scancode: 9 Character:
jrs@laptop:~/sb/sb22/sdl$

gfx_KeyName (SDL_GetKeyName +keydown | -keyup)
jrs@laptop:~/sb/sb22/sdl$ scriba getkey.sb
Key Name: +a
Key Name: -a
Key Name: +b
Key Name: -b
Key Name: +c
Key Name: -c
Key Name: +left shift
Key Name: +a
Key Name: -a
Key Name: +b
Key Name: -b
Key Name: +c
Key Name: -c
Key Name: -left shift
Key Name: +escape
Key Name: -escape
jrs@laptop:~/sb/sb22/sdl$

39
What's New / ScriptBasic SDL extension module
« on: December 21, 2013, 09:11:58 PM »
I have created a SDL extension module for drawing 2D graphic primitives. I plan to expand of the SDL extension module with sprites, a terminal and other SDL related API functions. I hope to have the SDL extension module completed for the ScriptBasic 2.2 release.



Code: [Select]
' ScriptBasic SDL_Draw Example

DECLARE SUB Window ALIAS "SB_Window" LIB "sdl"
DECLARE SUB RGB ALIAS "SB_RGB" LIB "sdl"
DECLARE SUB WaitKey ALIAS "SB_WaitKey" LIB "sdl"
DECLARE SUB Ticks ALIAS "SB_Ticks" LIB "sdl"
DECLARE SUB UpdateRect ALIAS "SB_UpdateRect" LIB "sdl"
DECLARE SUB CLS ALIAS "SB_CLS" LIB "sdl"
DECLARE SUB Draw_Pixel ALIAS "SB_Draw_Pixel" LIB "sdl"
DECLARE SUB Draw_Line ALIAS "SB_Draw_Line" LIB "sdl"
DECLARE SUB Draw_Circle ALIAS "SB_Draw_Circle" LIB "sdl"
DECLARE SUB Draw_FillCircle ALIAS "SB_Draw_FillCircle" LIB "sdl"
DECLARE SUB Draw_HLine ALIAS "SB_Draw_HLine" LIB "sdl"
DECLARE SUB Draw_VLine ALIAS "SB_Draw_VLine" LIB "sdl"
DECLARE SUB Draw_Rect ALIAS "SB_Draw_Rect" LIB "sdl"
DECLARE SUB Draw_FillRect ALIAS "SB_Draw_FillRect" LIB "sdl"
DECLARE SUB Draw_Ellipse ALIAS "SB_Draw_Ellipse" LIB "sdl"
DECLARE SUB Draw_FillEllipse ALIAS "SB_Draw_FillEllipse" LIB "sdl"
DECLARE SUB Draw_Round ALIAS "SB_Draw_Round" LIB "sdl"
DECLARE SUB Draw_FillRound ALIAS "SB_Draw_FillRound" LIB "sdl"

Window(640, 480, "ScriptBasic SDL_Draw Example")
c_white = RGB(255, 255, 255)
c_gray = RGB(200, 200, 200)
c_dgray = RGB(64, 64, 64)
c_cyan = RGB(32, 255, 255)
Draw_Line(100, 100, 30, 0, c_white)
Draw_Line(30, 0, 100, 100, c_white)
Draw_Line(100, 100, 30, 0, c_white)
Draw_Line(30, 0, 100, 100, c_white)
Draw_Line(0, 0, 100, 100, c_white)
Draw_Line(100, 100, 300, 200, c_white)
Draw_Line(200, 300, 250, 400, RGB(128, 128, 255))
Draw_Line(500, 50, 600, 70, RGB(128, 255, 128))
Draw_Line(500, 50, 600, 70, RGB(128, 255, 128))
Draw_Circle(100, 100, 50, c_white)
Draw_Circle(150, 150, 5, c_white)
Draw_Circle(150, 150, 4, RGB(64, 64, 64))
Draw_Circle(150, 150, 3, RGB(255, 0, 0))
Draw_Circle(150, 150, 2, RGB(0, 255, 0))
Draw_Circle(150, 150, 1, RGB(0, 0, 255))
Draw_Line(500, 100, 600, 120, RGB(128, 255, 128))
Draw_Circle(601, 121, 2, c_white)
Draw_Circle(400, 200, 2, c_white)
Draw_Line(400, 200, 409, 200, c_white)
Draw_Circle(409, 200, 2, c_white)
Draw_Line(400, 200, 400, 250, c_white)
Draw_Circle(400, 250, 2, c_white)
Draw_Line(409, 200, 400, 250, c_white)
Draw_Line(400, 300, 409, 300, c_gray)
Draw_Line(400, 300, 400, 350, c_gray)
Draw_Line(409,300, 400, 350, c_dgray)
Draw_Rect(398, 298, 4, 4, c_cyan)
Draw_Rect(407, 298, 4, 4, c_cyan)
Draw_Rect(398, 348, 4, 4, c_cyan)
Draw_HLine(10, 400, 50, c_white)
Draw_VLine(60, 400, 360, c_white)
Draw_Rect(500, 400, 50, 50, c_white)
Draw_Pixel(510, 410, c_white)
Draw_Pixel(520, 420, RGB(255, 0, 0))
Draw_Pixel(530, 430, RGB(0, 255, 0))
Draw_Pixel(540,440, RGB(0, 0, 255))
Draw_Ellipse(100, 300, 60, 30, c_white)
Draw_FillEllipse(300, 300, 30, 60, RGB(64, 64, 200))
Draw_Ellipse(300, 300, 30, 60, RGB(255, 0, 0))
Draw_Round(200, 20, 70, 50, 10, c_white)
Draw_Round(300, 20, 70, 50, 20, RGB(255, 0, 0))
Draw_FillRound(390, 20, 70, 50, 20, RGB(255, 0, 0))
Draw_Round(390, 20, 70, 50, 20, c_cyan)
Draw_Rect(499, 199, 52, 72, RGB(255, 255, 0))
Draw_FillRect(500, 200, 50, 70, RGB(64, 200, 64))
Draw_FillCircle(500, 330, 30, c_cyan)
  
UpdateRect

WaitKey



Code: [Select]
' ScriptBasic Circle

DECLARE SUB Window ALIAS "SB_Window" LIB "sdl"
DECLARE SUB WaitKey ALIAS "SB_WaitKey" LIB "sdl"
DECLARE SUB UpdateRect ALIAS "SB_UpdateRect" LIB "sdl"
DECLARE SUB RGB ALIAS "SB_RGB" LIB "sdl"
DECLARE SUB CLS ALIAS "SB_CLS" LIB "sdl"
DECLARE SUB Draw_Circle ALIAS "SB_Draw_Circle" LIB "sdl"

Window 800, 600, "ScriptBasic Circle"
w = 400
h = 300
CLS(RGB(255, 255, 255))
black = RGB(0, 0, 0)
FOR i = 0 TO 130 STEP 10
  Draw_Circle w - i, h + i, i, black
  Draw_Circle w + i, h - i, i, black
  Draw_Circle w + i, h + i, i, black
  Draw_Circle w - i, h - i, i, black
NEXT
UpdateRect
WaitKey

40
What's New / ScriptBasic LiveDev
« on: October 02, 2013, 01:40:43 PM »
ScriptBasic developers and advocates,

I have setup a Cloud9 IDE online development interface for the ScriptBasic project. I currently have the ScriptBasic 2.2 runtime environment working and plan a source code workspace with a Github interface. (stay tuned for announcement)

Here is the runtime project site and you need at least a FREE membership to Cloud9 IDE for access. Leave me a message here with your C9IDE user ID that you would like R/W access and ability to create example programs and test the SB 2.2 pre-release.

https://c9.io/scriptbasic/sb22

FYI - If your only interest is to try ScriptBasic 2.2 and don't want to sign up for Cloud9 IDE, the CompileOnline.com site gives you instance access to the ScriptBasic IDE to run your scripts without having to join a thing.

Note: CompileOnline.com only supports SQLite3 and not MySQL.






41
Download / ScriptBasic 2.2 pre-release runtime downloads (Windows/Linux)
« on: September 23, 2013, 11:46:01 AM »
There seems to be some confusion where to get the latest ScriptBasic 2.2 pre-release candidates for Windows and Linux so I created this sticky in the downloads section and will keep it updated as we come closer to an official release. (which will include source and documentation) Most of the work done for the 2.2 release is in the form of extension modules contributed by Armando I. Rivera (AIR) and updating 3rd party libraries to current levels. Another goal with the 2.2 release is to create both 32 and 64 bit versions of ScriptBasic for both Windows and Linux. (popular distributions) As a bonus I hope to have something for Android Linux with a SDL & JNI option. (stay tuned for announcements)

I'm confident that ScriptBasic core continues to be rock solid. The goal with this pre-release is to shake out any issues with the extensions modules and their updated library interfaces. I'm working hard on wrapping up the IUP extension module and working with Charles on DLLC.

Note: The www.scriptbasic.com site is not the open source project site and is Peter Verhas's (author) static snapshot of where he left of with the project. Using code from that site is ancient and more than likely not going to work on current versions of the OS. The Windows 2.00b version may still work.

42
What's New / ScriptBasic4Android
« on: August 04, 2013, 01:24:56 AM »
I was able to compile ScriptBasic native on Android Linux along with the runtime libraries. (static and dynamic) This was done on my stock Samsung Galaxy Tab 2 10.1 tablet. (non-rooted)


43
What's New / ScriptBasic 2.2 Beta Release
« on: July 22, 2013, 10:51:36 AM »
I hope to have a ScriptBasic 2.2 source beta release with runtime versions for the following platforms posted soon.

  • Windows 32 - make for VC10 and MinGW-gcc
  • Ubuntu 64 - make gcc (12.04 LTS)
  • Debian 64 - make gcc (7.1)
  • CentOS 64 - make gcc (6.4)


The above binary runtime versions are available as attachments to various posts on this forum. My goal today is to make the above set available as an attachment to this post. I'm confident that core ScriptBasic in it's 2.2 form continues to be production stable and bug free. (over 10 years of diverse use in various applications on multiple platforms)

44
Download / Geany IDE for ScriptBasic
« on: June 03, 2013, 11:30:18 AM »
Tomaaz put a zip together of the configuration files needed to give ScriptBasic syntax highlighting in the Geany IDE.

Thanks Tomaaz!

45
What's New / ScriptBasic JIT
« on: May 30, 2013, 12:00:53 PM »
Charles Pegge (OxygenBasic / DLLC author) has done it again and added JIT (Just-In-Time) function scripting, compiling and calling all at runtime. The following example is interesting as it shows DLLC supporting the JAPI  (Java Application Programming Interface) and using JIT for the Mandelbrot Set calculation. (76,800 pixel calculations)




The following code is using DLLC to interface with the JAPI DLL to produce the Mandelbrot Set.

Code: [Select]
' JAPI 2.0 DLLC

include "dllcinc.sb"

japi = dllfile("japi.dll")

j_start = dllproc(japi, "j_start i = ()")
j_frame = dllproc(japi, "j_frame i = (c * label)")
j_menubar = dllproc(japi, "j_menubar i = ( i obj)")
j_menu = dllproc(japi, "j_menu i = (i obj, c *label)")
j_menuitem = dllproc(japi, "j_menuitem i = (i obj, c *label)")
j_canvas = dllproc(japi, "j_canvas i = (i obj, i width , i height)")
j_setpos = dllproc(japi, "j_setpos (i obj, i xpos, i ypos)")
j_pack = dllproc(japi, "j_pack (i obj)")
j_show = dllproc(japi, "j_show (i obj)")
j_getaction = dllproc(japi, "j_getaction i = ()")
j_nextaction = dllproc(japi, "j_nextaction i = ()")
j_setcolor = dllproc(japi, "j_setcolor (i obj, i r, i g, i b)")
j_drawpixel = dllproc(japi, "j_drawpixel (i obj, i x, i y)")
j_quit = dllproc(japi, "j_quit ()")

CONST J_TRUE = 1
CONST J_FALSE = 0


xstart = -1.8
xend   =  0.8
ystart = -1.0
yend   =  1.0

hoehe  = 240
breite = 320

if (dllcall(j_start) = J_FALSE) then
  print("JAPI interface failed to start.\n")
  end
endif

jframe  = dllcall(j_frame,"JAPI 2.0 DLLC")
menubar = dllcall(j_menubar,jframe)
jfile   = dllcall(j_menu,menubar,"File")
calc    = dllcall(j_menu,menubar,"Calc")
quit    = dllcall(j_menuitem,jfile,"Quit")
start   = dllcall(j_menuitem,calc,"Start")
jstop   = dllcall(j_menuitem,calc,"Stop")

canvas  = dllcall(j_canvas,jframe,breite,hoehe)
dllcall(j_setpos,canvas,10,60)
dllcall(j_pack,jframe)
dllcall(j_show,jframe)

obj = 0
do_work = 0

while((obj <> jframe) and (obj <> quit))

    if(do_work = 1) then
        obj = dllcall(j_getaction)
    else
        obj = dllcall(j_nextaction)
    endif      

    if(obj = start) then
        x = -1
        y = -1
        do_work = 1
        st = dllsecs()
    endif

    if(obj = jstop) then
        do_work = 0
    endif
    
    if(do_work = 1) then
        x = (x+1) % breite
       if(x = 0) then
            y = (y+1) % hoehe
       endif
       if((x = breite-1) and (y = hoehe-1)) then
            do_work = 0
            PRINT format("%g",dllsecs() - st),"\n"
        else
            zre = xstart + x*(xend-xstart)/breite
            zim = ystart + y*(yend-ystart)/hoehe
            it = mandel(zre,zim,512)
            dllcall(j_setcolor,canvas,it*11,it*13,it*17)
            dllcall(j_drawpixel,canvas,x,y)
        endif
    endif

wend

dllcall(j_quit)


function mandel(zre,zim,maxiter)
    mx = 0.0
    my = 0.0
    iter=0
    betrag=0.0
 
    while ((iter < maxiter) and (betrag < 4.0))
        iter = iter+1
        tmp = mx*mx-my*my+zre
        my = 2*mx*my+zim
        mx = tmp
        betrag = (mx*mx + my*my)
    wend
    mandel=iter
end function

This version uses the new JIT compiling feature of DLLC with the mandel() function compiled at runtime.

Code: [Select]
' JAPI 2.0 DLLC JIT

include "dllcinc.sb"

oxy = dllfile("/sb22/modules/oxygen.dll")

o2_basic = dllproc( oxy, "o2_basic i =(c*source) " )
o2_exec  = dllproc( oxy, "o2_exec  i =(i call)   " )
o2_error = dllproc( oxy, "o2_error c*=()         " )
o2_errno = dllproc( oxy, "o2_errno i =()         " )
o2_len   = dllproc( oxy, "o2_len   i =()         " )
o2_mode  = dllproc( oxy, "o2_mode     (i mode)   " )

dllcall(o2_mode,1)

src = """
extern
function mandel(float zre,zim,sys maxiter) as sys
    float mx,my,betrag
    sys iter
 
    while iter < maxiter and betrag < 4.0
        iter = iter+1
        tmp = mx*mx-my*my+zre
        my = 2*mx*my+zim
        mx = tmp
        betrag = (mx*mx + my*my)
    wend
    return iter
end function

sub finish()
  terminate
end sub

function link(sys n) as sys
  select n
    case 0
      return @finish
    case 1
      return @mandel
  end select
end function

end extern

addr link
"""

dllcall(o2_basic, src)
dfn = dllcall(o2_exec,0)
mandel = dllproc(dfn,"mandel i = (f zre, f zim, i maxiter)", dllcald(dfn, 1))
finish = dllproc(dfn,"finish ()", dllcald(dfn, 0))

japi = dllfile("japi.dll")

j_start = dllproc(japi, "j_start i = ()")
j_frame = dllproc(japi, "j_frame i = (c * label)")
j_menubar = dllproc(japi, "j_menubar i = ( i obj)")
j_menu = dllproc(japi, "j_menu i = (i obj, c *label)")
j_menuitem = dllproc(japi, "j_menuitem i = (i obj, c *label)")
j_canvas = dllproc(japi, "j_canvas i = (i obj, i width , i height)")
j_setpos = dllproc(japi, "j_setpos (i obj, i xpos, i ypos)")
j_pack = dllproc(japi, "j_pack (i obj)")
j_show = dllproc(japi, "j_show (i obj)")
j_getaction = dllproc(japi, "j_getaction i = ()")
j_nextaction = dllproc(japi, "j_nextaction i = ()")
j_setcolor = dllproc(japi, "j_setcolor (i obj, i r, i g, i b)")
j_drawpixel = dllproc(japi, "j_drawpixel (i obj, i x, i y)")
j_quit = dllproc(japi, "j_quit ()")

CONST J_TRUE = 1
CONST J_FALSE = 0


xstart = -1.8
xend   =  0.8
ystart = -1.0
yend   =  1.0

hoehe  = 240
breite = 320

if (dllcall(j_start) = J_FALSE) then
  print("JAPI interface failed to start.\n")
  end
endif

jframe  = dllcall(j_frame,"JAPI 2.0 DLLC JIT")
menubar = dllcall(j_menubar,jframe)
jfile   = dllcall(j_menu,menubar,"File")
calc    = dllcall(j_menu,menubar,"Calc")
quit    = dllcall(j_menuitem,jfile,"Quit")
start   = dllcall(j_menuitem,calc,"Start")
jstop   = dllcall(j_menuitem,calc,"Stop")

canvas  = dllcall(j_canvas,jframe,breite,hoehe)
dllcall(j_setpos,canvas,10,60)
dllcall(j_pack,jframe)
dllcall(j_show,jframe)

obj = 0
do_work = 0

while((obj <> jframe) and (obj <> quit))
    if(do_work = 1) then
        obj = dllcall(j_getaction)
    else
        obj = dllcall(j_nextaction)
    endif      

    if(obj = start) then
        x = -1
        y = -1
        do_work = 1
        st = dllsecs()
    endif

    if(obj = jstop) then
        do_work = 0
    endif
    
    if(do_work = 1) then
        x = (x+1) % breite
       if(x = 0) then
            y = (y+1) % hoehe
       endif
       if((x = breite-1) and (y = hoehe-1)) then
            do_work = 0
            PRINT format("%g",dllsecs() - st),"\n"
        else
            zre = xstart + x*(xend-xstart)/breite
            zim = ystart + y*(yend-ystart)/hoehe
            it = dllcall(mandel,zre,zim,512)
            dllcall(j_setcolor,canvas,it*11,it*13,it*17)
            dllcall(j_drawpixel,canvas,x,y)
        endif
    endif
wend

dllcall(Finish)
dllcall(j_quit)
dllfile

When the menu start option is clicked I record the time and print the results when the last pixel is displayed of the Mandelbrot Set.

ScriptBasic
C:\SB22\japi_dllc>scriba mandel_dllc.sb
56.9223

C:\SB22\japi_dllc>

ScriptBasic JIT

C:\SB22\japi_dllc>scriba mandel_dllc2.sb
17.608

C:\SB22\japi_dllc>


Pages: 1 2 [3] 4 5 ... 12