examples/Sprite.pb can't open screen

Just starting out? Need help? Post your questions and find answers here.
rootuid
User
User
Posts: 48
Joined: Sat Nov 23, 2013 11:46 am

examples/Sprite.pb can't open screen

Post 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 ?
rootuid
User
User
Posts: 48
Joined: Sat Nov 23, 2013 11:46 am

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

Post 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
User avatar
Mindphazer
Enthusiast
Enthusiast
Posts: 487
Joined: Mon Sep 10, 2012 10:41 am
Location: Savoie

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

Post by Mindphazer »

There's a long long list of corrected bugs in PB 6.10 for OSX... Maybe you can try the last beta ?
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

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

Post 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).
Post Reply