path to images in classes :: Path NOT working.... ????!!!

Hi all OF lovers,

so i am making some classes (or addons) and i get a very strange behaviour:

if a class has an image member, i want to load an image from the directory where the file defining the class is.
But i can not do that.
so say we have the class “TestClass” with the file TestClass.h in the directory “Dir”.
How do i do to load an image from say, “Dir/data/image1.jpg” ???

I want to use that load in the initialization of the class:

  
tclass = TestClass();   

and

  
  
TestClass(){  
  
  img.loadImage( imPath);   
}  
  

but i can not get the image to be loaded, can not find the correct imPath…

But very Strange ::::::
when i put that image in the bin/data/ folder of the source code o the app (NOT the class definition), i can not load them … but i can load the fonts… etc…

More strange ::: in some classes it works ! in others not… !!!..

Any idea?

so in summary: how to load data in the class definition method from folders in the class definition files???

thank you !

www.tangiblex.net

this is a problem with the 007 release, and all previous OF releases.

it is fixed in the develop branch on GitHub, and will be released at some point with 0071.

alternatively, you can move your image loading to a setup() function, and call the setup() after creating the object.

Hi, kyle,

thank you for the answer.
I will do try that.

best,

miguel.
www.tangiblex.net