[01 Oct 2009] Resource loaded?

Contains all messages from the Hollywood mailing list between 01/2006 and 08/2012
Locked
Paolo Canonici
Posts: 14
Joined: Tue Feb 16, 2010 7:11 pm
Location: Rome
Contact:

[01 Oct 2009] Resource loaded?

Post by Paolo Canonici »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Thu, 01 Oct 2009 18:13:27 +0200

Hi,

I need to free the resources by my own. Is there a way to know if a resource (i.e. a brush) is actually loaded at the specified id?

Regards, Paolo.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[02 Oct 2009] Re: Resource loaded?

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 02 Oct 2009 12:04:04 +0200
Hi, I need to free the resources by my own. Is there a way to know if a resource (i.e. a brush) is actually loaded at the specified id?
What IDs are you using? Are you using number or new Hollywood 4.0 style IDs? (i.e. passing NIL as number and getting the return value), i.e.

Code: Select all

my_brush = LoadBrush(Nil, "test.iff")
DisplayBrush(my_brush, 0, 0)
Paolo Canonici
Posts: 14
Joined: Tue Feb 16, 2010 7:11 pm
Location: Rome
Contact:

[02 Oct 2009] Re: Resource loaded?

Post by Paolo Canonici »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 02 Oct 2009 16:52:49 +0200

I'm using the old style, providing explicit IDs.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[02 Oct 2009] Re: Resource loaded?

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 02 Oct 2009 21:54:06 +0200
Hi Andreas, I'm using the old style, providing explicit IDs.
So you want to check if a certain explicit ID contains a brush? There's no convenient way for this, I'm afraid, but you can use a little work around, i.e.

Code: Select all

/* returns True if specified id is a brush */
Function p_CheckBrush(id)

Local brush_there = True

ExitOnError(False)
GetAttribute(#BRUSH, id, #ATTRWIDTH)
If GetLastError() <> 0 Then brush_there = False
ExitOnError(True)
Return(brush_there)

EndFunction
This should do the job. It's a little bit awkward because it disables/enables the automatic error handler but it should do what you want :)
User avatar
NubeCheCorre
Posts: 77
Joined: Mon Mar 19, 2012 1:24 am
Contact:

[04 Oct 2009] Re: Resource loaded?

Post by NubeCheCorre »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Sun, 4 Oct 2009 12:34:40 +0200

Hi Andreas :-)

i was reading this topic about the ID, so it is better use the new ID way ? why ?

Thanks Davide
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[05 Oct 2009] Re: Resource loaded?

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Mon, 05 Oct 2009 10:47:51 +0200
Hi Andreas :-)

i was reading this topic about the ID, so it is better use the new ID way ? why ?
It's only useful if you've a larger project. Using hard-coded IDs can get quite bothersome in this case so you might want to use the new IDs. For smaller projects I find it easier to use hard-coded IDs like 1,2,3,4 :)
User avatar
NubeCheCorre
Posts: 77
Joined: Mon Mar 19, 2012 1:24 am
Contact:

[05 Oct 2009] Re: Resource loaded?

Post by NubeCheCorre »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Mon, 5 Oct 2009 11:51:36 +0200

OK thanks for the reply :-)
Locked