[5.20 b5] ClipSprite cancels ZoomSprite & TransformSprite

Just starting out? Need help? Post your questions and find answers here.
Kelebrindae
Enthusiast
Enthusiast
Posts: 151
Joined: Tue Apr 01, 2008 3:23 pm

[5.20 b5] ClipSprite cancels ZoomSprite & TransformSprite

Post by Kelebrindae »

Hi,

Bug: A call to "ClipSprite" cancels the results of "ZoomSprite" or "TransformSprite" (but not those of "RotateSprite"). Also, "RotateSprite" cancels "TransformSprite", but not "ZoomSprite"... :?

Code: Select all

; Initialization
If InitSprite() = 0 Or InitKeyboard() = 0 Or UsePNGImageDecoder() = 0
  MessageRequester("Error", "Sprite system can't be initialized", 0)
  End
EndIf
OpenWindow(0, 0, 0, 600, 400, "PB 5.20b5 - Sprite alphablending",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 600, 400, 0, 0, 0, #PB_Screen_SmartSynchronization)

; Load a sprite and zoom it
LoadSprite(0, #PB_Compiler_Home + "Examples/Sources/Data/PureBasic.bmp",#PB_Sprite_AlphaBlending)
ZoomSprite(0,500,200)


clipped.b = #False
Repeat
  While WindowEvent(): Delay(1): Wend
     
  ClearScreen(RGB(120,150,200))
  ExamineKeyboard()
  If clipped = #False
    StartDrawing(ScreenOutput())
      DrawText(10,10,"Zoomed sprite. Press [Space] to clip it.")
    StopDrawing()
    If KeyboardReleased(#PB_Key_Space)
      ; When a sprite is clipped, previously applied "ZoomSprite" or "TransformSprite" are cancelled.
      ClipSprite(0,20,10,100,50)
      clipped = #True
    EndIf
  Else
    StartDrawing(ScreenOutput())
      DrawText(10,10,"ClipSprite cancels the ZoomSprite results :(")
    StopDrawing()
  EndIf
  
  
  DisplayTransparentSprite(0, 50, 100)
  FlipBuffers()
   
Until KeyboardPushed(#PB_Key_Escape) Or event = #PB_Event_CloseWindow

Lebostein
Addict
Addict
Posts: 807
Joined: Fri Jun 11, 2004 7:07 am

Re: [5.20 b5] ClipSprite cancels ZoomSprite & TransformSprit

Post by Lebostein »

Yea! I also have a problem with these commands. In what order should I use it? In the manual there are no informations about that...
User avatar
STARGÅTE
Addict
Addict
Posts: 2090
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: [5.20 b5] ClipSprite cancels ZoomSprite & TransformSprit

Post by STARGÅTE »

1. ClipSprite()
2. ZoomSprite()
3. RotateSprite()
4. DisplaySprite()

or

1. ClipSprite()
2. TransformSprite()
3. DisplaySprite()

---

ClipSprite() works not like a Clip-Texture or change texture-UV-data.
So the Width and Height in ClipSprite is used as width and height auf the Sprite.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
Fig
Enthusiast
Enthusiast
Posts: 351
Joined: Thu Apr 30, 2009 5:23 pm
Location: Côtes d'Azur, France

Re: [5.20 b5] ClipSprite cancels ZoomSprite & TransformSprit

Post by Fig »

Thank you, it should be written in help file though.
There are 2 methods to program bugless.
But only the third works fine.

Win10, Pb x64 5.71 LTS
User avatar
Olliv
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Sep 22, 2009 10:41 pm

Re: [5.20 b5] ClipSprite cancels ZoomSprite & TransformSprit

Post by Olliv »

:shock: (Fig does not show his secret tool I found)
Image :mrgreen:
User avatar
Fig
Enthusiast
Enthusiast
Posts: 351
Joined: Thu Apr 30, 2009 5:23 pm
Location: Côtes d'Azur, France

Re: [5.20 b5] ClipSprite cancels ZoomSprite & TransformSprit

Post by Fig »

Well, i was wondering about the clipsprite behaviour and i search...and find this thread so... :mrgreen:
There are 2 methods to program bugless.
But only the third works fine.

Win10, Pb x64 5.71 LTS
Post Reply