PureBasic 6.21 is out !

Developed or developing a new product in PureBasic? Tell the world about it.
Fred
Administrator
Administrator
Posts: 18153
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: PureBasic 6.21 beta 8 is out !

Post by Fred »

May be you can comment stuff step by step
Joubarbe
Enthusiast
Enthusiast
Posts: 702
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Re: PureBasic 6.21 beta 8 is out !

Post by Joubarbe »

So I've been trying a few things during the last hour, but I cannot find anything useful. All events seem to trigger normally, and when I reduce the drawing operations to a minimum, it still lags. I could post some parts of my code (update and render) but I doubt it will be useful as is (non runnable, non reproducible).

I'd really like to help, but I'm really at a loss here. :?

EDIT: I've also tried with the C backend and code optimisation ON/OFF... no change.
BarryG
Addict
Addict
Posts: 4121
Joined: Thu Apr 18, 2019 8:17 am

Re: PureBasic 6.21 beta 8 is out !

Post by BarryG »

[Deleted]
Last edited by BarryG on Wed May 07, 2025 11:14 am, edited 1 time in total.
Joubarbe
Enthusiast
Enthusiast
Posts: 702
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Re: PureBasic 6.21 beta 8 is out !

Post by Joubarbe »

What would be the link with 6.21...? Everything works well on 6.20. And other games would have problem too.
BarryG
Addict
Addict
Posts: 4121
Joined: Thu Apr 18, 2019 8:17 am

Re: PureBasic 6.21 beta 8 is out !

Post by BarryG »

Joubarbe wrote: Wed May 07, 2025 11:09 amEverything works well on 6.20
True. I overlooked that. Sorry!
miso
Enthusiast
Enthusiast
Posts: 407
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: PureBasic 6.21 beta 8 is out !

Post by miso »

when I reduce the drawing operations to a minimum, it still lags.
Then I assume it's not the drawings, but something else. I don't use canvas, so I'm just stabbing in the dark.
User avatar
diceman
User
User
Posts: 63
Joined: Tue Apr 10, 2018 9:42 pm

Re: PureBasic 6.21 beta 8 is out !

Post by diceman »

Don't know if helpful (maybe not), but with my game (turn-based dungeon crawler "The Ruins of Calaworm"), and another sideproject (an asteroids-shooter called "Cherry Shift") all is well. :) No lags, graphics is rendering fast as ever, also no CPU overload. Working on a (kinda) ancient laptop with Windows 10.
Hope you can figure things out.
Now these points of data make a beautiful line,
And we're out of Beta, we're releasing on time.
Fred
Administrator
Administrator
Posts: 18153
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: PureBasic 6.21 beta 9 is out !

Post by Fred »

Quin
Addict
Addict
Posts: 1122
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: PureBasic 6.21 beta 9 is out !

Post by Quin »

Called it. Thanks Fred!
miso
Enthusiast
Enthusiast
Posts: 407
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: PureBasic 6.21 beta 9 is out !

Post by miso »

Thanks! Compiled and tested all my major projects without issues.
(projects includes SqLite,OGL 2d/3d screens, sprites, controllers, sound engine, music engine, fonts, 2d drawing, filesystem, packs, basic window gadgets)
Joubarbe
Enthusiast
Enthusiast
Posts: 702
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Re: PureBasic 6.21 beta 8 is out !

Post by Joubarbe »

diceman wrote: Wed May 07, 2025 1:37 pm Don't know if helpful (maybe not), but with my game (turn-based dungeon crawler "The Ruins of Calaworm"), and another sideproject (an asteroids-shooter called "Cherry Shift") all is well. :) No lags, graphics is rendering fast as ever, also no CPU overload. Working on a (kinda) ancient laptop with Windows 10.
Hope you can figure things out.
Yep, it's weird... What I find really weird is that I cannot ALT-F4 the game. Does BindEvent() work exactly the same as handling events with WaitWindowEvent()? If it's stuck in an event loop, it wouldn't redraw the game at all (as it is a custom event).
Quin
Addict
Addict
Posts: 1122
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: PureBasic 6.21 beta 8 is out !

Post by Quin »

Joubarbe wrote: Wed May 07, 2025 8:39 pm Yep, it's weird... What I find really weird is that I cannot ALT-F4 the game. Does BindEvent() work exactly the same as handling events with WaitWindowEvent()? If it's stuck in an event loop, it wouldn't redraw the game at all (as it is a custom event).
Yes, it does, or at least is supposed to. I use BindEvent() for all of my apps, my main loop is always Repeat : WaitWindowEvent(1) : ForEver, and then I just BindEvent to #PB_Event_CloseWindow. I have no issues on PB 6.21 beta 9, but I'm writing desktop apps, not games. It should work the same though.
Joubarbe
Enthusiast
Enthusiast
Posts: 702
Joined: Wed Sep 18, 2013 11:54 am
Location: France

Re: PureBasic 6.21 beta 9 is out !

Post by Joubarbe »

Unfortunately, some events cannot be bound, so my event declaration block looks like this:

Code: Select all

