Author Topic: how to install and use PULSAR 2D  (Read 3647 times)

drfloyd

  • Guest
how to install and use PULSAR 2D
« on: June 01, 2019, 04:55:20 PM »
I would like to install and use PULSAR 2D...

But how ? I have download the ZIP... but no interface, no IDE in the folder

What should I done please ?

I suppose I should use an external IDE? but which one ? And how to configure it and start my program ?

Thanks

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: how to install and use PULSAR 2D
« Reply #1 on: June 01, 2019, 08:35:57 PM »
Yes, it's "only" an interpreter which comes with no editor. You can use any editor - I am using Geany. Write a script in Lua and drag and drop it onto the interpreter, then it will start. (I guess from you earlier post that you are using Windows.)

If you are a fan of Blitz however, I recommend using Pulsar2D as a framework for FreeBASIC. Here's a small example - Mandelbrot on three windows:
Code: [Select]
#include once "pulsar2d.bi"
using p2d

declare sub drawthemandel (cg as integer,cb as integer)
dim as p2d.window win, win2, win3

win = openwindow ("MandelCrap",10,10,620,480)
win2 = openwindow ("MandelCrap On A Second Window",650,10,620,480)
win3 =openwindow ("Third Window",1300,10,620,480)


dim as integer ts

setactivewindow (win)
backcolor (15,20,100,255)
clearwindow
ts = timerticks
drawthemandel (0,30)
color 255,255,255,255
textsize 2
drawtext (str(timerticks()-ts) & " ms",0,0)
sync

setactivewindow (win2)
backcolor (105,168,100,255)
clearwindow
ts = timerticks
drawthemandel (30,0)
color 255,255,255,255
textsize 2
drawtext (str(timerticks()-ts) & " ms",0,0)
sync

setactivewindow (win3)
backcolor (70,90,20,255)
clearwindow
ts = timerticks
drawthemandel (15,15)
color 255,255,255,255
textsize 2
drawtext (str(timerticks()-ts) & " ms",0,0)
sync


p2d.inkey

closewindow (win)
closewindow (win2)
closewindow (win3)
closeapplication

sub drawthemandel (cg as integer,cb as integer)
dim  as single a,x,y,dy,cx,cy,i,b,it,yy,y0,x0,x1,y1
for dy=0 to 2
for x =0 to 620
    a = (x*.06)-12
    cx = -2*a/25
for y=0 to 255 
    yy = y + dy
    b = yy *0.121+21
    cy = 2-b/25
    x0 = 0
    y0 = 0
    it = 0
for i=1 To 255
    x1 = x0*x0-y0*y0 + cx
    y1 = 2*x0*y0+cy
    if x1*x1+y1*y1 >4 then
       it = 1
       exit for
    end if
    x0 = x1
    y0 = y1
next               
    if it then
   color y*.4,i*cg,i*cb,255
       dot x, yy
       dot x, 480-yy
       
    end if     
next
next
next
end sub

For compilation, put all p2d*.bi (and pulsar2d.bi) in the same directory as the source.
One note: the input routine doesn't work properly anymore with the newest SDL2 versions, I will fix that eventually in the future.

drfloyd

  • Guest
Re: how to install and use PULSAR 2D
« Reply #2 on: June 02, 2019, 01:57:36 PM »
Hello, and sorry for my english, i speak like a spanish cow ! Hope you understand a lot ?????

Thank you for your help but i am a total novice (coming from BLITZ and his automatic IDE for babies) + I know anything about Lua ! And nothing about BLITZ... but i suppose is is something like BLITZ 3D ?

So, 2 solutions ?

1) writing a script in Lua ? ok.... So... I go on Geany, open a new file, write some Lua code (a little exemple?) and save it into Pulsar2D folder ? I am correct ????

2) Using Free Basic ?????  I am more and more LOST (in space). Why, because of the cool IDE ? And because i do not need classic Lua instructions ? Perhaps it's better for me as Lua is not basic, but Free Basic is.
So ? I should do what ? Copy ***.bi files in my .bas folder ?

I have tried, FreeBasic say : Cannot find -1SDL2, cannot find -1SDL2_image, cannot find -1SDL_mixer



Additional questions:

3) is there a good manual for PULSAR 2D ?

4) your example seems near to BLITZ code ! I love the easy commands, without bloody ( ) {}


Oups, my god ! I just realise : 4 questions !!!!! No need to answer to all questions... i am a troll ??????

 I love languages since the 80', and want to discover the modern ones ! But i am looking for TRUE Basics :)
« Last Edit: June 02, 2019, 02:55:42 PM by drfloyd »

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: how to install and use PULSAR 2D
« Reply #3 on: June 02, 2019, 05:58:27 PM »
Hi drfloyd,

I will try to answer all of your questions ...  ;)

1. There should be examples in the download. Look into the Lua folder ... but here is a simple script (an analog clock - "scancodes.lua" should be in the same folder):
Code: [Select]
-- analog clock

require "scancodes"

win = openwindow ("Analog Clock ",-1,-1,350,350)
setactivewindow (win)
setframetimer (60)
page = 0
xcenter = windowwidth()/2
ycenter = windowheight()/2

backcolor  (0,90,82,255)
textsize (2)

repeat
cls()
key = getkey()

color (0,0,0,255)

fillcircle (xcenter, ycenter, 150)

color  (50,255,50,255)

for i=1, 11 do
if (i~=3) and (i~=6) and (i~=9) then
fillcircle (round(math.cos((i * 30) * math.pi / 180 - math.pi / 2) * 140 + xcenter), round(math.sin((i * 30) * math.pi / 180 - math.pi / 2) * 140 + ycenter), 3)
end
end

