March 01, 2021, 10:52:55 PM

Author Topic: [bb] Coordinated Flip by jfk EO-11110 [ 1+ years ago ]  (Read 461 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] Coordinated Flip by jfk EO-11110 [ 1+ years ago ]
« on: June 29, 2017, 12:28:42 AM »
Title : Coordinated Flip
Author : jfk EO-11110
Posted : 1+ years ago

Description : ;This is about how to make sure Windows Messages won't be
;drawn to the backbuffer in fullscreen mode.


Code :
Code: BlitzBasic
  1. ;Sometimes Windows Api Messages such as System Alerts or
  2. ;Firewall Queries remain invisible because they are drawn to
  3. ;the backbuffer and pause the Blitz App in Fullscreen Mode.
  4.  
  5. ;This is about how to make sure Windows Messages won't be
  6. ;disguised in the backbuffer in fullscreen mode.
  7.  
  8. ;Why are the messages not drawn everytime to the front  
  9. ;buffer or to the backbuffer, why is it some kind of random
  10. ;game with them?
  11.  
  12. ;The reason why is there are two buffers, lets name them
  13. ;Buffer 1 and Buffer 2. They always remain Buffer 1 and 2,
  14. ;no matter if we made them Frontbuffer or Backbuffer! And
  15. ;windows (as usual) doesn't know about frontbuffer or
  16. ;backbuffer and simply writes to Buffer 1 all the time.
  17.  
  18. ;So all we have to do is watch every flip closely and use a
  19. ;counter that will tell us if we are watching Buffer 1 or 2.
  20.  
  21. ;This is pretty easy, simply replace your current Flip
  22. ;commands with a function call. EG:
  23.  
  24. global flipcounter
  25. ...
  26.  
  27. CoFlip() ; replaces a normal Flip
  28.  
  29. ...
  30.  
  31. function CoFlip(waitsync=1)
  32.  flip waitsync
  33.  flipcounter=flipcounter xor 1
  34. end function
  35.  
  36. ;now right before we call a function or external Exe that will
  37. ;force some Win Api High priority Alert (like when you
  38. ;connect to the internet and eg. a Firewall like Zonealarm
  39. ;throws a prompt to the user), to make sure your game won't
  40. ;freeze with an alert in the backbuffer that waits for user
  41. ;action, all you have to do is this:
  42.  
  43. if flipcounter=1 then CoFlip(0)
  44.  
  45. ;of course, you may also add an additional Renderworld
  46. ;before to make sure everything looks nice.


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal