Retrogamecoding(.org) > Pulsar2D

how to install and use PULSAR 2D

(1/3) > >>

drfloyd:
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:
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: ---#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
--- End code ---

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:
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 :)

Cybermonkey:
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: ----- 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()

--- End code ---

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:
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 :



???

Navigation

[0] Message Index

[#] Next page

Go to full version