Oxygen Basic
Programming => Example Code => Topic started by: Peter on February 16, 2013, 08:10:34 AM
-
Deleted
-
I think it ends here.
You are correct.
-
Hi John,
Something gone wrong with the Oxygen-generated DLL headers: The length of the export table is set to zero. But the table itself is well formed, otherwiise it would not work at all.
(Evil trick for hiding function names methinks ;D )
Charles
-
Too weird for me.
I think it's a tie. Aurel & Peter both wins the prize. ::)
-
I've fixed the DLL header bug.
Peter, can you recompile sw.dll with this Oxygen:
PS:
Oxygen uses Bstrings (OLE strings)
To return a C string from a DLL, which other languages can safely use:
do something like this
function f() as char*, export
static string s="Hello"
return strptr s
end function
print f
X
-
If want to reduce the Cpu power, then just use Sync().
Adding Sync calls just makes the game run at full speed which makes the game unusable. Trying to fine tune the software with SLEEP x (1 sec resolution) is not an option under SB. As I said before, gaming is not what I enjoy doing and with this experience I don't plan on revisiting it soon. The only reason I even bothered to convert the game is I wanted to prove that SB could stand up to the requirements of a game engine library.
-
Hi John,
You might be running into satuaration, running Peter's animated games, through the SB byte code interpreter. I found the Bees example (compiled with Oxygen) required about 14% of CPU on my quad core PC. Interpreters will generally run 10..300 times slower on the parts of the code they have to process.
Charles
-
Charles,
I'm not using Bass.
SUB PlaySound(sfn)
DLL("ms,l,winmm.dll,sndPlaySoundA,zl", sfn, 0)
END SUB
I think I have solved my Simple Windows issues.
' Julia set fractal
common R, I, X ,Y
setdisplay(1024, 768, 32, 0)
setautoback(0)
FOR iT = 0 TO 32
color(iT, rgb(iT * 8, it * 12, iT * 8))
NEXT
mousehide()
SUB _INVERSE_WORK
D = X * X + Y * Y
IF D = 0.0 THEN
R = 100000.0 : X = R : I = R : Y = R
ELSE
R = R / D : X = R : I = I / D : Y = I
End if
END SUB
SUB _INSIDE_STRUC_WORK(D, FAC, Z, IT)
I = ABS(Log(D)) * FAC
IF Z = IT THEN
Ink(color(I))
ELSE
Ink(color(0))
END IF
END SUB
SUB _JULIA_INIT(XSS, YSS, LT, RT, BM, TP, IT, BB, _INV, INS, FAC, DX, DY, CI, CR)
DXPP = (RT - LT) / XSS
DYPP = (TP - BM) / YSS
R=BM
FOR XR = 0 TO XSS
I = LT
FOR YR = 0 TO YSS
X = R : Y = I : B = X : M = Y
IF _INV = 1 THEN
_INVERSE_WORK
END IF
XS = X * X : YS = Y * Y
WHILE key(27) = 0
Y = X * Y : Y = Y + Y - CR : X = XS - YS - CI
XS = X * X : YS = Y * Y : D = XS + YS
IF (D < BB) AND (Z < IT) THEN
Z = Z + 1
ELSE
EXIT WHILE
END IF
END WHILE
IF key(27) THEN
END
END IF
IF INS = 0 THEN
Ink(color(Z))
ELSE
_INSIDE_STRUC_WORK(D, FAC, Z, IT)
END IF
dot(XR + DX, YR + DY)
Z = 0 : R = B : I = M : I = I + DYPP
NEXT
R = R + DXPP
screenunlock(0)
screenswap()
screenlock(0)
NEXT
END SUB
' MAIN
LT=-2.0 : RT=2.0
BM=-2.0 : TP=2.0
screenlock(0)
_JULIA_INIT(1024,768,LT,RT,BM,TP,20,30.0,1,1,5,1,1,-0.32,-0.043)
screenunlock(0)
waitkey
X
-
That is simple SDLBASIC by Vroby.
This Basic dialect isn't stable!
I'm not interested in the Basic part of SDLBASIC. It's open source an I plan on using the SDL part in a ScriptBasic extension module that will run on both Linux and Windows.
-
Peter,
I don't think programmers are going to use ScriptBasic to develop graphic applications. It's nice to have the ability to generate graphics on a small scale when needed. That is the only interest in SDL that I have. Always use the right tools (open source) for the job. Loyalty to any language can be fatal.
John
-
John, I understand you fully.
ScriptBasic is similar to Gambas in some ways. (interpreter with a bunch of library extensions) Gambas took the realBASIC motorhome approach and is difficult to park and steer. ScriptBasic is more like a LEGO set where you snap on the extensions to get the functionality you need. Just as with LEGO creations they are meant to prototype or make a one off solution, taken apart and reused again for some other project you don't have a lifetime to invest in.
-
John
Do you try run any oxygen basic example with awinh.inc with SB ?
By the way all my string functions work as espected and parser on which i work
currently work fast and properly.
-
Here is a translation of Julia SdlBasic for OxygenbBasic
That is amazing compared to the sdlBasic interpreter version. Nice job Peter! (it needs a Cls before getting started)
BTW: The sw.dll you included in the zip for this example still doesn't expose the exported function list when browsed.
@Aurel: This is the first O2 based DLL I have tried with SB. I have learned to ask next time if the author is using/exporting MS OLE strings before using the library.
-
@Aurel: This is the first O2 based DLL I have tried with SB. I have learned to ask next time if the author is using/exporting MS OLE strings before using the library.
Ok...
But i think that i don't use any OLE strings in awinh.inc
in the begining i use bstring but now not when Charles add strptr()
-
Peter,
I download the SokoMouse zip Charles had posted to the site in the Games section. I wondered if it would run under Wine.
(http://files.allbasic.info/O2/o2wineSM.png)
A little too slow to be usable for normal game play. The Bass sound even works.
John