Retrogamecoding(.org) > Pulsar2D

Welcome to the new board for Pulsar2D

(1/9) > >>

Cybermonkey:
Yes, it's time to reveal the name for my next Lua interpreter and Free Pascal game engione based on SDL2: Pulsar2D
I just finished the Lua bindings with the so far implemented functions. Here you can se the somewhat comprehensive list:

--- Quote ---openwindow
setactivewindow
closeapplication
wait
color
redraw
circle
clearwindow
cls
closewindow
backcolor
inkey
dot
line
getkey
fillcircle
mousex
mousey
mousebutton
ellipse
fillellipse
loadimage
mousehide
mouseshow
keystate
timeleft
setframetimer
colorkey
loadsound
playsound
drawtext
mousezone
loadmusic
playmusic
pausemusic
resumemusic
togglefullscreen
spritewidth
spriteheight
nocolorkey
timerticks
ostype
joystickplugged
getjoyx
getjoyy
getjoybutton
numberjoybuttons
setcaption
triangle
filltriangle
boxcoll
rnd
int
chr
asc
val
left
right
mid
insert
len
time
date
uppercase
lowercase
input
resizewindow
arguments
freeimage
windowwidth
windowheight
bmptext
bmpinput
bmpfont
sqrt
abs
cos
sin
exp
floor
ceil
imagecoll
circlecoll
roundcoll
sidecoll
sync
open
close
finput
eof
eoln
fprint
fileexists
directoryexists
makedir
removedir
changedir
deletefile
system
insidetriangle
insiderectangle
insidecircle
drawtile
tileset
warpmouse
bmpfontheight
bmpfontwidth
rectangle
illrectangle
round
createsprite
freesprite
drawsprite
drawspritepart
spritecolor
setvirtualsize
bmpfontsize
bmpinputcolor
bmpinputbackcolor
bmpfontnagle
textsize
textwidth
textheight
textinputcolor
textinputbackcolor
messagebox
setscalequality
seticon
fullscreen
fademusic
haltmusic
freesound
freemusic
--- End quote ---
A lot of things have changed, a lot have kept the same. Still missing are sprite animations and particles. These are the next things I wil implement, I just wanted to be sure that the rest is working as expected.
Here is the first example code in Lua:

--- Code: ----- first test of Lua bindings to Pulsar2D
require "scancodes"

win=openwindow ("First Test",-1,-1,1024,768)
setactivewindow (win)
setframetimer (250)
image = loadimage ("media/sprite.bmp")
sprite = createsprite (image)
freeimage (image)
x= 150
y= 250

repeat
key=getkey()
cls()
  color (255,255,0,255)
  fillcircle (612,356,50)
  drawtext ("Hello and welcome to Pulsar2D",10,10)
  drawsprite (sprite,x,y,2,2,0,false,true)
 
  if keystate (SCANCODE_LEFT) then
      x=x-1
  end
  if keystate (SCANCODE_RIGHT) then
      x=x+1
  end
  if keystate (SCANCODE_UP) then
      y=y-1
  end
  if keystate (SCANCODE_DOWN) then
      y=y+1
  end
   sync()
until key == SCANCODE_ESCAPE

freesprite (sprite)
closewindow (win)
closeapplication()

--- End code ---
With the scancodes.lua one needn't to remember all those numbers. If you want to check the escape key just use SCANCODE_ESCAPE (of course you can use the number if you prefer that but since these are now scancodes they are different from the EGSL keycodes).
A nice thing is that all error message are now inside a message box, so if you type the wrong filename for example... see the attachment.

Osgeld:
looks interesting, thanks for your efforts

regarding the scancodes, would it be a big deal to just embed them, nothing that EGSL runs on currently requires non pc keyboard scancodes (IE adb based MAC)?

Cybermonkey:
Well, as I said you don't need to use the scancodes from scancodes.lua. Just use the numbers instead (you don't have to include scancodes.lua then). But the numbers changed, so better look into the file first. For example escape has the number 41 (used to be 27 on EGSL).

GEEK:
looks great  ;D

Cybermonkey:
Thanks.
On Windows the messageboxes have a native look btw:

Navigation

[0] Message Index

[#] Next page

Go to full version