This seems to only affect linux, and both of my machines (Ubuntu 18.04 x64, Linux Mint x64).
LoadSprite(#PB_Any, ...) fails because #PB_Any seems to be returning a negative value.
EDIT: It seems to be under very specific circumstances - will update when investigated further
#PB_Any returning negative values
#PB_Any returning negative values
Last edited by Env on Fri Jan 11, 2019 3:00 pm, edited 1 time in total.
Thanks!
Re: #PB_Any returning negative values
You should check for non-zero, not for greater zero. Why do you think it fails? What does IsSprite() tell you? If you use variables then what type are they?
<edit>
works here
<edit>
works here
Code: Select all
InitSprite()
UsePNGImageDecoder()
win=OpenWindow(#PB_Any, 50,100, ww,wh, "", style) :: AddKeyboardShortcut(win, #PB_Shortcut_Escape, 10)
OpenWindowedScreen(WindowID(win), 0,0, ww,wh, 0,0,0)
;file.s = #PB_Compiler_Home + "examples/3D/Data/PureBasic3DLogo.png" ; windows
file.s = #PB_Compiler_Home + "examples/3d/Data/PureBasic3DLogo.png" ; linux
Debug file
Debug FileSize(file)
sp.i = LoadSprite(#PB_Any, file)
Debug sp
; /home/user/purebasic_570_lts/examples/3d/Data/PureBasic3DLogo.png
; 30617
; 26190776
- NicTheQuick
- Addict
- Posts: 1226
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: #PB_Any returning negative values
Why are you posting things in the Bugs forum if there is no bug?
There are no negative handles, but wrong conversions to a decimal number.
There are no negative handles, but wrong conversions to a decimal number.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Re: #PB_Any returning negative values
#PB_Any is a negative constant
But used as an object identifier in a function xxx(#PB_Any, ... it is just used to indicate that the object identifier must be generated by the return value.
Not a bug: moderator, please move this topic to 'Coding Questions' (?)
Code: Select all
Debug #PB_Any
Code: Select all
-1
Not a bug: moderator, please move this topic to 'Coding Questions' (?)
Re: #PB_Any returning negative values
Mod, you can actually delete lol
For some reason another change to the main code seems to have made the issue disappear. Not PB bug.. 4 hour grind mind-bug
For some reason another change to the main code seems to have made the issue disappear. Not PB bug.. 4 hour grind mind-bug
Thanks!