color  (0,255,0,255)

drawtext ("9",xcenter - 145, ycenter - 5)
drawtext ("3",xcenter + 135, ycenter - 5)
drawtext ("12",xcenter - 5, ycenter - 145)
drawtext ("6",xcenter - 5, ycenter + 130)

second = os.date ("%S")
minute = os.date ("%M")
hour = os.date ("%H")
xsecond = round(math.cos(second * math.pi / 30 - math.pi / 2) * 120 + xcenter)
ysecond = round(math.sin(second * math.pi / 30 - math.pi / 2) * 120 + ycenter)
xminute = round(math.cos(minute * math.pi / 30 - math.pi / 2) * 100 + xcenter)
yminute = round(math.sin(minute * math.pi / 30 - math.pi / 2) * 100 + ycenter)
xhour = round(math.cos((hour * 30 + minute / 2) * math.pi / 180 - math.pi / 2) * 80 + xcenter)
yhour = round(math.sin((hour * 30 + minute / 2) * math.pi / 180 - math.pi / 2) * 80 + ycenter)

color (255,0,0,255)
line (xcenter, ycenter, xsecond, ysecond)
color (255,255,255,255)
line (xcenter, ycenter - 1, xminute, yminute)
line (xcenter - 1, ycenter, xminute, yminute)

line (xcenter, ycenter - 1, xhour, yhour)
line (xcenter - 1, ycenter, xhour, yhour)

color  (0,255,0,255)
fillcircle (175,175,5)

sync()
until key == SCANCODE_ESCAPE
closewindow (win)
closeapplication()

2. There are 3 different ways to use Pulsar2D:
  1. Using the Pulsarlua interpreter one can directly execute Lua scripts. Just drag and drop the *.lua-file onto pulsarlua.exe
  2. Using FreeBASIC - it's just a framework on top of SDL2 - you might want to add before compiling SDL2.dll, SDL2_image.dll and SDL2_mixer.dll to the folder where the source is. The runtime binaries can be found on: http://libsdl.org/download-2.0.php (btw, it's -lSDL2 etc. not -1SDL2 ...)
  3. Using Free Pascal - it's a unit which can be used with it. Before compiling though one needs the SDL2.pas units - unfortunately they still don't ship with FPC 3.0.4

3. There is none, yet.

4. Yes, that's rather hard with Lua ...

drfloyd

  • Guest
Re: how to install and use PULSAR 2D
« Reply #4 on: June 02, 2019, 06:59:10 PM »
I have no succes with freebasic

I have created a folder in Freebasic with this :



(jeu.bas is your test program)

when i compile, i obtain lot or errors :



???

drfloyd

  • Guest
Re: how to install and use PULSAR 2D
« Reply #5 on: June 02, 2019, 08:21:20 PM »
I have downloaded runtime 32bit instead 64bit, it's better but still 3 errors :



I suppose i need to find 3 files isdl2  isdl2image and isdl2_mixer

But where are these files ????

Aurel

  • Guest
Re: how to install and use PULSAR 2D
« Reply #6 on: June 02, 2019, 08:48:20 PM »
To download SDL you need to go to SDL site and download this 3 files / .dll s
sdl2.dll
sdl2image.dll
sdl2mixer.dll

Also which editor /IDE u use with FreeBasic ?
I suggest you the simpliest like CSED_FB..
and i must say that i also never tried Cyb pulsarFB edition..
so i will too..
« Last Edit: June 02, 2019, 08:51:40 PM by Aurel »

drfloyd

  • Guest
Re: how to install and use PULSAR 2D
« Reply #7 on: June 02, 2019, 08:58:59 PM »
Yes, if you check my screencopy, these 3 files are present

Aurel

  • Guest
Re: how to install and use PULSAR 2D
« Reply #8 on: June 02, 2019, 09:41:15 PM »
oh yes
i will try it tomorow on my second computer where i have FreeBasic installed.

drfloyd

  • Guest
Re: how to install and use PULSAR 2D
« Reply #9 on: June 03, 2019, 05:47:57 AM »
Ok thanks, I suppose CyberM will also give me a new reply :)

Aurel

  • Guest
Re: how to install and use PULSAR 2D
« Reply #10 on: June 03, 2019, 11:02:49 AM »
Ok
It is not very much easy to collect all this files because of different versions
latest is 2.0.9
Cyb use 2.0.3
I download from SourceForge  versions 2.0,0 of SDL2
 so i have put all this inside folder freeBasic  of pulsar2d distro folder. 

Aurel

  • Guest
Re: how to install and use PULSAR 2D
« Reply #11 on: June 03, 2019, 11:06:22 AM »
So as we can see there is one main pulsar2d.bi include file .
To build program under FreeBasic i suppose that i need to start my own program
because i don't see any example written in FreeBasic which use pusar2d.bi

Cyb... do i have right?
If you have any written in FB ,then that would be nice to see.
Or i miss something somewhere ?  ::)

drfloyd

  • Guest
Re: how to install and use PULSAR 2D
« Reply #12 on: June 03, 2019, 04:32:57 PM »
CyberM is our God, he will help us

Perhaps it would be great to create a full package ZIP of Pulsar 2D + Freebasic preconfigured

Aurel

  • Guest
Re: how to install and use PULSAR 2D
« Reply #13 on: June 03, 2019, 07:19:48 PM »
Quote
Perhaps it would be great to create a full package ZIP of Pulsar 2D + Freebasic preconfigured

That would be a lot of work ,and there is no need for that..
because which editor you want..etc..etc...
I simply have folder with FreeBasic
inside this main i put CSED_FB folder with CSED_FB editor.
All pulsar2d files i add into
\examples\win32
and that is