Page 1 of 1

examples/Sprite.pb can't open screen

Posted: Fri Mar 08, 2024 12:36 pm
by rootuid
I'm trialling PureBasic 6.04 LTS on Mac.

I opened an example file examples/sources/Sprite.pb

Code: Select all

;
; ------------------------------------------------------------
;
;   PureBasic - Sprite example file
;
;    (c) Fantaisie Software
;
; ------------------------------------------------------------
;

If InitSprite() = 0 Or InitKeyboard() = 0
  MessageRequester("Error", "Sprite system can't be initialized", 0)
  End
EndIf

If OpenScreen(800, 600, 32, "Sprite")

  ; Load our 16 bit sprite (which is a 24 bit picture in fact, as BMP doesn't support 16 bit format)
  ;
  LoadSprite(0, #PB_Compiler_Home + "examples/sources/Data/PureBasic.bmp")
  CopySprite(0, 1, 0)
  
  Repeat
    
    ; Inverse the buffers (the back become the front (visible)... And we can do the rendering on the back)
    
    FlipBuffers()
    
    ClearScreen(RGB(0,0,0))
    
    ; Draw our sprite

    ClipSprite(0, 0, 0, x, x/8)
     
    DisplaySprite(0, x, 100)
    DisplaySprite(1, x, x)
    DisplaySprite(0, 600-x, x)
    
    x+1
    
    ExamineKeyboard()
  Until KeyboardPushed(#PB_Key_Escape)
  
Else
  MessageRequester("Error", "Can't open a 800*600 - 32 bit screen !", 0)
EndIf

and pressed compile but got this error

Code: Select all

Can't open a 800*600 - 32 bit screen !
So the
If OpenScreen(800, 600, 32, "Sprite") is failing but why? Is this a Mac issue? Does anyone else have the problem ?

Re: examples/Sprite.pb can't open screen

Posted: Fri Mar 08, 2024 12:52 pm
by rootuid
Ok from reading https://www.purebasic.fr/english/viewto ... ac#p605018

It appears the first supported Screen mode for this MacBook m2 is 1920, 1200, 32

Code: Select all

If OpenScreen(1920, 1200, 32, "Sprite")
works

Why can't I select a lower resolution? For example, if I use Pico 8, my output is 128x128 as intended by Pico 8

Re: examples/Sprite.pb can't open screen

Posted: Fri Mar 08, 2024 1:47 pm
by Mindphazer
There's a long long list of corrected bugs in PB 6.10 for OSX... Maybe you can try the last beta ?

Re: examples/Sprite.pb can't open screen

Posted: Fri Mar 08, 2024 2:21 pm
by Fred
Opening a real screen isn't really the trend nowaday, you can use a borderless window with a WindowedScreen() inside which avoid monitor resolution switch (and you can use anysize).