Rotated Sprite Bug PB561 tested x64 /x86 - all OS

Post bugreports for the Windows version here
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Rotated Sprite Bug PB561 tested x64 /x86 - all OS

Post by J. Baker »

The only thing I can think of, if you don't want to create your own procedure. Fred could possibly create a #PB_Recenter combination flag for RotateSprite(). Something that would auto calculate the center for non-power of 2 sprites.
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: Rotated Sprite Bug PB561 tested x64 /x86 - all OS

Post by Mijikai »

JHPJHP wrote: Try the following:
- UnClipping the Sprite not needed: ClipSprite(FA,#PB_Default,#PB_Default,#PB_Default,#PB_Default)

Code: Select all

...
RotateSprite(FA,0.5,#PB_Relative)
ClipSprite(FA,0,0,400,150)                       ; Added ClipSprite HERE
DisplayTransparentSprite(FA,400,150)
ClipSprite(FA,0,0,400,150)                       ; Added ClipSprite HERE
DisplayTransparentSprite(FA,400,150,200,#Red)
ClipSprite(FA,0,10,18,18)
DisplayTransparentSprite(FA,400,350)
DisplayTransparentSprite(FA,400,350,200,#Yellow)
...
Thanks :)
I will use this workaround until the issue is officially solved.
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: Rotated Sprite Bug PB561 tested x64 /x86 - all OS

Post by walbus »

@J.Baker
Yep, but, this solve not the negative y output bug

Rotated sprites which coming in from above, you don't see as long as y is negative

This is for gaming a no-go
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Rotated Sprite Bug PB561 tested x64 /x86 - all OS

Post by J. Baker »

Does this help? Oddly, non-power of 2 scale up to 2048x2048 on my Mac. :shock:

Code: Select all

;PureBasic 5.44 LTS

InitSprite()

Procedure RotateOffset(Sprite, X, Y, Angle, Absolute = #False)
  
  Static Degree = 0
  
  Degree + Angle

  If Degree >= 360
    Degree = 0
  EndIf
  
  If Absolute = #True
    RotateSprite(Sprite, Angle, #PB_Absolute)
  Else
    RotateSprite(Sprite, Angle, #PB_Relative)
  EndIf
  
  DisplaySprite(Sprite, X + Cos(Radian(Degree)) * SpriteWidth(Sprite) / 2048, Y + Sin(Radian(Degree)) * SpriteHeight(Sprite) / 2048)
  
EndProcedure

OpenWindow(0, 0, 0, 800, 600, "Rotate Sprite Offset", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 0, 0, 0)

CreateSprite(1, 600, 100)
StartDrawing(SpriteOutput(1))
  Box(0,0,600,100,$FF0000)
StopDrawing()
  
CopySprite(1, 2)
CopySprite(1, 3)

Repeat

Event = WindowEvent()

ClearScreen(0)
  
  RotateOffset(1, 0, 0, 10, #True)
  Delay(10)
  ZoomSprite(2, 64, 64)
  RotateOffset(2, 160, 160, 1, #False)
  RotateOffset(3, 0, 300, 3, #False)
  
FlipBuffers()

Until Event = #PB_Event_CloseWindow
Last edited by J. Baker on Tue Oct 17, 2017 6:04 pm, edited 1 time in total.
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: Rotated Sprite Bug PB561 tested x64 /x86 - all OS

Post by walbus »

@J.Baker
Yep, this looking good
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Re: Rotated Sprite Bug PB561 tested x64 /x86 - all OS

Post by #NULL »

I just want to mention in the procedure by J. Baker there seems to be left some redundant code that probably got there in the process:

Code: Select all

.. - (SpriteWidth(Sprite) / 2 - SpriteWidth(Sprite) / 2) .. - (SpriteHeight(Sprite) / 2 - SpriteHeight(Sprite) / 2)
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: Rotated Sprite Bug PB561 tested x64 /x86 - all OS

Post by walbus »

@NULL
PB calculate the needed new size after rotating not

I must working to time, i will looking again later

Code: Select all

; This is not needed :
SpriteWidth(Sprite) / 2 - SpriteWidth(Sprite) / 2), it results zero

; This is the resulted line :
DisplaySprite(Sprite, X + Cos(Radian(Degree)) * SpriteWidth(Sprite) / 2048, Y + Sin(Radian(Degree)) * SpriteHeight(Sprite) / 2048)
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Rotated Sprite Bug PB561 tested x64 /x86 - all OS

Post by J. Baker »

#NULL wrote:I just want to mention in the procedure by J. Baker there seems to be left some redundant code that probably got there in the process:
It looks like I did. I wrote it up quickly and it took me a couple tries before it started working. I didn't go back and verify the math. :oops:
I updated the code above. Thanks for pointing that out though and cleaning that line of code up. ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: Rotated Sprite Bug PB561 tested x64 /x86 - all OS

Post by walbus »

@J.Baker
This is a nice workaround from you
User avatar
J. Baker
Addict
Addict
Posts: 2178
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Rotated Sprite Bug PB561 tested x64 /x86 - all OS

Post by J. Baker »

walbus wrote:@J.Baker
This is a nice workaround from you
No problem. ;)
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.
Post Reply