I've switched my OS from win 10 to ubuntu 20.04 and I installed purebasic on it just like I had on win 10... during instillation i installed all dependencies except for libgnome2.dev which is obsolete and you cannot install it anymore with apt-get command...
so I started to test my projects that I started on purebasic in win 10 and I see that it doesn't run as expected it gets stuck or buggy...
here is a few examples of code that runs well on purebasic windows but doesn't on Linux...
one a game of Russian roulette code... the game does not excepts input from the console and get stuck - but it worked fine on windows
Code: Select all
;EnableExplicit
#Window_Main = 0
#Screen_Width = 800
#Screen_Height = 600
Global color.i = #White
Global.s name1, name2
Global score1 = 5000, score2 = 5000, ii = 1
Global.b isTurn = #True
Global bank = 2500
InitSprite()
InitKeyboard()
OpenWindow(#Window_Main, 0, 0, #Screen_Width, #Screen_Height, "TEST", #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(#Window_Main), 0, 0, #Screen_Width, #Screen_Height, #True, 0, 0)
Procedure.s inputs()
Define.s userInput$, userInputChar$
Repeat
ExamineKeyboard()
If KeyboardReleased(#PB_Key_Back)
userInput$ = Left(userInput$, Len(userInput$) - 1)
Else
userInputChar$ = KeyboardInkey()
If FindString("1234567890 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz,.", userInputChar$)
userInput$ + userInputChar$
EndIf
EndIf
ClearScreen(RGB(0, 0, 0))
If StartDrawing(ScreenOutput())
FrontColor(#White)
DrawText(100,180, "player " + ii +" enter name please:")
DrawText(100, 200, userInput$)
StopDrawing()
EndIf
FlipBuffers()
Until KeyboardReleased(#PB_Key_Return)
ProcedureReturn userInput$
EndProcedure
Procedure cprint(row.i, text.s)
DrawText((#Screen_Width - TextWidth(text)) / 2, row , text, color)
EndProcedure
Procedure russian()
Repeat
color = #White
Define k.s
Dim gun(5)
Define text1.s = "press key 1 to load gun with one bullet or key 2 for two bollets"
Define text2.s = ""
Define text3.s = "Russian Roulette"
Define text4.s = "--------------------"
Define shot.i
Define e
Define i
Define.s t1 = "player 1 " + name1 +" " + "player 2 " + name2
Define.s t2 = "Ruballes " + Str(score1) + " Ruballes " + Str(score2)
Define.s t3 = "Bank " + Str(bank)
Define.s turn
For i = 0 To 5
gun(i) = 0
Next
Repeat
ClearScreen(#Black)
; e = WaitWindowEvent()
k = KeyboardInkey()
If StartDrawing(ScreenOutput())
cprint(30, turn)
cprint(50, text3)
cprint(70, text4)
cprint(90, text1)
cprint(110, t1)
cprint(130, t2)
cprint(150, t3)
cprint(200, text2)
StopDrawing()
EndIf
If isTurn = #True
turn = name1 + " TURN"
Else
turn = name2 + " TURN"
EndIf
If k = "1"
gun(0) = 1
text1 = "gun is loaded with one bullet"
text2 = "press 'r' key to roll the revolver"
EndIf
If k = "2"
gun(0) = 1
gun(3) = 1
text1 = "gun is loaded with two bullets"
text2 = "press 'r' key to roll the revolver"
EndIf
If k = "r"
shot = gun(Random(5,0))
text1 = "revolver has been rolled"
text2 = "press space bar to pull the triger or again 'r' to roll the revolver"
EndIf
If k = Chr(32)
If shot = 0
bank + 750
text2 = "emthy shot"
text1 = "press 'r' key to roll over revolver"
If isTurn = #True
score1 = score1 + 1000 + bank
score2 = -1000
isTurn = #False
Else
score2 = score2 + 1000 + bank
score1 = -1000
isTurn = #True
EndIf
ElseIf shot = 1
If isTurn = #True
score2 = score2 + score1 + bank
score1 = 0
bank + 750
isTurn = #False
Else
score1 = score1 + score2 + bank
score2 = 0
bank + 750
isTurn = #True
EndIf
text1 = "press key 'enter' to begin again"
text3 = ""
text4 = ""
color = #Red
text2 = "YOU LOST!"
; e = WaitWindowEvent(2000)
Delay(2000)
EndIf
; ElseIf k = Chr(13)
; color = #White
; Break
EndIf
ExamineKeyboard()
FlipBuffers()
Delay(3)
Until k = Chr(13)
Until shot = 1
color = #White
EndProcedure
Procedure opening()
Repeat
Repeat
Define Event = WindowEvent()
Select Event
Case #PB_Event_CloseWindow
End
EndSelect
Until Event = 0
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Space)
color = #Red
EndIf
If StartDrawing(ScreenOutput())
cprint(50, "Russian Roulette")
cprint(70, "press key 1 to continue")
StopDrawing()
EndIf
FlipBuffers()
Delay(3)
Until KeyboardInkey() = "1"
ClearScreen(RGB(0,0,0))
color = #White
name1 = inputs()
ClearScreen(RGB(0,0,0))
ii + 1
name2 = inputs()
ClearScreen(RGB(0,0,0))
EndProcedure
Procedure main()
Repeat
Repeat
Define Event = WindowEvent()
Select Event
Case #PB_Event_CloseWindow
End
EndSelect
Until Event = 0
ClearScreen(#Black)
If StartDrawing(ScreenOutput())
cprint(50, "press key 'r' for Russian Roulette or 'ESC' key to exit")
StopDrawing()
EndIf
If KeyboardInkey() = "r"
ClearScreen(RGB(0,0,0))
russian()
EndIf
ExamineKeyboard()
FlipBuffers()
Delay(3)
Until KeyboardPushed(#PB_Key_Escape)
EndProcedure
opening()
main()
Code: Select all
OpenConsole()
text.s = "hello world!"
Print(text.s)
Input()
CloseConsole()