Author Topic: sw part II  (Read 5622 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
sw part II
« on: February 16, 2013, 08:10:34 AM »
Deleted
« Last Edit: April 14, 2015, 03:49:12 AM by Peter »

JRS

  • Guest
Re: sw part II
« Reply #1 on: February 20, 2013, 12:45:06 PM »
Quote
I think it ends here.

You are correct.



Charles Pegge

  • Guest
Re: sw part II
« Reply #2 on: February 20, 2013, 01:12:55 PM »
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

JRS

  • Guest
Re: sw part II
« Reply #3 on: February 20, 2013, 02:12:06 PM »
Too weird for me.

I think it's a tie.  Aurel & Peter both wins the prize.  ::)

Charles Pegge

  • Guest
Re: sw part II
« Reply #4 on: February 20, 2013, 03:35:17 PM »
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
« Last Edit: February 20, 2013, 03:51:51 PM by Charles Pegge »

JRS

  • Guest
Re: sw part II
« Reply #5 on: February 20, 2013, 05:37:53 PM »
Quote
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.

Charles Pegge

  • Guest
Re: sw part II
« Reply #6 on: February 20, 2013, 09:25:53 PM »
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

JRS

  • Guest
Re: sw part II
« Reply #7 on: February 21, 2013, 12:04:18 AM »
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.

Code: [Select]
' 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

JRS

  • Guest
Re: sw part II
« Reply #8 on: February 21, 2013, 08:35:58 AM »
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.


JRS

  • Guest
Re: sw part II
« Reply #9 on: February 21, 2013, 09:43:24 AM »
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

JRS

  • Guest
Re: sw part II
« Reply #10 on: February 21, 2013, 10:56:16 AM »
Quote
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.

Aurel

  • Guest
Re: sw part II
« Reply #11 on: February 21, 2013, 12:13:51 PM »
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.

JRS

  • Guest
Re: sw part II
« Reply #12 on: February 21, 2013, 12:23:15 PM »
Quote
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.

« Last Edit: February 21, 2013, 12:59:07 PM by JRS »

Aurel

  • Guest
Re: sw part II
« Reply #13 on: February 21, 2013, 12:29:42 PM »
Quote
@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()

JRS

  • Guest
Re: sw part II
« Reply #14 on: February 28, 2013, 10:03:25 PM »
Peter,

I download the SokoMouse zip Charles had posted to the site in the Games section. I wondered if it would run under Wine.



A little too slow to be usable for normal game play. The Bass sound even works.

John