Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: where is property "filename" in ObjectBase/Texture  (Read 3744 times)

0 Members and 1 Guest are viewing this topic.

Falke88

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
where is property "filename" in ObjectBase/Texture
« on: November 08, 2014, 09:44:55 pm »
As I try to create a Generic Class with all Resource in SFML.NET I kinda need to know where property filename resides?

When I call the constructor of the class Texture i.e. I gonna have to pass a "string" filename.

public Texture(string filename) :
                this(filename, new IntRect(0, 0, 0, 0))
            {
            }

Is the Constructor Definition within' Texture.cs

since it's called "this" and not "base" it has to be within the Texture class or can "this" be handled like "base" here and filename therefore lies within "ObjectBase" ?

Wherever it lies I can't find the property within Texture.cs and ObjectBase.cs anyway...that's why I'm asking actually.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: where is property "filename" in ObjectBase/Texture
« Reply #1 on: November 09, 2014, 10:32:53 am »
I'm not sure what you ask exactly, but:

1. The constructor that you show just calls another one of the same class, which is defined right below.

2. The class does not expose a Filename property.
Laurent Gomila - SFML developer

Falke88

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
Re: where is property "filename" in ObjectBase/Texture
« Reply #2 on: November 09, 2014, 11:53:44 am »
Ah ok...is this filename property some kind of anonymous property or temporary which never is been saved really?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: where is property "filename" in ObjectBase/Texture
« Reply #3 on: November 09, 2014, 02:17:25 pm »
It is not a property.

property != field/member variable
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Falke88

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
Re: where is property "filename" in ObjectBase/Texture
« Reply #4 on: November 09, 2014, 03:03:09 pm »
well since I can't find it I don't know if its a field or a property sadly :P
« Last Edit: November 09, 2014, 03:05:48 pm by Falke88 »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: where is property "filename" in ObjectBase/Texture
« Reply #5 on: November 09, 2014, 03:13:08 pm »
It's neither :P
The value is passed to another constructor, and then to a C function.

But why don't you simply have a look at the code? And please read the posts carefully, Laurent mentioned:
1. The constructor that you show just calls another one of the same class, which is defined right below.

In any case, these are implementation details that you -- as a SFML.NET user -- need not be interested in. All you have to know is that you cannot access the filename through which a texture was loaded.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Falke88

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
Re: where is property "filename" in ObjectBase/Texture
« Reply #6 on: November 09, 2014, 03:39:10 pm »
Well I had to know these kinda to get an idea how to solve a problem within a generic class where I wanted to create an instance of an generic type class WITH parameters... only with constraint new() it was possible to call the default constructor.

But I solved it using Activator.CreateInstance(x,y) glady :D

thanks for the help anyway guys !