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

drfloyd

  • Newcomer
  • *
  • Posts: 15
    • View Profile
how to install and use PULSAR 2D
« on: 01. June 2019, 18:55:20 »
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
  • Hero Member
  • *****
  • Posts: 673
    • View Profile
    • Home of EGSL
Re: how to install and use PULSAR 2D
« Reply #1 on: 01. June 2019, 22:35:57 »
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.
Best regards,
Cybermonkey

drfloyd

  • Newcomer
  • *
  • Posts: 15
    • View Profile
Re: how to install and use PULSAR 2D
« Reply #2 on: 02. June 2019, 15:57:36 »
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: 02. June 2019, 16:55:42 by drfloyd »

Cybermonkey

  • Administrator
  • Hero Member
  • *****
  • Posts: 673
    • View Profile
    • Home of EGSL
Re: how to install and use PULSAR 2D
« Reply #3 on: 02. June 2019, 19:58:27 »
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 ...
Best regards,
Cybermonkey

drfloyd

  • Newcomer
  • *
  • Posts: 15
    • View Profile
Re: how to install and use PULSAR 2D
« Reply #4 on: 02. June 2019, 20:59:10 »
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

  • Newcomer
  • *
  • Posts: 15
    • View Profile
Re: how to install and use PULSAR 2D
« Reply #5 on: 02. June 2019, 22:21:20 »
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

  • Regular Member
  • Hero Member
  • *
  • Posts: 596
    • View Profile
Re: how to install and use PULSAR 2D
« Reply #6 on: 02. June 2019, 22:48:20 »
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: 02. June 2019, 22:51:40 by Aurel »
my site:BLOG and FORUM
https://aurelsoft.ucoz.com/

drfloyd

  • Newcomer
  • *
  • Posts: 15
    • View Profile
Re: how to install and use PULSAR 2D
« Reply #7 on: 02. June 2019, 22:58:59 »
Yes, if you check my screencopy, these 3 files are present

Aurel

  • Regular Member
  • Hero Member
  • *
  • Posts: 596
    • View Profile
Re: how to install and use PULSAR 2D
« Reply #8 on: 02. June 2019, 23:41:15 »
oh yes
i will try it tomorow on my second computer where i have FreeBasic installed.
my site:BLOG and FORUM
https://aurelsoft.ucoz.com/

drfloyd

  • Newcomer
  • *
  • Posts: 15
    • View Profile
Re: how to install and use PULSAR 2D
« Reply #9 on: 03. June 2019, 07:47:57 »
Ok thanks, I suppose CyberM will also give me a new reply :)

Aurel

  • Regular Member
  • Hero Member
  • *
  • Posts: 596
    • View Profile
Re: how to install and use PULSAR 2D
« Reply #10 on: 03. June 2019, 13:02:49 »
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. 
my site:BLOG and FORUM
https://aurelsoft.ucoz.com/

Aurel

  • Regular Member
  • Hero Member
  • *
  • Posts: 596
    • View Profile
Re: how to install and use PULSAR 2D
« Reply #11 on: 03. June 2019, 13:06:22 »
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 ?  ::)
my site:BLOG and FORUM
https://aurelsoft.ucoz.com/

drfloyd

  • Newcomer
  • *
  • Posts: 15
    • View Profile
Re: how to install and use PULSAR 2D
« Reply #12 on: 03. June 2019, 18:32:57 »
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

  • Regular Member
  • Hero Member
  • *
  • Posts: 596
    • View Profile
Re: how to install and use PULSAR 2D
« Reply #13 on: 03. June 2019, 21:19:48 »
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 
my site:BLOG and FORUM
https://aurelsoft.ucoz.com/