Check if InitSprite() has been already called

Just starting out? Need help? Post your questions and find answers here.
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Check if InitSprite() has been already called

Post by nco2k »

when writing a userlib, is there a trick how to check if InitSprite() / InitSprite3D() has been already called?

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
User avatar
idle
Always Here
Always Here
Posts: 5835
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Check if InitSprite() has been already called

Post by idle »

I think you can get away with using ScreenID() but only when the debugger off
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: Check if InitSprite() has been already called

Post by nco2k »

ScreenID() works only if a screen is open, which is not exactly what i was looking for.

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Check if InitSprite() has been already called

Post by ts-soft »

I think adding sprite.lib to the depedencies of the desc-file of the userlib should work,
or Import "Sprite.lib" : EndImport", but not tested,

but i would not call InitSpite in the userlib!
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: Check if InitSprite() has been already called

Post by nco2k »

ts-soft wrote:but i would not call InitSpite in the userlib!
why not? as long as its not inside the AttachProcess() it should be perfectly fine.

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Check if InitSprite() has been already called

Post by netmaestro »

why not? as long as its not inside the AttachProcess() it should be perfectly fine.
:?: A userlib isn't a dll..
BERESHEIT
C64
Enthusiast
Enthusiast
Posts: 151
Joined: Sat Dec 18, 2010 4:40 am

Re: Check if InitSprite() has been already called

Post by C64 »

nco2k wrote:when writing a userlib, is there a trick how to check if InitSprite() / InitSprite3D() has been already called?
Why not save yourself the hassle and just say in your manual that those commands must be called before using the commands in your lib? Why reinvent the wheel?
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: Check if InitSprite() has been already called

Post by nco2k »

@netmaestro
i mean the tailbite *_Init() :)

@C64
because i dont want them to call it at all?! and since no one reads TFM, i just want to be on the safe side.

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Post Reply