Allow the PureBasic compiler to be linked in SpiderBasic. For quick compiles to see if your SpiderBasic code can be compiled properly in PureBasic. And if not you could easily/quickly insert a compiler If statement in the code.
Or just a menu PureBasic compile option if SpiderBasic detects that Purebasic is installed.
[Resolved] PureBasic compiler link in SpiderBasic
[Resolved] PureBasic compiler link in SpiderBasic
Last edited by J. Baker on Wed Oct 09, 2024 2:13 pm, edited 1 time in total.
Re: PureBasic compiler link in SpiderBasic
Its too difficutl imho to have a program compiled unchanged in PB and SB ,except small simple apps
While i like and agree to have as much as pb compatibility
Stuff like ,sb is event driven, while pb is loop (mostly)
On rhe other hand , is not too difficult to make a similar cli tool (with pb) and add it to tools menu
Will give you a impression
While i like and agree to have as much as pb compatibility
Stuff like ,sb is event driven, while pb is loop (mostly)
On rhe other hand , is not too difficult to make a similar cli tool (with pb) and add it to tools menu
Will give you a impression
Christos
Re: PureBasic compiler link in SpiderBasic
For 2D games it's not too bad. Just have to put most of your work in procedures and any minor differences just use CompilerIf #PB_Compiler_Processor constant. Being able to do a quick compile in PureBasic or SpiderBasic to see if your cross platform code is good would be nice. Just to make sure it doesn't throw any errors before your code gets too long and you have to make major changes.
Re: PureBasic compiler link in SpiderBasic
Actually I just ran the following code in both SpiderBasic and PureBasic (both opened at the same time) and anything saved in one or the other reloads in the other app. So maybe my feature request is not needed. I guess I will mark this topic as resolved.
Screen.sb (edited for PureBasic and SpiderBasic)
Screen.sb (edited for PureBasic and SpiderBasic)
Code: Select all
; ------------------------------------------------------------
;
; SpiderBasic - Screen example file
;
; (c) Fantaisie Software
;
; ------------------------------------------------------------
;
Debug "Use mouse and arrow keys to move the sprites"
CompilerIf #PB_Compiler_Processor = #PB_Processor_x64
InitSprite()
InitKeyboard()
InitMouse()
UsePNGImageDecoder()
CompilerEndIf
OpenScreen(800, 600, 32, "Test")
;Global SpriteStep
;Global Init
Global nbFrames
SetFrameRate(60)
LoadSprite(0, "Data/Spider.png", #PB_Sprite_PixelCollision)
Procedure RenderFrame()
Static x = 100, y = 200, previousElapsed
ClearScreen(RGB(0, 0, 0))
If ElapsedMilliseconds() - previousElapsed >= 1000
Debug "FPS: " + nbFrames
nbFrames = 0
previousElapsed = ElapsedMilliseconds()
Else
nbFrames + 1
EndIf
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
x-1
ElseIf KeyboardPushed(#PB_Key_Right)
x+1
EndIf
If KeyboardPushed(#PB_Key_Up)
y-1
ElseIf KeyboardPushed(#PB_Key_Down)
y+1
EndIf
DisplayTransparentSprite(0, x+10, y+10, 60) ; And its shadow
DisplaySprite(0, x, y) ; The spider
EndIf
If ExamineMouse()
SpriteX = MouseX()-SpriteWidth(0)/2
SpriteY = MouseY()-SpriteHeight(0)/2
DisplaySprite(0, SpriteX, SpriteY)
If SpritePixelCollision(0, x, y, 0, SpriteX, SpriteY)
Debug "Pixel Collide !"
EndIf
If MouseButton(#PB_MouseButton_Left)
Debug "Left button"
EndIf
EndIf
FlipBuffers() ; continue the rendering
EndProcedure
Procedure Loading(Type, Filename$)
Static NbLoadedElements
NbLoadedElements+1
If NbLoadedElements = 1 ; Finished the loading of all images and sounds, we can start the applications
FlipBuffers() ; start the rendering
EndIf
EndProcedure
Procedure LoadingError(Type, Filename$)
Debug Filename$ + ": loading error"
EndProcedure
CompilerIf #PB_Compiler_Processor = #PB_Processor_JavaScript
; Register the loading event before calling any resource load command
BindEvent(#PB_Event_Loading, @Loading())
BindEvent(#PB_Event_LoadingError, @LoadingError())
BindEvent(#PB_Event_RenderFrame, @RenderFrame())
CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x64
Repeat
RenderFrame()
Until KeyboardPushed(#PB_Key_Escape)
CompilerEndIf