BindGadgetEvent(#CANVAS_MAIN, @OnInput(), #PB_EventType_Input)
BindGadgetEvent(#CANVAS_MAIN, @OnKeyUp(), #PB_EventType_KeyUp)
BindGadgetEvent(#CANVAS_MAIN, @OnKeyDown(), #PB_EventType_KeyDown)
BindGadgetEvent(#CANVAS_MAIN, @OnLeftClick(), #PB_EventType_LeftClick)
BindGadgetEvent(#CANVAS_MAIN, @OnRightClick(), #PB_EventType_RightClick)
BindGadgetEvent(#CANVAS_MAIN, @OnMouseMove(), #PB_EventType_MouseMove)
BindGadgetEvent(#CANVAS_MAIN, @OnMouseWheel(), #PB_EventType_MouseWheel)
BindEvent(#PB_Event_SizeWindow, @OnResize(), #WINDOW_MAIN)
BindEvent(#PB_Event_ActivateWindow, @OnFocus(), #WINDOW_MAIN)
BindEvent(#PB_Event_Timer, @OnTimer(), #WINDOW_MAIN)
BindEvent(#EVENT_REDRAW_TERMINAL, @RenderTerminal())
BindEvent(#EVENT_REDRAW_VIEW, @RenderView())
AddKeyboardShortcut(#WINDOW_MAIN, #PB_Shortcut_Tab, #EVENT_TAB)
AddKeyboardShortcut(#WINDOW_MAIN, #PB_Shortcut_Shift | #PB_Shortcut_Tab, #EVENT_SHIFT_TAB)

Repeat
  event = WaitWindowEvent()
  Select event
    Case #PB_Event_CloseWindow
      CloseTerminal()
    Case #PB_Event_Menu
      Select EventMenu()
        Case #EVENT_TAB
          If terminal\no_keyboard_navigation = #False And terminal\active_view\locked = #False
            NextView()
          EndIf
        Case #EVENT_SHIFT_TAB
          If terminal\no_keyboard_navigation = #False And terminal\active_view\locked = #False
            PreviousView()
          EndIf
      EndSelect
  EndSelect
ForEver
EDIT: Hmm... Maybe they could all go to BindEvent actually :oops:
miso
Enthusiast
Enthusiast
Posts: 407
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: PureBasic 6.21 beta 9 is out !

Post by miso »

What if with timeout? As Quin specified?

Code: Select all

 event = WaitWindowEvent(1)
I don't think so, but worth a try.
Quin
Addict
Addict
Posts: 1122
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: PureBasic 6.21 beta 9 is out !

Post by Quin »

Joubarbe wrote: Wed May 07, 2025 9:17 pm Unfortunately, some events cannot be bound, so my event declaration block looks like this:

Code: Select all

BindGadgetEvent(#CANVAS_MAIN, @OnInput(), #PB_EventType_Input)
BindGadgetEvent(#CANVAS_MAIN, @OnKeyUp(), #PB_EventType_KeyUp)
BindGadgetEvent(#CANVAS_MAIN, @OnKeyDown(), #PB_EventType_KeyDown)
BindGadgetEvent(#CANVAS_MAIN, @OnLeftClick(), #PB_EventType_LeftClick)
BindGadgetEvent(#CANVAS_MAIN, @OnRightClick(), #PB_EventType_RightClick)
BindGadgetEvent(#CANVAS_MAIN, @OnMouseMove(), #PB_EventType_MouseMove)
BindGadgetEvent(#CANVAS_MAIN, @OnMouseWheel(), #PB_EventType_MouseWheel)
BindEvent(#PB_Event_SizeWindow, @OnResize(), #WINDOW_MAIN)
BindEvent(#PB_Event_ActivateWindow, @OnFocus(), #WINDOW_MAIN)
BindEvent(#PB_Event_Timer, @OnTimer(), #WINDOW_MAIN)
BindEvent(#EVENT_REDRAW_TERMINAL, @RenderTerminal())
BindEvent(#EVENT_REDRAW_VIEW, @RenderView())
AddKeyboardShortcut(#WINDOW_MAIN, #PB_Shortcut_Tab, #EVENT_TAB)
AddKeyboardShortcut(#WINDOW_MAIN, #PB_Shortcut_Shift | #PB_Shortcut_Tab, #EVENT_SHIFT_TAB)

Repeat
  event = WaitWindowEvent()
  Select event
    Case #PB_Event_CloseWindow
      CloseTerminal()
    Case #PB_Event_Menu
      Select EventMenu()
        Case #EVENT_TAB
          If terminal\no_keyboard_navigation = #False And terminal\active_view\locked = #False
            NextView()
          EndIf
        Case #EVENT_SHIFT_TAB
          If terminal\no_keyboard_navigation = #False And terminal\active_view\locked = #False
            PreviousView()
          EndIf
      EndSelect
  EndSelect
ForEver
EDIT: Hmm... Maybe they could all go to BindEvent actually :oops:
You can definitely use BindEvent() for all of these, that's how I do it in my app.
The CPU getting hogged could be because you're not specifying WaitWindowEvent() with a timeout. I've found 1 to work the best, perhaps try that?
Post Reply